diff --git a/.babelrc b/.babelrc index b61ae9684..692a17bc5 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,6 @@ { "presets": [ + "@babel/typescript", [ "@babel/preset-env", { diff --git a/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/app.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts new file mode 100644 index 000000000..ae8cd4046 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/application.d.ts @@ -0,0 +1,53 @@ +import { PasswordWizardType } from './types'; +import { SNApplication, Challenge, ChallengeOrchestrator, ProtectedAction } from 'snjs'; +import { AppState, DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from './services'; +declare type WebServices = { + appState: AppState; + desktopService: DesktopManager; + lockService: LockManager; + archiveService: ArchiveManager; + nativeExtService: NativeExtManager; + statusService: StatusManager; + themeService: ThemeManager; + prefsService: PreferencesManager; + keyboardService: KeyboardManager; +}; +export declare class WebApplication extends SNApplication { + private $compile?; + private scope?; + private onDeinit?; + private webServices; + private currentAuthenticationElement?; + constructor($compile: ng.ICompileService, $timeout: ng.ITimeoutService, scope: ng.IScope, onDeinit: () => void); + /** @override */ + deinit(): void; + setWebServices(services: WebServices): void; + /** @access public */ + getAppState(): AppState; + /** @access public */ + getDesktopService(): DesktopManager; + /** @access public */ + getLockService(): LockManager; + /** @access public */ + getArchiveService(): ArchiveManager; + /** @access public */ + getNativeExtService(): NativeExtManager; + /** @access public */ + getStatusService(): StatusManager; + /** @access public */ + getThemeService(): ThemeManager; + /** @access public */ + getPrefsService(): PreferencesManager; + /** @access public */ + getKeyboardService(): KeyboardManager; + checkForSecurityUpdate(): Promise; + presentPasswordWizard(type: PasswordWizardType): void; + promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator): void; + performProtocolUpgrade(): Promise; + presentPrivilegesModal(action: ProtectedAction, onSuccess: any, onCancel: any): Promise; + presentPrivilegesManagementModal(): void; + authenticationInProgress(): boolean; + presentPasswordModal(callback: () => void): void; + presentRevisionPreviewModal(uuid: string, content: any): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts new file mode 100644 index 000000000..12aeed088 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/applicationManager.d.ts @@ -0,0 +1,28 @@ +export class ApplicationManager { + constructor($compile: any, $rootScope: any, $timeout: any); + $compile: any; + $timeout: any; + $rootScope: any; + applications: any[]; + changeObservers: any[]; + /** @callback */ + onApplicationDeinit(application: any): void; + /** @access private */ + createDefaultApplication(): void; + activeApplication: WebApplication | null | undefined; + /** @access private */ + createNewApplication(): WebApplication; + get application(): WebApplication | null | undefined; + /** @access public */ + getApplications(): any[]; + /** + * Notifies observer when the active application has changed. + * Any application which is no longer active is destroyed, and + * must be removed from the interface. + * @access public + * @param {function} callback + */ + addApplicationChangeObserver(callback: Function): void; + notifyObserversOfAppChange(): void; +} +import { WebApplication } from "./application"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts new file mode 100644 index 000000000..04f225476 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/abstract/pure_ctrl.d.ts @@ -0,0 +1,28 @@ +export class PureCtrl { + constructor($timeout: any); + $timeout: any; + props: any; + state: any; + $onInit(): void; + deinit(): void; + unsubApp: any; + unsubState: any; + application: any; + $onDestroy(): void; + /** @private */ + private resetState; + /** @override */ + getInitialState(): {}; + setState(state: any): Promise; + stateTimeout: any; + initProps(props: any): void; + addAppStateObserver(): void; + onAppStateEvent(eventName: any, data: any): void; + addAppEventObserver(): void; + onAppEvent(eventName: any): void; + /** @override */ + onAppStart(): Promise; + onAppLaunch(): Promise; + onAppKeyChange(): Promise; + onAppSync(): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts new file mode 100644 index 000000000..da4795c16 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/applicationView.d.ts @@ -0,0 +1,47 @@ +export class ApplicationView { + template: any; + controller: typeof ApplicationViewCtrl; + replace: boolean; + controllerAs: string; + bindToController: { + application: string; + }; +} +declare class ApplicationViewCtrl extends PureCtrl { + constructor($compile: any, $location: any, $rootScope: any, $timeout: any); + $location: any; + $rootScope: any; + $compile: any; + platformString: string; + state: { + appClass: string; + }; + onDragDrop(event: any): void; + onDragOver(event: any): void; + openModalComponent(component: any): void; + presentPermissionsDialog(dialog: any): void; + lockScreenPuppet: any; + loadApplication(): Promise; + onAppStart(): void; + onAppLaunch(): void; + onUpdateAvailable(): void; + /** @override */ + onAppEvent(eventName: any): Promise; + syncStatus: any; + completedInitialSync: boolean | undefined; + /** @override */ + onAppStateEvent(eventName: any, data: any): Promise; + notesCollapsed: any; + tagsCollapsed: any; + updateLocalDataStatus(): void; + updateSyncStatus(): void; + showingDownloadStatus: boolean | undefined; + uploadSyncStatus: any; + overrideComponentManagerFunctions(): void; + showInvalidSessionAlert(): void; + lastShownDate: Date | undefined; + addDragDropHandlers(): void; + handleAutoSignInFromParams(): Promise; +} +import { PureCtrl } from "./abstract/pure_ctrl"; +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts new file mode 100644 index 000000000..35f38d001 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/constants.d.ts @@ -0,0 +1,2 @@ +export const PANEL_NAME_NOTES: "notes"; +export const PANEL_NAME_TAGS: "tags"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts new file mode 100644 index 000000000..23a9038f0 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/editor.d.ts @@ -0,0 +1,122 @@ +export class EditorPanel { + restrict: string; + scope: { + application: string; + }; + template: any; + replace: boolean; + controller: typeof EditorCtrl; + controllerAs: string; + bindToController: boolean; +} +declare class EditorCtrl { + constructor($timeout: any); + leftPanelPuppet: { + onReady: () => void; + }; + rightPanelPuppet: { + onReady: () => void; + }; + /** Used by .pug template */ + prefKeyMonospace: string; + prefKeySpellcheck: string; + prefKeyMarginResizers: string; + deinit(): void; + /** @components */ + onEditorLoad: (editor: any) => void; + unregisterComponent: any; + $onInit(): void; + /** @override */ + getInitialState(): { + componentStack: never[]; + editorDebounce: number; + isDesktop: any; + spellcheck: boolean; + mutable: { + tagsString: string; + }; + }; + onAppLaunch(): void; + /** @override */ + onAppStateEvent(eventName: any, data: any): void; + /** @override */ + onAppEvent(eventName: any): void; + /** + * Because note.locked accesses note.content.appData, + * we do not want to expose the template to direct access to note.locked, + * otherwise an exception will occur when trying to access note.locked if the note + * is deleted. There is potential for race conditions to occur with setState, where a + * previous setState call may have queued a digest cycle, and the digest cycle triggers + * on a deleted note. + */ + get noteLocked(): any; + streamItems(): void; + handleNoteSelectionChange(note: any, previousNote: any): Promise; + editorForNote(note: any): any; + setMenuState(menu: any, state: any): void; + toggleMenu(menu: any): void; + closeAllMenus({ exclude }?: { + exclude: any; + }): void; + editorMenuOnSelect: (component: any) => void; + hasAvailableExtensions(): boolean; + performFirefoxPinnedTabFix(): void; + saveNote({ bypassDebouncer, updateClientModified, dontUpdatePreviews }: { + bypassDebouncer: any; + updateClientModified: any; + dontUpdatePreviews: any; + }): void; + saveTimeout: any; + showSavingStatus(): void; + showAllChangesSavedStatus(): void; + showErrorStatus(error: any): void; + setStatus(status: any, wait?: boolean): void; + statusTimeout: any; + contentChanged(): void; + onTitleEnter($event: any): void; + onTitleChange(): void; + focusEditor(): void; + lastEditorFocusEventSource: number | null | undefined; + focusTitle(): void; + clickedTextArea(): void; + onNameFocus(): void; + editingName: boolean | undefined; + onContentFocus(): void; + onNameBlur(): void; + selectedMenuItem(hide: any): void; + deleteNote(permanently: any): Promise; + performNoteDeletion(note: any): void; + restoreTrashedNote(): void; + deleteNotePermanantely(): void; + getTrashCount(): any; + emptyTrash(): void; + togglePin(): void; + toggleLockNote(): void; + toggleProtectNote(): void; + toggleNotePreview(): void; + toggleArchiveNote(): void; + reloadTagsString(): void; + addTag(tag: any): void; + removeTag(tag: any): void; + saveTags({ strings }?: { + strings: any; + }): Promise; + onPanelResizeFinish: (width: any, left: any, isMaxWidth: any) => void; + reloadPreferences(): void; + reloadFont(): void; + toggleKey(key: any): Promise; + registerComponentHandler(): void; + reloadComponentStackArray(): void; + reloadComponentContext(): void; + toggleStackComponentForCurrentItem(component: any): void; + disassociateComponentWithCurrentNote(component: any): void; + associateComponentWithCurrentNote(component: any): void; + registerKeyboardShortcuts(): void; + altKeyObserver: any; + trashKeyObserver: any; + deleteKeyObserver: any; + onSystemEditorLoad(): void; + tabObserver: any; + removeTabObserver(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts new file mode 100644 index 000000000..007635308 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/footer.d.ts @@ -0,0 +1,69 @@ +export class Footer { + restrict: string; + template: any; + controller: typeof FooterCtrl; + replace: boolean; + controllerAs: string; + bindToController: { + application: string; + }; +} +declare class FooterCtrl { + constructor($rootScope: any, $timeout: any); + $rootScope: any; + rooms: any[]; + themesWithIcons: any[]; + showSyncResolution: any; + deinit(): void; + unregisterComponent: any; + rootScopeListener1: any; + rootScopeListener2: any; + closeAccountMenu: () => void; + toggleSyncResolutionMenu: () => void; + $onInit(): void; + arbitraryStatusMessage: any; + getInitialState(): { + hasPasscode: boolean; + }; + reloadUpgradeStatus(): void; + onAppLaunch(): void; + user: any; + reloadPasscodeStatus(): Promise; + addRootScopeListeners(): void; + /** @override */ + onAppStateEvent(eventName: any, data: any): void; + backupStatus: any; + /** @override */ + onAppKeyChange(): Promise; + /** @override */ + onAppEvent(eventName: any): void; + showAccountMenu: any; + streamItems(): void; + queueExtReload: boolean | undefined; + registerComponentHandler(): void; + reloadExtendedData(): void; + reloadInProgress: boolean | undefined; + updateOfflineStatus(): void; + offline: any; + openSecurityUpdate(): void; + findErrors(): void; + error: any; + accountMenuPressed(): void; + lockApp(): void; + refreshData(): void; + isRefreshing: boolean | undefined; + syncUpdated(): void; + lastSyncDate: any; + onNewUpdateAvailable(): void; + newUpdateAvailable: boolean | undefined; + clickedNewUpdateAnnouncement(): void; + reloadDockShortcuts(): void; + dockShortcuts: any; + initSvgForShortcut(shortcut: any): void; + selectShortcut(shortcut: any): void; + onRoomDismiss(room: any): void; + closeAllRooms(): void; + selectRoom(room: any): Promise; + clickOutsideAccountMenu(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts new file mode 100644 index 000000000..d9ccabbd6 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/index.d.ts @@ -0,0 +1,7 @@ +export { PureCtrl } from "./abstract/pure_ctrl"; +export { EditorPanel } from "./editor"; +export { Footer } from "./footer"; +export { NotesPanel } from "./notes/notes"; +export { TagsPanel } from "./tags"; +export { Root } from "./root"; +export { ApplicationView } from "./applicationView"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts new file mode 100644 index 000000000..0cdbd0f47 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/lockScreen.depr.d.ts @@ -0,0 +1,23 @@ +export class LockScreen { + restrict: string; + template: any; + controller: typeof LockScreenCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + onValue: string; + puppet: string; + }; +} +declare class LockScreenCtrl extends PureCtrl { + constructor($timeout: any); + formData: {}; + get passcodeInput(): HTMLElement | null; + /** @override */ + onAppStateEvent(eventName: any, data: any): Promise; + submitPasscodeForm(): Promise; + forgotPasscode(): void; + beginDeleteData(): void; +} +import { PureCtrl } from "./abstract/pure_ctrl"; +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts new file mode 100644 index 000000000..c769e82ad --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/note_utils.d.ts @@ -0,0 +1,25 @@ +export function filterAndSortNotes({ notes, selectedTag, showArchived, hidePinned, filterText, sortBy, reverse }: { + notes: any; + selectedTag: any; + showArchived: any; + hidePinned: any; + filterText: any; + sortBy: any; + reverse: any; +}): any[]; +export function filterNotes({ notes, selectedTag, showArchived, hidePinned, filterText }: { + notes: any; + selectedTag: any; + showArchived: any; + hidePinned: any; + filterText: any; +}): any; +export function sortNotes({ notes, sortBy, reverse }: { + notes?: any[] | undefined; + sortBy: any; + reverse: any; +}): any[]; +export const SORT_KEY_CREATED_AT: "created_at"; +export const SORT_KEY_UPDATED_AT: "updated_at"; +export const SORT_KEY_CLIENT_UPDATED_AT: "client_updated_at"; +export const SORT_KEY_TITLE: "title"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts new file mode 100644 index 000000000..0c5382c44 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/notes/notes.d.ts @@ -0,0 +1,118 @@ +export class NotesPanel { + template: any; + replace: boolean; + controller: typeof NotesCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + application: string; + }; +} +declare class NotesCtrl { + constructor($timeout: any); + $onInit(): void; + panelPuppet: { + onReady: () => void; + } | null | undefined; + onWindowResize(): void; + deinit(): void; + onPanelResize: (newWidth: any, lastLeft: any, isAtMaxWidth: any, isCollapsed: any) => void; + getInitialState(): { + notes: never[]; + renderedNotes: never[]; + selectedNote: null; + tag: null; + sortBy: null; + showArchived: null; + hidePinned: null; + sortReverse: null; + panelTitle: null; + mutable: { + showMenu: boolean; + }; + noteFilter: { + text: string; + }; + }; + onAppLaunch(): void; + /** @override */ + onAppStateEvent(eventName: any, data: any): void; + /** @override */ + onAppEvent(eventName: any): Promise; + /** + * @access private + * Access the current state notes without awaiting any potential reloads + * that may be in progress. This is the sync alternative to `async getMostValidNotes` + */ + getPossiblyStaleNotes(): any; + /** + * @access private + * Access the current state notes after waiting for any pending reloads. + * This returns the most up to date notes, but is the asyncronous counterpart + * to `getPossiblyStaleNotes` + */ + getMostValidNotes(): Promise; + /** + * Triggered programatically to create a new placeholder note + * when conditions allow for it. This is as opposed to creating a new note + * as part of user interaction (pressing the + button). + * @access private + */ + createPlaceholderNote(): Promise; + streamNotesAndTags(): void; + selectNote(note: any): Promise; + createNewNote(): Promise; + handleTagChange(tag: any, previousTag: any): Promise; + resetScrollPosition(): void; + removeNoteFromList(note: any): Promise; + reloadNotes(): Promise; + reloadNotesPromise: Promise | undefined; + performPeloadNotes(): Promise; + setShowMenuFalse(): void; + handleNoteSelection(note: any): Promise; + selectedIndex: number | undefined; + reloadPreferences(): void; + paginate(): void; + resetPagination({ keepCurrentIfLarger }?: { + keepCurrentIfLarger: any; + }): void; + pageSize: number | undefined; + notesToDisplay: number | undefined; + reloadPanelTitle(): void; + optionsSubtitle(): string; + loadFlagsForNote(note: any): { + text: string; + class: string; + }[]; + displayableNotes(): any; + getFirstNonProtectedNote(): any; + selectFirstNote(): void; + selectNextNote(): void; + selectNextOrCreateNew(): void; + selectPreviousNote(): boolean; + isFiltering(): boolean; + setNoteFilterText(text: any): Promise; + clearFilterText(): Promise; + filterTextChanged(): Promise; + searchSubmitted: boolean | undefined; + onFilterEnter(): void; + selectedMenuItem(): void; + togglePrefKey(key: any): void; + selectedSortByCreated(): void; + selectedSortByUpdated(): void; + selectedSortByTitle(): void; + toggleReverseSort(): void; + setSortBy(type: any): void; + shouldShowTagsForNote(note: any): boolean; + getSearchBar(): HTMLElement | null; + registerKeyboardShortcuts(): void; + /** + * In the browser we're not allowed to override cmd/ctrl + n, so we have to + * use Control modifier as well. These rules don't apply to desktop, but + * probably better to be consistent. + */ + newNoteKeyObserver: any; + nextNoteKeyObserver: any; + searchKeyObserver: any; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts new file mode 100644 index 000000000..d5aef945c --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/root.d.ts @@ -0,0 +1,15 @@ +export class Root { + template: any; + controller: typeof RootCtrl; + replace: boolean; + controllerAs: string; + bindToController: boolean; +} +declare class RootCtrl { + constructor($timeout: any, applicationManager: any); + $timeout: any; + applicationManager: any; + reload(): void; + applications: any; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts new file mode 100644 index 000000000..1b23a8ea8 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/controllers/tags.d.ts @@ -0,0 +1,52 @@ +export class TagsPanel { + restrict: string; + scope: { + application: string; + }; + template: any; + replace: boolean; + controller: typeof TagsPanelCtrl; + controllerAs: string; + bindToController: boolean; +} +declare class TagsPanelCtrl { + constructor($timeout: any); + panelPuppet: { + onReady: () => void; + }; + deinit(): void; + unregisterComponent: any; + getInitialState(): { + tags: never[]; + smartTags: never[]; + noteCounts: {}; + }; + onAppStart(): void; + onAppLaunch(): void; + /** @override */ + onAppSync(): void; + /** + * Returns all officially saved tags as reported by the model manager. + * @access private + */ + getMappedTags(): any; + beginStreamingItems(): void; + /** @override */ + onAppStateEvent(eventName: any, data: any): void; + /** @override */ + onAppEvent(eventName: any): Promise; + reloadNoteCounts(): void; + loadPreferences(): void; + onPanelResize: (newWidth: any, lastLeft: any, isAtMaxWidth: any, isCollapsed: any) => void; + registerComponentHandler(): void; + component: any; + selectTag(tag: any): Promise; + clickedAddNewTag(): Promise; + tagTitleDidChange(tag: any): void; + saveTag($event: any, tag: any): Promise; + editingOriginalName: any; + selectedRenameTag($event: any, tag: any): Promise; + selectedDeleteTag(tag: any): void; + removeTag(tag: any): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts new file mode 100644 index 000000000..d94c95583 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/database.d.ts @@ -0,0 +1,43 @@ +export class Database { + locked: boolean; + /** @access public */ + deinit(): void; + alertService: any; + db: any; + /** @access public */ + setApplication(application: any): void; + /** + * Relinquishes the lock and allows db operations to proceed + * @access public + */ + unlock(): void; + /** + * Opens the database natively, or returns the existing database object if already opened. + * @access public + * @param {function} onNewDatabase - Callback to invoke when a database has been created + * as part of the open process. This can happen on new application sessions, or if the + * browser deleted the database without the user being aware. + */ + openDatabase(onNewDatabase: Function): Promise; + /** @access public */ + getAllPayloads(): Promise; + /** @access public */ + savePayload(payload: any): Promise; + /** @access public */ + savePayloads(payloads: any): Promise; + /** @access private */ + putItems(objectStore: any, items: any): Promise<[any, any, any, any, any, any, any, any, any, any]>; + /** @access public */ + deletePayload(uuid: any): Promise; + /** @access public */ + clearAllPayloads(): Promise; + /** @access private */ + showAlert(message: any): void; + /** + * @access private + * @param {object} error - {code, name} + */ + showGenericError(error: object): void; + /** @access private */ + displayOfflineAlert(): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts new file mode 100644 index 000000000..159a60450 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/autofocus.d.ts @@ -0,0 +1,7 @@ +export function autofocus($timeout: any): { + restrict: string; + scope: { + shouldFocus: string; + }; + link: ($scope: any, $element: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts new file mode 100644 index 000000000..b74259c26 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/click-outside.d.ts @@ -0,0 +1,5 @@ +export function clickOutside($document: any): { + restrict: string; + replace: boolean; + link: ($scope: any, $element: any, attrs: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts new file mode 100644 index 000000000..91c9ad5d7 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/delay-hide.d.ts @@ -0,0 +1,8 @@ +export function delayHide($timeout: any): { + restrict: string; + scope: { + show: string; + delay: string; + }; + link: (scope: any, elem: any, attrs: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts new file mode 100644 index 000000000..bda2d4c42 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/elemReady.d.ts @@ -0,0 +1,4 @@ +export function elemReady($parse: any): { + restrict: string; + link: ($scope: any, elem: any, attrs: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts new file mode 100644 index 000000000..3a284104b --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/file-change.d.ts @@ -0,0 +1,7 @@ +export function fileChange(): { + restrict: string; + scope: { + handler: string; + }; + link: (scope: any, element: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts new file mode 100644 index 000000000..3a2852dec --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/index.d.ts @@ -0,0 +1,9 @@ +export { autofocus } from "./autofocus"; +export { clickOutside } from "./click-outside"; +export { delayHide } from "./delay-hide"; +export { elemReady } from "./elemReady"; +export { fileChange } from "./file-change"; +export { infiniteScroll } from "./infiniteScroll"; +export { lowercase } from "./lowercase"; +export { selectOnClick } from "./selectOnClick"; +export { snEnter } from "./snEnter"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts new file mode 100644 index 000000000..6f9500126 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/infiniteScroll.d.ts @@ -0,0 +1,3 @@ +export function infiniteScroll(): { + link: (scope: any, elem: any, attrs: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts new file mode 100644 index 000000000..b2df15723 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/lowercase.d.ts @@ -0,0 +1,4 @@ +export function lowercase(): { + require: string; + link: (scope: any, element: any, attrs: any, modelCtrl: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts new file mode 100644 index 000000000..ed23ff5b1 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/selectOnClick.d.ts @@ -0,0 +1,4 @@ +export function selectOnClick($window: any): { + restrict: string; + link: (scope: any, element: any, attrs: any) => void; +}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts new file mode 100644 index 000000000..a4faa7f1d --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/functional/snEnter.d.ts @@ -0,0 +1 @@ +export function snEnter(): (scope: any, element: any, attrs: any) => void; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts new file mode 100644 index 000000000..91da180f9 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/accountMenu.d.ts @@ -0,0 +1,71 @@ +export class AccountMenu { + restrict: string; + template: any; + controller: typeof AccountMenuCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + closeFunction: string; + application: string; + }; +} +declare class AccountMenuCtrl { + constructor($timeout: any, appVersion: any); + appVersion: any; + /** @override */ + getInitialState(): { + appVersion: string; + passcodeAutoLockOptions: any; + user: any; + formData: { + mergeLocal: boolean; + ephemeral: boolean; + }; + mutable: {}; + }; + onAppKeyChange(): Promise; + onAppLaunch(): Promise; + refreshedCredentialState(): { + user: any; + canAddPasscode: boolean; + hasPasscode: any; + showPasscodeForm: boolean; + }; + $onInit(): void; + syncStatus: any; + close(): void; + loadHost(): Promise; + onHostInputChange(): void; + loadBackupsAvailability(): Promise; + submitMfaForm(): void; + blurAuthFields(): void; + submitAuthForm(): void; + setFormDataState(formData: any): Promise; + login(): Promise; + register(): Promise; + mergeLocalChanged(): void; + openPasswordWizard(): void; + openPrivilegesModal(): Promise; + destroyLocalData(): void; + submitImportPassword(): Promise; + readFile(file: any): Promise; + /** + * @template + */ + importFileSelected<(Missing)>(files: any): Promise; + performImport(data: any, password: any): Promise; + importJSONData(data: any, password: any): Promise; + downloadDataArchive(): Promise; + notesAndTagsCount(): any; + encryptionStatusForNotes(): string; + reloadAutoLockInterval(): Promise; + selectAutoLockInterval(interval: any): Promise; + hidePasswordForm(): void; + hasPasscode(): any; + addPasscodeClicked(): void; + submitPasscodeForm(): void; + changePasscodePressed(): Promise; + removePasscodePressed(): Promise; + isDesktopApplication(): any; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts new file mode 100644 index 000000000..f31ae0e68 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/actionsMenu.d.ts @@ -0,0 +1,24 @@ +export class ActionsMenu { + restrict: string; + template: any; + replace: boolean; + controller: typeof ActionsMenuCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + item: string; + application: string; + }; +} +declare class ActionsMenuCtrl { + constructor($timeout: any); + state: { + extensions: never[]; + }; + $onInit(): void; + loadExtensions(): Promise; + executeAction(action: any, extension: any): Promise; + handleActionResult(action: any, result: any): void; + subRowsForAction(parentAction: any, extension: any): any; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts new file mode 100644 index 000000000..1151642a4 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/challengeModal.d.ts @@ -0,0 +1,29 @@ +export class ChallengeModal { + restrict: string; + template: any; + controller: typeof ChallengeModalCtrl; + controllerAs: string; + bindToController: { + challenge: string; + orchestrator: string; + application: string; + }; +} +declare class ChallengeModalCtrl { + constructor($element: any, $timeout: any); + $element: any; + processingTypes: any[]; + $onInit(): void; + deinit(): void; + application: any; + orchestrator: any; + challenge: any; + reloadProcessingStatus(): void; + promptForChallenge(challenge: any): "Enter your application passcode" | "Enter your account password"; + cancel(): void; + onTextValueChange(challenge: any): void; + validate(): boolean; + submit(): Promise; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts new file mode 100644 index 000000000..c64eb91e6 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentModal.d.ts @@ -0,0 +1,19 @@ +export class ComponentModalCtrl { + constructor($element: any); + $element: any; + dismiss(): void; +} +export class ComponentModal { + restrict: string; + template: any; + controller: typeof ComponentModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + show: string; + component: string; + callback: string; + onDismiss: string; + application: string; + }; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts new file mode 100644 index 000000000..11bc5e78d --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/componentView.d.ts @@ -0,0 +1,47 @@ +export class ComponentView { + restrict: string; + template: any; + scope: { + component: string; + onLoad: string; + manualDealloc: string; + application: string; + }; + controller: typeof ComponentViewCtrl; + controllerAs: string; + bindToController: boolean; +} +declare class ComponentViewCtrl { + constructor($scope: any, $rootScope: any, $timeout: any); + $rootScope: any; + $timeout: any; + componentValid: boolean; + cleanUpOn: any; + onVisibilityChange(): void; + $onDestroy(): void; + unregisterComponentHandler: any; + unregisterDesktopObserver: any; + component: any; + onLoad: any; + application: any; + $onChanges(): void; + didRegisterObservers: boolean | undefined; + lastComponentValue: any; + registerPackageUpdateObserver(): void; + registerComponentHandlers(): void; + reloadComponent(): Promise; + reloadStatus(doManualReload?: boolean): void; + reloading: boolean | undefined; + expired: boolean | undefined; + loading: boolean | undefined; + error: string | null | undefined; + handleActivation(): void; + loadTimeout: any; + handleIframeLoadTimeout(): Promise; + issueLoading: boolean | undefined; + didAttemptReload: boolean | undefined; + handleIframeLoad(iframe: any): Promise; + disableActiveTheme(): void; + getUrl(): any; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts new file mode 100644 index 000000000..41fd17121 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/conflictResolutionModal.d.ts @@ -0,0 +1,29 @@ +export class ConflictResolutionModal { + restrict: string; + template: any; + controller: typeof ConflictResolutionCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + item1: string; + item2: string; + callback: string; + application: string; + }; +} +declare class ConflictResolutionCtrl { + constructor($element: any); + $element: any; + $onInit(): void; + contentType: any; + item1Content: string | undefined; + item2Content: string | undefined; + createContentString(item: any): string; + keepItem1(): void; + keepItem2(): void; + keepBoth(): void; + export(): void; + triggerCallback(): void; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts new file mode 100644 index 000000000..299ad3eb8 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/editorMenu.d.ts @@ -0,0 +1,27 @@ +export class EditorMenu { + restrict: string; + template: any; + controller: typeof EditorMenuCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + callback: string; + selectedEditor: string; + currentItem: string; + application: string; + }; +} +declare class EditorMenuCtrl { + constructor($timeout: any); + state: { + isDesktop: any; + }; + $onInit(): void; + selectComponent(component: any): void; + toggleDefaultForEditor(editor: any): void; + offlineAvailableForComponent(component: any): any; + makeEditorDefault(component: any): void; + removeEditorDefault(component: any): void; + shouldDisplayRunningLocallyLabel(component: any): boolean; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts new file mode 100644 index 000000000..f3f785f9f --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/index.d.ts @@ -0,0 +1,17 @@ +export { AccountMenu } from "./accountMenu"; +export { ActionsMenu } from "./actionsMenu"; +export { ChallengeModal } from "./challengeModal"; +export { ComponentModal } from "./componentModal"; +export { ComponentView } from "./componentView"; +export { ConflictResolutionModal } from "./conflictResolutionModal"; +export { EditorMenu } from "./editorMenu"; +export { InputModal } from "./inputModal"; +export { MenuRow } from "./menuRow"; +export { PanelResizer } from "./panelResizer"; +export { PasswordWizard } from "./passwordWizard"; +export { PermissionsModal } from "./permissionsModal"; +export { PrivilegesAuthModal } from "./privilegesAuthModal"; +export { PrivilegesManagementModal } from "./privilegesManagementModal"; +export { RevisionPreviewModal } from "./revisionPreviewModal"; +export { SessionHistoryMenu } from "./sessionHistoryMenu"; +export { SyncResolutionMenu } from "./syncResolutionMenu"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts new file mode 100644 index 000000000..a4559694f --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/inputModal.d.ts @@ -0,0 +1,22 @@ +export class InputModal { + restrict: string; + template: any; + controller: typeof InputModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + type: string; + title: string; + message: string; + placeholder: string; + callback: string; + }; +} +declare class InputModalCtrl { + constructor($element: any); + $element: any; + formData: {}; + dismiss(): void; + submit(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts new file mode 100644 index 000000000..a7914ebd7 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/menuRow.d.ts @@ -0,0 +1,30 @@ +export class MenuRow { + restrict: string; + transclude: boolean; + template: any; + controller: typeof MenuRowCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + action: string; + buttonAction: string; + buttonClass: string; + buttonText: string; + desc: string; + disabled: string; + circle: string; + circleAlign: string; + faded: string; + hasButton: string; + label: string; + spinnerClass: string; + stylekitClass: string; + subRows: string; + subtitle: string; + }; +} +declare class MenuRowCtrl { + onClick($event: any): void; + clickAccessoryButton($event: any): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts new file mode 100644 index 000000000..fceae3702 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/panelResizer.d.ts @@ -0,0 +1,72 @@ +export class PanelResizer { + restrict: string; + template: any; + controller: typeof PanelResizerCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + alwaysVisible: string; + collapsable: string; + control: string; + defaultWidth: string; + hoverable: string; + index: string; + minWidth: string; + onResizeFinish: string; + panelId: string; + property: string; + }; +} +declare class PanelResizerCtrl { + constructor($compile: any, $element: any, $timeout: any); + $compile: any; + $element: any; + $timeout: any; + handleResize(): void; + onMouseMove(event: any): void; + onMouseUp(): void; + onMouseDown(event: any): void; + $onInit(): void; + $onDestroy(): void; + onResizeFinish: any; + control: any; + configureControl(): void; + configureDefaults(): void; + panel: HTMLElement | null | undefined; + resizerColumn: any; + currentMinWidth: any; + pressed: boolean | undefined; + startWidth: any; + lastDownX: any; + collapsed: boolean | undefined; + lastWidth: any; + startLeft: number | undefined; + lastLeft: any; + appFrame: DOMRect | null | undefined; + widthBeforeLastDblClick: any; + configureRightPanel(): void; + getParentRect(): any; + reloadDefaultValues(): void; + addDoubleClickHandler(): void; + addMouseDownListener(): void; + addMouseMoveListener(): void; + handleWidthEvent(event: any): void; + handleLeftEvent(event: any): void; + addMouseUpListener(): void; + isAtMaxWidth(): any; + isCollapsed(): boolean; + setWidth(width: any, finish: any): void; + setLeft(left: any): void; + finishSettingWidth(): void; + /** + * If an iframe is displayed adjacent to our panel, and the mouse exits over the iframe, + * document[onmouseup] is not triggered because the document is no longer the same over + * the iframe. We add an invisible overlay while resizing so that the mouse context + * remains in our main document. + */ + addInvisibleOverlay(): void; + overlay: any; + removeInvisibleOverlay(): void; + flash(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts new file mode 100644 index 000000000..f92a102d0 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/passwordWizard.d.ts @@ -0,0 +1,28 @@ +export class PasswordWizard { + restrict: string; + template: any; + controller: typeof PasswordWizardCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + type: string; + application: string; + }; +} +declare class PasswordWizardCtrl { + constructor($element: any, $timeout: any); + $element: any; + $timeout: any; + $onInit(): void; + $onDestroy(): void; + /** Confirms with user before closing tab */ + registerWindowUnloadStopper(): void; + resetContinueState(): void; + isContinuing: boolean | undefined; + nextStep(): Promise; + setFormDataState(formData: any): Promise; + validateCurrentPassword(): Promise; + processPasswordChange(): Promise; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts new file mode 100644 index 000000000..cfe077aeb --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/permissionsModal.d.ts @@ -0,0 +1,21 @@ +export class PermissionsModal { + restrict: string; + template: any; + controller: typeof PermissionsModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + show: string; + component: string; + permissionsString: string; + callback: string; + }; +} +declare class PermissionsModalCtrl { + constructor($element: any); + $element: any; + dismiss(): void; + accept(): void; + deny(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts new file mode 100644 index 000000000..a8dd657df --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesAuthModal.d.ts @@ -0,0 +1,32 @@ +export class PrivilegesAuthModal { + restrict: string; + template: any; + controller: typeof PrivilegesAuthModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + action: string; + onSuccess: string; + onCancel: string; + application: string; + }; +} +declare class PrivilegesAuthModalCtrl { + constructor($element: any, $timeout: any); + $element: any; + $timeout: any; + $onInit(): void; + authParameters: {} | undefined; + sessionLengthOptions: any; + selectedSessionLength: any; + requiredCredentials: any; + selectSessionLength(length: any): void; + promptForCredential(credential: any): any; + cancel(): void; + isCredentialInFailureState(credential: any): boolean; + validate(): boolean; + failedCredentials: any; + submit(): Promise; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts new file mode 100644 index 000000000..50852202b --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/privilegesManagementModal.d.ts @@ -0,0 +1,32 @@ +export class PrivilegesManagementModal { + restrict: string; + template: any; + controller: typeof PrivilegesManagementModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + application: string; + }; +} +declare class PrivilegesManagementModalCtrl { + constructor($timeout: any, $element: any); + $element: any; + onAppLaunch(): void; + hasPasscode: any; + hasAccount: boolean | undefined; + displayInfoForCredential(credential: any): any; + displayInfoForAction(action: any): any; + isCredentialRequiredForAction(action: any, credential: any): any; + clearSession(): Promise; + reloadPrivileges(): Promise; + availableActions: any; + availableCredentials: any; + sessionExpirey: any; + sessionExpired: boolean | undefined; + credentialDisplayInfo: {} | undefined; + privileges: any; + checkboxValueChanged(action: any, credential: any): void; + cancel(): void; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts new file mode 100644 index 000000000..9569f65b7 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/revisionPreviewModal.d.ts @@ -0,0 +1,26 @@ +export class RevisionPreviewModal { + restrict: string; + template: any; + controller: typeof RevisionPreviewModalCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + uuid: string; + content: string; + application: string; + }; +} +declare class RevisionPreviewModalCtrl { + constructor($element: any, $timeout: any); + $element: any; + $timeout: any; + $onInit(): void; + $onDestroy(): void; + unregisterComponent: any; + configure(): Promise; + note: any; + editor: any; + restore(asCopy: any): void; + dismiss(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts new file mode 100644 index 000000000..614c9e6c7 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/sessionHistoryMenu.d.ts @@ -0,0 +1,28 @@ +export class SessionHistoryMenu { + restrict: string; + template: any; + controller: typeof SessionHistoryMenuCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + item: string; + application: string; + }; +} +declare class SessionHistoryMenuCtrl { + constructor($timeout: any); + $timeout: any; + $onInit(): void; + diskEnabled: any; + autoOptimize: any; + reloadHistory(): void; + entries: any; + history: any; + openRevision(revision: any): void; + classForRevision(revision: any): "default" | "success" | "danger" | undefined; + clearItemHistory(): void; + clearAllHistory(): void; + toggleDiskSaving(): void; + toggleAutoOptimize(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts new file mode 100644 index 000000000..2fe1255df --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/directives/views/syncResolutionMenu.d.ts @@ -0,0 +1,21 @@ +export class SyncResolutionMenu { + restrict: string; + template: any; + controller: typeof SyncResolutionMenuCtrl; + controllerAs: string; + bindToController: boolean; + scope: { + closeFunction: string; + application: string; + }; +} +declare class SyncResolutionMenuCtrl { + constructor($timeout: any); + $timeout: any; + status: {}; + downloadBackup(encrypted: any): void; + skipBackup(): void; + performSyncResolution(): Promise; + close(): void; +} +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts new file mode 100644 index 000000000..28238231f --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/filters/index.d.ts @@ -0,0 +1 @@ +export { trusted } from "./trusted"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts new file mode 100644 index 000000000..4a1324ee5 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/filters/trusted.d.ts @@ -0,0 +1 @@ +export function trusted($sce: any): (url: any) => any; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts new file mode 100644 index 000000000..3247c0201 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/routes.d.ts @@ -0,0 +1 @@ +export declare function configRoutes($locationProvider: ng.ILocationProvider): void; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts new file mode 100644 index 000000000..bd3b618ce --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/alertService.d.ts @@ -0,0 +1,6 @@ +export class AlertService extends SNAlertService { + constructor(deviceInterface: import("../../../../../snjs/dist/@types").DeviceInterface); + alert(title: any, text: any, closeButtonText?: string, onClose: any): Promise; + confirm(title: any, text: any, confirmButtonText?: string, cancelButtonText?: string, onConfirm: any, onCancel: any, destructive?: boolean): Promise; +} +import { SNAlertService } from "../../../../../snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts new file mode 100644 index 000000000..7442f11d5 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/archiveManager.d.ts @@ -0,0 +1,21 @@ +export class ArchiveManager { + constructor(application: any); + application: any; + /** @public */ + public downloadBackup(encrypted: any): Promise; + /** @public */ + public downloadBackupOfItems(items: any, encrypted: any): Promise; + /** @private */ + private formattedDate; + /** @private */ + private itemsData; + /** @private */ + private loadZip; + /** @private */ + private downloadZippedItems; + /** @private */ + private hrefForData; + textFile: string | undefined; + /** @private */ + private downloadData; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts new file mode 100644 index 000000000..d45215ef4 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/desktopManager.d.ts @@ -0,0 +1,49 @@ +export class DesktopManager extends ApplicationService { + constructor($rootScope: any, $timeout: any, application: any); + $rootScope: any; + $timeout: any; + componentActivationObservers: any[]; + updateObservers: any[]; + isDesktop: any; + /** @override */ + onAppEvent(eventName: any): void; + dataLoaded: boolean | undefined; + saveBackup(): void; + getExtServerHost(): any; + /** + * Sending a component in its raw state is really slow for the desktop app + * Keys are not passed into ItemParams, so the result is not encrypted + */ + convertComponentForTransmission(component: any): Promise; + syncComponentsInstallation(components: any): void; + installComponent(component: any): Promise; + registerUpdateObserver(callback: any): () => void; + searchText(text: any): void; + lastSearchedText: any; + redoSearch(): void; + desktop_setSearchHandler(handler: any): void; + searchHandler: any; + desktop_windowGainedFocus(): void; + desktop_windowLostFocus(): void; + desktop_onComponentInstallationComplete(componentData: any, error: any): Promise; + desktop_registerComponentActivationObserver(callback: any): { + id: () => number; + callback: any; + }; + desktop_deregisterComponentActivationObserver(observer: any): void; + notifyComponentActivation(component: any): Promise; + desktop_setExtServerHost(host: any): void; + extServerHost: any; + desktop_setComponentInstallationSyncHandler(handler: any): void; + installationSyncHandler: any; + desktop_setInstallComponentHandler(handler: any): void; + installComponentHandler: any; + desktop_setInitialDataLoadHandler(handler: any): void; + dataLoadHandler: any; + desktop_requestBackupFile(callback: any): Promise; + desktop_setMajorDataChangeHandler(handler: any): void; + majorDataChangeHandler: any; + desktop_didBeginBackup(): void; + desktop_didFinishBackup(success: any): void; +} +import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts new file mode 100644 index 000000000..7558e5de1 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/index.d.ts @@ -0,0 +1,10 @@ +export { AlertService } from "./alertService"; +export { ArchiveManager } from "./archiveManager"; +export { DesktopManager } from "./desktopManager"; +export { KeyboardManager } from "./keyboardManager"; +export { LockManager } from "./lockManager"; +export { NativeExtManager } from "./nativeExtManager"; +export { PreferencesManager } from "./preferencesManager"; +export { StatusManager } from "./statusManager"; +export { ThemeManager } from "./themeManager"; +export { AppState } from "./state"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts new file mode 100644 index 000000000..d8f1cedf0 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/keyboardManager.d.ts @@ -0,0 +1,42 @@ +export namespace KeyboardKeys { + export const Tab: string; + export const Backspace: string; + export const Up: string; + export const Down: string; +} +export namespace KeyboardModifiers { + export const Shift: string; + export const Ctrl: string; + export const Meta: string; + export const Alt: string; +} +export class KeyboardManager { + observers: any[]; + handleKeyDown(event: any): void; + handleKeyUp(event: any): void; + /** @access public */ + deinit(): void; + modifiersForEvent(event: any): any[]; + eventMatchesKeyAndModifiers(event: any, key: any, modifiers?: any[]): boolean; + notifyObserver(event: any, keyEventType: any): void; + addKeyObserver({ key, modifiers, onKeyDown, onKeyUp, element, elements, notElement, notElementIds }: { + key: any; + modifiers: any; + onKeyDown: any; + onKeyUp: any; + element: any; + elements: any; + notElement: any; + notElementIds: any; + }): { + key: any; + modifiers: any; + onKeyDown: any; + onKeyUp: any; + element: any; + elements: any; + notElement: any; + notElementIds: any; + }; + removeKeyObserver(observer: any): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts new file mode 100644 index 000000000..7470cb337 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/lockManager.d.ts @@ -0,0 +1,25 @@ +export class LockManager { + constructor(application: any); + application: any; + observeVisibility(): void; + unsubState: any; + deinit(): void; + setAutoLockInterval(interval: any): Promise; + getAutoLockInterval(): Promise; + /** + * Verify document is in focus every so often as visibilitychange event is + * not triggered on a typical window blur event but rather on tab changes. + */ + beginWebFocusPolling(): void; + pollFocusInterval: NodeJS.Timeout | undefined; + lastFocusState: string | undefined; + getAutoLockIntervalOptions(): { + value: number; + label: string; + }[]; + documentVisibilityChanged(visible: any): Promise; + beginAutoLockTimer(): Promise; + lockAfterDate: Date | null | undefined; + lockTimeout: NodeJS.Timeout | undefined; + cancelAutoLockTimer(): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts new file mode 100644 index 000000000..df6d08911 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/nativeExtManager.d.ts @@ -0,0 +1,17 @@ +/** A class for handling installation of system extensions */ +export class NativeExtManager extends ApplicationService { + constructor(application: any); + extManagerId: string; + batchManagerId: string; + /** @override */ + onAppLaunch(): void; + get extManagerPred(): SNPredicate; + get batchManagerPred(): SNPredicate; + reload(): void; + resolveExtensionsManager(): Promise; + extensionsManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined; + batchManagerTemplatePayload(): import("../../../../../snjs/dist/@types/protocol/payloads/pure_payload").PurePayload | undefined; + resolveBatchManager(): Promise; +} +import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; +import { SNPredicate } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts new file mode 100644 index 000000000..09416a0ee --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/preferencesManager.d.ts @@ -0,0 +1,29 @@ +export namespace PrefKeys { + export const TagsPanelWidth: string; + export const NotesPanelWidth: string; + export const EditorWidth: string; + export const EditorLeft: string; + export const EditorMonospaceEnabled: string; + export const EditorSpellcheck: string; + export const EditorResizersEnabled: string; + export const SortNotesBy: string; + export const SortNotesReverse: string; + export const NotesShowArchived: string; + export const NotesHidePinned: string; + export const NotesHideNotePreview: string; + export const NotesHideDate: string; + export const NotesHideTags: string; +} +export class PreferencesManager extends ApplicationService { + constructor(application: import("../../../../../snjs/dist/@types/application").SNApplication); + /** @override */ + onAppLaunch(): void; + streamPreferences(): void; + loadSingleton(): Promise; + userPreferences: any; + preferencesDidChange(): void; + syncUserPreferences(): void; + getValue(key: any, defaultValue: any): any; + setUserPrefValue(key: any, value: any, sync: any): void; +} +import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts new file mode 100644 index 000000000..a7b672f6b --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/state.d.ts @@ -0,0 +1,56 @@ +export namespace AppStateEvents { + export const TagChanged: number; + export const NoteChanged: number; + export const PreferencesChanged: number; + export const PanelResized: number; + export const EditorFocused: number; + export const BeganBackupDownload: number; + export const EndedBackupDownload: number; + export const DesktopExtsReady: number; + export const WindowDidFocus: number; + export const WindowDidBlur: number; +} +export namespace EventSources { + export const UserInteraction: number; + export const Script: number; +} +export class AppState { + constructor($rootScope: any, $timeout: any, application: any); + $timeout: any; + $rootScope: any; + application: any; + observers: any[]; + locked: boolean; + deinit(): void; + unsubApp: any; + rootScopeCleanup1: any; + rootScopeCleanup2: any; + onVisibilityChange(): void; + addAppEventObserver(): void; + isLocked(): boolean; + registerVisibilityObservers(): void; + /** @returns A function that unregisters this observer */ + addObserver(callback: any): () => void; + notifyEvent(eventName: any, data: any): Promise; + setSelectedTag(tag: any): void; + selectedTag: any; + setSelectedNote(note: any): Promise; + selectedNote: any; + getSelectedTag(): any; + getSelectedNote(): any; + setUserPreferences(preferences: any): void; + userPreferences: any; + panelDidResize({ name, collapsed }: { + name: any; + collapsed: any; + }): void; + editorDidFocus(eventSource: any): void; + beganBackupDownload(): void; + endedBackupDownload({ success }: { + success: any; + }): void; + /** + * When the desktop appplication extension server is ready. + */ + desktopExtensionsReady(): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts new file mode 100644 index 000000000..adc5ce52d --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/statusManager.d.ts @@ -0,0 +1,15 @@ +export class StatusManager { + statuses: any[]; + observers: any[]; + statusFromString(string: any): { + string: any; + }; + replaceStatusWithString(status: any, string: any): any; + addStatusFromString(string: any): any; + addStatus(status: any): any; + removeStatus(status: any): null; + getStatusString(): string; + notifyObservers(): void; + addStatusObserver(callback: any): void; + removeStatusObserver(callback: any): void; +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts new file mode 100644 index 000000000..4d34eabe1 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/services/themeManager.d.ts @@ -0,0 +1,26 @@ +export class ThemeManager extends ApplicationService { + constructor(application: any); + activeThemes: any[]; + unsubState: any; + unregisterDesktop: any; + unregisterComponent: any; + /** @override */ + onAppStart(): void; + /** @access private */ + activateCachedThemes(): Promise; + /** @access private */ + registerObservers(): void; + /** @access public */ + deactivateAllThemes(): void; + /** @access private */ + activateTheme(theme: any, writeToCache?: boolean): void; + /** @access private */ + deactivateTheme(theme: any): void; + /** @access private */ + cacheThemes(): Promise; + /** @access private */ + decacheThemes(): Promise; + /** @access private */ + getCachedThemes(): Promise; +} +import { ApplicationService } from "../../../../../../../../../../Users/mo/Desktop/sn/dev/snjs/dist/@types"; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts new file mode 100644 index 000000000..00116bf4a --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/strings.d.ts @@ -0,0 +1,43 @@ +export function StringSyncException(data: any): string; +export function StringDeleteNote({ title, permanently }: { + title: any; + permanently: any; +}): string; +export function StringEmptyTrash({ count }: { + count: any; +}): string; +export function StringImportError({ errorCount }: { + errorCount: any; +}): string; +/** @generic */ +export const STRING_SESSION_EXPIRED: "Your session has expired. New changes will not be pulled in. Please sign out and sign back in to refresh your session."; +export const STRING_DEFAULT_FILE_ERROR: "Please use FileSafe or the Bold Editor to attach images and files. Learn more at standardnotes.org/filesafe."; +export const STRING_GENERIC_SYNC_ERROR: "There was an error syncing. Please try again. If all else fails, try signing out and signing back in."; +/** @footer */ +export const STRING_NEW_UPDATE_READY: "A new update is ready to install. Please use the top-level 'Updates' menu to manage installation."; +/** @tags */ +export const STRING_DELETE_TAG: "Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes."; +/** @editor */ +export const STRING_DELETED_NOTE: "The note you are attempting to edit has been deleted, and is awaiting sync. Changes you make will be disregarded."; +export const STRING_INVALID_NOTE: "The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note."; +export const STRING_ELLIPSES: "..."; +export const STRING_GENERIC_SAVE_ERROR: "There was an error saving your note. Please try again."; +export const STRING_DELETE_PLACEHOLDER_ATTEMPT: "This note is a placeholder and cannot be deleted. To remove from your list, simply navigate to a different note."; +export const STRING_DELETE_LOCKED_ATTEMPT: "This note is locked. If you'd like to delete it, unlock it, and try again."; +/** @account */ +export const STRING_ACCOUNT_MENU_UNCHECK_MERGE: "Unchecking this option means any of the notes you have written while you were signed out will be deleted. Are you sure you want to discard these notes?"; +export const STRING_SIGN_OUT_CONFIRMATION: "Are you sure you want to end your session? This will delete all local items and extensions."; +export const STRING_ERROR_DECRYPTING_IMPORT: "There was an error decrypting your items. Make sure the password you entered is correct and try again."; +export const STRING_E2E_ENABLED: "End-to-end encryption is enabled. Your data is encrypted on your device first, then synced to your private cloud."; +export const STRING_LOCAL_ENC_ENABLED: "Encryption is enabled. Your data is encrypted using your passcode before it is saved to your device storage."; +export const STRING_ENC_NOT_ENABLED: "Encryption is not enabled. Sign in, register, or add a passcode lock to enable encryption."; +export const STRING_IMPORT_SUCCESS: "Your data has been successfully imported."; +export const STRING_REMOVE_PASSCODE_CONFIRMATION: "Are you sure you want to remove your application passcode?"; +export const STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM: " This will remove encryption from your local data."; +export const STRING_NON_MATCHING_PASSCODES: "The two passcodes you entered do not match. Please try again."; +export const STRING_NON_MATCHING_PASSWORDS: "The two passwords you entered do not match. Please try again."; +export const STRING_GENERATING_LOGIN_KEYS: "Generating Login Keys..."; +export const STRING_GENERATING_REGISTER_KEYS: "Generating Account Keys..."; +export const STRING_INVALID_IMPORT_FILE: "Unable to open file. Ensure it is a proper JSON file and try again."; +/** @password_change */ +export const STRING_FAILED_PASSWORD_CHANGE: "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup."; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts new file mode 100644 index 000000000..b76181d93 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/types.d.ts @@ -0,0 +1,4 @@ +export declare enum PasswordWizardType { + ChangePassword = 1, + AccountUpgrade = 2 +} diff --git a/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts new file mode 100644 index 000000000..5501470ac --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/utils.d.ts @@ -0,0 +1,10 @@ +export function getParameterByName(name: any, url: any): string | null; +export function parametersFromURL(url: any): {}; +export function isNullOrUndefined(value: any): boolean; +export function dictToArray(dict: any): any[]; +export function humanReadableList(array: any): string; +export function getPlatformString(): string; +export function dateToLocalizedString(date: any): any; +/** Via https://davidwalsh.name/javascript-debounce-function */ +export function debounce(func: any, wait: any, immediate: any): (...args: any[]) => void; +export function isDesktopApplication(): any; diff --git a/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts b/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts new file mode 100644 index 000000000..640546166 --- /dev/null +++ b/app/assets/javascripts/@types/app/assets/javascripts/web_device_interface.d.ts @@ -0,0 +1,29 @@ +import { DeviceInterface, SNApplication } from 'snjs'; +export declare class WebDeviceInterface extends DeviceInterface { + private database; + constructor(namespace: string, timeout: any); + setApplication(application: SNApplication): void; + deinit(): void; + getRawStorageValue(key: string): Promise; + getAllRawStorageKeyValues(): Promise<{ + key: string; + value: any; + }[]>; + setRawStorageValue(key: string, value: any): Promise; + removeRawStorageValue(key: string): Promise; + removeAllRawStorageValues(): Promise; + openDatabase(): Promise<{ + isNewDatabase?: boolean | undefined; + } | undefined>; + private getDatabaseKeyPrefix; + private keyForPayloadId; + getAllRawDatabasePayloads(): Promise; + saveRawDatabasePayload(payload: any): Promise; + saveRawDatabasePayloads(payloads: any[]): Promise; + removeRawDatabasePayloadWithId(id: string): Promise; + removeAllRawDatabasePayloads(): Promise; + getKeychainValue(): Promise; + setKeychainValue(value: any): Promise; + clearKeychainValue(): Promise; + openUrl(url: string): void; +} diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts new file mode 100644 index 000000000..7f565f6f2 --- /dev/null +++ b/app/assets/javascripts/@types/vendor/assets/javascripts/angular-sanitize.d.ts @@ -0,0 +1,242 @@ +/** + * @ngdoc module + * @name ngSanitize + * @description + * + * The `ngSanitize` module provides functionality to sanitize HTML. + * + * See {@link ngSanitize.$sanitize `$sanitize`} for usage. + */ +/** + * @ngdoc service + * @name $sanitize + * @kind function + * + * @description + * Sanitizes an html string by stripping all potentially dangerous tokens. + * + * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are + * then serialized back to a properly escaped HTML string. This means that no unsafe input can make + * it into the returned string. + * + * The whitelist for URL sanitization of attribute values is configured using the functions + * `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link $compileProvider}. + * + * The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}. + * + * @param {string} html HTML input. + * @returns {string} Sanitized HTML. + * + * @example + + + +
+ Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + +
DirectiveHowSourceRendered
ng-bind-htmlAutomatically uses $sanitize
<div ng-bind-html="snippet">
</div>
ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value +
<div ng-bind-html="deliberatelyTrustDangerousSnippet()">
+</div>
+
ng-bindAutomatically escapes
<div ng-bind="snippet">
</div>
+
+
+ + it('should sanitize the html snippet by default', function() { + expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')). + toBe('

an html\nclick here\nsnippet

'); + }); + + it('should inline raw snippet if bound to a trusted value', function() { + expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')). + toBe("

an html\n" + + "click here\n" + + "snippet

"); + }); + + it('should escape snippet without any filter', function() { + expect(element(by.css('#bind-default div')).getAttribute('innerHTML')). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new text'); + expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')). + toBe('new text'); + expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe( + 'new text'); + expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe( + "new <b onclick=\"alert(1)\">text</b>"); + }); +
+
+ */ +/** + * @ngdoc provider + * @name $sanitizeProvider + * @this + * + * @description + * Creates and configures {@link $sanitize} instance. + */ +declare function $SanitizeProvider(): void; +declare class $SanitizeProvider { + $get: (string | (($$sanitizeUri: any) => (html: any) => string))[]; + /** + * @ngdoc method + * @name $sanitizeProvider#enableSvg + * @kind function + * + * @description + * Enables a subset of svg to be supported by the sanitizer. + * + *
+ *

By enabling this setting without taking other precautions, you might expose your + * application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned + * outside of the containing element and be rendered over other elements on the page (e.g. a login + * link). Such behavior can then result in phishing incidents.

+ * + *

To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg + * tags within the sanitized content:

+ * + *
+ * + *

+     *   .rootOfTheIncludedContent svg {
+     *     overflow: hidden !important;
+     *   }
+     *   
+ *
+ * + * @param {boolean=} flag Enable or disable SVG support in the sanitizer. + * @returns {boolean|$sanitizeProvider} Returns the currently configured value if called + * without an argument or self for chaining otherwise. + */ + enableSvg: (enableSvg: any) => any; + /** + * @ngdoc method + * @name $sanitizeProvider#addValidElements + * @kind function + * + * @description + * Extends the built-in lists of valid HTML/SVG elements, i.e. elements that are considered safe + * and are not stripped off during sanitization. You can extend the following lists of elements: + * + * - `htmlElements`: A list of elements (tag names) to extend the current list of safe HTML + * elements. HTML elements considered safe will not be removed during sanitization. All other + * elements will be stripped off. + * + * - `htmlVoidElements`: This is similar to `htmlElements`, but marks the elements as + * "void elements" (similar to HTML + * [void elements](https://rawgit.com/w3c/html/html5.1-2/single-page.html#void-elements)). These + * elements have no end tag and cannot have content. + * + * - `svgElements`: This is similar to `htmlElements`, but for SVG elements. This list is only + * taken into account if SVG is {@link ngSanitize.$sanitizeProvider#enableSvg enabled} for + * `$sanitize`. + * + *
+ * This method must be called during the {@link angular.Module#config config} phase. Once the + * `$sanitize` service has been instantiated, this method has no effect. + *
+ * + *
+ * Keep in mind that extending the built-in lists of elements may expose your app to XSS or + * other vulnerabilities. Be very mindful of the elements you add. + *
+ * + * @param {Array|Object} elements - A list of valid HTML elements or an object with one or + * more of the following properties: + * - **htmlElements** - `{Array}` - A list of elements to extend the current list of + * HTML elements. + * - **htmlVoidElements** - `{Array}` - A list of elements to extend the current list of + * void HTML elements; i.e. elements that do not have an end tag. + * - **svgElements** - `{Array}` - A list of elements to extend the current list of SVG + * elements. The list of SVG elements is only taken into account if SVG is + * {@link ngSanitize.$sanitizeProvider#enableSvg enabled} for `$sanitize`. + * + * Passing an array (`[...]`) is equivalent to passing `{htmlElements: [...]}`. + * + * @return {$sanitizeProvider} Returns self for chaining. + */ + addValidElements: (elements: Object | string[]) => any; + /** + * @ngdoc method + * @name $sanitizeProvider#addValidAttrs + * @kind function + * + * @description + * Extends the built-in list of valid attributes, i.e. attributes that are considered safe and are + * not stripped off during sanitization. + * + * **Note**: + * The new attributes will not be treated as URI attributes, which means their values will not be + * sanitized as URIs using `$compileProvider`'s + * {@link ng.$compileProvider#aHrefSanitizationWhitelist aHrefSanitizationWhitelist} and + * {@link ng.$compileProvider#imgSrcSanitizationWhitelist imgSrcSanitizationWhitelist}. + * + *
+ * This method must be called during the {@link angular.Module#config config} phase. Once the + * `$sanitize` service has been instantiated, this method has no effect. + *
+ * + *
+ * Keep in mind that extending the built-in list of attributes may expose your app to XSS or + * other vulnerabilities. Be very mindful of the attributes you add. + *
+ * + * @param {Array} attrs - A list of valid attributes. + * + * @returns {$sanitizeProvider} Returns self for chaining. + */ + addValidAttrs: (attrs: string[]) => any; +} +declare function sanitizeText(chars: any): string; +declare var $sanitizeMinErr: any; +declare var bind: any; +declare var extend: any; +declare var forEach: any; +declare var isArray: any; +declare var isDefined: any; +declare var lowercase: any; +declare var noop: any; +declare var nodeContains: any; +declare var htmlParser: any; +declare var htmlSanitizeWriter: any; diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/deflate.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/inflate.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/z-worker.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts b/app/assets/javascripts/@types/vendor/assets/javascripts/zip/zip.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.ts similarity index 55% rename from app/assets/javascripts/application.js rename to app/assets/javascripts/application.ts index 746419027..08b875929 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.ts @@ -1,30 +1,61 @@ +import { PasswordWizardType } from './types'; import { + Environment, SNApplication, SNAlertService, - Environments, - platformFromString + platformFromString, + Challenge, + ChallengeOrchestrator, + ProtectedAction } from 'snjs'; import angular from 'angular'; import { getPlatformString } from '@/utils'; import { AlertService } from '@/services/alertService'; import { WebDeviceInterface } from '@/web_device_interface'; +import { AppState, DesktopManager, LockManager, ArchiveManager, NativeExtManager, StatusManager, ThemeManager, PreferencesManager, KeyboardManager } from './services'; + +type WebServices = { + appState: AppState + desktopService: DesktopManager + lockService: LockManager + archiveService: ArchiveManager + nativeExtService: NativeExtManager + statusService: StatusManager + themeService: ThemeManager + prefsService: PreferencesManager + keyboardService: KeyboardManager +} export class WebApplication extends SNApplication { + + private $compile?: ng.ICompileService + private scope?: ng.IScope + private onDeinit?: (app: SNApplication) => void + private webServices!: WebServices + private currentAuthenticationElement?: JQLite + /* @ngInject */ - constructor($compile, $timeout, scope, onDeinit) { - const deviceInterface = new WebDeviceInterface({ timeout: $timeout }); - super({ - environment: Environments.Web, - platform: platformFromString(getPlatformString()), - namespace: '', - deviceInterface: deviceInterface, - swapClasses: [ + constructor( + $compile: ng.ICompileService, + $timeout: ng.ITimeoutService, + scope: ng.IScope, + onDeinit: () => void + ) { + const namespace = ''; + const deviceInterface = new WebDeviceInterface(namespace, $timeout); + super( + Environment.Web, + platformFromString(getPlatformString()), + deviceInterface, + namespace, + undefined, + [ { swap: SNAlertService, with: AlertService } ] - }); + ); this.$compile = $compile; this.scope = scope; this.onDeinit = onDeinit; @@ -34,30 +65,23 @@ export class WebApplication extends SNApplication { /** @override */ deinit() { for (const key of Object.keys(this.webServices)) { - const service = this.webServices[key]; - if(service.deinit) { + const service = (this.webServices as any)[key]; + if (service.deinit) { service.deinit(); } - service.application = null; - delete this.webServices[key]; + service.application = undefined; } - this.webServices = {}; - this.onDeinit(this); - this.onDeinit = null; - this.$compile = null; - this.$timeout = null; - this.scope.application = null; - this.scope.$destroy(); - this.scope = null; + this.webServices = {} as WebServices; + this.onDeinit!(this); + this.onDeinit = undefined; + this.$compile = undefined; + (this.scope! as any).application = undefined; + this.scope!.$destroy(); + this.scope = undefined; super.deinit(); } - - /** - * @access public - * @param {object} services - */ - setWebServices(services) { + setWebServices(services: WebServices) { this.webServices = services; } @@ -110,20 +134,20 @@ export class WebApplication extends SNApplication { return this.protocolUpgradeAvailable(); } - presentPasswordWizard(type) { - const scope = this.scope.$new(true); + presentPasswordWizard(type: PasswordWizardType) { + const scope: any = this.scope!.$new(true); scope.type = type; scope.application = this; - const el = this.$compile("")(scope); + const el = this.$compile!("")(scope); angular.element(document.body).append(el); } - promptForChallenge(challenge, orchestrator) { - const scope = this.scope.$new(true); + promptForChallenge(challenge: Challenge, orchestrator: ChallengeOrchestrator) { + const scope: any = this.scope!.$new(true); scope.challenge = challenge; scope.orchestrator = orchestrator; scope.application = this; - const el = this.$compile( + const el = this.$compile!( "" + "" @@ -133,19 +157,23 @@ export class WebApplication extends SNApplication { async performProtocolUpgrade() { const errors = await this.upgradeProtocolVersion(); - if (errors.length === 0) { - this.alertService.alert({ - text: "Success! Your encryption version has been upgraded." + - " You'll be asked to enter your credentials again on other devices you're signed into." - }); + if (!errors || errors.length === 0) { + this.alertService!.alert( + "Success! Your encryption version has been upgraded." + + " You'll be asked to enter your credentials again on other devices you're signed into." + ); } else { - this.alertService.alert({ - text: "Unable to upgrade encryption version. Please try again." - }); + this.alertService!.alert( + "Unable to upgrade encryption version. Please try again." + ); } } - async presentPrivilegesModal(action, onSuccess, onCancel) { + async presentPrivilegesModal( + action: ProtectedAction, + onSuccess: any, + onCancel: any + ) { if (this.authenticationInProgress()) { onCancel && onCancel(); return; @@ -153,19 +181,19 @@ export class WebApplication extends SNApplication { const customSuccess = async () => { onSuccess && await onSuccess(); - this.currentAuthenticationElement = null; + this.currentAuthenticationElement = undefined; }; const customCancel = async () => { onCancel && await onCancel(); - this.currentAuthenticationElement = null; + this.currentAuthenticationElement = undefined; }; - const scope = this.scope.$new(true); + const scope: any = this.scope!.$new(true); scope.action = action; scope.onSuccess = customSuccess; scope.onCancel = customCancel; scope.application = this; - const el = this.$compile(` + const el = this.$compile!(` `)(scope); @@ -175,9 +203,9 @@ export class WebApplication extends SNApplication { } presentPrivilegesManagementModal() { - const scope = this.scope.$new(true); + const scope: any = this.scope!.$new(true); scope.application = this; - const el = this.$compile("")(scope); + const el = this.$compile!("")(scope); angular.element(document.body).append(el); } @@ -185,26 +213,26 @@ export class WebApplication extends SNApplication { return this.currentAuthenticationElement != null; } - presentPasswordModal(callback) { - const scope = this.scope.$new(true); + presentPasswordModal(callback: () => void) { + const scope: any = this.scope!.$new(true); scope.type = "password"; scope.title = "Decryption Assistance"; scope.message = `Unable to decrypt this item with your current keys. Please enter your account password at the time of this revision.`; scope.callback = callback; - const el = this.$compile( + const el = this.$compile!( `` )(scope); angular.element(document.body).append(el); } - presentRevisionPreviewModal(uuid, content) { - const scope = this.scope.$new(true); + presentRevisionPreviewModal(uuid: string, content: any) { + const scope: any = this.scope!.$new(true); scope.uuid = uuid; scope.content = content; scope.application = this; - const el = this.$compile( + const el = this.$compile!( `` )(scope); diff --git a/app/assets/javascripts/controllers/abstract/pure_ctrl.js b/app/assets/javascripts/controllers/abstract/pure_ctrl.js index 48edebf9b..9a1a9765b 100644 --- a/app/assets/javascripts/controllers/abstract/pure_ctrl.js +++ b/app/assets/javascripts/controllers/abstract/pure_ctrl.js @@ -1,4 +1,4 @@ -import { ApplicationEvents } from 'snjs'; +import { ApplicationEvent } from 'snjs'; export class PureCtrl { /* @ngInject */ @@ -84,13 +84,13 @@ export class PureCtrl { } this.unsubApp = this.application.addEventObserver(async (eventName) => { this.onAppEvent(eventName); - if (eventName === ApplicationEvents.Started) { + if (eventName === ApplicationEvent.Started) { await this.onAppStart(); - } else if (eventName === ApplicationEvents.Launched) { + } else if (eventName === ApplicationEvent.Launched) { await this.onAppLaunch(); - } else if (eventName === ApplicationEvents.CompletedSync) { + } else if (eventName === ApplicationEvent.CompletedSync) { this.onAppSync(); - } else if (eventName === ApplicationEvents.KeyStatusChanged) { + } else if (eventName === ApplicationEvent.KeyStatusChanged) { this.onAppKeyChange(); } }); diff --git a/app/assets/javascripts/controllers/applicationView.js b/app/assets/javascripts/controllers/applicationView.js index 98fb359c2..99a3e75ae 100644 --- a/app/assets/javascripts/controllers/applicationView.js +++ b/app/assets/javascripts/controllers/applicationView.js @@ -1,7 +1,7 @@ import { getPlatformString } from '@/utils'; import template from '%/application-view.pug'; import { AppStateEvents } from '@/services/state'; -import { ApplicationEvents } from 'snjs'; +import { ApplicationEvent } from 'snjs'; import angular from 'angular'; import { PANEL_NAME_NOTES, @@ -91,34 +91,34 @@ class ApplicationViewCtrl extends PureCtrl { /** @override */ async onAppEvent(eventName) { super.onAppEvent(eventName); - if (eventName === ApplicationEvents.LocalDataIncrementalLoad) { + if (eventName === ApplicationEvent.LocalDataIncrementalLoad) { this.updateLocalDataStatus(); } else if ( - eventName === ApplicationEvents.SyncStatusChanged || - eventName === ApplicationEvents.FailedSync + eventName === ApplicationEvent.SyncStatusChanged || + eventName === ApplicationEvent.FailedSync ) { this.updateSyncStatus(); - } else if (eventName === ApplicationEvents.LocalDataLoaded) { + } else if (eventName === ApplicationEvent.LocalDataLoaded) { this.updateLocalDataStatus(); - } else if (eventName === ApplicationEvents.WillSync) { + } else if (eventName === ApplicationEvent.WillSync) { if (!this.completedInitialSync) { this.syncStatus = this.application.getStatusService().replaceStatusWithString( this.syncStatus, "Syncing..." ); } - } else if (eventName === ApplicationEvents.CompletedSync) { + } else if (eventName === ApplicationEvent.CompletedSync) { if (!this.completedInitialSync) { this.syncStatus = this.application.getStatusService().removeStatus(this.syncStatus); this.completedInitialSync = true; } - } else if (eventName === ApplicationEvents.InvalidSyncSession) { + } else if (eventName === ApplicationEvent.InvalidSyncSession) { this.showInvalidSessionAlert(); - } else if (eventName === ApplicationEvents.LocalDatabaseReadError) { + } else if (eventName === ApplicationEvent.LocalDatabaseReadError) { this.application.alertService.alert({ text: 'Unable to load local database. Please restart the app and try again.' }); - } else if (eventName === ApplicationEvents.LocalDatabaseWriteError) { + } else if (eventName === ApplicationEvent.LocalDatabaseWriteError) { this.application.alertService.alert({ text: 'Unable to write to local database. Please restart the app and try again.' }); diff --git a/app/assets/javascripts/controllers/editor.js b/app/assets/javascripts/controllers/editor.js index 547bd1154..8fdb21375 100644 --- a/app/assets/javascripts/controllers/editor.js +++ b/app/assets/javascripts/controllers/editor.js @@ -1,6 +1,6 @@ import angular from 'angular'; import { - ApplicationEvents, + ApplicationEvent, isPayloadSourceRetrieved, ContentTypes, ProtectedActions @@ -113,9 +113,9 @@ class EditorCtrl extends PureCtrl { if (!this.state.note) { return; } - if (eventName === ApplicationEvents.HighLatencySync) { + if (eventName === ApplicationEvent.HighLatencySync) { this.setState({ syncTakingTooLong: true }); - } else if (eventName === ApplicationEvents.CompletedSync) { + } else if (eventName === ApplicationEvent.CompletedSync) { this.setState({ syncTakingTooLong: false }); if (this.state.note.dirty) { /** if we're still dirty, don't change status, a sync is likely upcoming. */ @@ -126,7 +126,7 @@ class EditorCtrl extends PureCtrl { this.showAllChangesSavedStatus(); } } - } else if (eventName === ApplicationEvents.FailedSync) { + } else if (eventName === ApplicationEvent.FailedSync) { /** * Only show error status in editor if the note is dirty. * Otherwise, it means the originating sync came from somewhere else @@ -135,7 +135,7 @@ class EditorCtrl extends PureCtrl { if (this.state.note.dirty) { this.showErrorStatus(); } - } else if (eventName === ApplicationEvents.LocalDatabaseWriteError) { + } else if (eventName === ApplicationEvent.LocalDatabaseWriteError) { this.showErrorStatus({ message: "Offline Saving Issue", desc: "Changes not saved" diff --git a/app/assets/javascripts/controllers/footer.js b/app/assets/javascripts/controllers/footer.js index de5206f60..0d2a99921 100644 --- a/app/assets/javascripts/controllers/footer.js +++ b/app/assets/javascripts/controllers/footer.js @@ -1,6 +1,6 @@ import { dateToLocalizedString } from '@/utils'; import { - ApplicationEvents, + ApplicationEvent, TIMING_STRATEGY_FORCE_SPAWN_NEW, ProtectedActions, ContentTypes @@ -132,24 +132,24 @@ class FooterCtrl extends PureCtrl { /** @override */ onAppEvent(eventName) { - if (eventName === ApplicationEvents.KeyStatusChanged) { + if (eventName === ApplicationEvent.KeyStatusChanged) { this.reloadUpgradeStatus(); - } else if (eventName === ApplicationEvents.EnteredOutOfSync) { + } else if (eventName === ApplicationEvent.EnteredOutOfSync) { this.setState({ outOfSync: true }); - } else if (eventName === ApplicationEvents.ExitedOutOfSync) { + } else if (eventName === ApplicationEvent.ExitedOutOfSync) { this.setState({ outOfSync: false }); - } else if (eventName === ApplicationEvents.CompletedSync) { + } else if (eventName === ApplicationEvent.CompletedSync) { if (this.offline && this.application.getNoteCount() === 0) { this.showAccountMenu = true; } this.syncUpdated(); this.findErrors(); this.updateOfflineStatus(); - } else if (eventName === ApplicationEvents.FailedSync) { + } else if (eventName === ApplicationEvent.FailedSync) { this.findErrors(); this.updateOfflineStatus(); } diff --git a/app/assets/javascripts/controllers/notes/notes.js b/app/assets/javascripts/controllers/notes/notes.js index 3b72b1491..4e0a0083e 100644 --- a/app/assets/javascripts/controllers/notes/notes.js +++ b/app/assets/javascripts/controllers/notes/notes.js @@ -1,6 +1,6 @@ import angular from 'angular'; import template from '%/notes.pug'; -import { ApplicationEvents, ContentTypes, removeFromArray } from 'snjs'; +import { ApplicationEvent, ContentTypes, removeFromArray } from 'snjs'; import { PureCtrl } from '@Controllers'; import { AppStateEvents } from '@/services/state'; import { KeyboardModifiers, KeyboardKeys } from '@/services/keyboardManager'; @@ -103,14 +103,14 @@ class NotesCtrl extends PureCtrl { /** @override */ async onAppEvent(eventName) { - if (eventName === ApplicationEvents.SignedIn) { + if (eventName === ApplicationEvent.SignedIn) { /** Delete dummy note if applicable */ if (this.state.selectedNote && this.state.selectedNote.dummy) { this.application.deleteItemLocally({ item: this.state.selectedNote }); await this.selectNote(null); await this.reloadNotes(); } - } else if (eventName === ApplicationEvents.CompletedSync) { + } else if (eventName === ApplicationEvent.CompletedSync) { this.getMostValidNotes().then((notes) => { if (notes.length === 0) { this.createPlaceholderNote(); diff --git a/app/assets/javascripts/controllers/tags.js b/app/assets/javascripts/controllers/tags.js index 286152a78..e200b7189 100644 --- a/app/assets/javascripts/controllers/tags.js +++ b/app/assets/javascripts/controllers/tags.js @@ -2,7 +2,7 @@ import { SNNote, SNSmartTag, ContentTypes, - ApplicationEvents, + ApplicationEvent, ComponentActions } from 'snjs'; import template from '%/tags.pug'; @@ -107,9 +107,9 @@ class TagsPanelCtrl extends PureCtrl { /** @override */ async onAppEvent(eventName) { super.onAppEvent(eventName); - if (eventName === ApplicationEvents.LocalDataIncrementalLoad) { + if (eventName === ApplicationEvent.LocalDataIncrementalLoad) { this.reloadNoteCounts(); - } else if (eventName === ApplicationEvents.SyncStatusChanged) { + } else if (eventName === ApplicationEvent.SyncStatusChanged) { const syncStatus = this.application.getSyncStatus(); const stats = syncStatus.getStats(); if (stats.downloadCount > 0) { diff --git a/app/assets/javascripts/routes.js b/app/assets/javascripts/routes.ts similarity index 81% rename from app/assets/javascripts/routes.js rename to app/assets/javascripts/routes.ts index d689f85c8..42d646e37 100644 --- a/app/assets/javascripts/routes.js +++ b/app/assets/javascripts/routes.ts @@ -1,7 +1,7 @@ import { isDesktopApplication } from './utils'; /* @ngInject */ -export function configRoutes($locationProvider) { +export function configRoutes($locationProvider: ng.ILocationProvider) { if (!isDesktopApplication()) { if (window.history && window.history.pushState) { $locationProvider.html5Mode({ diff --git a/app/assets/javascripts/services/desktopManager.js b/app/assets/javascripts/services/desktopManager.js index c470ff69b..8e8234bbb 100644 --- a/app/assets/javascripts/services/desktopManager.js +++ b/app/assets/javascripts/services/desktopManager.js @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ // An interface used by the Desktop app to interact with SN import { isDesktopApplication } from '@/utils'; -import { EncryptionIntents, ApplicationService, ApplicationEvents, removeFromArray } from 'snjs'; +import { EncryptionIntents, ApplicationService, ApplicationEvent, removeFromArray } from 'snjs'; const COMPONENT_DATA_KEY_INSTALL_ERROR = 'installError'; const COMPONENT_CONTENT_KEY_PACKAGE_INFO = 'package_info'; @@ -30,12 +30,12 @@ export class DesktopManager extends ApplicationService { /** @override */ onAppEvent(eventName) { super.onAppEvent(eventName); - if (eventName === ApplicationEvents.LocalDataLoaded) { + if (eventName === ApplicationEvent.LocalDataLoaded) { this.dataLoaded = true; if (this.dataLoadHandler) { this.dataLoadHandler(); } - } else if (eventName === ApplicationEvents.MajorDataChange) { + } else if (eventName === ApplicationEvent.MajorDataChange) { if (this.majorDataChangeHandler) { this.majorDataChangeHandler(); } diff --git a/app/assets/javascripts/services/state.js b/app/assets/javascripts/services/state.js index f83afa10d..d49b2a1a8 100644 --- a/app/assets/javascripts/services/state.js +++ b/app/assets/javascripts/services/state.js @@ -1,6 +1,6 @@ import { isDesktopApplication } from '@/utils'; import pull from 'lodash/pull'; -import { ProtectedActions, ApplicationEvents } from 'snjs'; +import { ProtectedActions, ApplicationEvent } from 'snjs'; export const AppStateEvents = { TagChanged: 1, @@ -52,9 +52,9 @@ export class AppState { addAppEventObserver() { this.unsubApp = this.application.addEventObserver(async (eventName) => { - if (eventName === ApplicationEvents.Started) { + if (eventName === ApplicationEvent.Started) { this.locked = true; - } else if (eventName === ApplicationEvents.Launched) { + } else if (eventName === ApplicationEvent.Launched) { this.locked = false; } }); diff --git a/app/assets/javascripts/services/themeManager.js b/app/assets/javascripts/services/themeManager.js index 3e0e219a5..c94e9a32f 100644 --- a/app/assets/javascripts/services/themeManager.js +++ b/app/assets/javascripts/services/themeManager.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import { - ApplicationEvents, + ApplicationEvent, StorageValueModes, EncryptionIntents, ApplicationService, diff --git a/app/assets/javascripts/tsconfig.json b/app/assets/javascripts/tsconfig.json new file mode 100644 index 000000000..d6a0eb4ff --- /dev/null +++ b/app/assets/javascripts/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "moduleResolution": "node", + "allowJs": true, + "strict": true, + "isolatedModules": true, + "esModuleInterop": true, + "types": ["node", "../../../node_modules/snjs/dist/@types"], + "declaration": true, + "declarationDir": "@types", + "emitDeclarationOnly": true, + "baseUrl": ".", + "paths": { + "%/*": ["../templates/*"], + "@/*": ["./*"], + "@Controllers/*": ["./controllers/*"] + } + }, + "typeAcquisition": { + "include": [ + "snjs" + ] +} +} diff --git a/app/assets/javascripts/types.ts b/app/assets/javascripts/types.ts new file mode 100644 index 000000000..96888c091 --- /dev/null +++ b/app/assets/javascripts/types.ts @@ -0,0 +1,4 @@ +export enum PasswordWizardType { + ChangePassword = 1, + AccountUpgrade = 2 +} \ No newline at end of file diff --git a/app/assets/javascripts/utils.js b/app/assets/javascripts/utils.js index 313cdf4ea..008c58d53 100644 --- a/app/assets/javascripts/utils.js +++ b/app/assets/javascripts/utils.js @@ -61,10 +61,9 @@ export function getPlatformString() { if (platform.indexOf('linux') !== -1) { trimmed = 'linux'; } - return trimmed + (isDesktopApplication() ? '-desktop' : '-web'); } catch (e) { - return null; + return 'unknown-platform'; } } diff --git a/app/assets/javascripts/web_device_interface.js b/app/assets/javascripts/web_device_interface.ts similarity index 70% rename from app/assets/javascripts/web_device_interface.js rename to app/assets/javascripts/web_device_interface.ts index 3cd852ff0..7cc29e4dc 100644 --- a/app/assets/javascripts/web_device_interface.js +++ b/app/assets/javascripts/web_device_interface.ts @@ -1,41 +1,31 @@ -import { DeviceInterface, getGlobalScope } from 'snjs'; +import { DeviceInterface, getGlobalScope, SNApplication } from 'snjs'; import { Database } from '@/database'; const KEYCHAIN_STORAGE_KEY = 'keychain'; export class WebDeviceInterface extends DeviceInterface { - constructor({ - namespace, - timeout - } = {}) { - super({ - namespace, - timeout: timeout || setTimeout.bind(getGlobalScope()), - interval: setInterval.bind(getGlobalScope()) - }); - this.createDatabase(); - } + private database: Database - createDatabase() { + constructor(namespace: string, timeout: any) { + super( + namespace, + timeout || setTimeout.bind(getGlobalScope()), + setInterval.bind(getGlobalScope()) + ); this.database = new Database(); } - setApplication(application) { + setApplication(application: SNApplication) { this.database.setApplication(application); } - /** @override */ deinit() { super.deinit(); this.database.deinit(); } - /** - * @value storage - */ - - async getRawStorageValue(key) { + async getRawStorageValue(key: string) { return localStorage.getItem(key); } @@ -50,11 +40,11 @@ export class WebDeviceInterface extends DeviceInterface { return results; } - async setRawStorageValue(key, value) { + async setRawStorageValue(key: string, value: any) { localStorage.setItem(key, value); } - async removeRawStorageValue(key) { + async removeRawStorageValue(key: string) { localStorage.removeItem(key); } @@ -72,11 +62,10 @@ export class WebDeviceInterface extends DeviceInterface { }).catch((error => { reject(error); })); - }); + }) as Promise<{ isNewDatabase?: boolean } | undefined>; } - /** @private */ - getDatabaseKeyPrefix() { + private getDatabaseKeyPrefix() { if (this.namespace) { return `${this.namespace}-item-`; } else { @@ -84,8 +73,7 @@ export class WebDeviceInterface extends DeviceInterface { } } - /** @private */ - keyForPayloadId(id) { + private keyForPayloadId(id: string) { return `${this.getDatabaseKeyPrefix()}${id}`; } @@ -93,15 +81,15 @@ export class WebDeviceInterface extends DeviceInterface { return this.database.getAllPayloads(); } - async saveRawDatabasePayload(payload) { + async saveRawDatabasePayload(payload: any) { return this.database.savePayload(payload); } - async saveRawDatabasePayloads(payloads) { + async saveRawDatabasePayloads(payloads: any[]) { return this.database.savePayloads(payloads); } - async removeRawDatabasePayloadWithId(id) { + async removeRawDatabasePayloadWithId(id: string) { return this.database.deletePayload(id); } @@ -109,7 +97,6 @@ export class WebDeviceInterface extends DeviceInterface { return this.database.clearAllPayloads(); } - /** @keychian */ async getKeychainValue() { const value = localStorage.getItem(KEYCHAIN_STORAGE_KEY); if (value) { @@ -117,7 +104,7 @@ export class WebDeviceInterface extends DeviceInterface { } } - async setKeychainValue(value) { + async setKeychainValue(value: any) { localStorage.setItem(KEYCHAIN_STORAGE_KEY, JSON.stringify(value)); } @@ -125,14 +112,10 @@ export class WebDeviceInterface extends DeviceInterface { localStorage.removeItem(KEYCHAIN_STORAGE_KEY); } - /** - * @actions - */ - openUrl(url) { + openUrl(url: string) { const win = window.open(url, '_blank'); if (win) { win.focus(); } } - } diff --git a/dist/javascripts/app.js b/dist/javascripts/app.js index 8d682da3f..d6354111c 100644 --- a/dist/javascripts/app.js +++ b/dist/javascripts/app.js @@ -1,90639 +1,23 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./app/assets/javascripts/index.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../snjs/dist/snjs.js": -/*!****************************!*\ - !*** ../snjs/dist/snjs.js ***! - \****************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -(function webpackUniversalModuleDefinition(root,factory){if(true)module.exports=factory();else {}})(window,function(){return(/******/function(modules){// webpackBootstrap -/******/ // The module cache -/******/var installedModules={};/******/ /******/ // The require function -/******/function __webpack_require__(moduleId){/******/ /******/ // Check if module is in cache -/******/if(installedModules[moduleId]){/******/return installedModules[moduleId].exports;/******/}/******/ // Create a new module (and put it into the cache) -/******/var module=installedModules[moduleId]={/******/i:moduleId,/******/l:false,/******/exports:{}/******/};/******/ /******/ // Execute the module function -/******/modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);/******/ /******/ // Flag the module as loaded -/******/module.l=true;/******/ /******/ // Return the exports of the module -/******/return module.exports;/******/}/******/ /******/ /******/ // expose the modules object (__webpack_modules__) -/******/__webpack_require__.m=modules;/******/ /******/ // expose the module cache -/******/__webpack_require__.c=installedModules;/******/ /******/ // define getter function for harmony exports -/******/__webpack_require__.d=function(exports,name,getter){/******/if(!__webpack_require__.o(exports,name)){/******/Object.defineProperty(exports,name,{enumerable:true,get:getter});/******/}/******/};/******/ /******/ // define __esModule on exports -/******/__webpack_require__.r=function(exports){/******/if(typeof Symbol!=='undefined'&&Symbol.toStringTag){/******/Object.defineProperty(exports,Symbol.toStringTag,{value:'Module'});/******/}/******/Object.defineProperty(exports,'__esModule',{value:true});/******/};/******/ /******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/__webpack_require__.t=function(value,mode){/******/if(mode&1)value=__webpack_require__(value);/******/if(mode&8)return value;/******/if(mode&4&&typeof value==='object'&&value&&value.__esModule)return value;/******/var ns=Object.create(null);/******/__webpack_require__.r(ns);/******/Object.defineProperty(ns,'default',{enumerable:true,value:value});/******/if(mode&2&&typeof value!='string')for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key];}.bind(null,key));/******/return ns;/******/};/******/ /******/ // getDefaultExport function for compatibility with non-harmony modules -/******/__webpack_require__.n=function(module){/******/var getter=module&&module.__esModule?/******/function getDefault(){return module['default'];}:/******/function getModuleExports(){return module;};/******/__webpack_require__.d(getter,'a',getter);/******/return getter;/******/};/******/ /******/ // Object.prototype.hasOwnProperty.call -/******/__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property);};/******/ /******/ // __webpack_public_path__ -/******/__webpack_require__.p="/dist/";/******/ /******/ /******/ // Load entry module and return exports -/******/return __webpack_require__(__webpack_require__.s="./lib/main.js");/******/}(/************************************************************************/ /******/{/***/"../sncrypto/dist/sncrypto.js":/*!************************************!*\ - !*** ../sncrypto/dist/sncrypto.js ***! - \************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof2=function _typeof2(obj){return typeof obj;};}else{_typeof2=function _typeof2(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof2(obj);}(function webpackUniversalModuleDefinition(root,factory){if((false?undefined:_typeof2(exports))==='object'&&(false?undefined:_typeof2(module))==='object')module.exports=factory();else if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_FACTORY__=factory,__WEBPACK_AMD_DEFINE_RESULT__=typeof __WEBPACK_AMD_DEFINE_FACTORY__==='function'?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__));else{}})(window,function(){return(/******/function(modules){// webpackBootstrap -/******/ // The module cache -/******/var installedModules={};/******/ /******/ // The require function -/******/function __webpack_require__(moduleId){/******/ /******/ // Check if module is in cache -/******/if(installedModules[moduleId]){/******/return installedModules[moduleId].exports;/******/}/******/ // Create a new module (and put it into the cache) -/******/var module=installedModules[moduleId]={/******/i:moduleId,/******/l:false,/******/exports:{}/******/};/******/ /******/ // Execute the module function -/******/modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);/******/ /******/ // Flag the module as loaded -/******/module.l=true;/******/ /******/ // Return the exports of the module -/******/return module.exports;/******/}/******/ /******/ /******/ // expose the modules object (__webpack_modules__) -/******/__webpack_require__.m=modules;/******/ /******/ // expose the module cache -/******/__webpack_require__.c=installedModules;/******/ /******/ // define getter function for harmony exports -/******/__webpack_require__.d=function(exports,name,getter){/******/if(!__webpack_require__.o(exports,name)){/******/Object.defineProperty(exports,name,{enumerable:true,get:getter});/******/}/******/};/******/ /******/ // define __esModule on exports -/******/__webpack_require__.r=function(exports){/******/if(typeof Symbol!=='undefined'&&Symbol.toStringTag){/******/Object.defineProperty(exports,Symbol.toStringTag,{value:'Module'});/******/}/******/Object.defineProperty(exports,'__esModule',{value:true});/******/};/******/ /******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/__webpack_require__.t=function(value,mode){/******/if(mode&1)value=__webpack_require__(value);/******/if(mode&8)return value;/******/if(mode&4&&_typeof2(value)==='object'&&value&&value.__esModule)return value;/******/var ns=Object.create(null);/******/__webpack_require__.r(ns);/******/Object.defineProperty(ns,'default',{enumerable:true,value:value});/******/if(mode&2&&typeof value!='string')for(var key in value){__webpack_require__.d(ns,key,function(key){return value[key];}.bind(null,key));}/******/return ns;/******/};/******/ /******/ // getDefaultExport function for compatibility with non-harmony modules -/******/__webpack_require__.n=function(module){/******/var getter=module&&module.__esModule?/******/function getDefault(){return module['default'];}:/******/function getModuleExports(){return module;};/******/__webpack_require__.d(getter,'a',getter);/******/return getter;/******/};/******/ /******/ // Object.prototype.hasOwnProperty.call -/******/__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property);};/******/ /******/ // __webpack_public_path__ -/******/__webpack_require__.p="/dist/";/******/ /******/ /******/ // Load entry module and return exports -/******/return __webpack_require__(__webpack_require__.s="./lib/main.js");/******/}(/************************************************************************/ /******/{/***/"./lib/crypto/pure_crypto.js":/*!***********************************!*\ - !*** ./lib/crypto/pure_crypto.js ***! - \***********************************/ /*! exports provided: SNPureCrypto */ /***/function libCryptoPure_cryptoJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNPureCrypto",function(){return SNPureCrypto;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/utils */"./lib/utils/index.js");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i} - */},{key:"generateUUID",value:function(){var _generateUUID=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:return _context.abrupt("return",Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["generateUUIDSync"])());case 1:case"end":return _context.stop();}}},_callee);}));function generateUUID(){return _generateUUID.apply(this,arguments);}return generateUUID;}()/** - * Constant-time string comparison - * @param {string} a - * @param {string} b - * @returns {boolean} Whether the strings are equal - */},{key:"timingSafeEqual",value:function timingSafeEqual(a,b){var strA=String(a);var strB=String(b);var lenA=strA.length;var result=0;if(lenA!==strB.length){strB=strA;result=1;}for(var i=0;i} Hex string - */},{key:"pbkdf2",value:function(){var _pbkdf=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(password,salt,iterations,length){var key;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return this.webCryptoImportKey(password,WebCryptoAlgs.Pbkdf2,[WebCryptoActions.DeriveBits]);case 2:key=_context.sent;if(key){_context.next=6;break;}console.error('Key is null, unable to continue');return _context.abrupt("return",null);case 6:return _context.abrupt("return",this.webCryptoDeriveBits(key,salt,iterations,length));case 7:case"end":return _context.stop();}}},_callee,this);}));function pbkdf2(_x,_x2,_x3,_x4){return _pbkdf.apply(this,arguments);}return pbkdf2;}()/** - * Generates a random key in hex format - * @access public - * @param {number} bits - Length of key in bits - * @returns {Promise} A string key in hex format - */},{key:"generateRandomKey",value:function(){var _generateRandomKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(bits){var bytes,arrayBuffer;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:bytes=bits/8;arrayBuffer=_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["getGlobalScope"]().crypto.getRandomValues(new Uint8Array(bytes));return _context2.abrupt("return",_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"](arrayBuffer));case 3:case"end":return _context2.stop();}}},_callee2);}));function generateRandomKey(_x5){return _generateRandomKey.apply(this,arguments);}return generateRandomKey;}()/** - * Encrypts a string using AES-CBC via WebCrypto. - * @access public - * @param {string} plaintext - * @param {string} iv - In hex format - * @param {string} key - In hex format - * @returns {Promise} Ciphertext in Base64 format. - */},{key:"aes256CbcEncrypt",value:function(){var _aes256CbcEncrypt=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(plaintext,iv,key){var keyData,ivData,alg,importedKeyData,textData,result,ciphertext;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"](key);case 2:keyData=_context3.sent;_context3.next=5;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"](iv);case 5:ivData=_context3.sent;alg={name:WebCryptoAlgs.AesCbc,iv:ivData};_context3.next=9;return this.webCryptoImportKey(keyData,alg.name,[WebCryptoActions.Encrypt]);case 9:importedKeyData=_context3.sent;_context3.next=12;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](plaintext);case 12:textData=_context3.sent;_context3.next=15;return crypto.subtle.encrypt(alg,importedKeyData,textData);case 15:result=_context3.sent;_context3.next=18;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToBase64"](result);case 18:ciphertext=_context3.sent;return _context3.abrupt("return",ciphertext);case 20:case"end":return _context3.stop();}}},_callee3,this);}));function aes256CbcEncrypt(_x6,_x7,_x8){return _aes256CbcEncrypt.apply(this,arguments);}return aes256CbcEncrypt;}()/** - * Decrypts a string using AES-CBC via WebCrypto. - * @access public - * @param {string} ciphertext - Base64 format - * @param {string} iv - In hex format - * @param {string} key - In hex format - * @returns {Promise} Plain utf8 string or null if decryption fails - */},{key:"aes256CbcDecrypt",value:function(){var _aes256CbcDecrypt=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(ciphertext,iv,key){var keyData,ivData,alg,importedKeyData,textData;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.next=2;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"](key);case 2:keyData=_context5.sent;_context5.next=5;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"](iv);case 5:ivData=_context5.sent;alg={name:WebCryptoAlgs.AesCbc,iv:ivData};_context5.next=9;return this.webCryptoImportKey(keyData,alg.name,[WebCryptoActions.Decrypt]);case 9:importedKeyData=_context5.sent;_context5.next=12;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["base64ToArrayBuffer"](ciphertext);case 12:textData=_context5.sent;return _context5.abrupt("return",crypto.subtle.decrypt(alg,importedKeyData,textData).then(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(result){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.abrupt("return",_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToString"](result));case 1:case"end":return _context4.stop();}}},_callee4);}));return function(_x12){return _ref.apply(this,arguments);};}()).catch(function(error){console.error('Error performing AES-CBC decryption:',error);return null;}));case 14:case"end":return _context5.stop();}}},_callee5,this);}));function aes256CbcDecrypt(_x9,_x10,_x11){return _aes256CbcDecrypt.apply(this,arguments);}return aes256CbcDecrypt;}()/** - * Runs HMAC with SHA-256 on a message with key. - * @access public - * @param {string} message - Plain utf8 string - * @param {string} key - In hex format - * @returns {Promise} Hex string or null if computation fails - */},{key:"hmac256",value:function(){var _hmac=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(message,key){var keyHexData,keyData,messageData;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"](key);case 2:keyHexData=_context6.sent;_context6.next=5;return this.webCryptoImportKey(keyHexData,WebCryptoAlgs.Hmac,[WebCryptoActions.Sign],{name:WebCryptoAlgs.Sha256});case 5:keyData=_context6.sent;_context6.next=8;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](message);case 8:messageData=_context6.sent;return _context6.abrupt("return",crypto.subtle.sign({name:WebCryptoAlgs.Hmac},keyData,messageData).then(function(signature){return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"](signature);}).catch(function(err){console.error('Error computing HMAC:',err);return null;}));case 10:case"end":return _context6.stop();}}},_callee6,this);}));function hmac256(_x13,_x14){return _hmac.apply(this,arguments);}return hmac256;}()/** - * @access public - * @param {string} text - Plain utf8 string - * @returns {Promise} Hex string - */},{key:"sha256",value:function(){var _sha=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(text){var textData,digest;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](text);case 2:textData=_context7.sent;_context7.next=5;return crypto.subtle.digest(WebCryptoAlgs.Sha256,textData);case 5:digest=_context7.sent;return _context7.abrupt("return",_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"](digest));case 7:case"end":return _context7.stop();}}},_callee7);}));function sha256(_x15){return _sha.apply(this,arguments);}return sha256;}()/** - * Use only for legacy applications. - * @access public - * @param {string} text - Plain utf8 string - * @returns {Promise} Hex string - */},{key:"unsafeSha1",value:function(){var _unsafeSha=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(text){var textData,digest;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.next=2;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](text);case 2:textData=_context8.sent;_context8.next=5;return crypto.subtle.digest(WebCryptoAlgs.Sha1,textData);case 5:digest=_context8.sent;return _context8.abrupt("return",_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"](digest));case 7:case"end":return _context8.stop();}}},_callee8);}));function unsafeSha1(_x16){return _unsafeSha.apply(this,arguments);}return unsafeSha1;}()/** - * Converts a raw string key to a WebCrypto CryptoKey object. - * @access private - * @param {string|Buffer} rawKey - * A plain utf8 string or an array buffer - * @param {string|WebCryptoAlgs} alg - * The name of the algorithm this key will be used for (i.e 'AES-CBC' or 'HMAC') - * @param {Array.} actions - * The actions this key will be used for (i.e 'deriveBits' or 'encrypt') - * @param {object} [hash] - * An optional object representing the hashing function this key is intended to be - * used for. This option is only supplied when the `alg` is HMAC. - * @param {string|WebCryptoAlgs} hash.name - * The name of the hashing function to use with HMAC. - * @returns {Promise} A WebCrypto CryptoKey object - */},{key:"webCryptoImportKey",value:function(){var _webCryptoImportKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(rawKey,alg,actions,hash){var keyData;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:if(!_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isString"](rawKey)){_context9.next=6;break;}_context9.next=3;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](rawKey);case 3:_context9.t0=_context9.sent;_context9.next=7;break;case 6:_context9.t0=rawKey;case 7:keyData=_context9.t0;return _context9.abrupt("return",subtleCrypto.importKey('raw',keyData,{name:alg,hash:hash},false,actions).then(function(key){return key;}).catch(function(err){console.error(err);return null;}));case 9:case"end":return _context9.stop();}}},_callee9);}));function webCryptoImportKey(_x17,_x18,_x19,_x20){return _webCryptoImportKey.apply(this,arguments);}return webCryptoImportKey;}()/** - * Performs WebCrypto PBKDF2 derivation. - * @access private - * @param {CryptoKey} key - A WebCrypto CryptoKey object - * @param {string} salt - In utf8 format - * @param {number} iterations - * @param {number} length - In bits - * @returns {Promise} Hex string - */},{key:"webCryptoDeriveBits",value:function(){var _webCryptoDeriveBits=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(key,salt,iterations,length){var params;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.t0=WebCryptoAlgs.Pbkdf2;_context10.next=3;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"](salt);case 3:_context10.t1=_context10.sent;_context10.t2=iterations;_context10.t3={name:WebCryptoAlgs.Sha512};params={name:_context10.t0,salt:_context10.t1,iterations:_context10.t2,hash:_context10.t3};return _context10.abrupt("return",subtleCrypto.deriveBits(params,key,length).then(function(bits){return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"](new Uint8Array(bits));}).catch(function(err){console.error(err);return null;}));case 8:case"end":return _context10.stop();}}},_callee10);}));function webCryptoDeriveBits(_x21,_x22,_x23,_x24){return _webCryptoDeriveBits.apply(this,arguments);}return webCryptoDeriveBits;}()/** - * Derives a key from a password and salt using - * argon2id (crypto_pwhash_ALG_DEFAULT). - * @param {string} password - Plain text string - * @param {string} salt - Salt in hex format - * @param {string} iterations - The algorithm's opslimit (recommended min 2) - * @param {string} bytes - The algorithm's memory limit (memlimit) (recommended min 67108864) - * @param {string} length - The output key length - * @returns {Promise} Derived key in hex format - */},{key:"argon2",value:function(){var _argon=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(password,salt,iterations,bytes,length){var result;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:_context11.next=2;return this.ready;case 2:_context11.t0=_Lib_libsodium__WEBPACK_IMPORTED_MODULE_3__;_context11.t1=length;_context11.next=6;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](password,'binary');case 6:_context11.t2=_context11.sent;_context11.next=9;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](salt,'hex');case 9:_context11.t3=_context11.sent;_context11.t4=iterations;_context11.t5=bytes;_context11.t6=_Lib_libsodium__WEBPACK_IMPORTED_MODULE_3__["crypto_pwhash_ALG_DEFAULT"];result=_context11.t0.crypto_pwhash.call(_context11.t0,_context11.t1,_context11.t2,_context11.t3,_context11.t4,_context11.t5,_context11.t6,'hex');return _context11.abrupt("return",result);case 15:case"end":return _context11.stop();}}},_callee11,this);}));function argon2(_x25,_x26,_x27,_x28,_x29){return _argon.apply(this,arguments);}return argon2;}()/** - * Encrypt a message (and associated data) with XChaCha20-Poly1305. - * @param {string|Buffer} plaintext - * @param {string|Buffer} nonce - In hex format - * @param {string|Buffer} key - In hex format - * @param {string|Buffer} assocData - * @returns {Promise} Base64 ciphertext string - */},{key:"xchacha20Encrypt",value:function(){var _xchacha20Encrypt=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(plaintext,nonce,key,assocData){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.next=2;return this.ready;case 2:if(!(nonce.length!==48)){_context12.next=4;break;}throw'Nonce must be 24 bytes';case 4:_context12.t0=_Lib_libsodium__WEBPACK_IMPORTED_MODULE_3__;_context12.next=7;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](plaintext);case 7:_context12.t1=_context12.sent;_context12.next=10;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](assocData);case 10:_context12.t2=_context12.sent;_context12.next=13;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](nonce,'hex');case 13:_context12.t3=_context12.sent;_context12.next=16;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](key,'hex');case 16:_context12.t4=_context12.sent;return _context12.abrupt("return",_context12.t0.crypto_aead_xchacha20poly1305_ietf_encrypt.call(_context12.t0,_context12.t1,_context12.t2,null,_context12.t3,_context12.t4,'base64'));case 18:case"end":return _context12.stop();}}},_callee12,this);}));function xchacha20Encrypt(_x30,_x31,_x32,_x33){return _xchacha20Encrypt.apply(this,arguments);}return xchacha20Encrypt;}()/** - * Decrypt a message (and associated data) with XChaCha20-Poly1305 - * @param {string|Buffer} ciphertext - * @param {string|Buffer} nonce - In hex format - * @param {string|Buffer} key - In hex format - * @param {string|Buffer} assocData - * @returns {Promise} Plain utf8 string or null if decryption fails - */},{key:"xchacha20Decrypt",value:function(){var _xchacha20Decrypt=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(ciphertext,nonce,key,assocData){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return this.ready;case 2:if(!(nonce.length!==48)){_context13.next=4;break;}throw'Nonce must be 24 bytes';case 4:_context13.prev=4;_context13.t0=_Lib_libsodium__WEBPACK_IMPORTED_MODULE_3__;_context13.next=8;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](ciphertext,'base64');case 8:_context13.t1=_context13.sent;_context13.next=11;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](assocData);case 11:_context13.t2=_context13.sent;_context13.next=14;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](nonce,'hex');case 14:_context13.t3=_context13.sent;_context13.next=17;return _Lib_utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"](key,'hex');case 17:_context13.t4=_context13.sent;return _context13.abrupt("return",_context13.t0.crypto_aead_xchacha20poly1305_ietf_decrypt.call(_context13.t0,null,_context13.t1,_context13.t2,_context13.t3,_context13.t4,'text'));case 21:_context13.prev=21;_context13.t5=_context13["catch"](4);return _context13.abrupt("return",null);case 24:case"end":return _context13.stop();}}},_callee13,this,[[4,21]]);}));function xchacha20Decrypt(_x34,_x35,_x36,_x37){return _xchacha20Decrypt.apply(this,arguments);}return xchacha20Decrypt;}()}]);return SNWebCrypto;}(_Crypto_pure_crypto__WEBPACK_IMPORTED_MODULE_1__["SNPureCrypto"]);/***/},/***/"./lib/libsodium.js":/*!**************************!*\ - !*** ./lib/libsodium.js ***! - \**************************/ /*! exports provided: ready, crypto_pwhash, crypto_pwhash_ALG_DEFAULT, crypto_aead_xchacha20poly1305_ietf_encrypt, crypto_aead_xchacha20poly1305_ietf_decrypt, to_base64, from_base64, base64_variants, from_hex, to_hex, from_string, to_string */ /***/function libLibsodiumJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! libsodium-wrappers */"./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js");/* harmony import */var libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__);/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ready",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["ready"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"crypto_pwhash",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["crypto_pwhash"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"crypto_pwhash_ALG_DEFAULT",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["crypto_pwhash_ALG_DEFAULT"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"crypto_aead_xchacha20poly1305_ietf_encrypt",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["crypto_aead_xchacha20poly1305_ietf_encrypt"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"crypto_aead_xchacha20poly1305_ietf_decrypt",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["crypto_aead_xchacha20poly1305_ietf_decrypt"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"to_base64",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["to_base64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"from_base64",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["from_base64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64_variants",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["base64_variants"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"from_hex",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["from_hex"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"to_hex",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["to_hex"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"from_string",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["from_string"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"to_string",function(){return libsodium_wrappers__WEBPACK_IMPORTED_MODULE_0__["to_string"];});/* eslint-disable camelcase */ /***/},/***/"./lib/main.js":/*!*********************!*\ - !*** ./lib/main.js ***! - \*********************/ /*! exports provided: SNPureCrypto, SNWebCrypto, isWebCryptoAvailable, Buffer, stringToArrayBuffer, arrayBufferToString, arrayBufferToHexString, hexStringToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64, hexToBase64, base64ToHex, base64Encode, base64Decode, toBuffer */ /***/function libMainJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _crypto_pure_crypto__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ./crypto/pure_crypto */"./lib/crypto/pure_crypto.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPureCrypto",function(){return _crypto_pure_crypto__WEBPACK_IMPORTED_MODULE_0__["SNPureCrypto"];});/* harmony import */var _crypto_webcrypto__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! ./crypto/webcrypto */"./lib/crypto/webcrypto.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNWebCrypto",function(){return _crypto_webcrypto__WEBPACK_IMPORTED_MODULE_1__["SNWebCrypto"];});/* harmony import */var _utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! ./utils */"./lib/utils/index.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isWebCryptoAvailable",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["isWebCryptoAvailable"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Buffer",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["Buffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"stringToArrayBuffer",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["stringToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToString",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToHexString",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToHexString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"hexStringToArrayBuffer",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["hexStringToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64ToArrayBuffer",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["base64ToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToBase64",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["arrayBufferToBase64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"hexToBase64",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["hexToBase64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64ToHex",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["base64ToHex"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64Encode",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["base64Encode"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64Decode",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["base64Decode"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"toBuffer",function(){return _utils__WEBPACK_IMPORTED_MODULE_2__["toBuffer"];});/***/},/***/"./lib/utils/common_utils.js":/*!***********************************!*\ - !*** ./lib/utils/common_utils.js ***! - \***********************************/ /*! exports provided: Buffer, isString, stringToArrayBuffer, arrayBufferToString, arrayBufferToHexString, hexStringToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64, hexToBase64, base64ToHex, base64Encode, base64Decode, toBuffer */ /***/function libUtilsCommon_utilsJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Buffer",function(){return Buffer;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isString",function(){return isString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"stringToArrayBuffer",function(){return stringToArrayBuffer;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"arrayBufferToString",function(){return arrayBufferToString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"arrayBufferToHexString",function(){return arrayBufferToHexString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"hexStringToArrayBuffer",function(){return hexStringToArrayBuffer;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"base64ToArrayBuffer",function(){return base64ToArrayBuffer;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"arrayBufferToBase64",function(){return arrayBufferToBase64;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"hexToBase64",function(){return hexToBase64;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"base64ToHex",function(){return base64ToHex;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"base64Encode",function(){return base64Encode;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"base64Decode",function(){return base64Decode;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"toBuffer",function(){return toBuffer;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _libsodium__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! ../libsodium */"./lib/libsodium.js");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}/* eslint-disable camelcase */ /** - * Libsodium's to_* functions take either a Buffer or String, but do not take raw buffers, - * as may be returned by WebCrypto API. - */var arrayToBuffer=__webpack_require__(/*! typedarray-to-buffer */"./node_modules/typedarray-to-buffer/index.js");var Buffer=__webpack_require__(/*! buffer/ */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer;var Format={Utf8:'utf8',Base64:'base64',Hex:'hex',Binary:'binary'};/** - * Determines if the input value is a string - * @access public - * @returns {boolean} - */function isString(value){return typeof value==='string'||value instanceof String;}/** - * Converts a plain string into an ArrayBuffer - * @access public - * @param {string} string - A plain string - * @returns {ArrayBuffer} - */function stringToArrayBuffer(_x){return _stringToArrayBuffer.apply(this,arguments);}/** - * Converts an ArrayBuffer into a plain string - * @access public - * @param {ArrayBuffer} arrayBuffer - * @returns {string} Plain string - */function _stringToArrayBuffer(){_stringToArrayBuffer=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(string){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(isString(string)){_context.next=2;break;}throw Error('Attempting to convert non-string to arrayBuffer');case 2:_context.next=4;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 4:return _context.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_string"])(string));case 5:case"end":return _context.stop();}}},_callee);}));return _stringToArrayBuffer.apply(this,arguments);}function arrayBufferToString(_x2){return _arrayBufferToString.apply(this,arguments);}/** - * Converts an ArrayBuffer into a hex string - * @access public - * @param {ArrayBuffer} arrayBuffer - * @returns {string} Hex string - */function _arrayBufferToString(){_arrayBufferToString=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(arrayBuffer){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context2.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_string"])(arrayBuffer));case 3:case"end":return _context2.stop();}}},_callee2);}));return _arrayBufferToString.apply(this,arguments);}function arrayBufferToHexString(_x3){return _arrayBufferToHexString.apply(this,arguments);}/** - * Converts a hex string into an ArrayBuffer - * @access public - * @param {string} hex - A hex string - * @returns {ArrayBuffer} - */function _arrayBufferToHexString(){_arrayBufferToHexString=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(arrayBuffer){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context3.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_hex"])(Buffer.from(arrayBuffer)));case 3:case"end":return _context3.stop();}}},_callee3);}));return _arrayBufferToHexString.apply(this,arguments);}function hexStringToArrayBuffer(_x4){return _hexStringToArrayBuffer.apply(this,arguments);}/** - * Converts a base64 string into an ArrayBuffer - * @access public - * @param {string} base64 - A base64 string - * @returns {ArrayBuffer} - */function _hexStringToArrayBuffer(){_hexStringToArrayBuffer=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(hex){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context4.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_hex"])(hex));case 3:case"end":return _context4.stop();}}},_callee4);}));return _hexStringToArrayBuffer.apply(this,arguments);}function base64ToArrayBuffer(_x5){return _base64ToArrayBuffer.apply(this,arguments);}/** - * Converts an ArrayBuffer into a base64 string - * @access public - * @param {ArrayBuffer} buffer - * @returns {string} base64 string - */function _base64ToArrayBuffer(){_base64ToArrayBuffer=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(base64){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context5.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_base64"])(base64,_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL));case 3:case"end":return _context5.stop();}}},_callee5);}));return _base64ToArrayBuffer.apply(this,arguments);}function arrayBufferToBase64(_x6){return _arrayBufferToBase.apply(this,arguments);}/** - * Converts a hex string into a base64 string - * @access public - * @param {string} hex - A hex string - * @returns {string} A base64 string - */function _arrayBufferToBase(){_arrayBufferToBase=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(arrayBuffer){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context6.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_base64"])(Buffer.from(arrayBuffer),_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL));case 3:case"end":return _context6.stop();}}},_callee6);}));return _arrayBufferToBase.apply(this,arguments);}function hexToBase64(_x7){return _hexToBase.apply(this,arguments);}/** - * Converts a base64 string into a hex string - * @access public - * @param {string} base64 - A base64 string - * @returns {string} A hex string - */function _hexToBase(){_hexToBase=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(hex){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context7.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_base64"])(Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_hex"])(hex),_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL));case 3:case"end":return _context7.stop();}}},_callee7);}));return _hexToBase.apply(this,arguments);}function base64ToHex(_x8){return _base64ToHex.apply(this,arguments);}/** - * Converts a plain string into base64 - * @access public - * @param {string} text - A plain string - * @returns {string} A base64 encoded string - */function _base64ToHex(){_base64ToHex=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(base64){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context8.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_hex"])(Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_base64"])(base64,_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL)));case 3:case"end":return _context8.stop();}}},_callee8);}));return _base64ToHex.apply(this,arguments);}function base64Encode(_x9){return _base64Encode.apply(this,arguments);}/** - * Converts a base64 string into a plain string - * @access public - * @param {string} base64String - A base64 encoded string - * @returns {string} A plain string - */function _base64Encode(){_base64Encode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(text){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context9.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_base64"])(text,_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL));case 3:case"end":return _context9.stop();}}},_callee9);}));return _base64Encode.apply(this,arguments);}function base64Decode(_x10){return _base64Decode.apply(this,arguments);}/** - * Coerce input to a Buffer, throwing a TypeError if it cannot be coerced. - * @param {string|Buffer|Uint8Array|Promise} stringOrBuffer - * @returns {Buffer} - */function _base64Decode(){_base64Decode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(base64String){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.next=2;return _libsodium__WEBPACK_IMPORTED_MODULE_1__["ready"];case 2:return _context10.abrupt("return",Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["to_string"])(Object(_libsodium__WEBPACK_IMPORTED_MODULE_1__["from_base64"])(base64String,_libsodium__WEBPACK_IMPORTED_MODULE_1__["base64_variants"].ORIGINAL)));case 3:case"end":return _context10.stop();}}},_callee10);}));return _base64Decode.apply(this,arguments);}function toBuffer(_x11){return _toBuffer.apply(this,arguments);}function _toBuffer(){_toBuffer=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(stringOrBuffer){var format,_args11=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:format=_args11.length>1&&_args11[1]!==undefined?_args11[1]:Format.Binary;if(!Buffer.isBuffer(stringOrBuffer)){_context11.next=5;break;}return _context11.abrupt("return",stringOrBuffer);case 5:if(!(stringOrBuffer===null)){_context11.next=9;break;}return _context11.abrupt("return",null);case 9:if(!(typeof stringOrBuffer==='string')){_context11.next=13;break;}return _context11.abrupt("return",Buffer.from(stringOrBuffer,format));case 13:if(!(stringOrBuffer instanceof Uint8Array)){_context11.next=17;break;}return _context11.abrupt("return",arrayToBuffer(stringOrBuffer));case 17:if(!(stringOrBuffer instanceof Promise)){_context11.next=21;break;}return _context11.abrupt("return",stringOrBuffer);case 21:throw new TypeError('Invalid type; string or buffer expected');case 22:case"end":return _context11.stop();}}},_callee11);}));return _toBuffer.apply(this,arguments);}/***/},/***/"./lib/utils/index.js":/*!****************************!*\ - !*** ./lib/utils/index.js ***! - \****************************/ /*! exports provided: getGlobalScope, ieOrEdge, isWebCryptoAvailable, getSubtleCrypto, generateUUIDSync, isString, Buffer, toBuffer, stringToArrayBuffer, arrayBufferToString, arrayBufferToHexString, hexStringToArrayBuffer, base64ToArrayBuffer, arrayBufferToBase64, hexToBase64, base64ToHex, base64Encode, base64Decode */ /***/function libUtilsIndexJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _web_utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ./web_utils */"./lib/utils/web_utils.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"getGlobalScope",function(){return _web_utils__WEBPACK_IMPORTED_MODULE_0__["getGlobalScope"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ieOrEdge",function(){return _web_utils__WEBPACK_IMPORTED_MODULE_0__["ieOrEdge"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isWebCryptoAvailable",function(){return _web_utils__WEBPACK_IMPORTED_MODULE_0__["isWebCryptoAvailable"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"getSubtleCrypto",function(){return _web_utils__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"generateUUIDSync",function(){return _web_utils__WEBPACK_IMPORTED_MODULE_0__["generateUUIDSync"];});/* harmony import */var _common_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! ./common_utils */"./lib/utils/common_utils.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isString",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["isString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Buffer",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["Buffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"toBuffer",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["toBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"stringToArrayBuffer",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["stringToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToString",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["arrayBufferToString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToHexString",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["arrayBufferToHexString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"hexStringToArrayBuffer",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["hexStringToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64ToArrayBuffer",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["base64ToArrayBuffer"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayBufferToBase64",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["arrayBufferToBase64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"hexToBase64",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["hexToBase64"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64ToHex",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["base64ToHex"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64Encode",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["base64Encode"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"base64Decode",function(){return _common_utils__WEBPACK_IMPORTED_MODULE_1__["base64Decode"];});/***/},/***/"./lib/utils/web_utils.js":/*!********************************!*\ - !*** ./lib/utils/web_utils.js ***! - \********************************/ /*! exports provided: getGlobalScope, ieOrEdge, isWebCryptoAvailable, getSubtleCrypto, generateUUIDSync */ /***/function libUtilsWeb_utilsJs(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* WEBPACK VAR INJECTION */(function(global){/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"getGlobalScope",function(){return getGlobalScope;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ieOrEdge",function(){return ieOrEdge;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isWebCryptoAvailable",function(){return isWebCryptoAvailable;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"getSubtleCrypto",function(){return getSubtleCrypto;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"generateUUIDSync",function(){return generateUUIDSync;});/** - * Returns `window` if available, or `global` if supported in environment. - * @returns {object|null} - */function getGlobalScope(){return typeof window!=='undefined'?window:typeof global!=='undefined'?global:null;}/** - * Determines whether we are in an Internet Explorer or Edge environment - * @access public - * @returns {boolean} - */function ieOrEdge(){return typeof document!=='undefined'&&document.documentMode||/Edge/.test(navigator.userAgent);}/** - * Returns true if WebCrypto is available - * @access public - * @returns {boolean} - */function isWebCryptoAvailable(){return!ieOrEdge()&&getGlobalScope().crypto&&!!getGlobalScope().crypto.subtle;}/** - * Returns the WebCrypto instance - * @access public - * @returns {object} - */function getSubtleCrypto(){return getGlobalScope().crypto?getGlobalScope().crypto.subtle:null;}/** - * Generates a UUID syncronously - * @access public - * @returns {string} - */function generateUUIDSync(){var globalScope=getGlobalScope();var crypto=globalScope.crypto||globalScope.msCrypto;if(crypto){var buf=new Uint32Array(4);crypto.getRandomValues(buf);var idx=-1;return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){idx++;var r=buf[idx>>3]>>idx%8*4&15;var v=c==='x'?r:r&0x3|0x8;return v.toString(16);});}else{var d=new Date().getTime();if(globalScope.performance&&typeof globalScope.performance.now==="function"){d+=performance.now();// use high-precision timer if available -}var uuid='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=(d+Math.random()*16)%16|0;d=Math.floor(d/16);return(c==='x'?r:r&0x3|0x8).toString(16);});return uuid;}}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/@babel/runtime/regenerator/index.js":/*!**********************************************************!*\ - !*** ./node_modules/@babel/runtime/regenerator/index.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesBabelRuntimeRegeneratorIndexJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! regenerator-runtime */"./node_modules/regenerator-runtime/runtime.js");/***/},/***/"./node_modules/asn1.js/lib/asn1.js":/*!******************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1.js ***! - \******************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1Js(module,exports,__webpack_require__){var asn1=exports;asn1.bignum=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");asn1.define=__webpack_require__(/*! ./asn1/api */"./node_modules/asn1.js/lib/asn1/api.js").define;asn1.base=__webpack_require__(/*! ./asn1/base */"./node_modules/asn1.js/lib/asn1/base/index.js");asn1.constants=__webpack_require__(/*! ./asn1/constants */"./node_modules/asn1.js/lib/asn1/constants/index.js");asn1.decoders=__webpack_require__(/*! ./asn1/decoders */"./node_modules/asn1.js/lib/asn1/decoders/index.js");asn1.encoders=__webpack_require__(/*! ./asn1/encoders */"./node_modules/asn1.js/lib/asn1/encoders/index.js");/***/},/***/"./node_modules/asn1.js/lib/asn1/api.js":/*!**********************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/api.js ***! - \**********************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1ApiJs(module,exports,__webpack_require__){var asn1=__webpack_require__(/*! ../asn1 */"./node_modules/asn1.js/lib/asn1.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var api=exports;api.define=function define(name,body){return new Entity(name,body);};function Entity(name,body){this.name=name;this.body=body;this.decoders={};this.encoders={};};Entity.prototype._createNamed=function createNamed(base){var named;try{named=__webpack_require__(/*! vm */"./node_modules/vm-browserify/index.js").runInThisContext('(function '+this.name+'(entity) {\n'+' this._initNamed(entity);\n'+'})');}catch(e){named=function named(entity){this._initNamed(entity);};}inherits(named,base);named.prototype._initNamed=function initnamed(entity){base.call(this,entity);};return new named(this);};Entity.prototype._getDecoder=function _getDecoder(enc){enc=enc||'der';// Lazily create decoder -if(!this.decoders.hasOwnProperty(enc))this.decoders[enc]=this._createNamed(asn1.decoders[enc]);return this.decoders[enc];};Entity.prototype.decode=function decode(data,enc,options){return this._getDecoder(enc).decode(data,options);};Entity.prototype._getEncoder=function _getEncoder(enc){enc=enc||'der';// Lazily create encoder -if(!this.encoders.hasOwnProperty(enc))this.encoders[enc]=this._createNamed(asn1.encoders[enc]);return this.encoders[enc];};Entity.prototype.encode=function encode(data,enc,/* internal */reporter){return this._getEncoder(enc).encode(data,reporter);};/***/},/***/"./node_modules/asn1.js/lib/asn1/base/buffer.js":/*!******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***! - \******************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1BaseBufferJs(module,exports,__webpack_require__){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Reporter=__webpack_require__(/*! ../base */"./node_modules/asn1.js/lib/asn1/base/index.js").Reporter;var Buffer=__webpack_require__(/*! buffer */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer;function DecoderBuffer(base,options){Reporter.call(this,options);if(!Buffer.isBuffer(base)){this.error('Input not Buffer');return;}this.base=base;this.offset=0;this.length=base.length;}inherits(DecoderBuffer,Reporter);exports.DecoderBuffer=DecoderBuffer;DecoderBuffer.prototype.save=function save(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)};};DecoderBuffer.prototype.restore=function restore(save){// Return skipped data -var res=new DecoderBuffer(this.base);res.offset=save.offset;res.length=this.offset;this.offset=save.offset;Reporter.prototype.restore.call(this,save.reporter);return res;};DecoderBuffer.prototype.isEmpty=function isEmpty(){return this.offset===this.length;};DecoderBuffer.prototype.readUInt8=function readUInt8(fail){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,true);else return this.error(fail||'DecoderBuffer overrun');};DecoderBuffer.prototype.skip=function skip(bytes,fail){if(!(this.offset+bytes<=this.length))return this.error(fail||'DecoderBuffer overrun');var res=new DecoderBuffer(this.base);// Share reporter state -res._reporterState=this._reporterState;res.offset=this.offset;res.length=this.offset+bytes;this.offset+=bytes;return res;};DecoderBuffer.prototype.raw=function raw(save){return this.base.slice(save?save.offset:this.offset,this.length);};function EncoderBuffer(value,reporter){if(Array.isArray(value)){this.length=0;this.value=value.map(function(item){if(!(item instanceof EncoderBuffer))item=new EncoderBuffer(item,reporter);this.length+=item.length;return item;},this);}else if(typeof value==='number'){if(!(0<=value&&value<=0xff))return reporter.error('non-byte EncoderBuffer value');this.value=value;this.length=1;}else if(typeof value==='string'){this.value=value;this.length=Buffer.byteLength(value);}else if(Buffer.isBuffer(value)){this.value=value;this.length=value.length;}else{return reporter.error('Unsupported type: '+_typeof(value));}}exports.EncoderBuffer=EncoderBuffer;EncoderBuffer.prototype.join=function join(out,offset){if(!out)out=new Buffer(this.length);if(!offset)offset=0;if(this.length===0)return out;if(Array.isArray(this.value)){this.value.forEach(function(item){item.join(out,offset);offset+=item.length;});}else{if(typeof this.value==='number')out[offset]=this.value;else if(typeof this.value==='string')out.write(this.value,offset);else if(Buffer.isBuffer(this.value))this.value.copy(out,offset);offset+=this.length;}return out;};/***/},/***/"./node_modules/asn1.js/lib/asn1/base/index.js":/*!*****************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***! - \*****************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1BaseIndexJs(module,exports,__webpack_require__){var base=exports;base.Reporter=__webpack_require__(/*! ./reporter */"./node_modules/asn1.js/lib/asn1/base/reporter.js").Reporter;base.DecoderBuffer=__webpack_require__(/*! ./buffer */"./node_modules/asn1.js/lib/asn1/base/buffer.js").DecoderBuffer;base.EncoderBuffer=__webpack_require__(/*! ./buffer */"./node_modules/asn1.js/lib/asn1/base/buffer.js").EncoderBuffer;base.Node=__webpack_require__(/*! ./node */"./node_modules/asn1.js/lib/asn1/base/node.js");/***/},/***/"./node_modules/asn1.js/lib/asn1/base/node.js":/*!****************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***! - \****************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1BaseNodeJs(module,exports,__webpack_require__){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var Reporter=__webpack_require__(/*! ../base */"./node_modules/asn1.js/lib/asn1/base/index.js").Reporter;var EncoderBuffer=__webpack_require__(/*! ../base */"./node_modules/asn1.js/lib/asn1/base/index.js").EncoderBuffer;var DecoderBuffer=__webpack_require__(/*! ../base */"./node_modules/asn1.js/lib/asn1/base/index.js").DecoderBuffer;var assert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");// Supported tags -var tags=['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'];// Public methods list -var methods=['key','obj','use','optional','explicit','implicit','def','choice','any','contains'].concat(tags);// Overrided methods list -var overrided=['_peekTag','_decodeTag','_use','_decodeStr','_decodeObjid','_decodeTime','_decodeNull','_decodeInt','_decodeBool','_decodeList','_encodeComposite','_encodeStr','_encodeObjid','_encodeTime','_encodeNull','_encodeInt','_encodeBool'];function Node(enc,parent){var state={};this._baseState=state;state.enc=enc;state.parent=parent||null;state.children=null;// State -state.tag=null;state.args=null;state.reverseArgs=null;state.choice=null;state.optional=false;state.any=false;state.obj=false;state.use=null;state.useDecoder=null;state.key=null;state['default']=null;state.explicit=null;state.implicit=null;state.contains=null;// Should create new instance on each method -if(!state.parent){state.children=[];this._wrap();}}module.exports=Node;var stateProps=['enc','parent','children','tag','args','reverseArgs','choice','optional','any','obj','use','alteredUse','key','default','explicit','implicit','contains'];Node.prototype.clone=function clone(){var state=this._baseState;var cstate={};stateProps.forEach(function(prop){cstate[prop]=state[prop];});var res=new this.constructor(cstate.parent);res._baseState=cstate;return res;};Node.prototype._wrap=function wrap(){var state=this._baseState;methods.forEach(function(method){this[method]=function _wrappedMethod(){var clone=new this.constructor(this);state.children.push(clone);return clone[method].apply(clone,arguments);};},this);};Node.prototype._init=function init(body){var state=this._baseState;assert(state.parent===null);body.call(this);// Filter children -state.children=state.children.filter(function(child){return child._baseState.parent===this;},this);assert.equal(state.children.length,1,'Root node can have only one child');};Node.prototype._useArgs=function useArgs(args){var state=this._baseState;// Filter children and args -var children=args.filter(function(arg){return arg instanceof this.constructor;},this);args=args.filter(function(arg){return!(arg instanceof this.constructor);},this);if(children.length!==0){assert(state.children===null);state.children=children;// Replace parent to maintain backward link -children.forEach(function(child){child._baseState.parent=this;},this);}if(args.length!==0){assert(state.args===null);state.args=args;state.reverseArgs=args.map(function(arg){if(_typeof(arg)!=='object'||arg.constructor!==Object)return arg;var res={};Object.keys(arg).forEach(function(key){if(key==(key|0))key|=0;var value=arg[key];res[value]=key;});return res;});}};// -// Overrided methods -// -overrided.forEach(function(method){Node.prototype[method]=function _overrided(){var state=this._baseState;throw new Error(method+' not implemented for encoding: '+state.enc);};});// -// Public methods -// -tags.forEach(function(tag){Node.prototype[tag]=function _tagMethod(){var state=this._baseState;var args=Array.prototype.slice.call(arguments);assert(state.tag===null);state.tag=tag;this._useArgs(args);return this;};});Node.prototype.use=function use(item){assert(item);var state=this._baseState;assert(state.use===null);state.use=item;return this;};Node.prototype.optional=function optional(){var state=this._baseState;state.optional=true;return this;};Node.prototype.def=function def(val){var state=this._baseState;assert(state['default']===null);state['default']=val;state.optional=true;return this;};Node.prototype.explicit=function explicit(num){var state=this._baseState;assert(state.explicit===null&&state.implicit===null);state.explicit=num;return this;};Node.prototype.implicit=function implicit(num){var state=this._baseState;assert(state.explicit===null&&state.implicit===null);state.implicit=num;return this;};Node.prototype.obj=function obj(){var state=this._baseState;var args=Array.prototype.slice.call(arguments);state.obj=true;if(args.length!==0)this._useArgs(args);return this;};Node.prototype.key=function key(newKey){var state=this._baseState;assert(state.key===null);state.key=newKey;return this;};Node.prototype.any=function any(){var state=this._baseState;state.any=true;return this;};Node.prototype.choice=function choice(obj){var state=this._baseState;assert(state.choice===null);state.choice=obj;this._useArgs(Object.keys(obj).map(function(key){return obj[key];}));return this;};Node.prototype.contains=function contains(item){var state=this._baseState;assert(state.use===null);state.contains=item;return this;};// -// Decoding -// -Node.prototype._decode=function decode(input,options){var state=this._baseState;// Decode root node -if(state.parent===null)return input.wrapResult(state.children[0]._decode(input,options));var result=state['default'];var present=true;var prevKey=null;if(state.key!==null)prevKey=input.enterKey(state.key);// Check if tag is there -if(state.optional){var tag=null;if(state.explicit!==null)tag=state.explicit;else if(state.implicit!==null)tag=state.implicit;else if(state.tag!==null)tag=state.tag;if(tag===null&&!state.any){// Trial and Error -var save=input.save();try{if(state.choice===null)this._decodeGeneric(state.tag,input,options);else this._decodeChoice(input,options);present=true;}catch(e){present=false;}input.restore(save);}else{present=this._peekTag(input,tag,state.any);if(input.isError(present))return present;}}// Push object on stack -var prevObj;if(state.obj&&present)prevObj=input.enterObject();if(present){// Unwrap explicit values -if(state.explicit!==null){var explicit=this._decodeTag(input,state.explicit);if(input.isError(explicit))return explicit;input=explicit;}var start=input.offset;// Unwrap implicit and normal values -if(state.use===null&&state.choice===null){if(state.any)var save=input.save();var body=this._decodeTag(input,state.implicit!==null?state.implicit:state.tag,state.any);if(input.isError(body))return body;if(state.any)result=input.raw(save);else input=body;}if(options&&options.track&&state.tag!==null)options.track(input.path(),start,input.length,'tagged');if(options&&options.track&&state.tag!==null)options.track(input.path(),input.offset,input.length,'content');// Select proper method for tag -if(state.any)result=result;else if(state.choice===null)result=this._decodeGeneric(state.tag,input,options);else result=this._decodeChoice(input,options);if(input.isError(result))return result;// Decode children -if(!state.any&&state.choice===null&&state.children!==null){state.children.forEach(function decodeChildren(child){// NOTE: We are ignoring errors here, to let parser continue with other -// parts of encoded data -child._decode(input,options);});}// Decode contained/encoded by schema, only in bit or octet strings -if(state.contains&&(state.tag==='octstr'||state.tag==='bitstr')){var data=new DecoderBuffer(result);result=this._getUse(state.contains,input._reporterState.obj)._decode(data,options);}}// Pop object -if(state.obj&&present)result=input.leaveObject(prevObj);// Set key -if(state.key!==null&&(result!==null||present===true))input.leaveKey(prevKey,state.key,result);else if(prevKey!==null)input.exitKey(prevKey);return result;};Node.prototype._decodeGeneric=function decodeGeneric(tag,input,options){var state=this._baseState;if(tag==='seq'||tag==='set')return null;if(tag==='seqof'||tag==='setof')return this._decodeList(input,tag,state.args[0],options);else if(/str$/.test(tag))return this._decodeStr(input,tag,options);else if(tag==='objid'&&state.args)return this._decodeObjid(input,state.args[0],state.args[1],options);else if(tag==='objid')return this._decodeObjid(input,null,null,options);else if(tag==='gentime'||tag==='utctime')return this._decodeTime(input,tag,options);else if(tag==='null_')return this._decodeNull(input,options);else if(tag==='bool')return this._decodeBool(input,options);else if(tag==='objDesc')return this._decodeStr(input,tag,options);else if(tag==='int'||tag==='enum')return this._decodeInt(input,state.args&&state.args[0],options);if(state.use!==null){return this._getUse(state.use,input._reporterState.obj)._decode(input,options);}else{return input.error('unknown tag: '+tag);}};Node.prototype._getUse=function _getUse(entity,obj){var state=this._baseState;// Create altered use decoder if implicit is set -state.useDecoder=this._use(entity,obj);assert(state.useDecoder._baseState.parent===null);state.useDecoder=state.useDecoder._baseState.children[0];if(state.implicit!==state.useDecoder._baseState.implicit){state.useDecoder=state.useDecoder.clone();state.useDecoder._baseState.implicit=state.implicit;}return state.useDecoder;};Node.prototype._decodeChoice=function decodeChoice(input,options){var state=this._baseState;var result=null;var match=false;Object.keys(state.choice).some(function(key){var save=input.save();var node=state.choice[key];try{var value=node._decode(input,options);if(input.isError(value))return false;result={type:key,value:value};match=true;}catch(e){input.restore(save);return false;}return true;},this);if(!match)return input.error('Choice not matched');return result;};// -// Encoding -// -Node.prototype._createEncoderBuffer=function createEncoderBuffer(data){return new EncoderBuffer(data,this.reporter);};Node.prototype._encode=function encode(data,reporter,parent){var state=this._baseState;if(state['default']!==null&&state['default']===data)return;var result=this._encodeValue(data,reporter,parent);if(result===undefined)return;if(this._skipDefault(result,reporter,parent))return;return result;};Node.prototype._encodeValue=function encode(data,reporter,parent){var state=this._baseState;// Decode root node -if(state.parent===null)return state.children[0]._encode(data,reporter||new Reporter());var result=null;// Set reporter to share it with a child class -this.reporter=reporter;// Check if data is there -if(state.optional&&data===undefined){if(state['default']!==null)data=state['default'];else return;}// Encode children first -var content=null;var primitive=false;if(state.any){// Anything that was given is translated to buffer -result=this._createEncoderBuffer(data);}else if(state.choice){result=this._encodeChoice(data,reporter);}else if(state.contains){content=this._getUse(state.contains,parent)._encode(data,reporter);primitive=true;}else if(state.children){content=state.children.map(function(child){if(child._baseState.tag==='null_')return child._encode(null,reporter,data);if(child._baseState.key===null)return reporter.error('Child should have a key');var prevKey=reporter.enterKey(child._baseState.key);if(_typeof(data)!=='object')return reporter.error('Child expected, but input is not object');var res=child._encode(data[child._baseState.key],reporter,data);reporter.leaveKey(prevKey);return res;},this).filter(function(child){return child;});content=this._createEncoderBuffer(content);}else{if(state.tag==='seqof'||state.tag==='setof'){// TODO(indutny): this should be thrown on DSL level -if(!(state.args&&state.args.length===1))return reporter.error('Too many args for : '+state.tag);if(!Array.isArray(data))return reporter.error('seqof/setof, but data is not Array');var child=this.clone();child._baseState.implicit=null;content=this._createEncoderBuffer(data.map(function(item){var state=this._baseState;return this._getUse(state.args[0],data)._encode(item,reporter);},child));}else if(state.use!==null){result=this._getUse(state.use,parent)._encode(data,reporter);}else{content=this._encodePrimitive(state.tag,data);primitive=true;}}// Encode data itself -var result;if(!state.any&&state.choice===null){var tag=state.implicit!==null?state.implicit:state.tag;var cls=state.implicit===null?'universal':'context';if(tag===null){if(state.use===null)reporter.error('Tag could be omitted only for .use()');}else{if(state.use===null)result=this._encodeComposite(tag,primitive,cls,content);}}// Wrap in explicit -if(state.explicit!==null)result=this._encodeComposite(state.explicit,false,'context',result);return result;};Node.prototype._encodeChoice=function encodeChoice(data,reporter){var state=this._baseState;var node=state.choice[data.type];if(!node){assert(false,data.type+' not found in '+JSON.stringify(Object.keys(state.choice)));}return node._encode(data.value,reporter);};Node.prototype._encodePrimitive=function encodePrimitive(tag,data){var state=this._baseState;if(/str$/.test(tag))return this._encodeStr(data,tag);else if(tag==='objid'&&state.args)return this._encodeObjid(data,state.reverseArgs[0],state.args[1]);else if(tag==='objid')return this._encodeObjid(data,null,null);else if(tag==='gentime'||tag==='utctime')return this._encodeTime(data,tag);else if(tag==='null_')return this._encodeNull();else if(tag==='int'||tag==='enum')return this._encodeInt(data,state.args&&state.reverseArgs[0]);else if(tag==='bool')return this._encodeBool(data);else if(tag==='objDesc')return this._encodeStr(data,tag);else throw new Error('Unsupported tag: '+tag);};Node.prototype._isNumstr=function isNumstr(str){return /^[0-9 ]*$/.test(str);};Node.prototype._isPrintstr=function isPrintstr(str){return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);};/***/},/***/"./node_modules/asn1.js/lib/asn1/base/reporter.js":/*!********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***! - \********************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1BaseReporterJs(module,exports,__webpack_require__){var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");function Reporter(options){this._reporterState={obj:null,path:[],options:options||{},errors:[]};}exports.Reporter=Reporter;Reporter.prototype.isError=function isError(obj){return obj instanceof ReporterError;};Reporter.prototype.save=function save(){var state=this._reporterState;return{obj:state.obj,pathLen:state.path.length};};Reporter.prototype.restore=function restore(data){var state=this._reporterState;state.obj=data.obj;state.path=state.path.slice(0,data.pathLen);};Reporter.prototype.enterKey=function enterKey(key){return this._reporterState.path.push(key);};Reporter.prototype.exitKey=function exitKey(index){var state=this._reporterState;state.path=state.path.slice(0,index-1);};Reporter.prototype.leaveKey=function leaveKey(index,key,value){var state=this._reporterState;this.exitKey(index);if(state.obj!==null)state.obj[key]=value;};Reporter.prototype.path=function path(){return this._reporterState.path.join('/');};Reporter.prototype.enterObject=function enterObject(){var state=this._reporterState;var prev=state.obj;state.obj={};return prev;};Reporter.prototype.leaveObject=function leaveObject(prev){var state=this._reporterState;var now=state.obj;state.obj=prev;return now;};Reporter.prototype.error=function error(msg){var err;var state=this._reporterState;var inherited=msg instanceof ReporterError;if(inherited){err=msg;}else{err=new ReporterError(state.path.map(function(elem){return'['+JSON.stringify(elem)+']';}).join(''),msg.message||msg,msg.stack);}if(!state.options.partial)throw err;if(!inherited)state.errors.push(err);return err;};Reporter.prototype.wrapResult=function wrapResult(result){var state=this._reporterState;if(!state.options.partial)return result;return{result:this.isError(result)?null:result,errors:state.errors};};function ReporterError(path,msg){this.path=path;this.rethrow(msg);};inherits(ReporterError,Error);ReporterError.prototype.rethrow=function rethrow(msg){this.message=msg+' at: '+(this.path||'(shallow)');if(Error.captureStackTrace)Error.captureStackTrace(this,ReporterError);if(!this.stack){try{// IE only adds stack when thrown -throw new Error(this.message);}catch(e){this.stack=e.stack;}}return this;};/***/},/***/"./node_modules/asn1.js/lib/asn1/constants/der.js":/*!********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***! - \********************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1ConstantsDerJs(module,exports,__webpack_require__){var constants=__webpack_require__(/*! ../constants */"./node_modules/asn1.js/lib/asn1/constants/index.js");exports.tagClass={0:'universal',1:'application',2:'context',3:'private'};exports.tagClassByName=constants._reverse(exports.tagClass);exports.tag={0x00:'end',0x01:'bool',0x02:'int',0x03:'bitstr',0x04:'octstr',0x05:'null_',0x06:'objid',0x07:'objDesc',0x08:'external',0x09:'real',0x0a:'enum',0x0b:'embed',0x0c:'utf8str',0x0d:'relativeOid',0x10:'seq',0x11:'set',0x12:'numstr',0x13:'printstr',0x14:'t61str',0x15:'videostr',0x16:'ia5str',0x17:'utctime',0x18:'gentime',0x19:'graphstr',0x1a:'iso646str',0x1b:'genstr',0x1c:'unistr',0x1d:'charstr',0x1e:'bmpstr'};exports.tagByName=constants._reverse(exports.tag);/***/},/***/"./node_modules/asn1.js/lib/asn1/constants/index.js":/*!**********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1ConstantsIndexJs(module,exports,__webpack_require__){var constants=exports;// Helper -constants._reverse=function reverse(map){var res={};Object.keys(map).forEach(function(key){// Convert key to integer if it is stringified -if((key|0)==key)key=key|0;var value=map[key];res[value]=key;});return res;};constants.der=__webpack_require__(/*! ./der */"./node_modules/asn1.js/lib/asn1/constants/der.js");/***/},/***/"./node_modules/asn1.js/lib/asn1/decoders/der.js":/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***! - \*******************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1DecodersDerJs(module,exports,__webpack_require__){var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var asn1=__webpack_require__(/*! ../../asn1 */"./node_modules/asn1.js/lib/asn1.js");var base=asn1.base;var bignum=asn1.bignum;// Import DER constants -var der=asn1.constants.der;function DERDecoder(entity){this.enc='der';this.name=entity.name;this.entity=entity;// Construct base tree -this.tree=new DERNode();this.tree._init(entity.body);};module.exports=DERDecoder;DERDecoder.prototype.decode=function decode(data,options){if(!(data instanceof base.DecoderBuffer))data=new base.DecoderBuffer(data,options);return this.tree._decode(data,options);};// Tree methods -function DERNode(parent){base.Node.call(this,'der',parent);}inherits(DERNode,base.Node);DERNode.prototype._peekTag=function peekTag(buffer,tag,any){if(buffer.isEmpty())return false;var state=buffer.save();var decodedTag=derDecodeTag(buffer,'Failed to peek tag: "'+tag+'"');if(buffer.isError(decodedTag))return decodedTag;buffer.restore(state);return decodedTag.tag===tag||decodedTag.tagStr===tag||decodedTag.tagStr+'of'===tag||any;};DERNode.prototype._decodeTag=function decodeTag(buffer,tag,any){var decodedTag=derDecodeTag(buffer,'Failed to decode tag of "'+tag+'"');if(buffer.isError(decodedTag))return decodedTag;var len=derDecodeLen(buffer,decodedTag.primitive,'Failed to get length of "'+tag+'"');// Failure -if(buffer.isError(len))return len;if(!any&&decodedTag.tag!==tag&&decodedTag.tagStr!==tag&&decodedTag.tagStr+'of'!==tag){return buffer.error('Failed to match tag: "'+tag+'"');}if(decodedTag.primitive||len!==null)return buffer.skip(len,'Failed to match body of: "'+tag+'"');// Indefinite length... find END tag -var state=buffer.save();var res=this._skipUntilEnd(buffer,'Failed to skip indefinite length body: "'+this.tag+'"');if(buffer.isError(res))return res;len=buffer.offset-state.offset;buffer.restore(state);return buffer.skip(len,'Failed to match body of: "'+tag+'"');};DERNode.prototype._skipUntilEnd=function skipUntilEnd(buffer,fail){while(true){var tag=derDecodeTag(buffer,fail);if(buffer.isError(tag))return tag;var len=derDecodeLen(buffer,tag.primitive,fail);if(buffer.isError(len))return len;var res;if(tag.primitive||len!==null)res=buffer.skip(len);else res=this._skipUntilEnd(buffer,fail);// Failure -if(buffer.isError(res))return res;if(tag.tagStr==='end')break;}};DERNode.prototype._decodeList=function decodeList(buffer,tag,decoder,options){var result=[];while(!buffer.isEmpty()){var possibleEnd=this._peekTag(buffer,'end');if(buffer.isError(possibleEnd))return possibleEnd;var res=decoder.decode(buffer,'der',options);if(buffer.isError(res)&&possibleEnd)break;result.push(res);}return result;};DERNode.prototype._decodeStr=function decodeStr(buffer,tag){if(tag==='bitstr'){var unused=buffer.readUInt8();if(buffer.isError(unused))return unused;return{unused:unused,data:buffer.raw()};}else if(tag==='bmpstr'){var raw=buffer.raw();if(raw.length%2===1)return buffer.error('Decoding of string type: bmpstr length mismatch');var str='';for(var i=0;i>6];var primitive=(tag&0x20)===0;// Multi-octet tag - load -if((tag&0x1f)===0x1f){var oct=tag;tag=0;while((oct&0x80)===0x80){oct=buf.readUInt8(fail);if(buf.isError(oct))return oct;tag<<=7;tag|=oct&0x7f;}}else{tag&=0x1f;}var tagStr=der.tag[tag];return{cls:cls,primitive:primitive,tag:tag,tagStr:tagStr};}function derDecodeLen(buf,primitive,fail){var len=buf.readUInt8(fail);if(buf.isError(len))return len;// Indefinite form -if(!primitive&&len===0x80)return null;// Definite form -if((len&0x80)===0){// Short form -return len;}// Long form -var num=len&0x7f;if(num>4)return buf.error('length octect is too long');len=0;for(var i=0;i=0x100;i>>=8){lenOctets++;}var header=new Buffer(1+1+lenOctets);header[0]=encodedTag;header[1]=0x80|lenOctets;for(var i=1+lenOctets,j=content.length;j>0;i--,j>>=8){header[i]=j&0xff;}return this._createEncoderBuffer([header,content]);};DERNode.prototype._encodeStr=function encodeStr(str,tag){if(tag==='bitstr'){return this._createEncoderBuffer([str.unused|0,str.data]);}else if(tag==='bmpstr'){var buf=new Buffer(str.length*2);for(var i=0;i=40)return this.reporter.error('Second objid identifier OOB');id.splice(0,2,id[0]*40+id[1]);}// Count number of octets -var size=0;for(var i=0;i=0x80;ident>>=7){size++;}}var objid=new Buffer(size);var offset=objid.length-1;for(var i=id.length-1;i>=0;i--){var ident=id[i];objid[offset--]=ident&0x7f;while((ident>>=7)>0){objid[offset--]=0x80|ident&0x7f;}}return this._createEncoderBuffer(objid);};function two(num){if(num<10)return'0'+num;else return num;}DERNode.prototype._encodeTime=function encodeTime(time,tag){var str;var date=new Date(time);if(tag==='gentime'){str=[two(date.getFullYear()),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),'Z'].join('');}else if(tag==='utctime'){str=[two(date.getFullYear()%100),two(date.getUTCMonth()+1),two(date.getUTCDate()),two(date.getUTCHours()),two(date.getUTCMinutes()),two(date.getUTCSeconds()),'Z'].join('');}else{this.reporter.error('Encoding '+tag+' time is not supported yet');}return this._encodeStr(str,'octstr');};DERNode.prototype._encodeNull=function encodeNull(){return this._createEncoderBuffer('');};DERNode.prototype._encodeInt=function encodeInt(num,values){if(typeof num==='string'){if(!values)return this.reporter.error('String int or enum given, but no values map');if(!values.hasOwnProperty(num)){return this.reporter.error('Values map doesn\'t contain: '+JSON.stringify(num));}num=values[num];}// Bignum, assume big endian -if(typeof num!=='number'&&!Buffer.isBuffer(num)){var numArray=num.toArray();if(!num.sign&&numArray[0]&0x80){numArray.unshift(0);}num=new Buffer(numArray);}if(Buffer.isBuffer(num)){var size=num.length;if(num.length===0)size++;var out=new Buffer(size);num.copy(out);if(num.length===0)out[0]=0;return this._createEncoderBuffer(out);}if(num<0x80)return this._createEncoderBuffer(num);if(num<0x100)return this._createEncoderBuffer([0,num]);var size=1;for(var i=num;i>=0x100;i>>=8){size++;}var out=new Array(size);for(var i=out.length-1;i>=0;i--){out[i]=num&0xff;num>>=8;}if(out[0]&0x80){out.unshift(0);}return this._createEncoderBuffer(new Buffer(out));};DERNode.prototype._encodeBool=function encodeBool(value){return this._createEncoderBuffer(value?0xff:0);};DERNode.prototype._use=function use(entity,obj){if(typeof entity==='function')entity=entity(obj);return entity._getEncoder('der').tree;};DERNode.prototype._skipDefault=function skipDefault(dataBuffer,reporter,parent){var state=this._baseState;var i;if(state['default']===null)return false;var data=dataBuffer.join();if(state.defaultBuffer===undefined)state.defaultBuffer=this._encodeValue(state['default'],reporter,parent).join();if(data.length!==state.defaultBuffer.length)return false;for(i=0;i=0x1f)return reporter.error('Multi-octet tag encoding unsupported');if(!primitive)res|=0x20;res|=der.tagClassByName[cls||'universal']<<6;return res;}/***/},/***/"./node_modules/asn1.js/lib/asn1/encoders/index.js":/*!*********************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***! - \*********************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1EncodersIndexJs(module,exports,__webpack_require__){var encoders=exports;encoders.der=__webpack_require__(/*! ./der */"./node_modules/asn1.js/lib/asn1/encoders/der.js");encoders.pem=__webpack_require__(/*! ./pem */"./node_modules/asn1.js/lib/asn1/encoders/pem.js");/***/},/***/"./node_modules/asn1.js/lib/asn1/encoders/pem.js":/*!*******************************************************!*\ - !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***! - \*******************************************************/ /*! no static exports found */ /***/function node_modulesAsn1JsLibAsn1EncodersPemJs(module,exports,__webpack_require__){var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var DEREncoder=__webpack_require__(/*! ./der */"./node_modules/asn1.js/lib/asn1/encoders/der.js");function PEMEncoder(entity){DEREncoder.call(this,entity);this.enc='pem';};inherits(PEMEncoder,DEREncoder);module.exports=PEMEncoder;PEMEncoder.prototype.encode=function encode(data,options){var buf=DEREncoder.prototype.encode.call(this,data);var p=buf.toString('base64');var out=['-----BEGIN '+options.label+'-----'];for(var i=0;i0){throw new Error('Invalid string. Length must be a multiple of 4');}// Trim off extra bytes after placeholder bytes are found -// See: https://github.com/beatgammit/base64-js/issues/42 -var validLen=b64.indexOf('=');if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen];}// base64 is 4/3 + up to two characters of the original data -function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen;}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen;}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;// if there are placeholders, only get up to the last complete 4 chars -var len=placeHoldersLen>0?validLen-4:validLen;var i;for(i=0;i>16&0xFF;arr[curByte++]=tmp>>8&0xFF;arr[curByte++]=tmp&0xFF;}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&0xFF;}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&0xFF;arr[curByte++]=tmp&0xFF;}return arr;}function tripletToBase64(num){return lookup[num>>18&0x3F]+lookup[num>>12&0x3F]+lookup[num>>6&0x3F]+lookup[num&0x3F];}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength));}// pad the end with zeros, but make sure to not forget the extra bytes -if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&0x3F]+'==');}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&0x3F]+lookup[tmp<<2&0x3F]+'=');}return parts.join('');}/***/},/***/"./node_modules/bn.js/lib/bn.js":/*!**************************************!*\ - !*** ./node_modules/bn.js/lib/bn.js ***! - \**************************************/ /*! no static exports found */ /***/function node_modulesBnJsLibBnJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}(function(module,exports){'use strict';// Utils -function assert(val,msg){if(!val)throw new Error(msg||'Assertion failed');}// Could use `inherits` module, but don't want to move from single file -// architecture yet. -function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}// BN -function BN(number,base,endian){if(BN.isBN(number)){return number;}this.negative=0;this.words=null;this.length=0;// Reduction context -this.red=null;if(number!==null){if(base==='le'||base==='be'){endian=base;base=10;}this._init(number||0,base||10,endian||'be');}}if(_typeof(module)==='object'){module.exports=BN;}else{exports.BN=BN;}BN.BN=BN;BN.wordSize=26;var Buffer;try{Buffer=__webpack_require__(/*! buffer */3).Buffer;}catch(e){}BN.isBN=function isBN(num){if(num instanceof BN){return true;}return num!==null&&_typeof(num)==='object'&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words);};BN.max=function max(left,right){if(left.cmp(right)>0)return left;return right;};BN.min=function min(left,right){if(left.cmp(right)<0)return left;return right;};BN.prototype._init=function init(number,base,endian){if(typeof number==='number'){return this._initNumber(number,base,endian);}if(_typeof(number)==='object'){return this._initArray(number,base,endian);}if(base==='hex'){base=16;}assert(base===(base|0)&&base>=2&&base<=36);number=number.toString().replace(/\s+/g,'');var start=0;if(number[0]==='-'){start++;}if(base===16){this._parseHex(number,start);}else{this._parseBase(number,base,start);}if(number[0]==='-'){this.negative=1;}this.strip();if(endian!=='le')return;this._initArray(this.toArray(),base,endian);};BN.prototype._initNumber=function _initNumber(number,base,endian){if(number<0){this.negative=1;number=-number;}if(number<0x4000000){this.words=[number&0x3ffffff];this.length=1;}else if(number<0x10000000000000){this.words=[number&0x3ffffff,number/0x4000000&0x3ffffff];this.length=2;}else{assert(number<0x20000000000000);// 2 ^ 53 (unsafe) -this.words=[number&0x3ffffff,number/0x4000000&0x3ffffff,1];this.length=3;}if(endian!=='le')return;// Reverse the bytes -this._initArray(this.toArray(),base,endian);};BN.prototype._initArray=function _initArray(number,base,endian){// Perhaps a Uint8Array -assert(typeof number.length==='number');if(number.length<=0){this.words=[0];this.length=1;return this;}this.length=Math.ceil(number.length/3);this.words=new Array(this.length);for(var i=0;i=0;i-=3){w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<>>26-off&0x3ffffff;off+=24;if(off>=26){off-=26;j++;}}}else if(endian==='le'){for(i=0,j=0;i>>26-off&0x3ffffff;off+=24;if(off>=26){off-=26;j++;}}}return this.strip();};function parseHex(str,start,end){var r=0;var len=Math.min(str.length,end);for(var i=start;i=49&&c<=54){r|=c-49+0xa;// 'A' - 'F' -}else if(c>=17&&c<=22){r|=c-17+0xa;// '0' - '9' -}else{r|=c&0xf;}}return r;}BN.prototype._parseHex=function _parseHex(number,start){// Create possibly bigger array to ensure that it fits the number -this.length=Math.ceil((number.length-start)/6);this.words=new Array(this.length);for(var i=0;i=start;i-=6){w=parseHex(number,i,i+6);this.words[j]|=w<>>26-off&0x3fffff;off+=24;if(off>=26){off-=26;j++;}}if(i+6!==start){w=parseHex(number,start,i+6);this.words[j]|=w<>>26-off&0x3fffff;}this.strip();};function parseBase(str,start,end,mul){var r=0;var len=Math.min(str.length,end);for(var i=start;i=49){r+=c-49+0xa;// 'A' -}else if(c>=17){r+=c-17+0xa;// '0' - '9' -}else{r+=c;}}return r;}BN.prototype._parseBase=function _parseBase(number,base,start){// Initialize as zero -this.words=[0];this.length=1;// Find length of limb in base -for(var limbLen=0,limbPow=1;limbPow<=0x3ffffff;limbPow*=base){limbLen++;}limbLen--;limbPow=limbPow/base|0;var total=number.length-start;var mod=total%limbLen;var end=Math.min(total,total-mod)+start;var word=0;for(var i=start;i1&&this.words[this.length-1]===0){this.length--;}return this._normSign();};BN.prototype._normSign=function _normSign(){// -0 = 0 -if(this.length===1&&this.words[0]===0){this.negative=0;}return this;};BN.prototype.inspect=function inspect(){return(this.red?'';};/* - var zeros = []; - var groupSizes = []; - var groupBases = []; - var s = ''; - var i = -1; - while (++i < BN.wordSize) { - zeros[i] = s; - s += '0'; - } - groupSizes[0] = 0; - groupSizes[1] = 0; - groupBases[0] = 0; - groupBases[1] = 0; - var base = 2 - 1; - while (++base < 36 + 1) { - var groupSize = 0; - var groupBase = 1; - while (groupBase < (1 << BN.wordSize) / base) { - groupBase *= base; - groupSize += 1; - } - groupSizes[base] = groupSize; - groupBases[base] = groupBase; - } - */var zeros=['','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'];var groupSizes=[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];var groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,10000000,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64000000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(base,padding){base=base||10;padding=padding|0||1;var out;if(base===16||base==='hex'){out='';var off=0;var carry=0;for(var i=0;i>>24-off&0xffffff;if(carry!==0||i!==this.length-1){out=zeros[6-word.length]+word+out;}else{out=word+out;}off+=2;if(off>=26){off-=26;i--;}}if(carry!==0){out=carry.toString(16)+out;}while(out.length%padding!==0){out='0'+out;}if(this.negative!==0){out='-'+out;}return out;}if(base===(base|0)&&base>=2&&base<=36){// var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); -var groupSize=groupSizes[base];// var groupBase = Math.pow(base, groupSize); -var groupBase=groupBases[base];out='';var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase);if(!c.isZero()){out=zeros[groupSize-r.length]+r+out;}else{out=r+out;}}if(this.isZero()){out='0'+out;}while(out.length%padding!==0){out='0'+out;}if(this.negative!==0){out='-'+out;}return out;}assert(false,'Base should be between 2 and 36');};BN.prototype.toNumber=function toNumber(){var ret=this.words[0];if(this.length===2){ret+=this.words[1]*0x4000000;}else if(this.length===3&&this.words[2]===0x01){// NOTE: at this stage it is known that the top bit is set -ret+=0x10000000000000+this.words[1]*0x4000000;}else if(this.length>2){assert(false,'Number can only safely store up to 53 bits');}return this.negative!==0?-ret:ret;};BN.prototype.toJSON=function toJSON(){return this.toString(16);};BN.prototype.toBuffer=function toBuffer(endian,length){assert(typeof Buffer!=='undefined');return this.toArrayLike(Buffer,endian,length);};BN.prototype.toArray=function toArray(endian,length){return this.toArrayLike(Array,endian,length);};BN.prototype.toArrayLike=function toArrayLike(ArrayType,endian,length){var byteLength=this.byteLength();var reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,'byte array longer than desired length');assert(reqLength>0,'Requested array length <= 0');this.strip();var littleEndian=endian==='le';var res=new ArrayType(reqLength);var b,i;var q=this.clone();if(!littleEndian){// Assume big-endian -for(i=0;i=0x1000){r+=13;t>>>=13;}if(t>=0x40){r+=7;t>>>=7;}if(t>=0x8){r+=4;t>>>=4;}if(t>=0x02){r+=2;t>>>=2;}return r+t;};}BN.prototype._zeroBits=function _zeroBits(w){// Short-cut -if(w===0)return 26;var t=w;var r=0;if((t&0x1fff)===0){r+=13;t>>>=13;}if((t&0x7f)===0){r+=7;t>>>=7;}if((t&0xf)===0){r+=4;t>>>=4;}if((t&0x3)===0){r+=2;t>>>=2;}if((t&0x1)===0){r++;}return r;};// Return number of used bits in a BN -BN.prototype.bitLength=function bitLength(){var w=this.words[this.length-1];var hi=this._countBits(w);return(this.length-1)*26+hi;};function toBitArray(num){var w=new Array(num.bitLength());for(var bit=0;bit>>wbit;}return w;}// Number of trailing zero bits -BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;var r=0;for(var i=0;inum.length)return this.clone().ior(num);return num.clone().ior(this);};BN.prototype.uor=function uor(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this);};// And `num` with `this` in-place -BN.prototype.iuand=function iuand(num){// b = min-length(num, this) -var b;if(this.length>num.length){b=num;}else{b=this;}for(var i=0;inum.length)return this.clone().iand(num);return num.clone().iand(this);};BN.prototype.uand=function uand(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this);};// Xor `num` with `this` in-place -BN.prototype.iuxor=function iuxor(num){// a.length > b.length -var a;var b;if(this.length>num.length){a=this;b=num;}else{a=num;b=this;}for(var i=0;inum.length)return this.clone().ixor(num);return num.clone().ixor(this);};BN.prototype.uxor=function uxor(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this);};// Not ``this`` with ``width`` bitwidth -BN.prototype.inotn=function inotn(width){assert(typeof width==='number'&&width>=0);var bytesNeeded=Math.ceil(width/26)|0;var bitsLeft=width%26;// Extend the buffer with leading zeroes -this._expand(bytesNeeded);if(bitsLeft>0){bytesNeeded--;}// Handle complete words -for(var i=0;i0){this.words[i]=~this.words[i]&0x3ffffff>>26-bitsLeft;}// And remove leading zeroes -return this.strip();};BN.prototype.notn=function notn(width){return this.clone().inotn(width);};// Set `bit` of `this` -BN.prototype.setn=function setn(bit,val){assert(typeof bit==='number'&&bit>=0);var off=bit/26|0;var wbit=bit%26;this._expand(off+1);if(val){this.words[off]=this.words[off]|1< b.length -var a,b;if(this.length>num.length){a=this;b=num;}else{a=num;b=this;}var carry=0;for(var i=0;i>>26;}for(;carry!==0&&i>>26;}this.length=a.length;if(carry!==0){this.words[this.length]=carry;this.length++;// Copy the rest of the words -}else if(a!==this){for(;inum.length)return this.clone().iadd(num);return num.clone().iadd(this);};// Subtract `num` from `this` in-place -BN.prototype.isub=function isub(num){// this - (-num) = this + num -if(num.negative!==0){num.negative=0;var r=this.iadd(num);num.negative=1;return r._normSign();// -this - num = -(this + num) -}else if(this.negative!==0){this.negative=0;this.iadd(num);this.negative=1;return this._normSign();}// At this point both numbers are positive -var cmp=this.cmp(num);// Optimization - zeroify -if(cmp===0){this.negative=0;this.length=1;this.words[0]=0;return this;}// a > b -var a,b;if(cmp>0){a=this;b=num;}else{a=num;b=this;}var carry=0;for(var i=0;i>26;this.words[i]=r&0x3ffffff;}for(;carry!==0&&i>26;this.words[i]=r&0x3ffffff;}// Copy rest of the words -if(carry===0&&i= 0x3ffffff -var ncarry=carry>>>26;var rword=carry&0x3ffffff;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j|0;a=self.words[i]|0;b=num.words[j]|0;r=a*b+rword;ncarry+=r/0x4000000|0;rword=r&0x3ffffff;}out.words[k]=rword|0;carry=ncarry|0;}if(carry!==0){out.words[k]=carry|0;}else{out.length--;}return out.strip();}// TODO(indutny): it may be reasonable to omit it for users who don't need -// to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit -// multiplication (like elliptic secp256k1). -var comb10MulTo=function comb10MulTo(self,num,out){var a=self.words;var b=num.words;var o=out.words;var c=0;var lo;var mid;var hi;var a0=a[0]|0;var al0=a0&0x1fff;var ah0=a0>>>13;var a1=a[1]|0;var al1=a1&0x1fff;var ah1=a1>>>13;var a2=a[2]|0;var al2=a2&0x1fff;var ah2=a2>>>13;var a3=a[3]|0;var al3=a3&0x1fff;var ah3=a3>>>13;var a4=a[4]|0;var al4=a4&0x1fff;var ah4=a4>>>13;var a5=a[5]|0;var al5=a5&0x1fff;var ah5=a5>>>13;var a6=a[6]|0;var al6=a6&0x1fff;var ah6=a6>>>13;var a7=a[7]|0;var al7=a7&0x1fff;var ah7=a7>>>13;var a8=a[8]|0;var al8=a8&0x1fff;var ah8=a8>>>13;var a9=a[9]|0;var al9=a9&0x1fff;var ah9=a9>>>13;var b0=b[0]|0;var bl0=b0&0x1fff;var bh0=b0>>>13;var b1=b[1]|0;var bl1=b1&0x1fff;var bh1=b1>>>13;var b2=b[2]|0;var bl2=b2&0x1fff;var bh2=b2>>>13;var b3=b[3]|0;var bl3=b3&0x1fff;var bh3=b3>>>13;var b4=b[4]|0;var bl4=b4&0x1fff;var bh4=b4>>>13;var b5=b[5]|0;var bl5=b5&0x1fff;var bh5=b5>>>13;var b6=b[6]|0;var bl6=b6&0x1fff;var bh6=b6>>>13;var b7=b[7]|0;var bl7=b7&0x1fff;var bh7=b7>>>13;var b8=b[8]|0;var bl8=b8&0x1fff;var bh8=b8>>>13;var b9=b[9]|0;var bl9=b9&0x1fff;var bh9=b9>>>13;out.negative=self.negative^num.negative;out.length=19;/* k = 0 */lo=Math.imul(al0,bl0);mid=Math.imul(al0,bh0);mid=mid+Math.imul(ah0,bl0)|0;hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0;w0&=0x3ffffff;/* k = 1 */lo=Math.imul(al1,bl0);mid=Math.imul(al1,bh0);mid=mid+Math.imul(ah1,bl0)|0;hi=Math.imul(ah1,bh0);lo=lo+Math.imul(al0,bl1)|0;mid=mid+Math.imul(al0,bh1)|0;mid=mid+Math.imul(ah0,bl1)|0;hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0;w1&=0x3ffffff;/* k = 2 */lo=Math.imul(al2,bl0);mid=Math.imul(al2,bh0);mid=mid+Math.imul(ah2,bl0)|0;hi=Math.imul(ah2,bh0);lo=lo+Math.imul(al1,bl1)|0;mid=mid+Math.imul(al1,bh1)|0;mid=mid+Math.imul(ah1,bl1)|0;hi=hi+Math.imul(ah1,bh1)|0;lo=lo+Math.imul(al0,bl2)|0;mid=mid+Math.imul(al0,bh2)|0;mid=mid+Math.imul(ah0,bl2)|0;hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0;w2&=0x3ffffff;/* k = 3 */lo=Math.imul(al3,bl0);mid=Math.imul(al3,bh0);mid=mid+Math.imul(ah3,bl0)|0;hi=Math.imul(ah3,bh0);lo=lo+Math.imul(al2,bl1)|0;mid=mid+Math.imul(al2,bh1)|0;mid=mid+Math.imul(ah2,bl1)|0;hi=hi+Math.imul(ah2,bh1)|0;lo=lo+Math.imul(al1,bl2)|0;mid=mid+Math.imul(al1,bh2)|0;mid=mid+Math.imul(ah1,bl2)|0;hi=hi+Math.imul(ah1,bh2)|0;lo=lo+Math.imul(al0,bl3)|0;mid=mid+Math.imul(al0,bh3)|0;mid=mid+Math.imul(ah0,bl3)|0;hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0;w3&=0x3ffffff;/* k = 4 */lo=Math.imul(al4,bl0);mid=Math.imul(al4,bh0);mid=mid+Math.imul(ah4,bl0)|0;hi=Math.imul(ah4,bh0);lo=lo+Math.imul(al3,bl1)|0;mid=mid+Math.imul(al3,bh1)|0;mid=mid+Math.imul(ah3,bl1)|0;hi=hi+Math.imul(ah3,bh1)|0;lo=lo+Math.imul(al2,bl2)|0;mid=mid+Math.imul(al2,bh2)|0;mid=mid+Math.imul(ah2,bl2)|0;hi=hi+Math.imul(ah2,bh2)|0;lo=lo+Math.imul(al1,bl3)|0;mid=mid+Math.imul(al1,bh3)|0;mid=mid+Math.imul(ah1,bl3)|0;hi=hi+Math.imul(ah1,bh3)|0;lo=lo+Math.imul(al0,bl4)|0;mid=mid+Math.imul(al0,bh4)|0;mid=mid+Math.imul(ah0,bl4)|0;hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0;w4&=0x3ffffff;/* k = 5 */lo=Math.imul(al5,bl0);mid=Math.imul(al5,bh0);mid=mid+Math.imul(ah5,bl0)|0;hi=Math.imul(ah5,bh0);lo=lo+Math.imul(al4,bl1)|0;mid=mid+Math.imul(al4,bh1)|0;mid=mid+Math.imul(ah4,bl1)|0;hi=hi+Math.imul(ah4,bh1)|0;lo=lo+Math.imul(al3,bl2)|0;mid=mid+Math.imul(al3,bh2)|0;mid=mid+Math.imul(ah3,bl2)|0;hi=hi+Math.imul(ah3,bh2)|0;lo=lo+Math.imul(al2,bl3)|0;mid=mid+Math.imul(al2,bh3)|0;mid=mid+Math.imul(ah2,bl3)|0;hi=hi+Math.imul(ah2,bh3)|0;lo=lo+Math.imul(al1,bl4)|0;mid=mid+Math.imul(al1,bh4)|0;mid=mid+Math.imul(ah1,bl4)|0;hi=hi+Math.imul(ah1,bh4)|0;lo=lo+Math.imul(al0,bl5)|0;mid=mid+Math.imul(al0,bh5)|0;mid=mid+Math.imul(ah0,bl5)|0;hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0;w5&=0x3ffffff;/* k = 6 */lo=Math.imul(al6,bl0);mid=Math.imul(al6,bh0);mid=mid+Math.imul(ah6,bl0)|0;hi=Math.imul(ah6,bh0);lo=lo+Math.imul(al5,bl1)|0;mid=mid+Math.imul(al5,bh1)|0;mid=mid+Math.imul(ah5,bl1)|0;hi=hi+Math.imul(ah5,bh1)|0;lo=lo+Math.imul(al4,bl2)|0;mid=mid+Math.imul(al4,bh2)|0;mid=mid+Math.imul(ah4,bl2)|0;hi=hi+Math.imul(ah4,bh2)|0;lo=lo+Math.imul(al3,bl3)|0;mid=mid+Math.imul(al3,bh3)|0;mid=mid+Math.imul(ah3,bl3)|0;hi=hi+Math.imul(ah3,bh3)|0;lo=lo+Math.imul(al2,bl4)|0;mid=mid+Math.imul(al2,bh4)|0;mid=mid+Math.imul(ah2,bl4)|0;hi=hi+Math.imul(ah2,bh4)|0;lo=lo+Math.imul(al1,bl5)|0;mid=mid+Math.imul(al1,bh5)|0;mid=mid+Math.imul(ah1,bl5)|0;hi=hi+Math.imul(ah1,bh5)|0;lo=lo+Math.imul(al0,bl6)|0;mid=mid+Math.imul(al0,bh6)|0;mid=mid+Math.imul(ah0,bl6)|0;hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0;w6&=0x3ffffff;/* k = 7 */lo=Math.imul(al7,bl0);mid=Math.imul(al7,bh0);mid=mid+Math.imul(ah7,bl0)|0;hi=Math.imul(ah7,bh0);lo=lo+Math.imul(al6,bl1)|0;mid=mid+Math.imul(al6,bh1)|0;mid=mid+Math.imul(ah6,bl1)|0;hi=hi+Math.imul(ah6,bh1)|0;lo=lo+Math.imul(al5,bl2)|0;mid=mid+Math.imul(al5,bh2)|0;mid=mid+Math.imul(ah5,bl2)|0;hi=hi+Math.imul(ah5,bh2)|0;lo=lo+Math.imul(al4,bl3)|0;mid=mid+Math.imul(al4,bh3)|0;mid=mid+Math.imul(ah4,bl3)|0;hi=hi+Math.imul(ah4,bh3)|0;lo=lo+Math.imul(al3,bl4)|0;mid=mid+Math.imul(al3,bh4)|0;mid=mid+Math.imul(ah3,bl4)|0;hi=hi+Math.imul(ah3,bh4)|0;lo=lo+Math.imul(al2,bl5)|0;mid=mid+Math.imul(al2,bh5)|0;mid=mid+Math.imul(ah2,bl5)|0;hi=hi+Math.imul(ah2,bh5)|0;lo=lo+Math.imul(al1,bl6)|0;mid=mid+Math.imul(al1,bh6)|0;mid=mid+Math.imul(ah1,bl6)|0;hi=hi+Math.imul(ah1,bh6)|0;lo=lo+Math.imul(al0,bl7)|0;mid=mid+Math.imul(al0,bh7)|0;mid=mid+Math.imul(ah0,bl7)|0;hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0;w7&=0x3ffffff;/* k = 8 */lo=Math.imul(al8,bl0);mid=Math.imul(al8,bh0);mid=mid+Math.imul(ah8,bl0)|0;hi=Math.imul(ah8,bh0);lo=lo+Math.imul(al7,bl1)|0;mid=mid+Math.imul(al7,bh1)|0;mid=mid+Math.imul(ah7,bl1)|0;hi=hi+Math.imul(ah7,bh1)|0;lo=lo+Math.imul(al6,bl2)|0;mid=mid+Math.imul(al6,bh2)|0;mid=mid+Math.imul(ah6,bl2)|0;hi=hi+Math.imul(ah6,bh2)|0;lo=lo+Math.imul(al5,bl3)|0;mid=mid+Math.imul(al5,bh3)|0;mid=mid+Math.imul(ah5,bl3)|0;hi=hi+Math.imul(ah5,bh3)|0;lo=lo+Math.imul(al4,bl4)|0;mid=mid+Math.imul(al4,bh4)|0;mid=mid+Math.imul(ah4,bl4)|0;hi=hi+Math.imul(ah4,bh4)|0;lo=lo+Math.imul(al3,bl5)|0;mid=mid+Math.imul(al3,bh5)|0;mid=mid+Math.imul(ah3,bl5)|0;hi=hi+Math.imul(ah3,bh5)|0;lo=lo+Math.imul(al2,bl6)|0;mid=mid+Math.imul(al2,bh6)|0;mid=mid+Math.imul(ah2,bl6)|0;hi=hi+Math.imul(ah2,bh6)|0;lo=lo+Math.imul(al1,bl7)|0;mid=mid+Math.imul(al1,bh7)|0;mid=mid+Math.imul(ah1,bl7)|0;hi=hi+Math.imul(ah1,bh7)|0;lo=lo+Math.imul(al0,bl8)|0;mid=mid+Math.imul(al0,bh8)|0;mid=mid+Math.imul(ah0,bl8)|0;hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0;w8&=0x3ffffff;/* k = 9 */lo=Math.imul(al9,bl0);mid=Math.imul(al9,bh0);mid=mid+Math.imul(ah9,bl0)|0;hi=Math.imul(ah9,bh0);lo=lo+Math.imul(al8,bl1)|0;mid=mid+Math.imul(al8,bh1)|0;mid=mid+Math.imul(ah8,bl1)|0;hi=hi+Math.imul(ah8,bh1)|0;lo=lo+Math.imul(al7,bl2)|0;mid=mid+Math.imul(al7,bh2)|0;mid=mid+Math.imul(ah7,bl2)|0;hi=hi+Math.imul(ah7,bh2)|0;lo=lo+Math.imul(al6,bl3)|0;mid=mid+Math.imul(al6,bh3)|0;mid=mid+Math.imul(ah6,bl3)|0;hi=hi+Math.imul(ah6,bh3)|0;lo=lo+Math.imul(al5,bl4)|0;mid=mid+Math.imul(al5,bh4)|0;mid=mid+Math.imul(ah5,bl4)|0;hi=hi+Math.imul(ah5,bh4)|0;lo=lo+Math.imul(al4,bl5)|0;mid=mid+Math.imul(al4,bh5)|0;mid=mid+Math.imul(ah4,bl5)|0;hi=hi+Math.imul(ah4,bh5)|0;lo=lo+Math.imul(al3,bl6)|0;mid=mid+Math.imul(al3,bh6)|0;mid=mid+Math.imul(ah3,bl6)|0;hi=hi+Math.imul(ah3,bh6)|0;lo=lo+Math.imul(al2,bl7)|0;mid=mid+Math.imul(al2,bh7)|0;mid=mid+Math.imul(ah2,bl7)|0;hi=hi+Math.imul(ah2,bh7)|0;lo=lo+Math.imul(al1,bl8)|0;mid=mid+Math.imul(al1,bh8)|0;mid=mid+Math.imul(ah1,bl8)|0;hi=hi+Math.imul(ah1,bh8)|0;lo=lo+Math.imul(al0,bl9)|0;mid=mid+Math.imul(al0,bh9)|0;mid=mid+Math.imul(ah0,bl9)|0;hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0;w9&=0x3ffffff;/* k = 10 */lo=Math.imul(al9,bl1);mid=Math.imul(al9,bh1);mid=mid+Math.imul(ah9,bl1)|0;hi=Math.imul(ah9,bh1);lo=lo+Math.imul(al8,bl2)|0;mid=mid+Math.imul(al8,bh2)|0;mid=mid+Math.imul(ah8,bl2)|0;hi=hi+Math.imul(ah8,bh2)|0;lo=lo+Math.imul(al7,bl3)|0;mid=mid+Math.imul(al7,bh3)|0;mid=mid+Math.imul(ah7,bl3)|0;hi=hi+Math.imul(ah7,bh3)|0;lo=lo+Math.imul(al6,bl4)|0;mid=mid+Math.imul(al6,bh4)|0;mid=mid+Math.imul(ah6,bl4)|0;hi=hi+Math.imul(ah6,bh4)|0;lo=lo+Math.imul(al5,bl5)|0;mid=mid+Math.imul(al5,bh5)|0;mid=mid+Math.imul(ah5,bl5)|0;hi=hi+Math.imul(ah5,bh5)|0;lo=lo+Math.imul(al4,bl6)|0;mid=mid+Math.imul(al4,bh6)|0;mid=mid+Math.imul(ah4,bl6)|0;hi=hi+Math.imul(ah4,bh6)|0;lo=lo+Math.imul(al3,bl7)|0;mid=mid+Math.imul(al3,bh7)|0;mid=mid+Math.imul(ah3,bl7)|0;hi=hi+Math.imul(ah3,bh7)|0;lo=lo+Math.imul(al2,bl8)|0;mid=mid+Math.imul(al2,bh8)|0;mid=mid+Math.imul(ah2,bl8)|0;hi=hi+Math.imul(ah2,bh8)|0;lo=lo+Math.imul(al1,bl9)|0;mid=mid+Math.imul(al1,bh9)|0;mid=mid+Math.imul(ah1,bl9)|0;hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0;w10&=0x3ffffff;/* k = 11 */lo=Math.imul(al9,bl2);mid=Math.imul(al9,bh2);mid=mid+Math.imul(ah9,bl2)|0;hi=Math.imul(ah9,bh2);lo=lo+Math.imul(al8,bl3)|0;mid=mid+Math.imul(al8,bh3)|0;mid=mid+Math.imul(ah8,bl3)|0;hi=hi+Math.imul(ah8,bh3)|0;lo=lo+Math.imul(al7,bl4)|0;mid=mid+Math.imul(al7,bh4)|0;mid=mid+Math.imul(ah7,bl4)|0;hi=hi+Math.imul(ah7,bh4)|0;lo=lo+Math.imul(al6,bl5)|0;mid=mid+Math.imul(al6,bh5)|0;mid=mid+Math.imul(ah6,bl5)|0;hi=hi+Math.imul(ah6,bh5)|0;lo=lo+Math.imul(al5,bl6)|0;mid=mid+Math.imul(al5,bh6)|0;mid=mid+Math.imul(ah5,bl6)|0;hi=hi+Math.imul(ah5,bh6)|0;lo=lo+Math.imul(al4,bl7)|0;mid=mid+Math.imul(al4,bh7)|0;mid=mid+Math.imul(ah4,bl7)|0;hi=hi+Math.imul(ah4,bh7)|0;lo=lo+Math.imul(al3,bl8)|0;mid=mid+Math.imul(al3,bh8)|0;mid=mid+Math.imul(ah3,bl8)|0;hi=hi+Math.imul(ah3,bh8)|0;lo=lo+Math.imul(al2,bl9)|0;mid=mid+Math.imul(al2,bh9)|0;mid=mid+Math.imul(ah2,bl9)|0;hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0;w11&=0x3ffffff;/* k = 12 */lo=Math.imul(al9,bl3);mid=Math.imul(al9,bh3);mid=mid+Math.imul(ah9,bl3)|0;hi=Math.imul(ah9,bh3);lo=lo+Math.imul(al8,bl4)|0;mid=mid+Math.imul(al8,bh4)|0;mid=mid+Math.imul(ah8,bl4)|0;hi=hi+Math.imul(ah8,bh4)|0;lo=lo+Math.imul(al7,bl5)|0;mid=mid+Math.imul(al7,bh5)|0;mid=mid+Math.imul(ah7,bl5)|0;hi=hi+Math.imul(ah7,bh5)|0;lo=lo+Math.imul(al6,bl6)|0;mid=mid+Math.imul(al6,bh6)|0;mid=mid+Math.imul(ah6,bl6)|0;hi=hi+Math.imul(ah6,bh6)|0;lo=lo+Math.imul(al5,bl7)|0;mid=mid+Math.imul(al5,bh7)|0;mid=mid+Math.imul(ah5,bl7)|0;hi=hi+Math.imul(ah5,bh7)|0;lo=lo+Math.imul(al4,bl8)|0;mid=mid+Math.imul(al4,bh8)|0;mid=mid+Math.imul(ah4,bl8)|0;hi=hi+Math.imul(ah4,bh8)|0;lo=lo+Math.imul(al3,bl9)|0;mid=mid+Math.imul(al3,bh9)|0;mid=mid+Math.imul(ah3,bl9)|0;hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0;w12&=0x3ffffff;/* k = 13 */lo=Math.imul(al9,bl4);mid=Math.imul(al9,bh4);mid=mid+Math.imul(ah9,bl4)|0;hi=Math.imul(ah9,bh4);lo=lo+Math.imul(al8,bl5)|0;mid=mid+Math.imul(al8,bh5)|0;mid=mid+Math.imul(ah8,bl5)|0;hi=hi+Math.imul(ah8,bh5)|0;lo=lo+Math.imul(al7,bl6)|0;mid=mid+Math.imul(al7,bh6)|0;mid=mid+Math.imul(ah7,bl6)|0;hi=hi+Math.imul(ah7,bh6)|0;lo=lo+Math.imul(al6,bl7)|0;mid=mid+Math.imul(al6,bh7)|0;mid=mid+Math.imul(ah6,bl7)|0;hi=hi+Math.imul(ah6,bh7)|0;lo=lo+Math.imul(al5,bl8)|0;mid=mid+Math.imul(al5,bh8)|0;mid=mid+Math.imul(ah5,bl8)|0;hi=hi+Math.imul(ah5,bh8)|0;lo=lo+Math.imul(al4,bl9)|0;mid=mid+Math.imul(al4,bh9)|0;mid=mid+Math.imul(ah4,bl9)|0;hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0;w13&=0x3ffffff;/* k = 14 */lo=Math.imul(al9,bl5);mid=Math.imul(al9,bh5);mid=mid+Math.imul(ah9,bl5)|0;hi=Math.imul(ah9,bh5);lo=lo+Math.imul(al8,bl6)|0;mid=mid+Math.imul(al8,bh6)|0;mid=mid+Math.imul(ah8,bl6)|0;hi=hi+Math.imul(ah8,bh6)|0;lo=lo+Math.imul(al7,bl7)|0;mid=mid+Math.imul(al7,bh7)|0;mid=mid+Math.imul(ah7,bl7)|0;hi=hi+Math.imul(ah7,bh7)|0;lo=lo+Math.imul(al6,bl8)|0;mid=mid+Math.imul(al6,bh8)|0;mid=mid+Math.imul(ah6,bl8)|0;hi=hi+Math.imul(ah6,bh8)|0;lo=lo+Math.imul(al5,bl9)|0;mid=mid+Math.imul(al5,bh9)|0;mid=mid+Math.imul(ah5,bl9)|0;hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0;w14&=0x3ffffff;/* k = 15 */lo=Math.imul(al9,bl6);mid=Math.imul(al9,bh6);mid=mid+Math.imul(ah9,bl6)|0;hi=Math.imul(ah9,bh6);lo=lo+Math.imul(al8,bl7)|0;mid=mid+Math.imul(al8,bh7)|0;mid=mid+Math.imul(ah8,bl7)|0;hi=hi+Math.imul(ah8,bh7)|0;lo=lo+Math.imul(al7,bl8)|0;mid=mid+Math.imul(al7,bh8)|0;mid=mid+Math.imul(ah7,bl8)|0;hi=hi+Math.imul(ah7,bh8)|0;lo=lo+Math.imul(al6,bl9)|0;mid=mid+Math.imul(al6,bh9)|0;mid=mid+Math.imul(ah6,bl9)|0;hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0;w15&=0x3ffffff;/* k = 16 */lo=Math.imul(al9,bl7);mid=Math.imul(al9,bh7);mid=mid+Math.imul(ah9,bl7)|0;hi=Math.imul(ah9,bh7);lo=lo+Math.imul(al8,bl8)|0;mid=mid+Math.imul(al8,bh8)|0;mid=mid+Math.imul(ah8,bl8)|0;hi=hi+Math.imul(ah8,bh8)|0;lo=lo+Math.imul(al7,bl9)|0;mid=mid+Math.imul(al7,bh9)|0;mid=mid+Math.imul(ah7,bl9)|0;hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0;w16&=0x3ffffff;/* k = 17 */lo=Math.imul(al9,bl8);mid=Math.imul(al9,bh8);mid=mid+Math.imul(ah9,bl8)|0;hi=Math.imul(ah9,bh8);lo=lo+Math.imul(al8,bl9)|0;mid=mid+Math.imul(al8,bh9)|0;mid=mid+Math.imul(ah8,bl9)|0;hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0;w17&=0x3ffffff;/* k = 18 */lo=Math.imul(al9,bl9);mid=Math.imul(al9,bh9);mid=mid+Math.imul(ah9,bl9)|0;hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&0x1fff)<<13)|0;c=(hi+(mid>>>13)|0)+(w18>>>26)|0;w18&=0x3ffffff;o[0]=w0;o[1]=w1;o[2]=w2;o[3]=w3;o[4]=w4;o[5]=w5;o[6]=w6;o[7]=w7;o[8]=w8;o[9]=w9;o[10]=w10;o[11]=w11;o[12]=w12;o[13]=w13;o[14]=w14;o[15]=w15;o[16]=w16;o[17]=w17;o[18]=w18;if(c!==0){o[19]=c;out.length++;}return out;};// Polyfill comb -if(!Math.imul){comb10MulTo=smallMulTo;}function bigMulTo(self,num,out){out.negative=num.negative^self.negative;out.length=self.length+num.length;var carry=0;var hncarry=0;for(var k=0;k= 0x3ffffff -var ncarry=hncarry;hncarry=0;var rword=carry&0x3ffffff;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j;var a=self.words[i]|0;var b=num.words[j]|0;var r=a*b;var lo=r&0x3ffffff;ncarry=ncarry+(r/0x4000000|0)|0;lo=lo+rword|0;rword=lo&0x3ffffff;ncarry=ncarry+(lo>>>26)|0;hncarry+=ncarry>>>26;ncarry&=0x3ffffff;}out.words[k]=rword;carry=ncarry;ncarry=hncarry;}if(carry!==0){out.words[k]=carry;}else{out.length--;}return out.strip();}function jumboMulTo(self,num,out){var fftm=new FFTM();return fftm.mulp(self,num,out);}BN.prototype.mulTo=function mulTo(num,out){var res;var len=this.length+num.length;if(this.length===10&&num.length===10){res=comb10MulTo(this,num,out);}else if(len<63){res=smallMulTo(this,num,out);}else if(len<1024){res=bigMulTo(this,num,out);}else{res=jumboMulTo(this,num,out);}return res;};// Cooley-Tukey algorithm for FFT -// slightly revisited to rely on looping instead of recursion -function FFTM(x,y){this.x=x;this.y=y;}FFTM.prototype.makeRBT=function makeRBT(N){var t=new Array(N);var l=BN.prototype._countBits(N)-1;for(var i=0;i>=1;}return rb;};// Performs "tweedling" phase, therefore 'emulating' -// behaviour of the recursive algorithm -FFTM.prototype.permute=function permute(rbt,rws,iws,rtws,itws,N){for(var i=0;i>>1){i++;}return 1<>>13;rws[2*i+1]=carry&0x1fff;carry=carry>>>13;}// Pad with zeroes -for(i=2*len;i>=26;carry+=w/0x4000000|0;// NOTE: lo is 27bit maximum -carry+=lo>>>26;this.words[i]=lo&0x3ffffff;}if(carry!==0){this.words[i]=carry;this.length++;}return this;};BN.prototype.muln=function muln(num){return this.clone().imuln(num);};// `this` * `this` -BN.prototype.sqr=function sqr(){return this.mul(this);};// `this` * `this` in-place -BN.prototype.isqr=function isqr(){return this.imul(this.clone());};// Math.pow(`this`, `num`) -BN.prototype.pow=function pow(num){var w=toBitArray(num);if(w.length===0)return new BN(1);// Skip leading zeroes -var res=this;for(var i=0;i=0);var r=bits%26;var s=(bits-r)/26;var carryMask=0x3ffffff>>>26-r<<26-r;var i;if(r!==0){var carry=0;for(i=0;i>>26-r;}if(carry){this.words[i]=carry;this.length++;}}if(s!==0){for(i=this.length-1;i>=0;i--){this.words[i+s]=this.words[i];}for(i=0;i=0);var h;if(hint){h=(hint-hint%26)/26;}else{h=0;}var r=bits%26;var s=Math.min((bits-r)/26,this.length);var mask=0x3ffffff^0x3ffffff>>>r<s){this.length-=s;for(i=0;i=0&&(carry!==0||i>=h);i--){var word=this.words[i]|0;this.words[i]=carry<<26-r|word>>>r;carry=word&mask;}// Push carried bits as a mask -if(maskedWords&&carry!==0){maskedWords.words[maskedWords.length++]=carry;}if(this.length===0){this.words[0]=0;this.length=1;}return this.strip();};BN.prototype.ishrn=function ishrn(bits,hint,extended){// TODO(indutny): implement me -assert(this.negative===0);return this.iushrn(bits,hint,extended);};// Shift-left -BN.prototype.shln=function shln(bits){return this.clone().ishln(bits);};BN.prototype.ushln=function ushln(bits){return this.clone().iushln(bits);};// Shift-right -BN.prototype.shrn=function shrn(bits){return this.clone().ishrn(bits);};BN.prototype.ushrn=function ushrn(bits){return this.clone().iushrn(bits);};// Test if n bit is set -BN.prototype.testn=function testn(bit){assert(typeof bit==='number'&&bit>=0);var r=bit%26;var s=(bit-r)/26;var q=1<=0);var r=bits%26;var s=(bits-r)/26;assert(this.negative===0,'imaskn works only with positive numbers');if(this.length<=s){return this;}if(r!==0){s++;}this.length=Math.min(s,this.length);if(r!==0){var mask=0x3ffffff^0x3ffffff>>>r<=0x4000000;i++){this.words[i]-=0x4000000;if(i===this.length-1){this.words[i+1]=1;}else{this.words[i+1]++;}}this.length=Math.max(this.length,i+1);return this;};// Subtract plain number `num` from `this` -BN.prototype.isubn=function isubn(num){assert(typeof num==='number');assert(num<0x4000000);if(num<0)return this.iaddn(-num);if(this.negative!==0){this.negative=0;this.iaddn(num);this.negative=1;return this;}this.words[0]-=num;if(this.length===1&&this.words[0]<0){this.words[0]=-this.words[0];this.negative=1;}else{// Carry -for(var i=0;i>26)-(right/0x4000000|0);this.words[i+shift]=w&0x3ffffff;}for(;i>26;this.words[i+shift]=w&0x3ffffff;}if(carry===0)return this.strip();// Subtraction overflow -assert(carry===-1);carry=0;for(i=0;i>26;this.words[i]=w&0x3ffffff;}this.negative=1;return this.strip();};BN.prototype._wordDiv=function _wordDiv(num,mode){var shift=this.length-num.length;var a=this.clone();var b=num;// Normalize -var bhi=b.words[b.length-1]|0;var bhiBits=this._countBits(bhi);shift=26-bhiBits;if(shift!==0){b=b.ushln(shift);a.iushln(shift);bhi=b.words[b.length-1]|0;}// Initialize quotient -var m=a.length-b.length;var q;if(mode!=='mod'){q=new BN(null);q.length=m+1;q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=(a.words[b.length+j]|0)*0x4000000+(a.words[b.length+j-1]|0);// NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max -// (0x7ffffff) -qj=Math.min(qj/bhi|0,0x3ffffff);a._ishlnsubmul(b,qj,j);while(a.negative!==0){qj--;a.negative=0;a._ishlnsubmul(b,1,j);if(!a.isZero()){a.negative^=1;}}if(q){q.words[j]=qj;}}if(q){q.strip();}a.strip();// Denormalize -if(mode!=='div'&&shift!==0){a.iushrn(shift);}return{div:q||null,mod:a};};// NOTE: 1) `mode` can be set to `mod` to request mod only, -// to `div` to request div only, or be absent to -// request both div & mod -// 2) `positive` is true if unsigned mod is requested -BN.prototype.divmod=function divmod(num,mode,positive){assert(!num.isZero());if(this.isZero()){return{div:new BN(0),mod:new BN(0)};}var div,mod,res;if(this.negative!==0&&num.negative===0){res=this.neg().divmod(num,mode);if(mode!=='mod'){div=res.div.neg();}if(mode!=='div'){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.iadd(num);}}return{div:div,mod:mod};}if(this.negative===0&&num.negative!==0){res=this.divmod(num.neg(),mode);if(mode!=='mod'){div=res.div.neg();}return{div:div,mod:res.mod};}if((this.negative&num.negative)!==0){res=this.neg().divmod(num.neg(),mode);if(mode!=='div'){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.isub(num);}}return{div:res.div,mod:mod};}// Both numbers are positive at this point -// Strip both numbers to approximate shift value -if(num.length>this.length||this.cmp(num)<0){return{div:new BN(0),mod:this};}// Very short reduction -if(num.length===1){if(mode==='div'){return{div:this.divn(num.words[0]),mod:null};}if(mode==='mod'){return{div:null,mod:new BN(this.modn(num.words[0]))};}return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))};}return this._wordDiv(num,mode);};// Find `this` / `num` -BN.prototype.div=function div(num){return this.divmod(num,'div',false).div;};// Find `this` % `num` -BN.prototype.mod=function mod(num){return this.divmod(num,'mod',false).mod;};BN.prototype.umod=function umod(num){return this.divmod(num,'mod',true).mod;};// Find Round(`this` / `num`) -BN.prototype.divRound=function divRound(num){var dm=this.divmod(num);// Fast case - exact division -if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod;var half=num.ushrn(1);var r2=num.andln(1);var cmp=mod.cmp(half);// Round down -if(cmp<0||r2===1&&cmp===0)return dm.div;// Round up -return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1);};BN.prototype.modn=function modn(num){assert(num<=0x3ffffff);var p=(1<<26)%num;var acc=0;for(var i=this.length-1;i>=0;i--){acc=(p*acc+(this.words[i]|0))%num;}return acc;};// In-place division by number -BN.prototype.idivn=function idivn(num){assert(num<=0x3ffffff);var carry=0;for(var i=this.length-1;i>=0;i--){var w=(this.words[i]|0)+carry*0x4000000;this.words[i]=w/num|0;carry=w%num;}return this.strip();};BN.prototype.divn=function divn(num){return this.clone().idivn(num);};BN.prototype.egcd=function egcd(p){assert(p.negative===0);assert(!p.isZero());var x=this;var y=p.clone();if(x.negative!==0){x=x.umod(p);}else{x=x.clone();}// A * x + B * y = x -var A=new BN(1);var B=new BN(0);// C * x + D * y = y -var C=new BN(0);var D=new BN(1);var g=0;while(x.isEven()&&y.isEven()){x.iushrn(1);y.iushrn(1);++g;}var yp=y.clone();var xp=x.clone();while(!x.isZero()){for(var i=0,im=1;(x.words[0]&im)===0&&i<26;++i,im<<=1){;}if(i>0){x.iushrn(i);while(i-->0){if(A.isOdd()||B.isOdd()){A.iadd(yp);B.isub(xp);}A.iushrn(1);B.iushrn(1);}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1){;}if(j>0){y.iushrn(j);while(j-->0){if(C.isOdd()||D.isOdd()){C.iadd(yp);D.isub(xp);}C.iushrn(1);D.iushrn(1);}}if(x.cmp(y)>=0){x.isub(y);A.isub(C);B.isub(D);}else{y.isub(x);C.isub(A);D.isub(B);}}return{a:C,b:D,gcd:y.iushln(g)};};// This is reduced incarnation of the binary EEA -// above, designated to invert members of the -// _prime_ fields F(p) at a maximal speed -BN.prototype._invmp=function _invmp(p){assert(p.negative===0);assert(!p.isZero());var a=this;var b=p.clone();if(a.negative!==0){a=a.umod(p);}else{a=a.clone();}var x1=new BN(1);var x2=new BN(0);var delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i=0,im=1;(a.words[0]&im)===0&&i<26;++i,im<<=1){;}if(i>0){a.iushrn(i);while(i-->0){if(x1.isOdd()){x1.iadd(delta);}x1.iushrn(1);}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1){;}if(j>0){b.iushrn(j);while(j-->0){if(x2.isOdd()){x2.iadd(delta);}x2.iushrn(1);}}if(a.cmp(b)>=0){a.isub(b);x1.isub(x2);}else{b.isub(a);x2.isub(x1);}}var res;if(a.cmpn(1)===0){res=x1;}else{res=x2;}if(res.cmpn(0)<0){res.iadd(p);}return res;};BN.prototype.gcd=function gcd(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone();var b=num.clone();a.negative=0;b.negative=0;// Remove common factor of two -for(var shift=0;a.isEven()&&b.isEven();shift++){a.iushrn(1);b.iushrn(1);}do{while(a.isEven()){a.iushrn(1);}while(b.isEven()){b.iushrn(1);}var r=a.cmp(b);if(r<0){// Swap `a` and `b` to make `a` always bigger than `b` -var t=a;a=b;b=t;}else if(r===0||b.cmpn(1)===0){break;}a.isub(b);}while(true);return b.iushln(shift);};// Invert number in the field F(num) -BN.prototype.invm=function invm(num){return this.egcd(num).a.umod(num);};BN.prototype.isEven=function isEven(){return(this.words[0]&1)===0;};BN.prototype.isOdd=function isOdd(){return(this.words[0]&1)===1;};// And first word and num -BN.prototype.andln=function andln(num){return this.words[0]#};// Increment at the bit position in-line -BN.prototype.bincn=function bincn(bit){assert(typeof bit==='number');var r=bit%26;var s=(bit-r)/26;var q=1<>>26;w&=0x3ffffff;this.words[i]=w;}if(carry!==0){this.words[i]=carry;this.length++;}return this;};BN.prototype.isZero=function isZero(){return this.length===1&&this.words[0]===0;};BN.prototype.cmpn=function cmpn(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1){res=1;}else{if(negative){num=-num;}assert(num<=0x3ffffff,'Number is too big');var w=this.words[0]|0;res=w===num?0:w `num` -// 0 - if `this` == `num` -// -1 - if `this` < `num` -BN.prototype.cmp=function cmp(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res;};// Unsigned comparison -BN.prototype.ucmp=function ucmp(num){// At this point both numbers have the same sign -if(this.length>num.length)return 1;if(this.length=0;i--){var a=this.words[i]|0;var b=num.words[i]|0;if(a===b)continue;if(ab){res=1;}break;}return res;};BN.prototype.gtn=function gtn(num){return this.cmpn(num)===1;};BN.prototype.gt=function gt(num){return this.cmp(num)===1;};BN.prototype.gten=function gten(num){return this.cmpn(num)>=0;};BN.prototype.gte=function gte(num){return this.cmp(num)>=0;};BN.prototype.ltn=function ltn(num){return this.cmpn(num)===-1;};BN.prototype.lt=function lt(num){return this.cmp(num)===-1;};BN.prototype.lten=function lten(num){return this.cmpn(num)<=0;};BN.prototype.lte=function lte(num){return this.cmp(num)<=0;};BN.prototype.eqn=function eqn(num){return this.cmpn(num)===0;};BN.prototype.eq=function eq(num){return this.cmp(num)===0;};// -// A reduce context, could be using montgomery or something better, depending -// on the `m` itself. -// -BN.red=function red(num){return new Red(num);};BN.prototype.toRed=function toRed(ctx){assert(!this.red,'Already a number in reduction context');assert(this.negative===0,'red works only with positives');return ctx.convertTo(this)._forceRed(ctx);};BN.prototype.fromRed=function fromRed(){assert(this.red,'fromRed works only with numbers in reduction context');return this.red.convertFrom(this);};BN.prototype._forceRed=function _forceRed(ctx){this.red=ctx;return this;};BN.prototype.forceRed=function forceRed(ctx){assert(!this.red,'Already a number in reduction context');return this._forceRed(ctx);};BN.prototype.redAdd=function redAdd(num){assert(this.red,'redAdd works only with red numbers');return this.red.add(this,num);};BN.prototype.redIAdd=function redIAdd(num){assert(this.red,'redIAdd works only with red numbers');return this.red.iadd(this,num);};BN.prototype.redSub=function redSub(num){assert(this.red,'redSub works only with red numbers');return this.red.sub(this,num);};BN.prototype.redISub=function redISub(num){assert(this.red,'redISub works only with red numbers');return this.red.isub(this,num);};BN.prototype.redShl=function redShl(num){assert(this.red,'redShl works only with red numbers');return this.red.shl(this,num);};BN.prototype.redMul=function redMul(num){assert(this.red,'redMul works only with red numbers');this.red._verify2(this,num);return this.red.mul(this,num);};BN.prototype.redIMul=function redIMul(num){assert(this.red,'redMul works only with red numbers');this.red._verify2(this,num);return this.red.imul(this,num);};BN.prototype.redSqr=function redSqr(){assert(this.red,'redSqr works only with red numbers');this.red._verify1(this);return this.red.sqr(this);};BN.prototype.redISqr=function redISqr(){assert(this.red,'redISqr works only with red numbers');this.red._verify1(this);return this.red.isqr(this);};// Square root over p -BN.prototype.redSqrt=function redSqrt(){assert(this.red,'redSqrt works only with red numbers');this.red._verify1(this);return this.red.sqrt(this);};BN.prototype.redInvm=function redInvm(){assert(this.red,'redInvm works only with red numbers');this.red._verify1(this);return this.red.invm(this);};// Return negative clone of `this` % `red modulo` -BN.prototype.redNeg=function redNeg(){assert(this.red,'redNeg works only with red numbers');this.red._verify1(this);return this.red.neg(this);};BN.prototype.redPow=function redPow(num){assert(this.red&&!num.red,'redPow(normalNum)');this.red._verify1(this);return this.red.pow(this,num);};// Prime numbers with efficient reduction -var primes={k256:null,p224:null,p192:null,p25519:null};// Pseudo-Mersenne prime -function MPrime(name,p){// P = 2 ^ N - K -this.name=name;this.p=new BN(p,16);this.n=this.p.bitLength();this.k=new BN(1).iushln(this.n).isub(this.p);this.tmp=this._tmp();}MPrime.prototype._tmp=function _tmp(){var tmp=new BN(null);tmp.words=new Array(Math.ceil(this.n/13));return tmp;};MPrime.prototype.ireduce=function ireduce(num){// Assumes that `num` is less than `P^2` -// num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) -var r=num;var rlen;do{this.split(r,this.tmp);r=this.imulK(r);r=r.iadd(this.tmp);rlen=r.bitLength();}while(rlen>this.n);var cmp=rlen0){r.isub(this.p);}else{r.strip();}return r;};MPrime.prototype.split=function split(input,out){input.iushrn(this.n,0,out);};MPrime.prototype.imulK=function imulK(num){return num.imul(this.k);};function K256(){MPrime.call(this,'k256','ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');}inherits(K256,MPrime);K256.prototype.split=function split(input,output){// 256 = 9 * 26 + 22 -var mask=0x3fffff;var outLen=Math.min(input.length,9);for(var i=0;i>>22;prev=next;}prev>>>=22;input.words[i-10]=prev;if(prev===0&&input.length>10){input.length-=10;}else{input.length-=9;}};K256.prototype.imulK=function imulK(num){// K = 0x1000003d1 = [ 0x40, 0x3d1 ] -num.words[num.length]=0;num.words[num.length+1]=0;num.length+=2;// bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 -var lo=0;for(var i=0;i>>=26;num.words[i]=lo;carry=hi;}if(carry!==0){num.words[num.length++]=carry;}return num;};// Exported mostly for testing purposes, use plain name instead -BN._prime=function prime(name){// Cached version of prime -if(primes[name])return primes[name];var prime;if(name==='k256'){prime=new K256();}else if(name==='p224'){prime=new P224();}else if(name==='p192'){prime=new P192();}else if(name==='p25519'){prime=new P25519();}else{throw new Error('Unknown prime '+name);}primes[name]=prime;return prime;};// -// Base reduction engine -// -function Red(m){if(typeof m==='string'){var prime=BN._prime(m);this.m=prime.p;this.prime=prime;}else{assert(m.gtn(1),'modulus must be greater than 1');this.m=m;this.prime=null;}}Red.prototype._verify1=function _verify1(a){assert(a.negative===0,'red works only with positives');assert(a.red,'red works only with red numbers');};Red.prototype._verify2=function _verify2(a,b){assert((a.negative|b.negative)===0,'red works only with positives');assert(a.red&&a.red===b.red,'red works only with red numbers');};Red.prototype.imod=function imod(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this);};Red.prototype.neg=function neg(a){if(a.isZero()){return a.clone();}return this.m.sub(a)._forceRed(this);};Red.prototype.add=function add(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0){res.isub(this.m);}return res._forceRed(this);};Red.prototype.iadd=function iadd(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0){res.isub(this.m);}return res;};Red.prototype.sub=function sub(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0){res.iadd(this.m);}return res._forceRed(this);};Red.prototype.isub=function isub(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0){res.iadd(this.m);}return res;};Red.prototype.shl=function shl(a,num){this._verify1(a);return this.imod(a.ushln(num));};Red.prototype.imul=function imul(a,b){this._verify2(a,b);return this.imod(a.imul(b));};Red.prototype.mul=function mul(a,b){this._verify2(a,b);return this.imod(a.mul(b));};Red.prototype.isqr=function isqr(a){return this.imul(a,a.clone());};Red.prototype.sqr=function sqr(a){return this.mul(a,a);};Red.prototype.sqrt=function sqrt(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);assert(mod3%2===1);// Fast case -if(mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow);}// Tonelli-Shanks algorithm (Totally unoptimized and slow) -// -// Find Q and S, that Q * 2 ^ S = (P - 1) -var q=this.m.subn(1);var s=0;while(!q.isZero()&&q.andln(1)===0){s++;q.iushrn(1);}assert(!q.isZero());var one=new BN(1).toRed(this);var nOne=one.redNeg();// Find quadratic non-residue -// NOTE: Max is such because of generalized Riemann hypothesis. -var lpow=this.m.subn(1).iushrn(1);var z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0){z.redIAdd(nOne);}var c=this.pow(z,q);var r=this.pow(a,q.addn(1).iushrn(1));var t=this.pow(a,q);var m=s;while(t.cmp(one)!==0){var tmp=t;for(var i=0;tmp.cmp(one)!==0;i++){tmp=tmp.redSqr();}assert(i=0;i--){var word=num.words[i];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0]){res=this.sqr(res);}if(bit===0&¤t===0){currentLen=0;continue;}current<<=1;current|=bit;currentLen++;if(currentLen!==windowSize&&(i!==0||j!==0))continue;res=this.mul(res,wnd[current]);currentLen=0;current=0;}start=26;}return res;};Red.prototype.convertTo=function convertTo(num){var r=num.umod(this.m);return r===num?r.clone():r;};Red.prototype.convertFrom=function convertFrom(num){var res=num.clone();res.red=null;return res;};// -// Montgomery method engine -// -BN.mont=function mont(num){return new Mont(num);};function Mont(m){Red.call(this,m);this.shift=this.m.bitLength();if(this.shift%26!==0){this.shift+=26-this.shift%26;}this.r=new BN(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);}inherits(Mont,Red);Mont.prototype.convertTo=function convertTo(num){return this.imod(num.ushln(this.shift));};Mont.prototype.convertFrom=function convertFrom(num){var r=this.imod(num.mul(this.rinv));r.red=null;return r;};Mont.prototype.imul=function imul(a,b){if(a.isZero()||b.isZero()){a.words[0]=0;a.length=1;return a;}var t=a.imul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m);}else if(u.cmpn(0)<0){res=u.iadd(this.m);}return res._forceRed(this);};Mont.prototype.mul=function mul(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m);}else if(u.cmpn(0)<0){res=u.iadd(this.m);}return res._forceRed(this);};Mont.prototype.invm=function invm(a){// (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R -var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this);};})( false||module,this);/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./node_modules/brorand/index.js":/*!***************************************!*\ - !*** ./node_modules/brorand/index.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesBrorandIndexJs(module,exports,__webpack_require__){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var r;module.exports=function rand(len){if(!r)r=new Rand(null);return r.generate(len);};function Rand(rand){this.rand=rand;}module.exports.Rand=Rand;Rand.prototype.generate=function generate(len){return this._rand(len);};// Emulate crypto API using randy -Rand.prototype._rand=function _rand(n){if(this.rand.getBytes)return this.rand.getBytes(n);var res=new Uint8Array(n);for(var i=0;i>>24]^SUB_MIX1[s1>>>16&0xff]^SUB_MIX2[s2>>>8&0xff]^SUB_MIX3[s3&0xff]^keySchedule[ksRow++];t1=SUB_MIX0[s1>>>24]^SUB_MIX1[s2>>>16&0xff]^SUB_MIX2[s3>>>8&0xff]^SUB_MIX3[s0&0xff]^keySchedule[ksRow++];t2=SUB_MIX0[s2>>>24]^SUB_MIX1[s3>>>16&0xff]^SUB_MIX2[s0>>>8&0xff]^SUB_MIX3[s1&0xff]^keySchedule[ksRow++];t3=SUB_MIX0[s3>>>24]^SUB_MIX1[s0>>>16&0xff]^SUB_MIX2[s1>>>8&0xff]^SUB_MIX3[s2&0xff]^keySchedule[ksRow++];s0=t0;s1=t1;s2=t2;s3=t3;}t0=(SBOX[s0>>>24]<<24|SBOX[s1>>>16&0xff]<<16|SBOX[s2>>>8&0xff]<<8|SBOX[s3&0xff])^keySchedule[ksRow++];t1=(SBOX[s1>>>24]<<24|SBOX[s2>>>16&0xff]<<16|SBOX[s3>>>8&0xff]<<8|SBOX[s0&0xff])^keySchedule[ksRow++];t2=(SBOX[s2>>>24]<<24|SBOX[s3>>>16&0xff]<<16|SBOX[s0>>>8&0xff]<<8|SBOX[s1&0xff])^keySchedule[ksRow++];t3=(SBOX[s3>>>24]<<24|SBOX[s0>>>16&0xff]<<16|SBOX[s1>>>8&0xff]<<8|SBOX[s2&0xff])^keySchedule[ksRow++];t0=t0>>>0;t1=t1>>>0;t2=t2>>>0;t3=t3>>>0;return[t0,t1,t2,t3];}// AES constants -var RCON=[0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x1b,0x36];var G=function(){// Compute double table -var d=new Array(256);for(var j=0;j<256;j++){if(j<128){d[j]=j<<1;}else{d[j]=j<<1^0x11b;}}var SBOX=[];var INV_SBOX=[];var SUB_MIX=[[],[],[],[]];var INV_SUB_MIX=[[],[],[],[]];// Walk GF(2^8) -var x=0;var xi=0;for(var i=0;i<256;++i){// Compute sbox -var sx=xi^xi<<1^xi<<2^xi<<3^xi<<4;sx=sx>>>8^sx&0xff^0x63;SBOX[x]=sx;INV_SBOX[sx]=x;// Compute multiplication -var x2=d[x];var x4=d[x2];var x8=d[x4];// Compute sub bytes, mix columns tables -var t=d[sx]*0x101^sx*0x1010100;SUB_MIX[0][x]=t<<24|t>>>8;SUB_MIX[1][x]=t<<16|t>>>16;SUB_MIX[2][x]=t<<8|t>>>24;SUB_MIX[3][x]=t;// Compute inv sub bytes, inv mix columns tables -t=x8*0x1010101^x4*0x10001^x2*0x101^x*0x1010100;INV_SUB_MIX[0][sx]=t<<24|t>>>8;INV_SUB_MIX[1][sx]=t<<16|t>>>16;INV_SUB_MIX[2][sx]=t<<8|t>>>24;INV_SUB_MIX[3][sx]=t;if(x===0){x=xi=1;}else{x=x2^d[d[d[x8^x2]]];xi^=d[d[xi]];}}return{SBOX:SBOX,INV_SBOX:INV_SBOX,SUB_MIX:SUB_MIX,INV_SUB_MIX:INV_SUB_MIX};}();function AES(key){this._key=asUInt32Array(key);this._reset();}AES.blockSize=4*4;AES.keySize=256/8;AES.prototype.blockSize=AES.blockSize;AES.prototype.keySize=AES.keySize;AES.prototype._reset=function(){var keyWords=this._key;var keySize=keyWords.length;var nRounds=keySize+6;var ksRows=(nRounds+1)*4;var keySchedule=[];for(var k=0;k>>24;t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&0xff]<<16|G.SBOX[t>>>8&0xff]<<8|G.SBOX[t&0xff];t^=RCON[k/keySize|0]<<24;}else if(keySize>6&&k%keySize===4){t=G.SBOX[t>>>24]<<24|G.SBOX[t>>>16&0xff]<<16|G.SBOX[t>>>8&0xff]<<8|G.SBOX[t&0xff];}keySchedule[k]=keySchedule[k-keySize]^t;}var invKeySchedule=[];for(var ik=0;ik>>24]]^G.INV_SUB_MIX[1][G.SBOX[tt>>>16&0xff]]^G.INV_SUB_MIX[2][G.SBOX[tt>>>8&0xff]]^G.INV_SUB_MIX[3][G.SBOX[tt&0xff]];}}this._nRounds=nRounds;this._keySchedule=keySchedule;this._invKeySchedule=invKeySchedule;};AES.prototype.encryptBlockRaw=function(M){M=asUInt32Array(M);return cryptBlock(M,this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds);};AES.prototype.encryptBlock=function(M){var out=this.encryptBlockRaw(M);var buf=Buffer.allocUnsafe(16);buf.writeUInt32BE(out[0],0);buf.writeUInt32BE(out[1],4);buf.writeUInt32BE(out[2],8);buf.writeUInt32BE(out[3],12);return buf;};AES.prototype.decryptBlock=function(M){M=asUInt32Array(M);// swap -var m1=M[1];M[1]=M[3];M[3]=m1;var out=cryptBlock(M,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds);var buf=Buffer.allocUnsafe(16);buf.writeUInt32BE(out[0],0);buf.writeUInt32BE(out[3],4);buf.writeUInt32BE(out[2],8);buf.writeUInt32BE(out[1],12);return buf;};AES.prototype.scrub=function(){scrubVec(this._keySchedule);scrubVec(this._invKeySchedule);scrubVec(this._key);};module.exports.AES=AES;/***/},/***/"./node_modules/browserify-aes/authCipher.js":/*!***************************************************!*\ - !*** ./node_modules/browserify-aes/authCipher.js ***! - \***************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifyAesAuthCipherJs(module,exports,__webpack_require__){var aes=__webpack_require__(/*! ./aes */"./node_modules/browserify-aes/aes.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var Transform=__webpack_require__(/*! cipher-base */"./node_modules/cipher-base/index.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var GHASH=__webpack_require__(/*! ./ghash */"./node_modules/browserify-aes/ghash.js");var xor=__webpack_require__(/*! buffer-xor */"./node_modules/buffer-xor/index.js");var incr32=__webpack_require__(/*! ./incr32 */"./node_modules/browserify-aes/incr32.js");function xorTest(a,b){var out=0;if(a.length!==b.length)out++;var len=Math.min(a.length,b.length);for(var i=0;i16){out=this.cache.slice(0,16);this.cache=this.cache.slice(16);return out;}}else{if(this.cache.length>=16){out=this.cache.slice(0,16);this.cache=this.cache.slice(16);return out;}}return null;};Splitter.prototype.flush=function(){if(this.cache.length)return this.cache;};function unpad(last){var padded=last[15];if(padded<1||padded>16){throw new Error('unable to decrypt data');}var i=-1;while(++i15){var out=this.cache.slice(0,16);this.cache=this.cache.slice(16);return out;}return null;};Splitter.prototype.flush=function(){var len=16-this.cache.length;var padBuff=Buffer.allocUnsafe(len);var i=-1;while(++i>>0,0);buf.writeUInt32BE(out[1]>>>0,4);buf.writeUInt32BE(out[2]>>>0,8);buf.writeUInt32BE(out[3]>>>0,12);return buf;}function GHASH(key){this.h=key;this.state=Buffer.alloc(16,0);this.cache=Buffer.allocUnsafe(0);}// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html -// by Juho Vähä-Herttua -GHASH.prototype.ghash=function(block){var i=-1;while(++i> 1 -for(j=3;j>0;j--){Vi[j]=Vi[j]>>>1|(Vi[j-1]&1)<<31;}Vi[0]=Vi[0]>>>1;// If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R -if(lsbVi){Vi[0]=Vi[0]^0xe1<<24;}}this.state=fromArray(Zi);};GHASH.prototype.update=function(buf){this.cache=Buffer.concat([this.cache,buf]);var chunk;while(this.cache.length>=16){chunk=this.cache.slice(0,16);this.cache=this.cache.slice(16);this.ghash(chunk);}};GHASH.prototype.final=function(abl,bl){if(this.cache.length){this.ghash(Buffer.concat([this.cache,ZEROES],16));}this.ghash(fromArray([0,abl,0,bl]));return this.state;};module.exports=GHASH;/***/},/***/"./node_modules/browserify-aes/incr32.js":/*!***********************************************!*\ - !*** ./node_modules/browserify-aes/incr32.js ***! - \***********************************************/ /*! no static exports found */ /***/function node_modulesBrowserifyAesIncr32Js(module,exports){function incr32(iv){var len=iv.length;var item;while(len--){item=iv.readUInt8(len);if(item===255){iv.writeUInt8(0,len);}else{item++;iv.writeUInt8(item,len);break;}}}module.exports=incr32;/***/},/***/"./node_modules/browserify-aes/modes/cbc.js":/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cbc.js ***! - \**************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifyAesModesCbcJs(module,exports,__webpack_require__){var xor=__webpack_require__(/*! buffer-xor */"./node_modules/buffer-xor/index.js");exports.encrypt=function(self,block){var data=xor(block,self._prev);self._prev=self._cipher.encryptBlock(data);return self._prev;};exports.decrypt=function(self,block){var pad=self._prev;self._prev=block;var out=self._cipher.decryptBlock(block);return xor(out,pad);};/***/},/***/"./node_modules/browserify-aes/modes/cfb.js":/*!**************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cfb.js ***! - \**************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifyAesModesCfbJs(module,exports,__webpack_require__){var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var xor=__webpack_require__(/*! buffer-xor */"./node_modules/buffer-xor/index.js");function encryptStart(self,data,decrypt){var len=data.length;var out=xor(data,self._cache);self._cache=self._cache.slice(len);self._prev=Buffer.concat([self._prev,decrypt?data:out]);return out;}exports.encrypt=function(self,data,decrypt){var out=Buffer.allocUnsafe(0);var len;while(data.length){if(self._cache.length===0){self._cache=self._cipher.encryptBlock(self._prev);self._prev=Buffer.allocUnsafe(0);}if(self._cache.length<=data.length){len=self._cache.length;out=Buffer.concat([out,encryptStart(self,data.slice(0,len),decrypt)]);data=data.slice(len);}else{out=Buffer.concat([out,encryptStart(self,data,decrypt)]);break;}}return out;};/***/},/***/"./node_modules/browserify-aes/modes/cfb1.js":/*!***************************************************!*\ - !*** ./node_modules/browserify-aes/modes/cfb1.js ***! - \***************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifyAesModesCfb1Js(module,exports,__webpack_require__){var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;function encryptByte(self,byteParam,decrypt){var pad;var i=-1;var len=8;var out=0;var bit,value;while(++i>i%8;self._prev=shiftIn(self._prev,decrypt?bit:value);}return out;}function shiftIn(buffer,value){var len=buffer.length;var i=-1;var out=Buffer.allocUnsafe(buffer.length);buffer=Buffer.concat([buffer,Buffer.from([value])]);while(++i>7;}return out;}exports.encrypt=function(self,chunk,decrypt){var len=chunk.length;var out=Buffer.allocUnsafe(len);var i=-1;while(++i=0||!r.umod(priv.prime1)||!r.umod(priv.prime2)){r=new bn(randomBytes(len));}return r;}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/browserify-sign/algos.js":/*!***********************************************!*\ - !*** ./node_modules/browserify-sign/algos.js ***! - \***********************************************/ /*! no static exports found */ /***/function node_modulesBrowserifySignAlgosJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! ./browser/algorithms.json */"./node_modules/browserify-sign/browser/algorithms.json");/***/},/***/"./node_modules/browserify-sign/browser/algorithms.json":/*!**************************************************************!*\ - !*** ./node_modules/browserify-sign/browser/algorithms.json ***! - \**************************************************************/ /*! exports provided: sha224WithRSAEncryption, RSA-SHA224, sha256WithRSAEncryption, RSA-SHA256, sha384WithRSAEncryption, RSA-SHA384, sha512WithRSAEncryption, RSA-SHA512, RSA-SHA1, ecdsa-with-SHA1, sha256, sha224, sha384, sha512, DSA-SHA, DSA-SHA1, DSA, DSA-WITH-SHA224, DSA-SHA224, DSA-WITH-SHA256, DSA-SHA256, DSA-WITH-SHA384, DSA-SHA384, DSA-WITH-SHA512, DSA-SHA512, DSA-RIPEMD160, ripemd160WithRSA, RSA-RIPEMD160, md5WithRSAEncryption, RSA-MD5, default */ /***/function node_modulesBrowserifySignBrowserAlgorithmsJson(module){module.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\"}}");/***/},/***/"./node_modules/browserify-sign/browser/curves.json":/*!**********************************************************!*\ - !*** ./node_modules/browserify-sign/browser/curves.json ***! - \**********************************************************/ /*! exports provided: 1.3.132.0.10, 1.3.132.0.33, 1.2.840.10045.3.1.1, 1.2.840.10045.3.1.7, 1.3.132.0.34, 1.3.132.0.35, default */ /***/function node_modulesBrowserifySignBrowserCurvesJson(module){module.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\"}");/***/},/***/"./node_modules/browserify-sign/browser/index.js":/*!*******************************************************!*\ - !*** ./node_modules/browserify-sign/browser/index.js ***! - \*******************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifySignBrowserIndexJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(Buffer){var createHash=__webpack_require__(/*! create-hash */"./node_modules/create-hash/browser.js");var stream=__webpack_require__(/*! stream */"./node_modules/stream-browserify/index.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var sign=__webpack_require__(/*! ./sign */"./node_modules/browserify-sign/browser/sign.js");var verify=__webpack_require__(/*! ./verify */"./node_modules/browserify-sign/browser/verify.js");var algorithms=__webpack_require__(/*! ./algorithms.json */"./node_modules/browserify-sign/browser/algorithms.json");Object.keys(algorithms).forEach(function(key){algorithms[key].id=new Buffer(algorithms[key].id,'hex');algorithms[key.toLowerCase()]=algorithms[key];});function Sign(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error('Unknown message digest');this._hashType=data.hash;this._hash=createHash(data.hash);this._tag=data.id;this._signType=data.sign;}inherits(Sign,stream.Writable);Sign.prototype._write=function _write(data,_,done){this._hash.update(data);done();};Sign.prototype.update=function update(data,enc){if(typeof data==='string')data=new Buffer(data,enc);this._hash.update(data);return this;};Sign.prototype.sign=function signMethod(key,enc){this.end();var hash=this._hash.digest();var sig=sign(hash,key,this._hashType,this._signType,this._tag);return enc?sig.toString(enc):sig;};function Verify(algorithm){stream.Writable.call(this);var data=algorithms[algorithm];if(!data)throw new Error('Unknown message digest');this._hash=createHash(data.hash);this._tag=data.id;this._signType=data.sign;}inherits(Verify,stream.Writable);Verify.prototype._write=function _write(data,_,done){this._hash.update(data);done();};Verify.prototype.update=function update(data,enc){if(typeof data==='string')data=new Buffer(data,enc);this._hash.update(data);return this;};Verify.prototype.verify=function verifyMethod(key,sig,enc){if(typeof sig==='string')sig=new Buffer(sig,enc);this.end();var hash=this._hash.digest();return verify(sig,hash,key,this._signType,this._tag);};function createSign(algorithm){return new Sign(algorithm);}function createVerify(algorithm){return new Verify(algorithm);}module.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify};/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/browserify-sign/browser/sign.js":/*!******************************************************!*\ - !*** ./node_modules/browserify-sign/browser/sign.js ***! - \******************************************************/ /*! no static exports found */ /***/function node_modulesBrowserifySignBrowserSignJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(Buffer){// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js -var createHmac=__webpack_require__(/*! create-hmac */"./node_modules/create-hmac/browser.js");var crt=__webpack_require__(/*! browserify-rsa */"./node_modules/browserify-rsa/index.js");var EC=__webpack_require__(/*! elliptic */"./node_modules/elliptic/lib/elliptic.js").ec;var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var parseKeys=__webpack_require__(/*! parse-asn1 */"./node_modules/parse-asn1/index.js");var curves=__webpack_require__(/*! ./curves.json */"./node_modules/browserify-sign/browser/curves.json");function sign(hash,key,hashType,signType,tag){var priv=parseKeys(key);if(priv.curve){// rsa keys can be interpreted as ecdsa ones in openssl -if(signType!=='ecdsa'&&signType!=='ecdsa/rsa')throw new Error('wrong private key type');return ecSign(hash,priv);}else if(priv.type==='dsa'){if(signType!=='dsa')throw new Error('wrong private key type');return dsaSign(hash,priv,hashType);}else{if(signType!=='rsa'&&signType!=='ecdsa/rsa')throw new Error('wrong private key type');}hash=Buffer.concat([tag,hash]);var len=priv.modulus.byteLength();var pad=[0,1];while(hash.length+pad.length+10)bits.ishrn(shift);return bits;}function bits2octets(bits,q){bits=bits2int(bits,q);bits=bits.mod(q);var out=new Buffer(bits.toArray());if(out.length=q)throw new Error('invalid sig');}module.exports=verify;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/buffer-xor/index.js":/*!******************************************!*\ - !*** ./node_modules/buffer-xor/index.js ***! - \******************************************/ /*! no static exports found */ /***/function node_modulesBufferXorIndexJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(Buffer){module.exports=function xor(a,b){var length=Math.min(a.length,b.length);var buffer=new Buffer(length);for(var i=0;iblocksize){var hash=alg==='rmd160'?new RIPEMD160():sha(alg);key=hash.update(key).digest();}else if(key.lengthblocksize){key=alg(key);}else if(key.length0;count--){inputOff+=this._buffer(data,inputOff);outputOff+=this._flushBuffer(out,outputOff);}// Buffer rest of the input -inputOff+=this._buffer(data,inputOff);return out;};Cipher.prototype.final=function final(buffer){var first;if(buffer)first=this.update(buffer);var last;if(this.type==='encrypt')last=this._finalEncrypt();else last=this._finalDecrypt();if(first)return first.concat(last);else return last;};Cipher.prototype._pad=function _pad(buffer,off){if(off===0)return false;while(off>>1];kL=utils.r28shl(kL,shift);kR=utils.r28shl(kR,shift);utils.pc2(kL,kR,state.keys,i);}};DES.prototype._update=function _update(inp,inOff,out,outOff){var state=this._desState;var l=utils.readUInt32BE(inp,inOff);var r=utils.readUInt32BE(inp,inOff+4);// Initial Permutation -utils.ip(l,r,state.tmp,0);l=state.tmp[0];r=state.tmp[1];if(this.type==='encrypt')this._encrypt(state,l,r,state.tmp,0);else this._decrypt(state,l,r,state.tmp,0);l=state.tmp[0];r=state.tmp[1];utils.writeUInt32BE(out,l,outOff);utils.writeUInt32BE(out,r,outOff+4);};DES.prototype._pad=function _pad(buffer,off){var value=buffer.length-off;for(var i=off;i>>0;l=t;}// Reverse Initial Permutation -utils.rip(r,l,out,off);};DES.prototype._decrypt=function _decrypt(state,lStart,rStart,out,off){var l=rStart;var r=lStart;// Apply f() x16 times -for(var i=state.keys.length-2;i>=0;i-=2){var keyL=state.keys[i];var keyR=state.keys[i+1];// f(r, k) -utils.expand(l,state.tmp,0);keyL^=state.tmp[0];keyR^=state.tmp[1];var s=utils.substitute(keyL,keyR);var f=utils.permute(s);var t=l;l=(r^f)>>>0;r=t;}// Reverse Initial Permutation -utils.rip(l,r,out,off);};/***/},/***/"./node_modules/des.js/lib/des/ede.js":/*!********************************************!*\ - !*** ./node_modules/des.js/lib/des/ede.js ***! - \********************************************/ /*! no static exports found */ /***/function node_modulesDesJsLibDesEdeJs(module,exports,__webpack_require__){"use strict";var assert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Cipher=__webpack_require__(/*! ./cipher */"./node_modules/des.js/lib/des/cipher.js");var DES=__webpack_require__(/*! ./des */"./node_modules/des.js/lib/des/des.js");function EDEState(type,key){assert.equal(key.length,24,'Invalid key length');var k1=key.slice(0,8);var k2=key.slice(8,16);var k3=key.slice(16,24);if(type==='encrypt'){this.ciphers=[DES.create({type:'encrypt',key:k1}),DES.create({type:'decrypt',key:k2}),DES.create({type:'encrypt',key:k3})];}else{this.ciphers=[DES.create({type:'decrypt',key:k3}),DES.create({type:'encrypt',key:k2}),DES.create({type:'decrypt',key:k1})];}}function EDE(options){Cipher.call(this,options);var state=new EDEState(this.type,this.options.key);this._edeState=state;}inherits(EDE,Cipher);module.exports=EDE;EDE.create=function create(options){return new EDE(options);};EDE.prototype._update=function _update(inp,inOff,out,outOff){var state=this._edeState;state.ciphers[0]._update(inp,inOff,out,outOff);state.ciphers[1]._update(out,outOff,out,outOff);state.ciphers[2]._update(out,outOff,out,outOff);};EDE.prototype._pad=DES.prototype._pad;EDE.prototype._unpad=DES.prototype._unpad;/***/},/***/"./node_modules/des.js/lib/des/utils.js":/*!**********************************************!*\ - !*** ./node_modules/des.js/lib/des/utils.js ***! - \**********************************************/ /*! no static exports found */ /***/function node_modulesDesJsLibDesUtilsJs(module,exports,__webpack_require__){"use strict";exports.readUInt32BE=function readUInt32BE(bytes,off){var res=bytes[0+off]<<24|bytes[1+off]<<16|bytes[2+off]<<8|bytes[3+off];return res>>>0;};exports.writeUInt32BE=function writeUInt32BE(bytes,value,off){bytes[0+off]=value>>>24;bytes[1+off]=value>>>16&0xff;bytes[2+off]=value>>>8&0xff;bytes[3+off]=value&0xff;};exports.ip=function ip(inL,inR,out,off){var outL=0;var outR=0;for(var i=6;i>=0;i-=2){for(var j=0;j<=24;j+=8){outL<<=1;outL|=inR>>>j+i&1;}for(var j=0;j<=24;j+=8){outL<<=1;outL|=inL>>>j+i&1;}}for(var i=6;i>=0;i-=2){for(var j=1;j<=25;j+=8){outR<<=1;outR|=inR>>>j+i&1;}for(var j=1;j<=25;j+=8){outR<<=1;outR|=inL>>>j+i&1;}}out[off+0]=outL>>>0;out[off+1]=outR>>>0;};exports.rip=function rip(inL,inR,out,off){var outL=0;var outR=0;for(var i=0;i<4;i++){for(var j=24;j>=0;j-=8){outL<<=1;outL|=inR>>>j+i&1;outL<<=1;outL|=inL>>>j+i&1;}}for(var i=4;i<8;i++){for(var j=24;j>=0;j-=8){outR<<=1;outR|=inR>>>j+i&1;outR<<=1;outR|=inL>>>j+i&1;}}out[off+0]=outL>>>0;out[off+1]=outR>>>0;};exports.pc1=function pc1(inL,inR,out,off){var outL=0;var outR=0;// 7, 15, 23, 31, 39, 47, 55, 63 -// 6, 14, 22, 30, 39, 47, 55, 63 -// 5, 13, 21, 29, 39, 47, 55, 63 -// 4, 12, 20, 28 -for(var i=7;i>=5;i--){for(var j=0;j<=24;j+=8){outL<<=1;outL|=inR>>j+i&1;}for(var j=0;j<=24;j+=8){outL<<=1;outL|=inL>>j+i&1;}}for(var j=0;j<=24;j+=8){outL<<=1;outL|=inR>>j+i&1;}// 1, 9, 17, 25, 33, 41, 49, 57 -// 2, 10, 18, 26, 34, 42, 50, 58 -// 3, 11, 19, 27, 35, 43, 51, 59 -// 36, 44, 52, 60 -for(var i=1;i<=3;i++){for(var j=0;j<=24;j+=8){outR<<=1;outR|=inR>>j+i&1;}for(var j=0;j<=24;j+=8){outR<<=1;outR|=inL>>j+i&1;}}for(var j=0;j<=24;j+=8){outR<<=1;outR|=inL>>j+i&1;}out[off+0]=outL>>>0;out[off+1]=outR>>>0;};exports.r28shl=function r28shl(num,shift){return num<>>28-shift;};var pc2table=[// inL => outL -14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,// inR => outR -15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];exports.pc2=function pc2(inL,inR,out,off){var outL=0;var outR=0;var len=pc2table.length>>>1;for(var i=0;i>>pc2table[i]&0x1;}for(var i=len;i>>pc2table[i]&0x1;}out[off+0]=outL>>>0;out[off+1]=outR>>>0;};exports.expand=function expand(r,out,off){var outL=0;var outR=0;outL=(r&1)<<5|r>>>27;for(var i=23;i>=15;i-=4){outL<<=6;outL|=r>>>i&0x3f;}for(var i=11;i>=3;i-=4){outR|=r>>>i&0x3f;outR<<=6;}outR|=(r&0x1f)<<1|r>>>31;out[off+0]=outL>>>0;out[off+1]=outR>>>0;};var sTable=[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];exports.substitute=function substitute(inL,inR){var out=0;for(var i=0;i<4;i++){var b=inL>>>18-i*6&0x3f;var sb=sTable[i*0x40+b];out<<=4;out|=sb;}for(var i=0;i<4;i++){var b=inR>>>18-i*6&0x3f;var sb=sTable[4*0x40+i*0x40+b];out<<=4;out|=sb;}return out>>>0;};var permuteTable=[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];exports.permute=function permute(num){var out=0;for(var i=0;i>>permuteTable[i]&0x1;}return out>>>0;};exports.padSplit=function padSplit(num,size,group){var str=num.toString(2);while(str.lengthbits){num.ishrn(1);}if(num.isEven()){num.iadd(ONE);}if(!num.testn(1)){num.iadd(TWO);}if(!gen.cmp(TWO)){while(num.mod(TWENTYFOUR).cmp(ELEVEN)){num.iadd(FOUR);}}else if(!gen.cmp(FIVE)){while(num.mod(TEN).cmp(THREE)){num.iadd(FOUR);}}n2=num.shrn(1);if(simpleSieve(n2)&&simpleSieve(num)&&fermatTest(n2)&&fermatTest(num)&&millerRabin.test(n2)&&millerRabin.test(num)){return num;}}}/***/},/***/"./node_modules/diffie-hellman/lib/primes.json":/*!*****************************************************!*\ - !*** ./node_modules/diffie-hellman/lib/primes.json ***! - \*****************************************************/ /*! exports provided: modp1, modp2, modp5, modp14, modp15, modp16, modp17, modp18, default */ /***/function node_modulesDiffieHellmanLibPrimesJson(module){module.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\"}}");/***/},/***/"./node_modules/elliptic/lib/elliptic.js":/*!***********************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic.js ***! - \***********************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticJs(module,exports,__webpack_require__){"use strict";var elliptic=exports;elliptic.version=__webpack_require__(/*! ../package.json */"./node_modules/elliptic/package.json").version;elliptic.utils=__webpack_require__(/*! ./elliptic/utils */"./node_modules/elliptic/lib/elliptic/utils.js");elliptic.rand=__webpack_require__(/*! brorand */"./node_modules/brorand/index.js");elliptic.curve=__webpack_require__(/*! ./elliptic/curve */"./node_modules/elliptic/lib/elliptic/curve/index.js");elliptic.curves=__webpack_require__(/*! ./elliptic/curves */"./node_modules/elliptic/lib/elliptic/curves.js");// Protocols -elliptic.ec=__webpack_require__(/*! ./elliptic/ec */"./node_modules/elliptic/lib/elliptic/ec/index.js");elliptic.eddsa=__webpack_require__(/*! ./elliptic/eddsa */"./node_modules/elliptic/lib/elliptic/eddsa/index.js");/***/},/***/"./node_modules/elliptic/lib/elliptic/curve/base.js":/*!**********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticCurveBaseJs(module,exports,__webpack_require__){"use strict";var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var getNAF=utils.getNAF;var getJSF=utils.getJSF;var assert=utils.assert;function BaseCurve(type,conf){this.type=type;this.p=new BN(conf.p,16);// Use Montgomery, when there is no fast reduction for the prime -this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p);// Useful for many curves -this.zero=new BN(0).toRed(this.red);this.one=new BN(1).toRed(this.red);this.two=new BN(2).toRed(this.red);// Curve configuration, optional -this.n=conf.n&&new BN(conf.n,16);this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed);// Temporary arrays -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;// Generalized Greg Maxwell's trick -var adjustCount=this.n&&this.p.div(this.n);if(!adjustCount||adjustCount.cmpn(100)>0){this.redN=null;}else{this._maxwellTrick=true;this.redN=this.n.toRed(this.red);}}module.exports=BaseCurve;BaseCurve.prototype.point=function point(){throw new Error('Not implemented');};BaseCurve.prototype.validate=function validate(){throw new Error('Not implemented');};BaseCurve.prototype._fixedNafMul=function _fixedNafMul(p,k){assert(p.precomputed);var doubles=p._getDoubles();var naf=getNAF(k,1,this._bitLength);var I=(1<=j;k--){nafW=(nafW<<1)+naf[k];}repr.push(nafW);}var a=this.jpoint(null,null,null);var b=this.jpoint(null,null,null);for(var i=I;i>0;i--){for(var j=0;j=0;i--){// Count zeroes -for(var k=0;i>=0&&naf[i]===0;i--){k++;}if(i>=0)k++;acc=acc.dblp(k);if(i<0)break;var z=naf[i];assert(z!==0);if(p.type==='affine'){// J +- P -if(z>0)acc=acc.mixedAdd(wnd[z-1>>1]);else acc=acc.mixedAdd(wnd[-z-1>>1].neg());}else{// J +- J -if(z>0)acc=acc.add(wnd[z-1>>1]);else acc=acc.add(wnd[-z-1>>1].neg());}}return p.type==='affine'?acc.toP():acc;};BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(defW,points,coeffs,len,jacobianResult){var wndWidth=this._wnafT1;var wnd=this._wnafT2;var naf=this._wnafT3;// Fill all arrays -var max=0;for(var i=0;i=1;i-=2){var a=i-1;var b=i;if(wndWidth[a]!==1||wndWidth[b]!==1){naf[a]=getNAF(coeffs[a],wndWidth[a],this._bitLength);naf[b]=getNAF(coeffs[b],wndWidth[b],this._bitLength);max=Math.max(naf[a].length,max);max=Math.max(naf[b].length,max);continue;}var comb=[points[a],/* 1 */null,/* 3 */null,/* 5 */points[b]/* 7 */];// Try to avoid Projective points, if possible -if(points[a].y.cmp(points[b].y)===0){comb[1]=points[a].add(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg());}else if(points[a].y.cmp(points[b].y.redNeg())===0){comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].add(points[b].neg());}else{comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg());}var index=[-3,/* -1 -1 */-1,/* -1 0 */-5,/* -1 1 */-7,/* 0 -1 */0,/* 0 0 */7,/* 0 1 */5,/* 1 -1 */1,/* 1 0 */3/* 1 1 */];var jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max);naf[a]=new Array(max);naf[b]=new Array(max);for(var j=0;j=0;i--){var k=0;while(i>=0){var zero=true;for(var j=0;j=0)k++;acc=acc.dblp(k);if(i<0)break;for(var j=0;j0)p=wnd[j][z-1>>1];else if(z<0)p=wnd[j][-z-1>>1].neg();if(p.type==='affine')acc=acc.mixedAdd(p);else acc=acc.add(p);}}// Zeroify references -for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step);};BasePoint.prototype._getDoubles=function _getDoubles(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var doubles=[this];var acc=this;for(var i=0;i';return'';};Point.prototype.isInfinity=function isInfinity(){// XXX This code assumes that zero is always zero in red -return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0);};Point.prototype._extDbl=function _extDbl(){// hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html -// #doubling-dbl-2008-hwcd -// 4M + 4S -// A = X1^2 -var a=this.x.redSqr();// B = Y1^2 -var b=this.y.redSqr();// C = 2 * Z1^2 -var c=this.z.redSqr();c=c.redIAdd(c);// D = a * A -var d=this.curve._mulA(a);// E = (X1 + Y1)^2 - A - B -var e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);// G = D + B -var g=d.redAdd(b);// F = G - C -var f=g.redSub(c);// H = D - B -var h=d.redSub(b);// X3 = E * F -var nx=e.redMul(f);// Y3 = G * H -var ny=g.redMul(h);// T3 = E * H -var nt=e.redMul(h);// Z3 = F * G -var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt);};Point.prototype._projDbl=function _projDbl(){// hyperelliptic.org/EFD/g1p/auto-twisted-projective.html -// #doubling-dbl-2008-bbjlp -// #doubling-dbl-2007-bl -// and others -// Generally 3M + 4S or 2M + 4S -// B = (X1 + Y1)^2 -var b=this.x.redAdd(this.y).redSqr();// C = X1^2 -var c=this.x.redSqr();// D = Y1^2 -var d=this.y.redSqr();var nx;var ny;var nz;if(this.curve.twisted){// E = a * C -var e=this.curve._mulA(c);// F = E + D -var f=e.redAdd(d);if(this.zOne){// X3 = (B - C - D) * (F - 2) -nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));// Y3 = F * (E - D) -ny=f.redMul(e.redSub(d));// Z3 = F^2 - 2 * F -nz=f.redSqr().redSub(f).redSub(f);}else{// H = Z1^2 -var h=this.z.redSqr();// J = F - 2 * H -var j=f.redSub(h).redISub(h);// X3 = (B-C-D)*J -nx=b.redSub(c).redISub(d).redMul(j);// Y3 = F * (E - D) -ny=f.redMul(e.redSub(d));// Z3 = F * J -nz=f.redMul(j);}}else{// E = C + D -var e=c.redAdd(d);// H = (c * Z1)^2 -var h=this.curve._mulC(this.z).redSqr();// J = E - 2 * H -var j=e.redSub(h).redSub(h);// X3 = c * (B - E) * J -nx=this.curve._mulC(b.redISub(e)).redMul(j);// Y3 = c * E * (C - D) -ny=this.curve._mulC(e).redMul(c.redISub(d));// Z3 = E * J -nz=e.redMul(j);}return this.curve.point(nx,ny,nz);};Point.prototype.dbl=function dbl(){if(this.isInfinity())return this;// Double in extended coordinates -if(this.curve.extended)return this._extDbl();else return this._projDbl();};Point.prototype._extAdd=function _extAdd(p){// hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html -// #addition-add-2008-hwcd-3 -// 8M -// A = (Y1 - X1) * (Y2 - X2) -var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x));// B = (Y1 + X1) * (Y2 + X2) -var b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));// C = T1 * k * T2 -var c=this.t.redMul(this.curve.dd).redMul(p.t);// D = Z1 * 2 * Z2 -var d=this.z.redMul(p.z.redAdd(p.z));// E = B - A -var e=b.redSub(a);// F = D - C -var f=d.redSub(c);// G = D + C -var g=d.redAdd(c);// H = B + A -var h=b.redAdd(a);// X3 = E * F -var nx=e.redMul(f);// Y3 = G * H -var ny=g.redMul(h);// T3 = E * H -var nt=e.redMul(h);// Z3 = F * G -var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt);};Point.prototype._projAdd=function _projAdd(p){// hyperelliptic.org/EFD/g1p/auto-twisted-projective.html -// #addition-add-2008-bbjlp -// #addition-add-2007-bl -// 10M + 1S -// A = Z1 * Z2 -var a=this.z.redMul(p.z);// B = A^2 -var b=a.redSqr();// C = X1 * X2 -var c=this.x.redMul(p.x);// D = Y1 * Y2 -var d=this.y.redMul(p.y);// E = d * C * D -var e=this.curve.d.redMul(c).redMul(d);// F = B - E -var f=b.redSub(e);// G = B + E -var g=b.redAdd(e);// X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) -var tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);var nx=a.redMul(f).redMul(tmp);var ny;var nz;if(this.curve.twisted){// Y3 = A * G * (D - a * C) -ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));// Z3 = F * G -nz=f.redMul(g);}else{// Y3 = A * G * (D - C) -ny=a.redMul(g).redMul(d.redSub(c));// Z3 = c * F * G -nz=this.curve._mulC(f).redMul(g);}return this.curve.point(nx,ny,nz);};Point.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;if(this.curve.extended)return this._extAdd(p);else return this._projAdd(p);};Point.prototype.mul=function mul(k){if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else return this.curve._wnafMul(this,k);};Point.prototype.mulAdd=function mulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,false);};Point.prototype.jmulAdd=function jmulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,true);};Point.prototype.normalize=function normalize(){if(this.zOne)return this;// Normalize coordinates -var zi=this.z.redInvm();this.x=this.x.redMul(zi);this.y=this.y.redMul(zi);if(this.t)this.t=this.t.redMul(zi);this.z=this.curve.one;this.zOne=true;return this;};Point.prototype.neg=function neg(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg());};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed();};Point.prototype.getY=function getY(){this.normalize();return this.y.fromRed();};Point.prototype.eq=function eq(other){return this===other||this.getX().cmp(other.getX())===0&&this.getY().cmp(other.getY())===0;};Point.prototype.eqXToP=function eqXToP(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(rx)===0)return true;var xc=x.clone();var t=this.curve.redN.redMul(this.z);for(;;){xc.iadd(this.curve.n);if(xc.cmp(this.curve.p)>=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true;}};// Compatibility with BaseCurve -Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;/***/},/***/"./node_modules/elliptic/lib/elliptic/curve/index.js":/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***! - \***********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticCurveIndexJs(module,exports,__webpack_require__){"use strict";var curve=exports;curve.base=__webpack_require__(/*! ./base */"./node_modules/elliptic/lib/elliptic/curve/base.js");curve.short=__webpack_require__(/*! ./short */"./node_modules/elliptic/lib/elliptic/curve/short.js");curve.mont=__webpack_require__(/*! ./mont */"./node_modules/elliptic/lib/elliptic/curve/mont.js");curve.edwards=__webpack_require__(/*! ./edwards */"./node_modules/elliptic/lib/elliptic/curve/edwards.js");/***/},/***/"./node_modules/elliptic/lib/elliptic/curve/mont.js":/*!**********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticCurveMontJs(module,exports,__webpack_require__){"use strict";var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Base=__webpack_require__(/*! ./base */"./node_modules/elliptic/lib/elliptic/curve/base.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");function MontCurve(conf){Base.call(this,'mont',conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.i4=new BN(4).toRed(this.red).redInvm();this.two=new BN(2).toRed(this.red);this.a24=this.i4.redMul(this.a.redAdd(this.two));}inherits(MontCurve,Base);module.exports=MontCurve;MontCurve.prototype.validate=function validate(point){var x=point.normalize().x;var x2=x.redSqr();var rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);var y=rhs.redSqrt();return y.redSqr().cmp(rhs)===0;};function Point(curve,x,z){Base.BasePoint.call(this,curve,'projective');if(x===null&&z===null){this.x=this.curve.one;this.z=this.curve.zero;}else{this.x=new BN(x,16);this.z=new BN(z,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);}}inherits(Point,Base.BasePoint);MontCurve.prototype.decodePoint=function decodePoint(bytes,enc){return this.point(utils.toArray(bytes,enc),1);};MontCurve.prototype.point=function point(x,z){return new Point(this,x,z);};MontCurve.prototype.pointFromJSON=function pointFromJSON(obj){return Point.fromJSON(this,obj);};Point.prototype.precompute=function precompute(){// No-op -};Point.prototype._encode=function _encode(){return this.getX().toArray('be',this.curve.p.byteLength());};Point.fromJSON=function fromJSON(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one);};Point.prototype.inspect=function inspect(){if(this.isInfinity())return'';return'';};Point.prototype.isInfinity=function isInfinity(){// XXX This code assumes that zero is always zero in red -return this.z.cmpn(0)===0;};Point.prototype.dbl=function dbl(){// http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 -// 2M + 2S + 4A -// A = X1 + Z1 -var a=this.x.redAdd(this.z);// AA = A^2 -var aa=a.redSqr();// B = X1 - Z1 -var b=this.x.redSub(this.z);// BB = B^2 -var bb=b.redSqr();// C = AA - BB -var c=aa.redSub(bb);// X3 = AA * BB -var nx=aa.redMul(bb);// Z3 = C * (BB + A24 * C) -var nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz);};Point.prototype.add=function add(){throw new Error('Not supported on Montgomery curve');};Point.prototype.diffAdd=function diffAdd(p,diff){// http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 -// 4M + 2S + 6A -// A = X2 + Z2 -var a=this.x.redAdd(this.z);// B = X2 - Z2 -var b=this.x.redSub(this.z);// C = X3 + Z3 -var c=p.x.redAdd(p.z);// D = X3 - Z3 -var d=p.x.redSub(p.z);// DA = D * A -var da=d.redMul(a);// CB = C * B -var cb=c.redMul(b);// X5 = Z1 * (DA + CB)^2 -var nx=diff.z.redMul(da.redAdd(cb).redSqr());// Z5 = X1 * (DA - CB)^2 -var nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz);};Point.prototype.mul=function mul(k){var t=k.clone();var a=this;// (N / 2) * Q + Q -var b=this.curve.point(null,null);// (N / 2) * Q -var c=this;// Q -for(var bits=[];t.cmpn(0)!==0;t.iushrn(1)){bits.push(t.andln(1));}for(var i=bits.length-1;i>=0;i--){if(bits[i]===0){// N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q -a=a.diffAdd(b,c);// N * Q = 2 * ((N / 2) * Q + Q)) -b=b.dbl();}else{// N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) -b=a.diffAdd(b,c);// N * Q + Q = 2 * ((N / 2) * Q + Q) -a=a.dbl();}}return b;};Point.prototype.mulAdd=function mulAdd(){throw new Error('Not supported on Montgomery curve');};Point.prototype.jumlAdd=function jumlAdd(){throw new Error('Not supported on Montgomery curve');};Point.prototype.eq=function eq(other){return this.getX().cmp(other.getX())===0;};Point.prototype.normalize=function normalize(){this.x=this.x.redMul(this.z.redInvm());this.z=this.curve.one;return this;};Point.prototype.getX=function getX(){// Normalize coordinates -this.normalize();return this.x.fromRed();};/***/},/***/"./node_modules/elliptic/lib/elliptic/curve/short.js":/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***! - \***********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticCurveShortJs(module,exports,__webpack_require__){"use strict";var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Base=__webpack_require__(/*! ./base */"./node_modules/elliptic/lib/elliptic/curve/base.js");var assert=utils.assert;function ShortCurve(conf){Base.call(this,'short',conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.tinv=this.two.redInvm();this.zeroA=this.a.fromRed().cmpn(0)===0;this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0;// If the curve is endomorphic, precalculate beta and lambda -this.endo=this._getEndomorphism(conf);this._endoWnafT1=new Array(4);this._endoWnafT2=new Array(4);}inherits(ShortCurve,Base);module.exports=ShortCurve;ShortCurve.prototype._getEndomorphism=function _getEndomorphism(conf){// No efficient endomorphism -if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;// Compute beta and lambda, that lambda * P = (beta * Px; Py) -var beta;var lambda;if(conf.beta){beta=new BN(conf.beta,16).toRed(this.red);}else{var betas=this._getEndoRoots(this.p);// Choose the smallest beta -beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1];beta=beta.toRed(this.red);}if(conf.lambda){lambda=new BN(conf.lambda,16);}else{// Choose the lambda that is matching selected beta -var lambdas=this._getEndoRoots(this.n);if(this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))===0){lambda=lambdas[0];}else{lambda=lambdas[1];assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))===0);}}// Get basis vectors, used for balanced length-two representation -var basis;if(conf.basis){basis=conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)};});}else{basis=this._getEndoBasis(lambda);}return{beta:beta,lambda:lambda,basis:basis};};ShortCurve.prototype._getEndoRoots=function _getEndoRoots(num){// Find roots of for x^2 + x + 1 in F -// Root = (-1 +- Sqrt(-3)) / 2 -// -var red=num===this.p?this.red:BN.mont(num);var tinv=new BN(2).toRed(red).redInvm();var ntinv=tinv.redNeg();var s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);var l1=ntinv.redAdd(s).fromRed();var l2=ntinv.redSub(s).fromRed();return[l1,l2];};ShortCurve.prototype._getEndoBasis=function _getEndoBasis(lambda){// aprxSqrt >= sqrt(this.n) -var aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2));// 3.74 -// Run EGCD, until r(L + 1) < aprxSqrt -var u=lambda;var v=this.n.clone();var x1=new BN(1);var y1=new BN(0);var x2=new BN(0);var y2=new BN(1);// NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) -var a0;var b0;// First vector -var a1;var b1;// Second vector -var a2;var b2;var prevR;var i=0;var r;var x;while(u.cmpn(0)!==0){var q=v.div(u);r=v.sub(q.mul(u));x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0){a0=prevR.neg();b0=x1;a1=r.neg();b1=x;}else if(a1&&++i===2){break;}prevR=r;v=u;u=r;x2=x1;x1=x;y2=y1;y1=y;}a2=r.neg();b2=x;var len1=a1.sqr().add(b1.sqr());var len2=a2.sqr().add(b2.sqr());if(len2.cmp(len1)>=0){a2=a0;b2=b0;}// Normalize signs -if(a1.negative){a1=a1.neg();b1=b1.neg();}if(a2.negative){a2=a2.neg();b2=b2.neg();}return[{a:a1,b:b1},{a:a2,b:b2}];};ShortCurve.prototype._endoSplit=function _endoSplit(k){var basis=this.endo.basis;var v1=basis[0];var v2=basis[1];var c1=v2.b.mul(k).divRound(this.n);var c2=v1.b.neg().mul(k).divRound(this.n);var p1=c1.mul(v1.a);var p2=c2.mul(v2.a);var q1=c1.mul(v1.b);var q2=c2.mul(v2.b);// Calculate answer -var k1=k.sub(p1).sub(p2);var k2=q1.add(q2).neg();return{k1:k1,k2:k2};};ShortCurve.prototype.pointFromX=function pointFromX(x,odd){x=new BN(x,16);if(!x.red)x=x.toRed(this.red);var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);var y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw new Error('invalid point');// XXX Is there any way to tell if the number is odd without converting it -// to non-red form? -var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y);};ShortCurve.prototype.validate=function validate(point){if(point.inf)return true;var x=point.x;var y=point.y;var ax=this.a.redMul(x);var rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return y.redSqr().redISub(rhs).cmpn(0)===0;};ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(points,coeffs,jacobianResult){var npoints=this._endoWnafT1;var ncoeffs=this._endoWnafT2;for(var i=0;i';return'';};Point.prototype.isInfinity=function isInfinity(){return this.inf;};Point.prototype.add=function add(p){// O + P = P -if(this.inf)return p;// P + O = P -if(p.inf)return this;// P + P = 2P -if(this.eq(p))return this.dbl();// P + (-P) = O -if(this.neg().eq(p))return this.curve.point(null,null);// P + Q = O -if(this.x.cmp(p.x)===0)return this.curve.point(null,null);var c=this.y.redSub(p.y);if(c.cmpn(0)!==0)c=c.redMul(this.x.redSub(p.x).redInvm());var nx=c.redSqr().redISub(this.x).redISub(p.x);var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny);};Point.prototype.dbl=function dbl(){if(this.inf)return this;// 2P = O -var ys1=this.y.redAdd(this.y);if(ys1.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a;var x2=this.x.redSqr();var dyinv=ys1.redInvm();var c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);var nx=c.redSqr().redISub(this.x.redAdd(this.x));var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny);};Point.prototype.getX=function getX(){return this.x.fromRed();};Point.prototype.getY=function getY(){return this.y.fromRed();};Point.prototype.mul=function mul(k){k=new BN(k,16);if(this.isInfinity())return this;else if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[k]);else return this.curve._wnafMul(this,k);};Point.prototype.mulAdd=function mulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs);else return this.curve._wnafMulAdd(1,points,coeffs,2);};Point.prototype.jmulAdd=function jmulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs,true);else return this.curve._wnafMulAdd(1,points,coeffs,2,true);};Point.prototype.eq=function eq(p){return this===p||this.inf===p.inf&&(this.inf||this.x.cmp(p.x)===0&&this.y.cmp(p.y)===0);};Point.prototype.neg=function neg(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed;var negate=function negate(p){return p.neg();};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}};}return res;};Point.prototype.toJ=function toJ(){if(this.inf)return this.curve.jpoint(null,null,null);var res=this.curve.jpoint(this.x,this.y,this.curve.one);return res;};function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,'jacobian');if(x===null&&y===null&&z===null){this.x=this.curve.one;this.y=this.curve.one;this.z=new BN(0);}else{this.x=new BN(x,16);this.y=new BN(y,16);this.z=new BN(z,16);}if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one;}inherits(JPoint,Base.BasePoint);ShortCurve.prototype.jpoint=function jpoint(x,y,z){return new JPoint(this,x,y,z);};JPoint.prototype.toP=function toP(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm();var zinv2=zinv.redSqr();var ax=this.x.redMul(zinv2);var ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay);};JPoint.prototype.neg=function neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z);};JPoint.prototype.add=function add(p){// O + P = P -if(this.isInfinity())return p;// P + O = P -if(p.isInfinity())return this;// 12M + 4S + 7A -var pz2=p.z.redSqr();var z2=this.z.redSqr();var u1=this.x.redMul(pz2);var u2=p.x.redMul(z2);var s1=this.y.redMul(pz2.redMul(p.z));var s2=p.y.redMul(z2.redMul(this.z));var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz);};JPoint.prototype.mixedAdd=function mixedAdd(p){// O + P = P -if(this.isInfinity())return p.toJ();// P + O = P -if(p.isInfinity())return this;// 8M + 3S + 7A -var z2=this.z.redSqr();var u1=this.x;var u2=p.x.redMul(z2);var s1=this.y;var s2=p.y.redMul(z2).redMul(this.z);var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl();}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz);};JPoint.prototype.dblp=function dblp(pow){if(pow===0)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var r=this;for(var i=0;i 6M + 6S + 9A -var a=this.curve.a;var tinv=this.curve.tinv;var jx=this.x;var jy=this.y;var jz=this.z;var jz4=jz.redSqr().redSqr();// Reuse results -var jyd=jy.redAdd(jy);for(var i=0;i=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true;}};JPoint.prototype.inspect=function inspect(){if(this.isInfinity())return'';return'';};JPoint.prototype.isInfinity=function isInfinity(){// XXX This code assumes that zero is always zero in red -return this.z.cmpn(0)===0;};/***/},/***/"./node_modules/elliptic/lib/elliptic/curves.js":/*!******************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/curves.js ***! - \******************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticCurvesJs(module,exports,__webpack_require__){"use strict";var curves=exports;var hash=__webpack_require__(/*! hash.js */"./node_modules/hash.js/lib/hash.js");var curve=__webpack_require__(/*! ./curve */"./node_modules/elliptic/lib/elliptic/curve/index.js");var utils=__webpack_require__(/*! ./utils */"./node_modules/elliptic/lib/elliptic/utils.js");var assert=utils.assert;function PresetCurve(options){if(options.type==='short')this.curve=new curve.short(options);else if(options.type==='edwards')this.curve=new curve.edwards(options);else this.curve=new curve.mont(options);this.g=this.curve.g;this.n=this.curve.n;this.hash=options.hash;assert(this.g.validate(),'Invalid curve');assert(this.g.mul(this.n).isInfinity(),'Invalid curve, G*N != O');}curves.PresetCurve=PresetCurve;function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:true,enumerable:true,get:function get(){var curve=new PresetCurve(options);Object.defineProperty(curves,name,{configurable:true,enumerable:true,value:curve});return curve;}});}defineCurve('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:hash.sha256,gRed:false,g:['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012','07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']});defineCurve('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:hash.sha256,gRed:false,g:['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21','bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']});defineCurve('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:hash.sha256,gRed:false,g:['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296','4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']});defineCurve('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:hash.sha384,gRed:false,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']});defineCurve('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:hash.sha512,gRed:false,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']});defineCurve('curve25519',{type:'mont',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'76d06',b:'1',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:hash.sha256,gRed:false,g:['9']});defineCurve('ed25519',{type:'edwards',prime:'p25519',p:'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',a:'-1',c:'1',// -121665 * (121666^(-1)) (mod P) -d:'52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',n:'1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',hash:hash.sha256,gRed:false,g:['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',// 4/5 -'6666666666666666666666666666666666666666666666666666666666666658']});var pre;try{pre=__webpack_require__(/*! ./precomputed/secp256k1 */"./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js");}catch(e){pre=undefined;}defineCurve('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:hash.sha256,// Precomputed endomorphism -beta:'7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',lambda:'5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',basis:[{a:'3086d221a7d46bcde86c90e49284eb15',b:'-e4437ed6010e88286f547fa90abfe4c3'},{a:'114ca50f7a8e2f3f657c1108d9d44cfd8',b:'3086d221a7d46bcde86c90e49284eb15'}],gRed:false,g:['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798','483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',pre]});/***/},/***/"./node_modules/elliptic/lib/elliptic/ec/index.js":/*!********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***! - \********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticEcIndexJs(module,exports,__webpack_require__){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var HmacDRBG=__webpack_require__(/*! hmac-drbg */"./node_modules/hmac-drbg/lib/hmac-drbg.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var curves=__webpack_require__(/*! ../curves */"./node_modules/elliptic/lib/elliptic/curves.js");var rand=__webpack_require__(/*! brorand */"./node_modules/brorand/index.js");var assert=utils.assert;var KeyPair=__webpack_require__(/*! ./key */"./node_modules/elliptic/lib/elliptic/ec/key.js");var Signature=__webpack_require__(/*! ./signature */"./node_modules/elliptic/lib/elliptic/ec/signature.js");function EC(options){if(!(this instanceof EC))return new EC(options);// Shortcut `elliptic.ec(curve-name)` -if(typeof options==='string'){assert(curves.hasOwnProperty(options),'Unknown curve '+options);options=curves[options];}// Shortcut for `elliptic.ec(elliptic.curves.curveName)` -if(options instanceof curves.PresetCurve)options={curve:options};this.curve=options.curve.curve;this.n=this.curve.n;this.nh=this.n.ushrn(1);this.g=this.curve.g;// Point on curve -this.g=options.curve.g;this.g.precompute(options.curve.n.bitLength()+1);// Hash for function for DRBG -this.hash=options.hash||options.curve.hash;}module.exports=EC;EC.prototype.keyPair=function keyPair(options){return new KeyPair(this,options);};EC.prototype.keyFromPrivate=function keyFromPrivate(priv,enc){return KeyPair.fromPrivate(this,priv,enc);};EC.prototype.keyFromPublic=function keyFromPublic(pub,enc){return KeyPair.fromPublic(this,pub,enc);};EC.prototype.genKeyPair=function genKeyPair(options){if(!options)options={};// Instantiate Hmac_DRBG -var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||'utf8',entropy:options.entropy||rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||'utf8',nonce:this.n.toArray()});var bytes=this.n.byteLength();var ns2=this.n.sub(new BN(2));do{var priv=new BN(drbg.generate(bytes));if(priv.cmp(ns2)>0)continue;priv.iaddn(1);return this.keyFromPrivate(priv);}while(true);};EC.prototype._truncateToN=function truncateToN(msg,truncOnly){var delta=msg.byteLength()*8-this.n.bitLength();if(delta>0)msg=msg.ushrn(delta);if(!truncOnly&&msg.cmp(this.n)>=0)return msg.sub(this.n);else return msg;};EC.prototype.sign=function sign(msg,key,enc,options){if(_typeof(enc)==='object'){options=enc;enc=null;}if(!options)options={};key=this.keyFromPrivate(key,enc);msg=this._truncateToN(new BN(msg,16));// Zero-extend key to provide enough entropy -var bytes=this.n.byteLength();var bkey=key.getPrivate().toArray('be',bytes);// Zero-extend nonce to have the same byte size as N -var nonce=msg.toArray('be',bytes);// Instantiate Hmac_DRBG -var drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce:nonce,pers:options.pers,persEnc:options.persEnc||'utf8'});// Number of bytes to generate -var ns1=this.n.sub(new BN(1));for(var iter=0;true;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));k=this._truncateToN(k,true);if(k.cmpn(1)<=0||k.cmp(ns1)>=0)continue;var kp=this.g.mul(k);if(kp.isInfinity())continue;var kpX=kp.getX();var r=kpX.umod(this.n);if(r.cmpn(0)===0)continue;var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));s=s.umod(this.n);if(s.cmpn(0)===0)continue;var recoveryParam=(kp.getY().isOdd()?1:0)|(kpX.cmp(r)!==0?2:0);// Use complement of `s`, if it is > `n / 2` -if(options.canonical&&s.cmp(this.nh)>0){s=this.n.sub(s);recoveryParam^=1;}return new Signature({r:r,s:s,recoveryParam:recoveryParam});}};EC.prototype.verify=function verify(msg,signature,key,enc){msg=this._truncateToN(new BN(msg,16));key=this.keyFromPublic(key,enc);signature=new Signature(signature,'hex');// Perform primitive values validation -var r=signature.r;var s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return false;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return false;// Validate signature -var sinv=s.invm(this.n);var u1=sinv.mul(msg).umod(this.n);var u2=sinv.mul(r).umod(this.n);if(!this.curve._maxwellTrick){var p=this.g.mulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.getX().umod(this.n).cmp(r)===0;}// NOTE: Greg Maxwell's trick, inspired by: -// https://git.io/vad3K -var p=this.g.jmulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;// Compare `p.x` of Jacobian point with `r`, -// this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the -// inverse of `p.z^2` -return p.eqXToP(r);};EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,'The recovery param is more than two bits');signature=new Signature(signature,enc);var n=this.n;var e=new BN(msg);var r=signature.r;var s=signature.s;// A set LSB signifies that the y-coordinate is odd -var isYOdd=j&1;var isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error('Unable to find sencond key candinate');// 1.1. Let x = r + jn. -if(isSecondKey)r=this.curve.pointFromX(r.add(this.curve.n),isYOdd);else r=this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n);var s1=n.sub(e).mul(rInv).umod(n);var s2=s.mul(rInv).umod(n);// 1.6.1 Compute Q = r^-1 (sR - eG) -// Q = r^-1 (sR + -eG) -return this.g.mulAdd(s1,r,s2);};EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){signature=new Signature(signature,enc);if(signature.recoveryParam!==null)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i);}catch(e){continue;}if(Qprime.eq(Q))return i;}throw new Error('Unable to find valid recovery factor');};/***/},/***/"./node_modules/elliptic/lib/elliptic/ec/key.js":/*!******************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***! - \******************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticEcKeyJs(module,exports,__webpack_require__){"use strict";var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var assert=utils.assert;function KeyPair(ec,options){this.ec=ec;this.priv=null;this.pub=null;// KeyPair(ec, { priv: ..., pub: ... }) -if(options.priv)this._importPrivate(options.priv,options.privEnc);if(options.pub)this._importPublic(options.pub,options.pubEnc);}module.exports=KeyPair;KeyPair.fromPublic=function fromPublic(ec,pub,enc){if(pub instanceof KeyPair)return pub;return new KeyPair(ec,{pub:pub,pubEnc:enc});};KeyPair.fromPrivate=function fromPrivate(ec,priv,enc){if(priv instanceof KeyPair)return priv;return new KeyPair(ec,{priv:priv,privEnc:enc});};KeyPair.prototype.validate=function validate(){var pub=this.getPublic();if(pub.isInfinity())return{result:false,reason:'Invalid public key'};if(!pub.validate())return{result:false,reason:'Public key is not a point'};if(!pub.mul(this.ec.curve.n).isInfinity())return{result:false,reason:'Public key * N != O'};return{result:true,reason:null};};KeyPair.prototype.getPublic=function getPublic(compact,enc){// compact is optional argument -if(typeof compact==='string'){enc=compact;compact=null;}if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!enc)return this.pub;return this.pub.encode(enc,compact);};KeyPair.prototype.getPrivate=function getPrivate(enc){if(enc==='hex')return this.priv.toString(16,2);else return this.priv;};KeyPair.prototype._importPrivate=function _importPrivate(key,enc){this.priv=new BN(key,enc||16);// Ensure that the priv won't be bigger than n, otherwise we may fail -// in fixed multiplication method -this.priv=this.priv.umod(this.ec.curve.n);};KeyPair.prototype._importPublic=function _importPublic(key,enc){if(key.x||key.y){// Montgomery points only have an `x` coordinate. -// Weierstrass/Edwards points on the other hand have both `x` and -// `y` coordinates. -if(this.ec.curve.type==='mont'){assert(key.x,'Need x coordinate');}else if(this.ec.curve.type==='short'||this.ec.curve.type==='edwards'){assert(key.x&&key.y,'Need both x and y coordinate');}this.pub=this.ec.curve.point(key.x,key.y);return;}this.pub=this.ec.curve.decodePoint(key,enc);};// ECDH -KeyPair.prototype.derive=function derive(pub){return pub.mul(this.priv).getX();};// ECDSA -KeyPair.prototype.sign=function sign(msg,enc,options){return this.ec.sign(msg,this,enc,options);};KeyPair.prototype.verify=function verify(msg,signature){return this.ec.verify(msg,signature,this);};KeyPair.prototype.inspect=function inspect(){return'';};/***/},/***/"./node_modules/elliptic/lib/elliptic/ec/signature.js":/*!************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***! - \************************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticEcSignatureJs(module,exports,__webpack_require__){"use strict";var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var assert=utils.assert;function Signature(options,enc){if(options instanceof Signature)return options;if(this._importDER(options,enc))return;assert(options.r&&options.s,'Signature without r or s');this.r=new BN(options.r,16);this.s=new BN(options.s,16);if(options.recoveryParam===undefined)this.recoveryParam=null;else this.recoveryParam=options.recoveryParam;}module.exports=Signature;function Position(){this.place=0;}function getLength(buf,p){var initial=buf[p.place++];if(!(initial&0x80)){return initial;}var octetLen=initial&0xf;var val=0;for(var i=0,off=p.place;i>>3);arr.push(octets|0x80);while(--octets){arr.push(len>>>(octets<<3)&0xff);}arr.push(len);}Signature.prototype.toDER=function toDER(enc){var r=this.r.toArray();var s=this.s.toArray();// Pad values -if(r[0]&0x80)r=[0].concat(r);// Pad values -if(s[0]&0x80)s=[0].concat(s);r=rmPadding(r);s=rmPadding(s);while(!s[0]&&!(s[1]&0x80)){s=s.slice(1);}var arr=[0x02];constructLength(arr,r.length);arr=arr.concat(r);arr.push(0x02);constructLength(arr,s.length);var backHalf=arr.concat(s);var res=[0x30];constructLength(res,backHalf.length);res=res.concat(backHalf);return utils.encode(res,enc);};/***/},/***/"./node_modules/elliptic/lib/elliptic/eddsa/index.js":/*!***********************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***! - \***********************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticEddsaIndexJs(module,exports,__webpack_require__){"use strict";var hash=__webpack_require__(/*! hash.js */"./node_modules/hash.js/lib/hash.js");var curves=__webpack_require__(/*! ../curves */"./node_modules/elliptic/lib/elliptic/curves.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var assert=utils.assert;var parseBytes=utils.parseBytes;var KeyPair=__webpack_require__(/*! ./key */"./node_modules/elliptic/lib/elliptic/eddsa/key.js");var Signature=__webpack_require__(/*! ./signature */"./node_modules/elliptic/lib/elliptic/eddsa/signature.js");function EDDSA(curve){assert(curve==='ed25519','only tested with ed25519 so far');if(!(this instanceof EDDSA))return new EDDSA(curve);var curve=curves[curve].curve;this.curve=curve;this.g=curve.g;this.g.precompute(curve.n.bitLength()+1);this.pointClass=curve.point().constructor;this.encodingLength=Math.ceil(curve.n.bitLength()/8);this.hash=hash.sha512;}module.exports=EDDSA;/** -* @param {Array|String} message - message bytes -* @param {Array|String|KeyPair} secret - secret bytes or a keypair -* @returns {Signature} - signature -*/EDDSA.prototype.sign=function sign(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret);var r=this.hashInt(key.messagePrefix(),message);var R=this.g.mul(r);var Rencoded=this.encodePoint(R);var s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv());var S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded});};/** -* @param {Array} message - message bytes -* @param {Array|String|Signature} sig - sig bytes -* @param {Array|String|Point|KeyPair} pub - public key -* @returns {Boolean} - true if public key matches sig of message -*/EDDSA.prototype.verify=function verify(message,sig,pub){message=parseBytes(message);sig=this.makeSignature(sig);var key=this.keyFromPublic(pub);var h=this.hashInt(sig.Rencoded(),key.pubBytes(),message);var SG=this.g.mul(sig.S());var RplusAh=sig.R().add(key.pub().mul(h));return RplusAh.eq(SG);};EDDSA.prototype.hashInt=function hashInt(){var hash=this.hash();for(var i=0;i} [params.secret] - secret seed bytes -* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) -* @param {Array} [params.pub] - public key point encoded as bytes -* -*/function KeyPair(eddsa,params){this.eddsa=eddsa;this._secret=parseBytes(params.secret);if(eddsa.isPoint(params.pub))this._pub=params.pub;else this._pubBytes=parseBytes(params.pub);}KeyPair.fromPublic=function fromPublic(eddsa,pub){if(pub instanceof KeyPair)return pub;return new KeyPair(eddsa,{pub:pub});};KeyPair.fromSecret=function fromSecret(eddsa,secret){if(secret instanceof KeyPair)return secret;return new KeyPair(eddsa,{secret:secret});};KeyPair.prototype.secret=function secret(){return this._secret;};cachedProperty(KeyPair,'pubBytes',function pubBytes(){return this.eddsa.encodePoint(this.pub());});cachedProperty(KeyPair,'pub',function pub(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv());});cachedProperty(KeyPair,'privBytes',function privBytes(){var eddsa=this.eddsa;var hash=this.hash();var lastIx=eddsa.encodingLength-1;var a=hash.slice(0,eddsa.encodingLength);a[0]&=248;a[lastIx]&=127;a[lastIx]|=64;return a;});cachedProperty(KeyPair,'priv',function priv(){return this.eddsa.decodeInt(this.privBytes());});cachedProperty(KeyPair,'hash',function hash(){return this.eddsa.hash().update(this.secret()).digest();});cachedProperty(KeyPair,'messagePrefix',function messagePrefix(){return this.hash().slice(this.eddsa.encodingLength);});KeyPair.prototype.sign=function sign(message){assert(this._secret,'KeyPair can only verify');return this.eddsa.sign(message,this);};KeyPair.prototype.verify=function verify(message,sig){return this.eddsa.verify(message,sig,this);};KeyPair.prototype.getSecret=function getSecret(enc){assert(this._secret,'KeyPair is public only');return utils.encode(this.secret(),enc);};KeyPair.prototype.getPublic=function getPublic(enc){return utils.encode(this.pubBytes(),enc);};module.exports=KeyPair;/***/},/***/"./node_modules/elliptic/lib/elliptic/eddsa/signature.js":/*!***************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***! - \***************************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticEddsaSignatureJs(module,exports,__webpack_require__){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var utils=__webpack_require__(/*! ../utils */"./node_modules/elliptic/lib/elliptic/utils.js");var assert=utils.assert;var cachedProperty=utils.cachedProperty;var parseBytes=utils.parseBytes;/** -* @param {EDDSA} eddsa - eddsa instance -* @param {Array|Object} sig - -* @param {Array|Point} [sig.R] - R point as Point or bytes -* @param {Array|bn} [sig.S] - S scalar as bn or bytes -* @param {Array} [sig.Rencoded] - R point encoded -* @param {Array} [sig.Sencoded] - S scalar encoded -*/function Signature(eddsa,sig){this.eddsa=eddsa;if(_typeof(sig)!=='object')sig=parseBytes(sig);if(Array.isArray(sig)){sig={R:sig.slice(0,eddsa.encodingLength),S:sig.slice(eddsa.encodingLength)};}assert(sig.R&&sig.S,'Signature without R or S');if(eddsa.isPoint(sig.R))this._R=sig.R;if(sig.S instanceof BN)this._S=sig.S;this._Rencoded=Array.isArray(sig.R)?sig.R:sig.Rencoded;this._Sencoded=Array.isArray(sig.S)?sig.S:sig.Sencoded;}cachedProperty(Signature,'S',function S(){return this.eddsa.decodeInt(this.Sencoded());});cachedProperty(Signature,'R',function R(){return this.eddsa.decodePoint(this.Rencoded());});cachedProperty(Signature,'Rencoded',function Rencoded(){return this.eddsa.encodePoint(this.R());});cachedProperty(Signature,'Sencoded',function Sencoded(){return this.eddsa.encodeInt(this.S());});Signature.prototype.toBytes=function toBytes(){return this.Rencoded().concat(this.Sencoded());};Signature.prototype.toHex=function toHex(){return utils.encode(this.toBytes(),'hex').toUpperCase();};module.exports=Signature;/***/},/***/"./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js":/*!*********************************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***! - \*********************************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticPrecomputedSecp256k1Js(module,exports){module.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']]}};/***/},/***/"./node_modules/elliptic/lib/elliptic/utils.js":/*!*****************************************************!*\ - !*** ./node_modules/elliptic/lib/elliptic/utils.js ***! - \*****************************************************/ /*! no static exports found */ /***/function node_modulesEllipticLibEllipticUtilsJs(module,exports,__webpack_require__){"use strict";var utils=exports;var BN=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var minAssert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");var minUtils=__webpack_require__(/*! minimalistic-crypto-utils */"./node_modules/minimalistic-crypto-utils/lib/utils.js");utils.assert=minAssert;utils.toArray=minUtils.toArray;utils.zero2=minUtils.zero2;utils.toHex=minUtils.toHex;utils.encode=minUtils.encode;// Represent num in a w-NAF form -function getNAF(num,w,bits){var naf=new Array(Math.max(num.bitLength(),bits)+1);naf.fill(0);var ws=1<(ws>>1)-1)z=(ws>>1)-mod;else z=mod;k.isubn(z);}else{z=0;}naf[i]=z;k.iushrn(1);}return naf;}utils.getNAF=getNAF;// Represent k1, k2 in a Joint Sparse Form -function getJSF(k1,k2){var jsf=[[],[]];k1=k1.clone();k2=k2.clone();var d1=0;var d2=0;while(k1.cmpn(-d1)>0||k2.cmpn(-d2)>0){// First phase -var m14=k1.andln(3)+d1&3;var m24=k2.andln(3)+d2&3;if(m14===3)m14=-1;if(m24===3)m24=-1;var u1;if((m14&1)===0){u1=0;}else{var m8=k1.andln(7)+d1&7;if((m8===3||m8===5)&&m24===2)u1=-m14;else u1=m14;}jsf[0].push(u1);var u2;if((m24&1)===0){u2=0;}else{var m8=k2.andln(7)+d2&7;if((m8===3||m8===5)&&m14===2)u2=-m24;else u2=m24;}jsf[1].push(u2);// Second phase -if(2*d1===u1+1)d1=1-d1;if(2*d2===u2+1)d2=1-d2;k1.iushrn(1);k2.iushrn(1);}return jsf;}utils.getJSF=getJSF;function cachedProperty(obj,name,computer){var key='_'+name;obj.prototype[name]=function cachedProperty(){return this[key]!==undefined?this[key]:this[key]=computer.call(this);};}utils.cachedProperty=cachedProperty;function parseBytes(bytes){return typeof bytes==='string'?utils.toArray(bytes,'hex'):bytes;}utils.parseBytes=parseBytes;function intFromLE(bytes){return new BN(bytes,'hex','le');}utils.intFromLE=intFromLE;/***/},/***/"./node_modules/elliptic/package.json":/*!********************************************!*\ - !*** ./node_modules/elliptic/package.json ***! - \********************************************/ /*! exports provided: _args, _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _spec, _where, author, bugs, dependencies, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */ /***/function node_modulesEllipticPackageJson(module){module.exports=JSON.parse("{\"_args\":[[\"elliptic@6.5.2\",\"/Users/mo/Desktop/sn/dev/snjs\"]],\"_from\":\"elliptic@6.5.2\",\"_id\":\"elliptic@6.5.2\",\"_inBundle\":false,\"_integrity\":\"sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==\",\"_location\":\"/sncrypto/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"elliptic@6.5.2\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"6.5.2\",\"saveSpec\":null,\"fetchSpec\":\"6.5.2\"},\"_requiredBy\":[\"/sncrypto/browserify-sign\",\"/sncrypto/create-ecdh\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz\",\"_spec\":\"6.5.2\",\"_where\":\"/Users/mo/Desktop/sn/dev/snjs\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"dependencies\":{\"bn.js\":\"^4.4.0\",\"brorand\":\"^1.0.1\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.0\",\"inherits\":\"^2.0.1\",\"minimalistic-assert\":\"^1.0.0\",\"minimalistic-crypto-utils\":\"^1.0.0\"},\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^1.4.3\",\"coveralls\":\"^3.0.8\",\"grunt\":\"^1.0.4\",\"grunt-browserify\":\"^5.0.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-connect\":\"^1.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^1.0.1\",\"grunt-mocha-istanbul\":\"^3.0.1\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.2\",\"jscs\":\"^3.0.7\",\"jshint\":\"^2.10.3\",\"mocha\":\"^6.2.2\"},\"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\":{\"jscs\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"jshint\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"lint\":\"npm run jscs && npm run jshint\",\"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.2\"}");/***/},/***/"./node_modules/events/events.js":/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesEventsEventsJs(module,exports,__webpack_require__){"use strict";// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var R=(typeof Reflect==="undefined"?"undefined":_typeof(Reflect))==='object'?Reflect:null;var ReflectApply=R&&typeof R.apply==='function'?R.apply:function ReflectApply(target,receiver,args){return Function.prototype.apply.call(target,receiver,args);};var ReflectOwnKeys;if(R&&typeof R.ownKeys==='function'){ReflectOwnKeys=R.ownKeys;}else if(Object.getOwnPropertySymbols){ReflectOwnKeys=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));};}else{ReflectOwnKeys=function ReflectOwnKeys(target){return Object.getOwnPropertyNames(target);};}function ProcessEmitWarning(warning){if(console&&console.warn)console.warn(warning);}var NumberIsNaN=Number.isNaN||function NumberIsNaN(value){return value!==value;};function EventEmitter(){EventEmitter.init.call(this);}module.exports=EventEmitter;// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=undefined;// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners=10;function checkListener(listener){if(typeof listener!=='function'){throw new TypeError('The "listener" argument must be of type Function. Received type '+_typeof(listener));}}Object.defineProperty(EventEmitter,'defaultMaxListeners',{enumerable:true,get:function get(){return defaultMaxListeners;},set:function set(arg){if(typeof arg!=='number'||arg<0||NumberIsNaN(arg)){throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+arg+'.');}defaultMaxListeners=arg;}});EventEmitter.init=function(){if(this._events===undefined||this._events===Object.getPrototypeOf(this)._events){this._events=Object.create(null);this._eventsCount=0;}this._maxListeners=this._maxListeners||undefined;};// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=='number'||n<0||NumberIsNaN(n)){throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+'.');}this._maxListeners=n;return this;};function _getMaxListeners(that){if(that._maxListeners===undefined)return EventEmitter.defaultMaxListeners;return that._maxListeners;}EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this);};EventEmitter.prototype.emit=function emit(type){var args=[];for(var i=1;i0)er=args[0];if(er instanceof Error){// Note: The comments on the `throw` lines are intentional, they show -// up in Node's output if this results in an unhandled exception. -throw er;// Unhandled 'error' event -}// At least give some kind of context to the user -var err=new Error('Unhandled error.'+(er?' ('+er.message+')':''));err.context=er;throw err;// Unhandled 'error' event -}var handler=events[type];if(handler===undefined)return false;if(typeof handler==='function'){ReflectApply(handler,this,args);}else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i0&&existing.length>m&&!existing.warned){existing.warned=true;// No error code for this since it is a Warning -// eslint-disable-next-line no-restricted-syntax -var w=new Error('Possible EventEmitter memory leak detected. '+existing.length+' '+String(type)+' listeners '+'added. Use emitter.setMaxListeners() to '+'increase limit');w.name='MaxListenersExceededWarning';w.emitter=target;w.type=type;w.count=existing.length;ProcessEmitWarning(w);}}return target;}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false);};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true);};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;if(arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments);}}function _onceWrap(target,type,listener){var state={fired:false,wrapFn:undefined,target:target,type:type,listener:listener};var wrapped=onceWrapper.bind(state);wrapped.listener=listener;state.wrapFn=wrapped;return wrapped;}EventEmitter.prototype.once=function once(type,listener){checkListener(listener);this.on(type,_onceWrap(this,type,listener));return this;};EventEmitter.prototype.prependOnceListener=function prependOnceListener(type,listener){checkListener(listener);this.prependListener(type,_onceWrap(this,type,listener));return this;};// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener=function removeListener(type,listener){var list,events,position,i,originalListener;checkListener(listener);events=this._events;if(events===undefined)return this;list=events[type];if(list===undefined)return this;if(list===listener||list.listener===listener){if(--this._eventsCount===0)this._events=Object.create(null);else{delete events[type];if(events.removeListener)this.emit('removeListener',type,list.listener||listener);}}else if(typeof list!=='function'){position=-1;for(i=list.length-1;i>=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break;}}if(position<0)return this;if(position===0)list.shift();else{spliceOne(list,position);}if(list.length===1)events[type]=list[0];if(events.removeListener!==undefined)this.emit('removeListener',type,originalListener||listener);}return this;};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(events===undefined)return this;// not listening for removeListener, no need to emit -if(events.removeListener===undefined){if(arguments.length===0){this._events=Object.create(null);this._eventsCount=0;}else if(events[type]!==undefined){if(--this._eventsCount===0)this._events=Object.create(null);else delete events[type];}return this;}// emit removeListener for all listeners on all events -if(arguments.length===0){var keys=Object.keys(events);var key;for(i=0;i=0;i--){this.removeListener(type,listeners[i]);}}return this;};function _listeners(target,type,unwrap){var events=target._events;if(events===undefined)return[];var evlistener=events[type];if(evlistener===undefined)return[];if(typeof evlistener==='function')return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length);}EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true);};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false);};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==='function'){return emitter.listenerCount(type);}else{return listenerCount.call(emitter,type);}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events!==undefined){var evlistener=events[type];if(typeof evlistener==='function'){return 1;}else if(evlistener!==undefined){return evlistener.length;}}return 0;}EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?ReflectOwnKeys(this._events):[];};function arrayClone(arr,n){var copy=new Array(n);for(var i=0;i0||ivLen>0){var hash=new MD5();hash.update(tmp);hash.update(password);if(salt)hash.update(salt);tmp=hash.digest();var used=0;if(keyLen>0){var keyStart=key.length-keyLen;used=Math.min(keyLen,tmp.length);tmp.copy(key,keyStart,0,used);keyLen-=used;}if(used0){var ivStart=iv.length-ivLen;var length=Math.min(ivLen,tmp.length-used);tmp.copy(iv,ivStart,used,used+length);ivLen-=length;}}tmp.fill(0);return{key:key,iv:iv};}module.exports=EVP_BytesToKey;/***/},/***/"./node_modules/hash-base/index.js":/*!*****************************************!*\ - !*** ./node_modules/hash-base/index.js ***! - \*****************************************/ /*! no static exports found */ /***/function node_modulesHashBaseIndexJs(module,exports,__webpack_require__){"use strict";var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var Transform=__webpack_require__(/*! stream */"./node_modules/stream-browserify/index.js").Transform;var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");function throwIfNotStringOrBuffer(val,prefix){if(!Buffer.isBuffer(val)&&typeof val!=='string'){throw new TypeError(prefix+' must be a string or a buffer');}}function HashBase(blockSize){Transform.call(this);this._block=Buffer.allocUnsafe(blockSize);this._blockSize=blockSize;this._blockOffset=0;this._length=[0,0,0,0];this._finalized=false;}inherits(HashBase,Transform);HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding);}catch(err){error=err;}callback(error);};HashBase.prototype._flush=function(callback){var error=null;try{this.push(this.digest());}catch(err){error=err;}callback(error);};HashBase.prototype.update=function(data,encoding){throwIfNotStringOrBuffer(data,'Data');if(this._finalized)throw new Error('Digest already called');if(!Buffer.isBuffer(data))data=Buffer.from(data,encoding);// consume data -var block=this._block;var offset=0;while(this._blockOffset+data.length-offset>=this._blockSize){for(var i=this._blockOffset;i0;++j){this._length[j]+=carry;carry=this._length[j]/0x0100000000|0;if(carry>0)this._length[j]-=0x0100000000*carry;}return this;};HashBase.prototype._update=function(){throw new Error('_update is not implemented');};HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error('Digest already called');this._finalized=true;var digest=this._digest();if(encoding!==undefined)digest=digest.toString(encoding);// reset state -this._block.fill(0);this._blockOffset=0;for(var i=0;i<4;++i){this._length[i]=0;}return digest;};HashBase.prototype._digest=function(){throw new Error('_digest is not implemented');};module.exports=HashBase;/***/},/***/"./node_modules/hash.js/lib/hash.js":/*!******************************************!*\ - !*** ./node_modules/hash.js/lib/hash.js ***! - \******************************************/ /*! no static exports found */ /***/function node_modulesHashJsLibHashJs(module,exports,__webpack_require__){var hash=exports;hash.utils=__webpack_require__(/*! ./hash/utils */"./node_modules/hash.js/lib/hash/utils.js");hash.common=__webpack_require__(/*! ./hash/common */"./node_modules/hash.js/lib/hash/common.js");hash.sha=__webpack_require__(/*! ./hash/sha */"./node_modules/hash.js/lib/hash/sha.js");hash.ripemd=__webpack_require__(/*! ./hash/ripemd */"./node_modules/hash.js/lib/hash/ripemd.js");hash.hmac=__webpack_require__(/*! ./hash/hmac */"./node_modules/hash.js/lib/hash/hmac.js");// Proxy hash functions to the main object -hash.sha1=hash.sha.sha1;hash.sha256=hash.sha.sha256;hash.sha224=hash.sha.sha224;hash.sha384=hash.sha.sha384;hash.sha512=hash.sha.sha512;hash.ripemd160=hash.ripemd.ripemd160;/***/},/***/"./node_modules/hash.js/lib/hash/common.js":/*!*************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/common.js ***! - \*************************************************/ /*! no static exports found */ /***/function node_modulesHashJsLibHashCommonJs(module,exports,__webpack_require__){"use strict";var utils=__webpack_require__(/*! ./utils */"./node_modules/hash.js/lib/hash/utils.js");var assert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");function BlockHash(){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;}exports.BlockHash=BlockHash;BlockHash.prototype.update=function update(msg,enc){// Convert message to array, pad it, and join into 32bit blocks -msg=utils.toArray(msg,enc);if(!this.pending)this.pending=msg;else this.pending=this.pending.concat(msg);this.pendingTotal+=msg.length;// Enough data, try updating -if(this.pending.length>=this._delta8){msg=this.pending;// Process pending data in blocks -var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length);if(this.pending.length===0)this.pending=null;msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i>>24&0xff;res[i++]=len>>>16&0xff;res[i++]=len>>>8&0xff;res[i++]=len&0xff;}else{res[i++]=len&0xff;res[i++]=len>>>8&0xff;res[i++]=len>>>16&0xff;res[i++]=len>>>24&0xff;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;for(t=8;tthis.blockSize)key=new this.Hash().update(key).digest();assert(key.length<=this.blockSize);// Add padding to key -for(var i=key.length;i>>3;}exports.g0_256=g0_256;function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10;}exports.g1_256=g1_256;/***/},/***/"./node_modules/hash.js/lib/hash/utils.js":/*!************************************************!*\ - !*** ./node_modules/hash.js/lib/hash/utils.js ***! - \************************************************/ /*! no static exports found */ /***/function node_modulesHashJsLibHashUtilsJs(module,exports,__webpack_require__){"use strict";var assert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");exports.inherits=inherits;function isSurrogatePair(msg,i){if((msg.charCodeAt(i)&0xFC00)!==0xD800){return false;}if(i<0||i+1>=msg.length){return false;}return(msg.charCodeAt(i+1)&0xFC00)===0xDC00;}function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==='string'){if(!enc){// Inspired by stringToUtf8ByteArray() in closure-library by Google -// https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 -// Apache License 2.0 -// https://github.com/google/closure-library/blob/master/LICENSE -var p=0;for(var i=0;i>6|192;res[p++]=c&63|128;}else if(isSurrogatePair(msg,i)){c=0x10000+((c&0x03FF)<<10)+(msg.charCodeAt(++i)&0x03FF);res[p++]=c>>18|240;res[p++]=c>>12&63|128;res[p++]=c>>6&63|128;res[p++]=c&63|128;}else{res[p++]=c>>12|224;res[p++]=c>>6&63|128;res[p++]=c&63|128;}}}else if(enc==='hex'){msg=msg.replace(/[^a-z0-9]+/ig,'');if(msg.length%2!==0)msg='0'+msg;for(i=0;i>>24|w>>>8&0xff00|w<<8&0xff0000|(w&0xff)<<24;return res>>>0;}exports.htonl=htonl;function toHex32(msg,endian){var res='';for(var i=0;i>>0;}return res;}exports.join32=join32;function split32(msg,endian){var res=new Array(msg.length*4);for(var i=0,k=0;i>>24;res[k+1]=m>>>16&0xff;res[k+2]=m>>>8&0xff;res[k+3]=m&0xff;}else{res[k+3]=m>>>24;res[k+2]=m>>>16&0xff;res[k+1]=m>>>8&0xff;res[k]=m&0xff;}}return res;}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b;}exports.rotr32=rotr32;function rotl32(w,b){return w<>>32-b;}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0;}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0;}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0;}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0;}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos];var bl=buf[pos+1];var lo=al+bl>>>0;var hi=(lo>>0;buf[pos+1]=lo;}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0;var hi=(lo>>0;}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0;}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0;}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0;}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0;}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0;}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0;}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0;}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num;}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0;}exports.shr64_lo=shr64_lo;/***/},/***/"./node_modules/hmac-drbg/lib/hmac-drbg.js":/*!*************************************************!*\ - !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***! - \*************************************************/ /*! no static exports found */ /***/function node_modulesHmacDrbgLibHmacDrbgJs(module,exports,__webpack_require__){"use strict";var hash=__webpack_require__(/*! hash.js */"./node_modules/hash.js/lib/hash.js");var utils=__webpack_require__(/*! minimalistic-crypto-utils */"./node_modules/minimalistic-crypto-utils/lib/utils.js");var assert=__webpack_require__(/*! minimalistic-assert */"./node_modules/minimalistic-assert/index.js");function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash;this.predResist=!!options.predResist;this.outLen=this.hash.outSize;this.minEntropy=options.minEntropy||this.hash.hmacStrength;this._reseed=null;this.reseedInterval=null;this.K=null;this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||'hex');var nonce=utils.toArray(options.nonce,options.nonceEnc||'hex');var pers=utils.toArray(options.pers,options.persEnc||'hex');assert(entropy.length>=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits');this._init(entropy,nonce,pers);}module.exports=HmacDRBG;HmacDRBG.prototype._init=function init(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8);this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,'Not enough entropy. Minimum is: '+this.minEntropy+' bits');this._update(entropy.concat(add||[]));this._reseed=1;};HmacDRBG.prototype.generate=function generate(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error('Reseed is required');// Optional encoding -if(typeof enc!=='string'){addEnc=add;add=enc;enc=null;}// Optional additional data -if(add){add=utils.toArray(add,addEnc||'hex');this._update(add);}var temp=[];while(temp.length>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};/***/},/***/"./node_modules/inherits/inherits_browser.js":/*!***************************************************!*\ - !*** ./node_modules/inherits/inherits_browser.js ***! - \***************************************************/ /*! no static exports found */ /***/function node_modulesInheritsInherits_browserJs(module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module -module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});};}else{// old school shim for old browsers -module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;};}/***/},/***/"./node_modules/is-typedarray/index.js":/*!*********************************************!*\ - !*** ./node_modules/is-typedarray/index.js ***! - \*********************************************/ /*! no static exports found */ /***/function node_modulesIsTypedarrayIndexJs(module,exports){module.exports=isTypedArray;isTypedArray.strict=isStrictTypedArray;isTypedArray.loose=isLooseTypedArray;var toString=Object.prototype.toString;var names={'[object Int8Array]':true,'[object Int16Array]':true,'[object Int32Array]':true,'[object Uint8Array]':true,'[object Uint8ClampedArray]':true,'[object Uint16Array]':true,'[object Uint32Array]':true,'[object Float32Array]':true,'[object Float64Array]':true};function isTypedArray(arr){return isStrictTypedArray(arr)||isLooseTypedArray(arr);}function isStrictTypedArray(arr){return arr instanceof Int8Array||arr instanceof Int16Array||arr instanceof Int32Array||arr instanceof Uint8Array||arr instanceof Uint8ClampedArray||arr instanceof Uint16Array||arr instanceof Uint32Array||arr instanceof Float32Array||arr instanceof Float64Array;}function isLooseTypedArray(arr){return names[toString.call(arr)];}/***/},/***/"./node_modules/isarray/index.js":/*!***************************************!*\ - !*** ./node_modules/isarray/index.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesIsarrayIndexJs(module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=='[object Array]';};/***/},/***/"./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js":/*!****************************************************************************!*\ - !*** ./node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js ***! - \****************************************************************************/ /*! no static exports found */ /***/function node_modulesLibsodiumWrappersDistModulesLibsodiumWrappersJs(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}!function(e){function t(e,t){"use strict";var r,a="uint8array",_=t.ready.then(function(){function a(){if(0!==r._sodium_init())throw new Error("libsodium was not correctly initialized.");for(var t=["crypto_aead_chacha20poly1305_decrypt","crypto_aead_chacha20poly1305_decrypt_detached","crypto_aead_chacha20poly1305_encrypt","crypto_aead_chacha20poly1305_encrypt_detached","crypto_aead_chacha20poly1305_ietf_decrypt","crypto_aead_chacha20poly1305_ietf_decrypt_detached","crypto_aead_chacha20poly1305_ietf_encrypt","crypto_aead_chacha20poly1305_ietf_encrypt_detached","crypto_aead_chacha20poly1305_ietf_keygen","crypto_aead_chacha20poly1305_keygen","crypto_aead_xchacha20poly1305_ietf_decrypt","crypto_aead_xchacha20poly1305_ietf_decrypt_detached","crypto_aead_xchacha20poly1305_ietf_encrypt","crypto_aead_xchacha20poly1305_ietf_encrypt_detached","crypto_aead_xchacha20poly1305_ietf_keygen","crypto_auth","crypto_auth_hmacsha256","crypto_auth_hmacsha256_keygen","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmacsha512_keygen","crypto_auth_hmacsha512_verify","crypto_auth_keygen","crypto_auth_verify","crypto_box_beforenm","crypto_box_curve25519xchacha20poly1305_keypair","crypto_box_curve25519xchacha20poly1305_seal","crypto_box_curve25519xchacha20poly1305_seal_open","crypto_box_detached","crypto_box_easy","crypto_box_easy_afternm","crypto_box_keypair","crypto_box_open_detached","crypto_box_open_easy","crypto_box_open_easy_afternm","crypto_box_seal","crypto_box_seal_open","crypto_box_seed_keypair","crypto_core_ristretto255_add","crypto_core_ristretto255_from_hash","crypto_core_ristretto255_is_valid_point","crypto_core_ristretto255_random","crypto_core_ristretto255_scalar_add","crypto_core_ristretto255_scalar_complement","crypto_core_ristretto255_scalar_invert","crypto_core_ristretto255_scalar_mul","crypto_core_ristretto255_scalar_negate","crypto_core_ristretto255_scalar_random","crypto_core_ristretto255_scalar_reduce","crypto_core_ristretto255_scalar_sub","crypto_core_ristretto255_sub","crypto_generichash","crypto_generichash_blake2b_salt_personal","crypto_generichash_final","crypto_generichash_init","crypto_generichash_keygen","crypto_generichash_update","crypto_hash","crypto_hash_sha256","crypto_hash_sha512","crypto_kdf_derive_from_key","crypto_kdf_keygen","crypto_kx_client_session_keys","crypto_kx_keypair","crypto_kx_seed_keypair","crypto_kx_server_session_keys","crypto_onetimeauth","crypto_onetimeauth_final","crypto_onetimeauth_init","crypto_onetimeauth_keygen","crypto_onetimeauth_update","crypto_onetimeauth_verify","crypto_pwhash","crypto_pwhash_scryptsalsa208sha256","crypto_pwhash_scryptsalsa208sha256_ll","crypto_pwhash_scryptsalsa208sha256_str","crypto_pwhash_scryptsalsa208sha256_str_verify","crypto_pwhash_str","crypto_pwhash_str_verify","crypto_scalarmult","crypto_scalarmult_base","crypto_scalarmult_ristretto255","crypto_scalarmult_ristretto255_base","crypto_secretbox_detached","crypto_secretbox_easy","crypto_secretbox_keygen","crypto_secretbox_open_detached","crypto_secretbox_open_easy","crypto_secretstream_xchacha20poly1305_init_pull","crypto_secretstream_xchacha20poly1305_init_push","crypto_secretstream_xchacha20poly1305_keygen","crypto_secretstream_xchacha20poly1305_pull","crypto_secretstream_xchacha20poly1305_push","crypto_secretstream_xchacha20poly1305_rekey","crypto_shorthash","crypto_shorthash_keygen","crypto_shorthash_siphashx24","crypto_sign","crypto_sign_detached","crypto_sign_ed25519_pk_to_curve25519","crypto_sign_ed25519_sk_to_curve25519","crypto_sign_ed25519_sk_to_pk","crypto_sign_ed25519_sk_to_seed","crypto_sign_final_create","crypto_sign_final_verify","crypto_sign_init","crypto_sign_keypair","crypto_sign_open","crypto_sign_seed_keypair","crypto_sign_update","crypto_sign_verify_detached","crypto_stream_chacha20","crypto_stream_chacha20_ietf_xor","crypto_stream_chacha20_ietf_xor_ic","crypto_stream_chacha20_keygen","crypto_stream_chacha20_xor","crypto_stream_chacha20_xor_ic","crypto_stream_keygen","crypto_stream_xchacha20_keygen","crypto_stream_xchacha20_xor","crypto_stream_xchacha20_xor_ic","randombytes_buf","randombytes_buf_deterministic","randombytes_close","randombytes_random","randombytes_set_implementation","randombytes_stir","randombytes_uniform","sodium_version_string"],a=[x,E,w,S,T,Y,A,B,K,I,M,L,N,U,O,R,P,C,G,D,X,V,F,H,z,j,q,W,J,Q,Z,$,ee,te,re,ae,_e,ne,se,ce,he,oe,pe,ye,ie,le,ue,ve,de,ge,be,fe,me,ke,xe,Ee,we,Se,Te,Ye,Ae,Be,Ke,Ie,Me,Le,Ne,Ue,Oe,Re,Pe,Ce,Ge,De,Xe,Ve,Fe,He,ze,je,qe,We,Je,Qe,Ze,$e,et,tt,rt,at,_t,nt,st,ct,ht,ot,pt,yt,it,lt,ut,vt,dt,gt,bt,ft,mt,kt,xt,Et,wt,St,Tt,Yt,At,Bt,Kt,It,Mt,Lt,Nt,Ut,Ot,Rt,Pt,Ct,Gt,Dt,Xt],_=0;_=240?(o=4,c=!0):p>=224?(o=3,c=!0):p>=192?(o=2,c=!0):p<128&&(o=1,c=!0);}while(!c);for(var y=o-(n.length-h),i=0;i>8&-39)<<8|87+(t=e[n]>>>4)+(t-10>>8&-39),_+=String.fromCharCode(255&a)+String.fromCharCode(a>>>8);}return _;}var h={ORIGINAL:1,ORIGINAL_NO_PADDING:3,URLSAFE:5,URLSAFE_NO_PADDING:7};function o(e){if(null==e)return h.URLSAFE_NO_PADDING;if(e!==h.ORIGINAL&&e!==h.ORIGINAL_NO_PADDING&&e!==h.URLSAFE&&e!=h.URLSAFE_NO_PADDING)throw new Error("unsupported base64 variant");return e;}function p(e,t){t=o(t),e=k(_,e,"input");var a,_=[],n=0|Math.floor(e.length/3),c=e.length-3*n,h=4*n+(0!==c?0==(2&t)?4:2+(c>>>1):0),p=new u(h+1),y=v(e);return _.push(y),_.push(p.address),0===r._sodium_bin2base64(p.address,p.length,y,e.length,t)&&b(_,"conversion failed"),p.length=h,a=s(p.to_Uint8Array()),g(_),a;}function y(e,t){var r=t||a;if(!i(r))throw new Error(r+" output format is not available");if(e instanceof u){if("uint8array"===r)return e.to_Uint8Array();if("text"===r)return s(e.to_Uint8Array());if("hex"===r)return c(e.to_Uint8Array());if("base64"===r)return p(e.to_Uint8Array(),h.URLSAFE_NO_PADDING);throw new Error('What is output format "'+r+'"?');}if("object"==_typeof(e)){for(var _=Object.keys(e),n={},o=0;o<_.length;o++){n[_[o]]=y(e[_[o]],r);}return n;}if("string"==typeof e)return e;throw new TypeError("Cannot format output");}function i(e){for(var t=["uint8array","text","hex","base64"],r=0;r>>24>>>8,h,o);var b=y(i,s);return g(c),b;}function Be(e){var t=[];l(e);var a=new u(0|r._crypto_kdf_keybytes()),_=a.address;t.push(_),r._crypto_kdf_keygen(_);var n=y(a,e);return g(t),n;}function Ke(e,t,a,_){var n=[];l(_),e=k(n,e,"clientPublicKey");var s,c=0|r._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid clientPublicKey length"),s=v(e),n.push(s),t=k(n,t,"clientSecretKey");var h,o=0|r._crypto_kx_secretkeybytes();t.length!==o&&f(n,"invalid clientSecretKey length"),h=v(t),n.push(h),a=k(n,a,"serverPublicKey");var p,i=0|r._crypto_kx_publickeybytes();a.length!==i&&f(n,"invalid serverPublicKey length"),p=v(a),n.push(p);var d=new u(0|r._crypto_kx_sessionkeybytes()),m=d.address;n.push(m);var x=new u(0|r._crypto_kx_sessionkeybytes()),E=x.address;if(n.push(E),0==(0|r._crypto_kx_client_session_keys(m,E,s,h,p))){var w=y({sharedRx:d,sharedTx:x},_);return g(n),w;}b(n,"invalid usage");}function Ie(e){var t=[];l(e);var a=new u(0|r._crypto_kx_publickeybytes()),_=a.address;t.push(_);var n=new u(0|r._crypto_kx_secretkeybytes()),s=n.address;if(t.push(s),0==(0|r._crypto_kx_keypair(_,s))){var c={publicKey:y(a,e),privateKey:y(n,e),keyType:"x25519"};return g(t),c;}b(t,"internal error");}function Me(e,t){var a=[];l(t),e=k(a,e,"seed");var _,n=0|r._crypto_kx_seedbytes();e.length!==n&&f(a,"invalid seed length"),_=v(e),a.push(_);var s=new u(0|r._crypto_kx_publickeybytes()),c=s.address;a.push(c);var h=new u(0|r._crypto_kx_secretkeybytes()),o=h.address;if(a.push(o),0==(0|r._crypto_kx_seed_keypair(c,o,_))){var p={publicKey:y(s,t),privateKey:y(h,t),keyType:"x25519"};return g(a),p;}b(a,"internal error");}function Le(e,t,a,_){var n=[];l(_),e=k(n,e,"serverPublicKey");var s,c=0|r._crypto_kx_publickeybytes();e.length!==c&&f(n,"invalid serverPublicKey length"),s=v(e),n.push(s),t=k(n,t,"serverSecretKey");var h,o=0|r._crypto_kx_secretkeybytes();t.length!==o&&f(n,"invalid serverSecretKey length"),h=v(t),n.push(h),a=k(n,a,"clientPublicKey");var p,i=0|r._crypto_kx_publickeybytes();a.length!==i&&f(n,"invalid clientPublicKey length"),p=v(a),n.push(p);var d=new u(0|r._crypto_kx_sessionkeybytes()),m=d.address;n.push(m);var x=new u(0|r._crypto_kx_sessionkeybytes()),E=x.address;if(n.push(E),0==(0|r._crypto_kx_server_session_keys(m,E,s,h,p))){var w=y({sharedRx:d,sharedTx:x},_);return g(n),w;}b(n,"invalid usage");}function Ne(e,t,a){var _=[];l(a);var n=v(e=k(_,e,"message")),s=e.length;_.push(n),t=k(_,t,"key");var c,h=0|r._crypto_onetimeauth_keybytes();t.length!==h&&f(_,"invalid key length"),c=v(t),_.push(c);var o=new u(0|r._crypto_onetimeauth_bytes()),p=o.address;if(_.push(p),0==(0|r._crypto_onetimeauth(p,n,s,0,c))){var i=y(o,a);return g(_),i;}b(_,"invalid usage");}function Ue(e,t){var a=[];l(t),m(a,e,"state_address");var _=new u(0|r._crypto_onetimeauth_bytes()),n=_.address;if(a.push(n),0==(0|r._crypto_onetimeauth_final(e,n))){var s=(r._free(e),y(_,t));return g(a),s;}b(a,"invalid usage");}function Oe(e,t){var a=[];l(t);var _=null;null!=e&&(_=v(e=k(a,e,"key")),e.length,a.push(_));var n=new u(144).address;if(0==(0|r._crypto_onetimeauth_init(n,_))){var s=n;return g(a),s;}b(a,"invalid usage");}function Re(e){var t=[];l(e);var a=new u(0|r._crypto_onetimeauth_keybytes()),_=a.address;t.push(_),r._crypto_onetimeauth_keygen(_);var n=y(a,e);return g(t),n;}function Pe(e,t,a){var _=[];l(a),m(_,e,"state_address");var n=v(t=k(_,t,"message_chunk")),s=t.length;_.push(n),0!=(0|r._crypto_onetimeauth_update(e,n,s))&&b(_,"invalid usage"),g(_);}function Ce(e,t,a){var _=[];e=k(_,e,"hash");var n,s=0|r._crypto_onetimeauth_bytes();e.length!==s&&f(_,"invalid hash length"),n=v(e),_.push(n);var c=v(t=k(_,t,"message")),h=t.length;_.push(c),a=k(_,a,"key");var o,p=0|r._crypto_onetimeauth_keybytes();a.length!==p&&f(_,"invalid key length"),o=v(a),_.push(o);var y=0==(0|r._crypto_onetimeauth_verify(n,c,h,0,o));return g(_),y;}function Ge(e,t,a,_,n,s,c){var h=[];l(c),m(h,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(h,"keyLength must be an unsigned integer");var o=v(t=k(h,t,"password")),p=t.length;h.push(o),a=k(h,a,"salt");var i,d=0|r._crypto_pwhash_saltbytes();a.length!==d&&f(h,"invalid salt length"),i=v(a),h.push(i),m(h,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(h,"opsLimit must be an unsigned integer"),m(h,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&f(h,"memLimit must be an unsigned integer"),m(h,s,"algorithm"),("number"!=typeof s||(0|s)!==s||s<0)&&f(h,"algorithm must be an unsigned integer");var x=new u(0|e),E=x.address;if(h.push(E),0==(0|r._crypto_pwhash(E,e,0,o,p,0,i,_,0,n,s))){var w=y(x,c);return g(h),w;}b(h,"invalid usage");}function De(e,t,a,_,n,s){var c=[];l(s),m(c,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&f(c,"keyLength must be an unsigned integer");var h=v(t=k(c,t,"password")),o=t.length;c.push(h),a=k(c,a,"salt");var p,i=0|r._crypto_pwhash_scryptsalsa208sha256_saltbytes();a.length!==i&&f(c,"invalid salt length"),p=v(a),c.push(p),m(c,_,"opsLimit"),("number"!=typeof _||(0|_)!==_||_<0)&&f(c,"opsLimit must be an unsigned integer"),m(c,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&f(c,"memLimit must be an unsigned integer");var d=new u(0|e),x=d.address;if(c.push(x),0==(0|r._crypto_pwhash_scryptsalsa208sha256(x,e,0,h,o,0,p,_,0,n))){var E=y(d,s);return g(c),E;}b(c,"invalid usage");}function Xe(e,t,a,_,n,s,c){var h=[];l(c);var o=v(e=k(h,e,"password")),p=e.length;h.push(o);var i=v(t=k(h,t,"salt")),d=t.length;h.push(i),m(h,a,"opsLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(h,"opsLimit must be an unsigned integer"),m(h,_,"r"),("number"!=typeof _||(0|_)!==_||_<0)&&f(h,"r must be an unsigned integer"),m(h,n,"p"),("number"!=typeof n||(0|n)!==n||n<0)&&f(h,"p must be an unsigned integer"),m(h,s,"keyLength"),("number"!=typeof s||(0|s)!==s||s<0)&&f(h,"keyLength must be an unsigned integer");var x=new u(0|s),E=x.address;if(h.push(E),0==(0|r._crypto_pwhash_scryptsalsa208sha256_ll(o,p,i,d,a,0,_,n,E,s))){var w=y(x,c);return g(h),w;}b(h,"invalid usage");}function Ve(e,t,a,_){var n=[];l(_);var s=v(e=k(n,e,"password")),c=e.length;n.push(s),m(n,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&f(n,"opsLimit must be an unsigned integer"),m(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(n,"memLimit must be an unsigned integer");var h=new u(0|r._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(n.push(h),0==(0|r._crypto_pwhash_scryptsalsa208sha256_str(h,s,c,0,t,0,a))){var o=r.UTF8ToString(h);return g(n),o;}b(n,"invalid usage");}function Fe(e,t,a){var _=[];l(a),"string"!=typeof e&&f(_,"hashed_password must be a string");var s=v(e=n(e+"\0"));e.length,_.push(s);var c=v(t=k(_,t,"password")),h=t.length;_.push(c);var o=0==(0|r._crypto_pwhash_scryptsalsa208sha256_str_verify(s,c,h,0));return g(_),o;}function He(e,t,a,_){var n=[];l(_);var s=v(e=k(n,e,"password")),c=e.length;n.push(s),m(n,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&f(n,"opsLimit must be an unsigned integer"),m(n,a,"memLimit"),("number"!=typeof a||(0|a)!==a||a<0)&&f(n,"memLimit must be an unsigned integer");var h=new u(0|r._crypto_pwhash_strbytes()).address;if(n.push(h),0==(0|r._crypto_pwhash_str(h,s,c,0,t,0,a))){var o=r.UTF8ToString(h);return g(n),o;}b(n,"invalid usage");}function ze(e,t,a){var _=[];l(a),"string"!=typeof e&&f(_,"hashed_password must be a string");var s=v(e=n(e+"\0"));e.length,_.push(s);var c=v(t=k(_,t,"password")),h=t.length;_.push(c);var o=0==(0|r._crypto_pwhash_str_verify(s,c,h,0));return g(_),o;}function je(e,t,a){var _=[];l(a),e=k(_,e,"privateKey");var n,s=0|r._crypto_scalarmult_scalarbytes();e.length!==s&&f(_,"invalid privateKey length"),n=v(e),_.push(n),t=k(_,t,"publicKey");var c,h=0|r._crypto_scalarmult_scalarbytes();t.length!==h&&f(_,"invalid publicKey length"),c=v(t),_.push(c);var o=new u(0|r._crypto_scalarmult_bytes()),p=o.address;if(_.push(p),0==(0|r._crypto_scalarmult(p,n,c))){var i=y(o,a);return g(_),i;}b(_,"weak public key");}function qe(e,t){var a=[];l(t),e=k(a,e,"privateKey");var _,n=0|r._crypto_scalarmult_scalarbytes();e.length!==n&&f(a,"invalid privateKey length"),_=v(e),a.push(_);var s=new u(0|r._crypto_scalarmult_scalarbytes()),c=s.address;if(a.push(c),0==(0|r._crypto_scalarmult_base(c,_))){var h=y(s,t);return g(a),h;}b(a,"insecure scalar");}function We(e,t,a){var _=[];l(a),e=k(_,e,"scalar");var n,s=0|r._crypto_scalarmult_ristretto255_scalarbytes();e.length!==s&&f(_,"invalid scalar length"),n=v(e),_.push(n),t=k(_,t,"privateKey");var c,h=0|r._crypto_scalarmult_ristretto255_bytes();t.length!==h&&f(_,"invalid privateKey length"),c=v(t),_.push(c);var o=new u(0|r._crypto_scalarmult_ristretto255_bytes()),p=o.address;if(_.push(p),0==(0|r._crypto_scalarmult_ristretto255(p,n,c))){var i=y(o,a);return g(_),i;}b(_,"input is zero element");}function Je(e,t){var a=[];l(t);var _=v(e=k(a,e,"scalar"));e.length,a.push(_);var n=new u(0|r._crypto_core_ristretto255_bytes()),s=n.address;if(a.push(s),0==(0|r._crypto_scalarmult_ristretto255_base(s,_))){var c=y(n,t);return g(a),c;}b(a,"scalar is 0");}function Qe(e,t,a,_){var n=[];l(_);var s=v(e=k(n,e,"message")),c=e.length;n.push(s),t=k(n,t,"nonce");var h,o=0|r._crypto_secretbox_noncebytes();t.length!==o&&f(n,"invalid nonce length"),h=v(t),n.push(h),a=k(n,a,"key");var p,i=0|r._crypto_secretbox_keybytes();a.length!==i&&f(n,"invalid key length"),p=v(a),n.push(p);var d=new u(0|c),m=d.address;n.push(m);var x=new u(0|r._crypto_secretbox_macbytes()),E=x.address;if(n.push(E),0==(0|r._crypto_secretbox_detached(m,E,s,c,0,h,p))){var w=y({mac:x,cipher:d},_);return g(n),w;}b(n,"invalid usage");}function Ze(e,t,a,_){var n=[];l(_);var s=v(e=k(n,e,"message")),c=e.length;n.push(s),t=k(n,t,"nonce");var h,o=0|r._crypto_secretbox_noncebytes();t.length!==o&&f(n,"invalid nonce length"),h=v(t),n.push(h),a=k(n,a,"key");var p,i=0|r._crypto_secretbox_keybytes();a.length!==i&&f(n,"invalid key length"),p=v(a),n.push(p);var d=new u(c+r._crypto_secretbox_macbytes()|0),m=d.address;if(n.push(m),0==(0|r._crypto_secretbox_easy(m,s,c,0,h,p))){var x=y(d,_);return g(n),x;}b(n,"invalid usage");}function $e(e){var t=[];l(e);var a=new u(0|r._crypto_secretbox_keybytes()),_=a.address;t.push(_),r._crypto_secretbox_keygen(_);var n=y(a,e);return g(t),n;}function et(e,t,a,_,n){var s=[];l(n);var c=v(e=k(s,e,"ciphertext")),h=e.length;s.push(c),t=k(s,t,"mac");var o,p=0|r._crypto_secretbox_macbytes();t.length!==p&&f(s,"invalid mac length"),o=v(t),s.push(o),a=k(s,a,"nonce");var i,d=0|r._crypto_secretbox_noncebytes();a.length!==d&&f(s,"invalid nonce length"),i=v(a),s.push(i),_=k(s,_,"key");var m,x=0|r._crypto_secretbox_keybytes();_.length!==x&&f(s,"invalid key length"),m=v(_),s.push(m);var E=new u(0|h),w=E.address;if(s.push(w),0==(0|r._crypto_secretbox_open_detached(w,c,o,h,0,i,m))){var S=y(E,n);return g(s),S;}b(s,"wrong secret key for the given ciphertext");}function tt(e,t,a,_){var n=[];l(_),e=k(n,e,"ciphertext");var s,c=r._crypto_secretbox_macbytes(),h=e.length;h>>0;return g([]),t;}function Ct(e,t){var a=[];l(t);for(var _=r._malloc(24),n=0;n<6;n++){r.setValue(_+4*n,r.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][n]]),"i32");}0!=(0|r._randombytes_set_implementation(_))&&b(a,"unsupported implementation"),g(a);}function Gt(e){l(e),r._randombytes_stir();}function Dt(e,t){var a=[];l(t),m(a,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&f(a,"upper_bound must be an unsigned integer");var _=r._randombytes_uniform(e)>>>0;return g(a),_;}function Xt(){var e=r._sodium_version_string(),t=r.UTF8ToString(e);return g([]),t;}return u.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(r.HEAPU8.subarray(this.address,this.address+this.length)),e;},e.add=function(e,t){if(!(e instanceof Uint8Array&&t instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can added");var r=e.length,a=0,_=0;if(t.length!=e.length)throw new TypeError("Arguments must have the same length");for(_=0;_>=8,a+=e[_]+t[_],e[_]=255&a;}},e.base64_variants=h,e.compare=function(e,t){if(!(e instanceof Uint8Array&&t instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be compared");if(e.length!==t.length)throw new TypeError("Only instances of identical length can be compared");for(var r=0,a=1,_=e.length;_-->0;){r|=t[_]-e[_]>>8&a,a&=(t[_]^e[_])-1>>8;}return r+r+a-1;},e.from_base64=function(e,t){t=o(t);var a,_=[],n=new u(3*(e=k(_,e,"input")).length/4),s=v(e),c=d(4),h=d(4);return _.push(s),_.push(n.address),_.push(n.result_bin_len_p),_.push(n.b64_end_p),0!==r._sodium_base642bin(n.address,n.length,s,e.length,0,c,h,t)&&b(_,"invalid input"),r.getValue(h,"i32")-s!==e.length&&b(_,"incomplete input"),n.length=r.getValue(c,"i32"),a=n.to_Uint8Array(),g(_),a;},e.from_hex=function(e){var t,a=[],_=new u((e=k(a,e,"input")).length/2),n=v(e),s=d(4);return a.push(n),a.push(_.address),a.push(_.hex_end_p),0!==r._sodium_hex2bin(_.address,_.length,n,e.length,0,0,s)&&b(a,"invalid input"),r.getValue(s,"i32")-n!==e.length&&b(a,"incomplete input"),t=_.to_Uint8Array(),g(a),t;},e.from_string=n,e.increment=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be incremented");for(var t=256,r=0,a=e.length;r>=8,t+=e[r],e[r]=255&t;}},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw new TypeError("Only Uint8Array instances can be checked");for(var t=0,r=0,a=e.length;r 0");var a,_=[],n=d(4),s=1,c=0,h=0|e.length,o=new u(h+t);_.push(n),_.push(o.address);for(var p=o.address,y=o.address+h+t;p>>48|h>>>32|h>>>16|h))-1>>16);}return 0!==r._sodium_pad(n,o.address,e.length,t,o.length)&&b(_,"internal error"),o.length=r.getValue(n,"i32"),a=o.to_Uint8Array(),g(_),a;},e.unpad=function(e,t){if(!(e instanceof Uint8Array))throw new TypeError("buffer must be a Uint8Array");if((t|=0)<=0)throw new Error("block size must be > 0");var a=[],_=v(e),n=d(4);return a.push(_),a.push(n),0!==r._sodium_unpad(n,_,e.length,t)&&b(a,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,r.getValue(n,"i32")),g(a),e;},e.ready=_,e.symbols=function(){return Object.keys(e).sort();},e.to_base64=p,e.to_hex=c,e.to_string=s,e;}var r="object"==_typeof(e.sodium)&&"function"==typeof e.sodium.onload?e.sodium.onload:null;true?!(__WEBPACK_AMD_DEFINE_ARRAY__=[exports,__webpack_require__(/*! libsodium */"./node_modules/libsodium/dist/modules/libsodium.js")],__WEBPACK_AMD_DEFINE_FACTORY__=t,__WEBPACK_AMD_DEFINE_RESULT__=typeof __WEBPACK_AMD_DEFINE_FACTORY__==='function'?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)):undefined,r&&e.sodium.ready.then(function(){r(e.sodium);});}(this);/***/},/***/"./node_modules/libsodium/dist/modules/libsodium.js":/*!**********************************************************!*\ - !*** ./node_modules/libsodium/dist/modules/libsodium.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesLibsodiumDistModulesLibsodiumJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global,process,__dirname,Buffer){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}!function(A){function I(A){"use strict";var I;void 0===(I=A)&&(I={});var g=I;"object"!=_typeof(g.sodium)&&("object"==(typeof global==="undefined"?"undefined":_typeof(global))?g=global:"object"==(typeof window==="undefined"?"undefined":_typeof(window))&&(g=window)),"object"==_typeof(g.sodium)&&"number"==typeof g.sodium.totalMemory&&(I.TOTAL_MEMORY=g.sodium.totalMemory);var B=I;return I.ready=new Promise(function(A,I){(C=B).onAbort=I,C.print=function(A){},C.printErr=function(A){},C.onRuntimeInitialized=function(){try{C._crypto_secretbox_keybytes(),A();}catch(A){I(A);}},C.useBackupModule=function(){var A,I=void 0!==(I={})?I:{},g={};for(A in I){I.hasOwnProperty(A)&&(g[A]=I[A]);}var C,Q,E,i,e=[],o=!1;C="object"==(typeof window==="undefined"?"undefined":_typeof(window)),Q="function"==typeof importScripts,E="object"==(typeof process==="undefined"?"undefined":_typeof(process))&&"object"==_typeof(process.versions)&&"string"==typeof process.versions.node,o=E&&!C&&!Q,i=!C&&!o&&!Q;var c,a,n,r,t,f="";o?(f=__dirname+"/",c=function c(A,I){var g;return(g=iA(A))||(r||(r=__webpack_require__(/*! fs */0)),t||(t=__webpack_require__(/*! path */"./node_modules/path-browserify/index.js")),A=t.normalize(A),g=r.readFileSync(A)),I?g:g.toString();},n=function n(A){var I=c(A,!0);return I.buffer||(I=new Uint8Array(I)),D(I.buffer),I;},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),e=process.argv.slice(2), true&&(module.exports=I),process.on("unhandledRejection",j),I.inspect=function(){return"[Emscripten Module object]";}):i?("undefined"!=typeof read&&(c=function c(A){var I=iA(A);return I?QA(I):read(A);}),n=function n(A){var I;return(I=iA(A))?I:"function"==typeof readbuffer?new Uint8Array(readbuffer(A)):(D("object"==_typeof(I=read(A,"binary"))),I);},"undefined"!=typeof scriptArgs?e=scriptArgs:void 0!==arguments&&(e=arguments),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(C||Q)&&(Q?f=self.location.href:document.currentScript&&(f=document.currentScript.src),f=0!==f.indexOf("blob:")?f.substr(0,f.lastIndexOf("/")+1):"",c=function c(A){try{var I=new XMLHttpRequest();return I.open("GET",A,!1),I.send(null),I.responseText;}catch(I){var g=iA(A);if(g)return QA(g);throw I;}},Q&&(n=function n(A){try{var I=new XMLHttpRequest();return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response);}catch(I){var g=iA(A);if(g)return g;throw I;}}),a=function a(A,I,g){var B=new XMLHttpRequest();B.open("GET",A,!0),B.responseType="arraybuffer",B.onload=function(){if(200==B.status||0==B.status&&B.response)I(B.response);else{var C=iA(A);C?I(C.buffer):g();}},B.onerror=g,B.send(null);});var w=I.print||void 0,y=I.printErr||void 0;for(A in g){g.hasOwnProperty(A)&&(I[A]=g[A]);}g=null,I.arguments&&(e=I.arguments),I.thisProgram&&I.thisProgram,I.quit&&I.quit,new Array(8);var s=0;I.wasmBinary&&I.wasmBinary,I.noExitRuntime&&I.noExitRuntime;var h=!1;function D(A,I){A||j("Assertion failed: "+I);}var F,p,u,H,k,l,_,G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function _d(A,I){return A?function(A,I,g){for(var B=I+g,C=I;A[C]&&!(C>=B);){++C;}if(C-I>16&&A.subarray&&G)return G.decode(A.subarray(I,C));for(var Q="";I>10,56320|1023&o);}}else Q+=String.fromCharCode((31&E)<<6|i);}else Q+=String.fromCharCode(E);}return Q;}(u,A,I):"";}function Y(A,I){return A%I>0&&(A+=I-A%I),A;}function M(A){F=A,I.HEAP8=p=new Int8Array(A),I.HEAP16=H=new Int16Array(A),I.HEAP32=k=new Int32Array(A),I.HEAPU8=u=new Uint8Array(A),I.HEAPU16=new Uint16Array(A),I.HEAPU32=new Uint32Array(A),I.HEAPF32=l=new Float32Array(A),I.HEAPF64=_=new Float64Array(A);}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var S=I.TOTAL_MEMORY||16777216;function U(A){for(;A.length>0;){var g=A.shift();if("function"!=typeof g){var B=g.func;"number"==typeof B?void 0===g.arg?I.dynCall_v(B):I.dynCall_vi(B,g.arg):B(void 0===g.arg?null:g.arg);}else g();}}S=(F=I.buffer?I.buffer:new ArrayBuffer(S)).byteLength,M(F),k[8808]=5278304;var v=[],b=[],J=[],P=[],R=Math.abs,N=Math.ceil,m=Math.floor,L=Math.min,x=0,K=null,X=null;function j(A){throw I.onAbort&&I.onAbort(A),w(A+=""),y(A),h=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info.";}I.preloadedImages={},I.preloadedAudios={};var T,q,V=null,z="data:application/octet-stream;base64,";function W(A){return String.prototype.startsWith?A.startsWith(z):0===A.indexOf(z);}var O=[function(){return I.getRandomValue();},function(){if(void 0===I.getRandomValue)try{var A="object"==(typeof window==="undefined"?"undefined":_typeof(window))?window:self,g=void 0!==A.crypto?A.crypto:A.msCrypto,B=function B(){var A=new Uint32Array(1);return g.getRandomValues(A),A[0]>>>0;};B(),I.getRandomValue=B;}catch(A){try{var C=__webpack_require__(/*! crypto */"./node_modules/crypto-browserify/index.js"),Q=function Q(){var A=C.randomBytes(4);return(A[0]<<24|A[1]<<16|A[2]<<8|A[3])>>>0;};Q(),I.getRandomValue=Q;}catch(A){throw"No secure random number generator found";}}}];function Z(A){return A;}function $(A){return A.replace(/\b__Z[\w\d_]+/g,function(A){var I=Z(A);return A===I?A:I+" ["+A+"]";});}function AA(){var A=new Error();if(!A.stack){try{throw new Error(0);}catch(I){A=I;}if(!A.stack)return"(no stack trace available)";}return A.stack.toString();}function IA(){return p.length;}function gA(A){try{var I=new ArrayBuffer(A);if(I.byteLength!=A)return;return new Int8Array(I).set(p),aA(I),M(I),1;}catch(A){}}function BA(A){return I.___errno_location&&(k[I.___errno_location()>>2]=A),A;}V="data:application/octet-stream;base64,AAAAAAAAAAC2eFn/hXLTAL1uFf8PCmoAKcABAJjoef+8PKD/mXHO/wC34v60DUj/AAAAAAAAAACwoA7+08mG/54YjwB/aTUAYAy9AKfX+/+fTID+amXh/x78BACSDK4AAAAAAAAAAABZ8bL+CuWm/3vdKv4eFNQAUoADADDR8wB3eUD/MuOc/wBuxQFnG5AAAAAAAAAAAACFO4wBvfEk//glwwFg3DcAt0w+/8NCPQAyTKQB4aRM/0w9o/91Ph8AUZFA/3ZBDgCic9b/BoouAHzm9P8Kio8ANBrCALj0TACBjykBvvQT/3uqev9igUQAedWTAFZlHv+hZ5sAjFlD/+/lvgFDC7UAxvCJ/u5FvP9Dl+4AEyps/+VVcQEyRIf/EWoJADJnAf9QAagBI5ge/xCouQE4Wej/ZdL8ACn6RwDMqk//Di7v/1BN7wC91kv/EY35ACZQTP++VXUAVuSqAJzY0AHDz6T/lkJM/6/hEP+NUGIBTNvyAMaicgAu2pgAmyvx/pugaP8zu6UAAhGvAEJUoAH3Oh4AI0E1/kXsvwAthvUBo3vdACBuFP80F6UAutZHAOmwYADy7zYBOVmKAFMAVP+IoGQAXI54/mh8vgC1sT7/+ilVAJiCKgFg/PYAl5c//u+FPgAgOJwALae9/46FswGDVtMAu7OW/vqqDv/So04AJTSXAGNNGgDunNX/1cDRAUkuVAAUQSkBNs5PAMmDkv6qbxj/sSEy/qsmy/9O93QA0d2ZAIWAsgE6LBkAySc7Ab0T/AAx5dIBdbt1ALWzuAEActsAMF6TAPUpOAB9Dcz+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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACbolY/CsiewRcP0ifLvmPDV36wF08YzObE4AohtU/wFxxdqcD1N2E+6PAt2DRBnDyogU/osOczGTsf9d5KsA3rs////////////////////////////////////////f+3///////////////////////////////////////9/7v///////////////////////////////////////3/t0/VcGmMSWNac96Le+d4UAAAAAAAAAAAAAAAAAAAAEAjJvPNn5glqO6fKhIWuZ7sr+JT+cvNuPPE2HV869U+l0YLmrX9SDlEfbD4rjGgFm2u9Qfur2YMfeSF+ExnN4FsirijXmC+KQs1l7yORRDdxLztN7M/7wLW824mBpdu16Ti1SPNbwlY5GdAFtvER8VmbTxmvpII/khiBbdrVXhyrQgIDo5iqB9i+b3BFAVuDEoyy5E6+hTEk4rT/1cN9DFVviXvydF2+crGWFjv+sd6ANRLHJacG3JuUJmnPdPGbwdJK8Z7BaZvk4yVPOIZHvu+11YyLxp3BD2WcrHfMoQwkdQIrWW8s6S2D5KZuqoR0StT7Qb3cqbBctVMRg9qI+Xar32buUlE+mBAytC1txjGoPyH7mMgnA7DkDu++x39Zv8KPqD3zC+DGJacKk0eRp9VvggPgUWPKBnBuDgpnKSkU/C/SRoUKtycmySZcOCEbLu0qxFr8bSxN37OVnRMNOFPeY6+LVHMKZaiydzy7Cmp25q7tRy7JwoE7NYIUhSxykmQD8Uyh6L+iATBCvEtmGqiRl/jQcItLwjC+VAajUWzHGFLv1hnoktEQqWVVJAaZ1iogcVeFNQ70uNG7MnCgahDI0NK4FsGkGVOrQVEIbDcemeuO30x3SCeoSJvhtbywNGNaycWzDBw5y4pB40qq2E5z42N3T8qcW6O4stbzby5o/LLvXe6Cj3RgLxdDb2OleHKr8KEUeMiE7DlkGggCx4woHmMj+v++kOm9gt7rbFCkFXnGsvej+b4rU3Lj8nhxxpxhJurOPifKB8LAIce4htEe6+DN1n3a6njRbu5/T331um8Xcqpn8AammMiixX1jCq4N+b4EmD8RG0ccEzULcRuEfQQj9XfbKJMkx0B7q8oyvL7JFQq+njxMDRCcxGcdQ7ZCPsu+1MVMKn5l/Jwpf1ns+tY6q2/LXxdYR0qMGURsgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4Ot6fDtBuK4WVuP68Z/EatoJjeucMrH9hmIFFl9JuABfnJW8o1CMJLHQsVWcg+9bBERcxFgcjobYIk7d0J8RV+z///////////////////////////////////////9/7f///////////////////////////////////////3/u////////////////////////////////////////f1NpZ0VkMjU1MTkgbm8gRWQyNTUxOSBjb2xsaXNpb25zAQAAAAAAAAAAAAAAAAAAAFMtPmJ1ZmxlbiA8PSBCTEFLRTJCX0JMT0NLQllURVMAY3J5cHRvX2dlbmVyaWNoYXNoL2JsYWtlMmIvcmVmL2JsYWtlMmItcmVmLmMAYmxha2UyYl9maW5hbABvdXRsZW4gPD0gVUlOVDhfTUFYAGNyeXB0b19nZW5lcmljaGFzaC9ibGFrZTJiL3JlZi9nZW5lcmljaGFzaF9ibGFrZTJiLmMAY3J5cHRvX2dlbmVyaWNoYXNoX2JsYWtlMmJfZmluYWwAJGFyZ29uMmlkACRhcmdvbjJpACR2PQAkbT0ALHQ9ACxwPQAkYXJnb24yaWQkdj0AJGFyZ29uMmkk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NvZGl1bURSR2J1Zl9sZW4gPD0gU0laRV9NQVgAcmFuZG9tYnl0ZXMvcmFuZG9tYnl0ZXMuYwByYW5kb21ieXRlcwBiNjRfcG9zIDw9IGI2NF9sZW4Ac29kaXVtL2NvZGVjcy5jAHNvZGl1bV9iaW4yYmFzZTY0ADEuMC4xOA==";var CA=!1;function QA(A){for(var I=[],g=0;g255&&(CA&&D(!1,"Character code "+B+" ("+String.fromCharCode(B)+") at offset "+g+" not in 0x00-0xFF."),B&=255),I.push(String.fromCharCode(B));}return I.join("");}var EA="function"==typeof atob?atob:function(A){var I,g,B,C,Q,E,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="",o=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{I=i.indexOf(A.charAt(o++))<<2|(C=i.indexOf(A.charAt(o++)))>>4,g=(15&C)<<4|(Q=i.indexOf(A.charAt(o++)))>>2,B=(3&Q)<<6|(E=i.indexOf(A.charAt(o++))),e+=String.fromCharCode(I),64!==Q&&(e+=String.fromCharCode(g)),64!==E&&(e+=String.fromCharCode(B));}while(o>2]=f,C[r+4>>2]=t,n=n+1|0;}while(16!=(0|n));n=A,r=(I=E)+64|0;do{B[I>>0]=0|B[n>>0],I=I+1|0,n=n+1|0;}while((0|I)<(0|r));for(C[E+88>>2]=1595750129,C[E+88+4>>2]=-1521486534,X=-1377402159^(Q[A+64>>0]|Q[A+64+1>>0]<<8|Q[A+64+2>>0]<<16|Q[A+64+3>>0]<<24),K=1359893119^(Q[A+64+4>>0]|Q[A+64+4+1>>0]<<8|Q[A+64+4+2>>0]<<16|Q[A+64+4+3>>0]<<24),S=725511199^(Q[A+72>>0]|Q[A+72+1>>0]<<8|Q[A+72+2>>0]<<16|Q[A+72+3>>0]<<24),U=-1694144372^(Q[A+72+4>>0]|Q[A+72+4+1>>0]<<8|Q[A+72+4+2>>0]<<16|Q[A+72+4+3>>0]<<24),u=-79577749^(Q[A+80>>0]|Q[A+80+1>>0]<<8|Q[A+80+2>>0]<<16|Q[A+80+3>>0]<<24),H=528734635^(Q[A+80+4>>0]|Q[A+80+4+1>>0]<<8|Q[A+80+4+2>>0]<<16|Q[A+80+4+3>>0]<<24),AA=327033209^(Q[A+88>>0]|Q[A+88+1>>0]<<8|Q[A+88+2>>0]<<16|Q[A+88+3>>0]<<24),$=1541459225^(Q[A+88+4>>0]|Q[A+88+4+1>>0]<<8|Q[A+88+4+2>>0]<<16|Q[A+88+4+3>>0]<<24),h=0|C[E+32>>2],D=0|C[E+32+4>>2],D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(yA=0|vg(0|(j=0|C[E+128>>2]),0|(T=0|C[E+128+4>>2]),0|h,0|D)),0|(wA=0|o()),0|C[E>>2],0|C[E+4>>2]))^X,(yA=0|o())^K,32)),0|(X=0|o()),-205731576,1779033703))^h,(f=0|o())^D,24),h=0|o(),IA=0|C[E+128+8>>2],gA=0|C[E+128+8+4>>2],X=0|ZI((yA=0|vg(0|(yA=0|vg(0|D,0|h,0|wA,0|yA)),0|o(),0|IA,0|gA))^K,(wA=0|o())^X,16),K=0|o(),C[E+96>>2]=X,C[E+96+4>>2]=K,f=0|vg(0|X,0|K,0|I,0|f),I=0|o(),C[E+64>>2]=f,C[E+64+4>>2]=I,h=0|ZI(f^D,I^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,W=0|C[E+40>>2],O=0|C[E+40+4>>2],O=0|ZI((s=0|vg(0|(U=0|ZI((nA=0|vg(0|(aA=0|vg(0|(r=0|C[E+128+16>>2]),0|(n=0|C[E+128+16+4>>2]),0|W,0|O)),0|(nA=0|o()),0|C[E+8>>2],0|C[E+8+4>>2]))^S,(aA=0|o())^U,32)),0|(S=0|o()),-2067093701,-1150833019))^W,(F=0|o())^O,24),W=0|o(),p=0|C[E+128+24>>2],k=0|C[E+128+24+4>>2],S=0|ZI((aA=0|vg(0|(aA=0|vg(0|O,0|W,0|nA,0|aA)),0|o(),0|p,0|k))^U,(nA=0|o())^S,16),U=0|o(),C[E+104>>2]=S,C[E+104+4>>2]=U,F=0|vg(0|S,0|U,0|s,0|F),s=0|o(),C[E+72>>2]=F,C[E+72+4>>2]=s,W=0|ZI(F^O,s^W,63),O=0|o(),m=0|C[E+48>>2],L=0|C[E+48+4>>2],L=0|ZI((z=0|vg(0|(H=0|ZI((oA=0|vg(0|(eA=0|vg(0|(a=0|C[E+128+32>>2]),0|(rA=0|C[E+128+32+4>>2]),0|m,0|L)),0|(oA=0|o()),0|C[E+16>>2],0|C[E+16+4>>2]))^u,(eA=0|o())^H,32)),0|(u=0|o()),-23791573,1013904242))^m,(Z=0|o())^L,24),m=0|o(),i=0|C[E+128+40>>2],G=0|C[E+128+40+4>>2],m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|vg(0|(eA=0|vg(0|L,0|m,0|oA,0|eA)),0|o(),0|i,0|G))^H,(oA=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,(z=0|o())^m,63),L=0|o(),Y=0|C[E+56>>2],d=0|C[E+56+4>>2],d=0|ZI((N=0|vg(0|($=0|ZI((EA=0|vg(0|(QA=0|vg(0|(_=0|C[E+128+48>>2]),0|(l=0|C[E+128+48+4>>2]),0|Y,0|d)),0|(EA=0|o()),0|C[E+24>>2],0|C[E+24+4>>2]))^AA,(QA=0|o())^$,32)),0|(AA=0|o()),1595750129,-1521486534))^Y,(x=0|o())^d,24),Y=0|o(),M=0|C[E+128+56>>2],v=0|C[E+128+56+4>>2],Y=0|ZI((x=0|vg(0|(AA=0|ZI((QA=0|vg(0|(QA=0|vg(0|d,0|Y,0|EA,0|QA)),0|o(),0|M,0|v))^$,(EA=0|o())^AA,16)),0|($=0|o()),0|N,0|x))^d,(N=0|o())^Y,63),d=0|o(),q=0|C[E+128+64>>2],V=0|C[E+128+64+4>>2],O=0|ZI((z=0|vg(0|($=0|ZI((wA=0|vg(0|(wA=0|vg(0|W,0|O,0|yA,0|wA)),0|o(),0|q,0|V))^AA,(yA=0|o())^$,32)),0|(AA=0|o()),0|Z,0|z))^W,(Z=0|o())^O,24),W=0|o(),c=0|C[E+128+72>>2],cA=0|C[E+128+72+4>>2],AA=0|ZI((yA=0|vg(0|(yA=0|vg(0|O,0|W,0|wA,0|yA)),0|o(),0|c,0|cA))^$,(wA=0|o())^AA,16),$=0|o(),C[E+120>>2]=AA,C[E+120+4>>2]=$,Z=0|vg(0|AA,0|$,0|z,0|Z),z=0|o(),C[E+80>>2]=Z,C[E+80+4>>2]=z,W=0|ZI(Z^O,z^W,63),O=0|o(),BA=0|C[E+128+80>>2],CA=0|C[E+128+80+4>>2],L=0|ZI((N=0|vg(0|(K=0|ZI((nA=0|vg(0|(nA=0|vg(0|m,0|L,0|aA,0|nA)),0|o(),0|BA,0|CA))^X,(aA=0|o())^K,32)),0|(X=0|o()),0|x,0|N))^m,(x=0|o())^L,24),m=0|o(),b=0|C[E+128+88>>2],J=0|C[E+128+88+4>>2],m=0|ZI((x=0|vg(0|(X=0|ZI((aA=0|vg(0|(aA=0|vg(0|L,0|m,0|nA,0|aA)),0|o(),0|b,0|J))^K,(nA=0|o())^X,16)),0|(K=0|o()),0|N,0|x))^L,(N=0|o())^m,63),L=0|o(),t=0|C[E+128+96>>2],w=0|C[E+128+96+4>>2],d=0|ZI((I=0|vg(0|(U=0|ZI((oA=0|vg(0|(oA=0|vg(0|Y,0|d,0|eA,0|oA)),0|o(),0|t,0|w))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),e=0|C[E+128+104>>2],iA=0|C[E+128+104+4>>2],Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|d,0|Y,0|oA,0|eA)),0|o(),0|e,0|iA))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),tA=0|C[E+128+112>>2],fA=0|C[E+128+112+4>>2],D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(EA=0|vg(0|QA,0|EA,0|h,0|D)),0|o(),0|tA,0|fA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),P=0|C[E+128+120>>2],R=0|C[E+128+120+4>>2],h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|D,0|h,0|EA,0|QA)),0|o(),0|P,0|R))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|tA,0|fA,0|yA,0|wA)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|BA,0|CA)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|a,0|rA)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|q,0|V)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|c,0|cA)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|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),0|Y,0|d))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|M,0|v)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|i,0|G)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|p,0|k)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|b,0|J)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|q,0|V)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|t,0|w)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|j,0|T)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o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o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|IA,0|gA)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|e,0|iA)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|t,0|w)),0|o(),0|L,0|m))^H,(oA=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,(z=0|o())^m,63),L=0|o(),d=0|ZI((N=0|vg(0|($=0|ZI((EA=0|vg(0|(sA=0|vg(0|Y,0|d,0|b,0|J)),0|o(),0|QA,0|EA))^AA,(QA=0|o())^$,32)),0|(AA=0|o()),0|x,0|N))^Y,(x=0|o())^d,24),Y=0|o(),Y=0|ZI((x=0|vg(0|(AA=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|tA,0|fA)),0|o(),0|d,0|Y))^$,(EA=0|o())^AA,16)),0|($=0|o()),0|N,0|x))^d,(N=0|o())^Y,63),d=0|o(),O=0|ZI((z=0|vg(0|($=0|ZI(AA^(wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|r,0|n)),0|o(),0|W,0|O)),$^(yA=0|o()),32)),0|(AA=0|o()),0|Z,0|z))^W,(Z=0|o())^O,24),W=0|o(),AA=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|_,0|l)),0|o(),0|O,0|W))^$,(wA=0|o())^AA,16),$=0|o(),C[E+120>>2]=AA,C[E+120+4>>2]=$,W=0|ZI((Z=0|vg(0|AA,0|$,0|z,0|Z))^O,(z=0|o())^W,63),O=0|o(),L=0|ZI((N=0|vg(0|(K=0|ZI((nA=0|vg(0|(nA=0|vg(0|aA,0|nA,0|i,0|G)),0|o(),0|m,0|L))^X,(aA=0|o())^K,32)),0|(X=0|o()),0|x,0|N))^m,(x=0|o())^L,24),m=0|o(),m=0|ZI((x=0|vg(0|(X=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|BA,0|CA)),0|o(),0|L,0|m))^K,(nA=0|o())^X,16)),0|(K=0|o()),0|N,0|x))^L,(N=0|o())^m,63),L=0|o(),d=0|ZI((I=0|vg(0|(U=0|ZI((oA=0|vg(0|(oA=0|vg(0|eA,0|oA,0|a,0|rA)),0|o(),0|Y,0|d))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|j,0|T)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|P,0|R)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|q,0|V)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|c,0|cA)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA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),$^(yA=0|o()),32)),0|(AA=0|o()),0|Z,0|z))^W,(Z=0|o())^O,24),W=0|o(),AA=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|IA,0|gA)),0|o(),0|O,0|W))^$,(wA=0|o())^AA,16),$=0|o(),C[E+120>>2]=AA,C[E+120+4>>2]=$,W=0|ZI((Z=0|vg(0|AA,0|$,0|z,0|Z))^O,(z=0|o())^W,63),O=0|o(),L=0|ZI((N=0|vg(0|(K=0|ZI((nA=0|vg(0|(nA=0|vg(0|aA,0|nA,0|b,0|J)),0|o(),0|m,0|L))^X,(aA=0|o())^K,32)),0|(X=0|o()),0|x,0|N))^m,(x=0|o())^L,24),m=0|o(),m=0|ZI((x=0|vg(0|(X=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|t,0|w)),0|o(),0|L,0|m))^K,(nA=0|o())^X,16)),0|(K=0|o()),0|N,0|x))^L,(N=0|o())^m,63),L=0|o(),d=0|ZI((I=0|vg(0|(U=0|ZI((oA=0|vg(0|(oA=0|vg(0|eA,0|oA,0|_,0|l)),0|o(),0|Y,0|d))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|q,0|V)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|p,0|k)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|e,0|iA)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|r,0|n)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|t,0|w)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|_,0|l)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|BA,0|CA)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|j,0|T)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|b,0|J)),0|o(),0|L,0|m))^H,(oA=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,(z=0|o())^m,63),L=0|o(),d=0|ZI((N=0|vg(0|($=0|ZI((EA=0|vg(0|(sA=0|vg(0|Y,0|d,0|q,0|V)),0|o(),0|QA,0|EA))^AA,(QA=0|o())^$,32)),0|(AA=0|o()),0|x,0|N))^Y,(x=0|o())^d,24),Y=0|o(),Y=0|ZI((x=0|vg(0|(AA=0|ZI((QA=0|v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0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|c,0|cA)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|t,0|w)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|i,0|G)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|IA,0|gA)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|P,0|R)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|tA,0|fA)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|e,0|iA)),0|o(),0|L,0|m))^H,(oA=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,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(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|r,0|n)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|q,0|V)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|b,0|J)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|e,0|iA)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|b,0|J)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|M,0|v)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|tA,0|fA)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|t,0|w)),0|o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|o()),0|N,0|x))^L,(N=0|o())^m,63),L=0|o(),d=0|ZI((I=0|vg(0|(U=0|ZI((oA=0|vg(0|(oA=0|vg(0|eA,0|oA,0|q,0|V)),0|o(),0|Y,0|d))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|_,0|l)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|r,0|n)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|BA,0|CA)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|_,0|l)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|P,0|R)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|tA,0|fA)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(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0|nA,0|e,0|iA)),0|o(),0|m,0|L))^X,(aA=0|o())^K,32)),0|(X=0|o()),0|x,0|N))^m,(x=0|o())^L,24),m=0|o(),m=0|ZI((x=0|vg(0|(X=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|M,0|v)),0|o(),0|L,0|m))^K,(nA=0|o())^X,16)),0|(K=0|o()),0|N,0|x))^L,(N=0|o())^m,63),L=0|o(),d=0|ZI((I=0|vg(0|(U=0|ZI((oA=0|vg(0|(oA=0|vg(0|eA,0|oA,0|IA,0|gA)),0|o(),0|Y,0|d))^S,(eA=0|o())^U,32)),0|(S=0|o()),0|f,0|I))^Y,(f=0|o())^d,24),Y=0|o(),Y=0|ZI((f=0|vg(0|(S=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|a,0|rA)),0|o(),0|d,0|Y))^U,(oA=0|o())^S,16)),0|(U=0|o()),0|I,0|f))^d,(I=0|o())^Y,63),d=0|o(),D=0|ZI((s=0|vg(0|(H=0|ZI((EA=0|vg(0|(sA=0|vg(0|h,0|D,0|BA,0|CA)),0|o(),0|QA,0|EA))^u,(QA=0|o())^H,32)),0|(u=0|o()),0|F,0|s))^h,(F=0|o())^D,24),h=0|o(),h=0|ZI((F=0|vg(0|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|i,0|G)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((wA=0|vg(0|(wA=0|vg(0|yA,0|wA,0|BA,0|CA)),0|o(),0|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|r,0|n)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())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|h,0|D))^X,(yA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((yA=0|vg(0|(yA=0|vg(0|wA,0|yA,0|IA,0|gA)),0|o(),0|D,0|h))^K,(wA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(sA=0|vg(0|W,0|O,0|r,0|n)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((aA=0|vg(0|(aA=0|vg(0|nA,0|aA,0|p,0|k)),0|o(),0|O,0|W))^U,(nA=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(sA=0|vg(0|m,0|L,0|a,0|rA)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((eA=0|vg(0|(eA=0|vg(0|oA,0|eA,0|i,0|G)),0|o(),0|L,0|m))^H,(oA=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,(z=0|o())^m,63),L=0|o(),d=0|ZI((N=0|vg(0|($=0|ZI((EA=0|vg(0|(sA=0|vg(0|Y,0|d,0|_,0|l)),0|o(),0|QA,0|EA))^AA,(QA=0|o())^$,32)),0|(AA=0|o()),0|x,0|N))^Y,(x=0|o())^d,24),Y=0|o(),Y=0|ZI((x=0|vg(0|(AA=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|M,0|v)),0|o(),0|d,0|Y))^$,(EA=0|o())^AA,16)),0|($=0|o()),0|N,0|x))^d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|(u=0|ZI((QA=0|vg(0|(QA=0|vg(0|EA,0|QA,0|P,0|R)),0|o(),0|D,0|h))^H,(EA=0|o())^u,16)),0|(H=0|o()),0|s,0|F))^D,(s=0|o())^h,63),D=0|o(),D=0|ZI((I=0|vg(0|(K=0|ZI((fA=0|vg(0|(fA=0|vg(0|yA,0|wA,0|tA,0|fA)),0|o(),0|h,0|D))^X,(tA=0|o())^K,32)),0|(X=0|o()),0|f,0|I))^h,(f=0|o())^D,24),h=0|o(),h=0|ZI((f=0|vg(0|(X=0|ZI((CA=0|vg(0|(CA=0|vg(0|fA,0|tA,0|BA,0|CA)),0|o(),0|D,0|h))^K,(BA=0|o())^X,16)),0|(K=0|o()),0|I,0|f))^D,(I=0|o())^h,63),D=0|o(),C[E+32>>2]=h,C[E+32+4>>2]=D,O=0|ZI((s=0|vg(0|(U=0|ZI(S^(nA=0|vg(0|(rA=0|vg(0|W,0|O,0|a,0|rA)),0|o(),0|aA,0|nA)),U^(aA=0|o()),32)),0|(S=0|o()),0|F,0|s))^W,(F=0|o())^O,24),W=0|o(),W=0|ZI((F=0|vg(0|(S=0|ZI((V=0|vg(0|(V=0|vg(0|nA,0|aA,0|q,0|V)),0|o(),0|O,0|W))^U,(q=0|o())^S,16)),0|(U=0|o()),0|s,0|F))^O,(s=0|o())^W,63),O=0|o(),L=0|ZI((z=0|vg(0|(H=0|ZI(u^(oA=0|vg(0|(cA=0|vg(0|m,0|L,0|c,0|cA)),0|o(),0|eA,0|oA)),H^(eA=0|o()),32)),0|(u=0|o()),0|Z,0|z))^m,(Z=0|o())^L,24),m=0|o(),m=0|ZI((Z=0|vg(0|(u=0|ZI((R=0|vg(0|(R=0|vg(0|oA,0|eA,0|P,0|R)),0|o(),0|L,0|m))^H,(P=0|o())^u,16)),0|(H=0|o()),0|z,0|Z))^L,(z=0|o())^m,63),L=0|o(),d=0|ZI((N=0|vg(0|($=0|ZI((EA=0|vg(0|(iA=0|vg(0|Y,0|d,0|e,0|iA)),0|o(),0|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g=0,ag=0,ng=0,tg=0,fg=0,wg=0,sg=0,hg=0,Dg=0,Fg=0,pg=0,ug=0;wA=0|Bg(0|B[(I|=0)>>0],0|B[I+1>>0],0|B[I+2>>0]),o(),UI=0|yg(0|(UI=0|kI(I+2|0)),0|o(),5),o(),uI=0|yg(0|(uI=0|Bg(0|B[I+5>>0],0|B[I+6>>0],0|B[I+7>>0])),0|o(),2),o(),SI=0|yg(0|(SI=0|kI(I+7|0)),0|o(),7),o(),yI=0|yg(0|(yI=0|kI(I+10|0)),0|o(),4),o(),CA=0|yg(0|(CA=0|Bg(0|B[I+13>>0],0|B[I+14>>0],0|B[I+15>>0])),0|o(),1),o(),FA=0|yg(0|(FA=0|kI(I+15|0)),0|o(),6),o(),_=0|yg(0|(_=0|Bg(0|B[I+18>>0],0|B[I+19>>0],0|B[I+20>>0])),0|o(),3),o(),QA=0|Bg(0|B[I+21>>0],0|B[I+22>>0],0|B[I+23>>0]),o(),q=0|yg(0|(q=0|kI(I+23|0)),0|o(),5),o(),HA=0|yg(0|(HA=0|Bg(0|B[I+26>>0],0|B[I+27>>0],0|B[I+28>>0])),0|o(),2),o(),GA=0|yg(0|(GA=0|kI(I+28|0)),0|o(),7),dA=0|o(),XI=0|Bg(0|B[g>>0],0|B[g+1>>0],0|B[g+2>>0]),o(),hI=0|yg(0|(hI=0|kI(g+2|0)),0|o(),5),o(),gI=0|yg(0|(gI=0|Bg(0|B[g+5>>0],0|B[g+6>>0],0|B[g+7>>0])),0|o(),2),o(),G=0|yg(0|(G=0|kI(g+7|0)),0|o(),7),o(),d=0|yg(0|(d=0|kI(g+10|0)),0|o(),4),o(),x=0|yg(0|(x=0|Bg(0|B[g+13>>0],0|B[g+14>>0],0|B[g+15>>0])),0|o(),1),o(),zA=0|yg(0|(zA=0|kI(g+15|0)),0|o(),6),o(),sA=0|yg(0|(sA=0|Bg(0|B[g+18>>0],0|B[g+19>>0],0|B[g+20>>0])),0|o(),3),o(),RA=0|Bg(0|B[g+21>>0],0|B[g+22>>0],0|B[g+23>>0]),o(),IA=0|yg(0|(IA=0|kI(g+23|0)),0|o(),5),o(),NI=0|yg(0|(NI=0|Bg(0|B[g+26>>0],0|B[g+27>>0],0|B[g+28>>0])),0|o(),2),o(),rA=0|yg(0|(rA=0|kI(g+28|0)),0|o(),7),nA=0|o(),LA=0|Bg(0|B[C>>0],0|B[C+1>>0],0|B[C+2>>0]),o(),BA=0|yg(0|(BA=0|kI(C+2|0)),0|o(),5),o(),KA=0|yg(0|(KA=0|Bg(0|B[C+5>>0],0|B[C+6>>0],0|B[C+7>>0])),0|o(),2),o(),bA=0|yg(0|(bA=0|kI(C+7|0)),0|o(),7),o(),PA=0|yg(0|(PA=0|kI(C+10|0)),0|o(),4),o(),WA=0|yg(0|(WA=0|Bg(0|B[C+13>>0],0|B[C+14>>0],0|B[C+15>>0])),0|o(),1),o(),_I=0|yg(0|(_I=0|kI(C+15|0)),0|o(),6),o(),U=0|yg(0|(U=0|Bg(0|B[C+18>>0],0|B[C+19>>0],0|B[C+20>>0])),0|o(),3),o(),cI=0|Bg(0|B[C+21>>0],0|B[C+22>>0],0|B[C+23>>0]),o(),TA=0|yg(0|(TA=0|kI(C+23|0)),0|o(),5),o(),tA=0|yg(0|(tA=0|Bg(0|B[C+26>>0],0|B[C+27>>0],0|B[C+28>>0])),0|o(),2),o(),FI=0|yg(0|(FI=0|kI(C+28|0)),0|o(),7),GI=0|o(),mA=0|vg(2097151&LA|0,0,0|(mA=0|Qg(2097151&XI|0,0,2097151&wA|0,0)),0|o()),LA=0|o(),F=0|Qg(2097151&hI|0,0,2097151&wA|0,0),D=0|o(),h=0|Qg(2097151&XI|0,0,2097151&UI|0,0),$A=0|o(),Z=0|Qg(2097151&gI|0,0,2097151&wA|0,0),xA=0|o(),KA=0|vg(0|(xA=0|vg(0|(vA=0|vg(0|(O=0|Qg(2097151&hI|0,0,2097151&UI|0,0)),0|o(),0|(vA=0|Qg(2097151&XI|0,0,2097151&uI|0,0)),0|o())),0|o(),0|Z,0|xA)),0|o(),2097151&KA|0,0),xA=0|o(),Z=0|Qg(2097151&G|0,0,2097151&wA|0,0),vA=0|o(),l=0|Qg(2097151&gI|0,0,2097151&UI|0,0),O=0|o(),s=0|Qg(2097151&hI|0,0,2097151&uI|0,0),y=0|o(),w=0|Qg(2097151&XI|0,0,2097151&SI|0,0),ug=0|o(),aA=0|Qg(2097151&d|0,0,2097151&wA|0,0),JA=0|o(),sg=0|Qg(2097151&G|0,0,2097151&UI|0,0),OA=0|o(),Dg=0|Qg(2097151&gI|0,0,2097151&uI|0,0),P=0|o(),PA=0|vg(0|(JA=0|vg(0|(OA=0|vg(0|(P=0|vg(0|(hg=0|vg(0|(Fg=0|Qg(2097151&hI|0,0,2097151&SI|0,0)),0|o(),0|(hg=0|Qg(2097151&XI|0,0,2097151&yI|0,0)),0|o())),0|o(),0|Dg,0|P)),0|o(),0|sg,0|OA)),0|o(),0|aA,0|JA)),0|o(),2097151&PA|0,0),JA=0|o(),aA=0|Qg(2097151&x|0,0,2097151&wA|0,0),OA=0|o(),sg=0|Qg(2097151&d|0,0,2097151&UI|0,0),P=0|o(),Dg=0|Qg(2097151&G|0,0,2097151&uI|0,0),hg=0|o(),k=0|Qg(2097151&gI|0,0,2097151&SI|0,0),Fg=0|o(),f=0|Qg(2097151&hI|0,0,2097151&yI|0,0),t=0|o(),r=0|Qg(2097151&XI|0,0,2097151&CA|0,0),pg=0|o(),I=0|Qg(2097151&zA|0,0,2097151&wA|0,0),DI=0|o(),Eg=0|Qg(2097151&x|0,0,2097151&UI|0,0),Y=0|o(),og=0|Qg(2097151&d|0,0,2097151&uI|0,0),S=0|o(),ag=0|Qg(2097151&G|0,0,2097151&SI|0,0),eg=0|o(),tg=0|Qg(2097151&gI|0,0,2097151&yI|0,0),cg=0|o(),_I=0|vg(0|(DI=0|vg(0|(Y=0|vg(0|(S=0|vg(0|(eg=0|vg(0|(cg=0|vg(0|(ng=0|vg(0|(fg=0|Qg(2097151&hI|0,0,2097151&CA|0,0)),0|o(),0|(ng=0|Qg(2097151&XI|0,0,2097151&FA|0,0)),0|o())),0|o(),0|tg,0|cg)),0|o(),0|ag,0|eg)),0|o(),0|og,0|S)),0|o(),0|Eg,0|Y)),0|o(),0|I,0|DI)),0|o(),2097151&_I|0,0),DI=0|o(),I=0|Qg(2097151&sA|0,0,2097151&wA|0,0),Y=0|o(),Eg=0|Qg(2097151&zA|0,0,2097151&UI|0,0),S=0|o(),og=0|Qg(2097151&x|0,0,2097151&uI|0,0),eg=0|o(),ag=0|Qg(2097151&d|0,0,2097151&SI|0,0),cg=0|o(),tg=0|Qg(2097151&G|0,0,2097151&yI|0,0),ng=0|o(),H=0|Qg(2097151&gI|0,0,2097151&CA|0,0),fg=0|o(),n=0|Qg(2097151&hI|0,0,2097151&FA|0,0),a=0|o(),c=0|Qg(2097151&XI|0,0,2097151&_|0,0),wg=0|o(),qI=0|Qg(2097151&RA|0,0,2097151&wA|0,0),M=0|o(),T=0|Qg(2097151&sA|0,0,2097151&UI|0,0),aI=0|o(),jI=0|Qg(2097151&zA|0,0,2097151&uI|0,0),TI=0|o(),zI=0|Qg(2097151&x|0,0,2097151&SI|0,0),j=0|o(),OI=0|Qg(2097151&d|0,0,2097151&yI|0,0),VI=0|o(),$I=0|Qg(2097151&G|0,0,2097151&CA|0,0),WI=0|o(),Ig=0|Qg(2097151&gI|0,0,2097151&FA|0,0),ZI=0|o(),cI=0|vg(0|(aI=0|vg(0|(M=0|vg(0|(TI=0|vg(0|(j=0|vg(0|(VI=0|vg(0|(WI=0|vg(0|(ZI=0|vg(0|(Ag=0|vg(0|(gg=0|Qg(2097151&hI|0,0,2097151&_|0,0)),0|o(),0|(Ag=0|Qg(2097151&XI|0,0,2097151&QA|0,0)),0|o())),0|o(),0|Ig,0|ZI)),0|o(),0|$I,0|WI)),0|o(),0|OI,0|VI)),0|o(),0|zI,0|j)),0|o(),0|jI,0|TI)),0|o(),0|qI,0|M)),0|o(),0|T,0|aI)),0|o(),2097151&cI|0,0),aI=0|o(),T=0|Qg(2097151&IA|0,0,2097151&wA|0,0),M=0|o(),qI=0|Qg(2097151&RA|0,0,2097151&UI|0,0),TI=0|o(),jI=0|Qg(2097151&sA|0,0,2097151&uI|0,0),j=0|o(),zI=0|Qg(2097151&zA|0,0,2097151&SI|0,0),VI=0|o(),OI=0|Qg(2097151&x|0,0,2097151&yI|0,0),WI=0|o(),$I=0|Qg(2097151&d|0,0,2097151&CA|0,0),ZI=0|o(),Ig=0|Qg(2097151&G|0,0,2097151&FA|0,0),Ag=0|o(),u=0|Qg(2097151&gI|0,0,2097151&_|0,0),gg=0|o(),e=0|Qg(2097151&hI|0,0,2097151&QA|0,0),i=0|o(),E=0|Qg(2097151&XI|0,0,2097151&q|0,0),Cg=0|o(),yA=0|Qg(2097151&NI|0,0,2097151&wA|0,0),fA=0|o(),W=0|Qg(2097151&IA|0,0,2097151&UI|0,0),z=0|o(),iI=0|Qg(2097151&RA|0,0,2097151&uI|0,0),EI=0|o(),JI=0|Qg(2097151&sA|0,0,2097151&SI|0,0),bI=0|o(),EA=0|Qg(2097151&zA|0,0,2097151&yI|0,0),b=0|o(),lI=0|Qg(2097151&x|0,0,2097151&CA|0,0),HI=0|o(),II=0|Qg(2097151&d|0,0,2097151&FA|0,0),AI=0|o(),rI=0|Qg(2097151&G|0,0,2097151&_|0,0),nI=0|o(),V=0|Qg(2097151&gI|0,0,2097151&QA|0,0),C=0|o(),tA=0|vg(0|(fA=0|vg(0|(z=0|vg(0|(bI=0|vg(0|(EI=0|vg(0|(b=0|vg(0|(HI=0|vg(0|(AI=0|vg(0|(nI=0|vg(0|(C=0|vg(0|(xI=0|vg(0|Qg(2097151&hI|0,0,2097151&q|0,0),0|(LI=0|o()),0|(xI=0|Qg(2097151&XI|0,0,2097151&HA|0,0)),0|o())),0|o(),0|V,0|C)),0|o(),0|rI,0|nI)),0|o(),0|II,0|AI)),0|o(),0|lI,0|HI)),0|o(),0|EA,0|b)),0|o(),0|iI,0|EI)),0|o(),0|JI,0|bI)),0|o(),0|W,0|z)),0|o(),0|yA,0|fA)),0|o(),2097151&tA|0,0),fA=0|o(),wA=0|Qg(0|rA,0|nA,2097151&wA|0,0),yA=0|o(),z=0|Qg(2097151&NI|0,0,2097151&UI|0,0),W=0|o(),bI=0|Qg(2097151&IA|0,0,2097151&uI|0,0),JI=0|o(),EI=0|Qg(2097151&RA|0,0,2097151&SI|0,0),iI=0|o(),b=0|Qg(2097151&sA|0,0,2097151&yI|0,0),EA=0|o(),HI=0|Qg(2097151&zA|0,0,2097151&CA|0,0),lI=0|o(),AI=0|Qg(2097151&x|0,0,2097151&FA|0,0),II=0|o(),nI=0|Qg(2097151&d|0,0,2097151&_|0,0),rI=0|o(),C=0|Qg(2097151&G|0,0,2097151&QA|0,0),V=0|o(),xI=0|Qg(2097151&gI|0,0,2097151&q|0,0),LI=0|o(),p=0|Qg(2097151&hI|0,0,2097151&HA|0,0),Q=0|o(),XI=0|Qg(2097151&XI|0,0,0|GA,0|dA),KI=0|o(),UI=0|Qg(0|rA,0|nA,2097151&UI|0,0),vI=0|o(),hA=0|Qg(2097151&NI|0,0,2097151&uI|0,0),pI=0|o(),PI=0|Qg(2097151&IA|0,0,2097151&SI|0,0),N=0|o(),uA=0|Qg(2097151&RA|0,0,2097151&yI|0,0),cA=0|o(),oA=0|Qg(2097151&sA|0,0,2097151&CA|0,0),RI=0|o(),SA=0|Qg(2097151&zA|0,0,2097151&FA|0,0),L=0|o(),kA=0|Qg(2097151&x|0,0,2097151&_|0,0),UA=0|o(),fI=0|Qg(2097151&d|0,0,2097151&QA|0,0),YA=0|o(),sI=0|Qg(2097151&G|0,0,2097151&q|0,0),tI=0|o(),vI=0|vg(0|(pI=0|vg(0|(N=0|vg(0|(RI=0|vg(0|(cA=0|vg(0|(L=0|vg(0|(UA=0|vg(0|(YA=0|vg(0|(tI=0|vg(0|(hI=0|vg(0|(MI=0|Qg(2097151&gI|0,0,2097151&HA|0,0)),0|(BI=0|o()),0|(hI=0|Qg(2097151&hI|0,0,0|GA,0|dA)),0|o())),0|o(),0|sI,0|tI)),0|o(),0|fI,0|YA)),0|o(),0|kA,0|UA)),0|o(),0|SA,0|L)),0|o(),0|uA,0|cA)),0|o(),0|oA,0|RI)),0|o(),0|PI,0|N)),0|o(),0|hA,0|pI)),0|o(),0|UI,0|vI),UI=0|o(),uI=0|Qg(0|rA,0|nA,2097151&uI|0,0),pI=0|o(),hA=0|Qg(2097151&NI|0,0,2097151&SI|0,0),N=0|o(),PI=0|Qg(2097151&IA|0,0,2097151&yI|0,0),RI=0|o(),oA=0|Qg(2097151&RA|0,0,2097151&CA|0,0),cA=0|o(),uA=0|Qg(2097151&sA|0,0,2097151&FA|0,0),L=0|o(),SA=0|Qg(2097151&zA|0,0,2097151&_|0,0),UA=0|o(),kA=0|Qg(2097151&x|0,0,2097151&QA|0,0),YA=0|o(),fI=0|Qg(2097151&d|0,0,2097151&q|0,0),tI=0|o(),sI=0|Qg(2097151&G|0,0,2097151&HA|0,0),hI=0|o(),gI=0|Qg(2097151&gI|0,0,0|GA,0|dA),BI=0|o(),SI=0|Qg(0|rA,0|nA,2097151&SI|0,0),MI=0|o(),dI=0|Qg(2097151&NI|0,0,2097151&yI|0,0),wI=0|o(),K=0|Qg(2097151&IA|0,0,2097151&CA|0,0),YI=0|o(),qA=0|Qg(2097151&RA|0,0,2097151&FA|0,0),$=0|o(),J=0|Qg(2097151&sA|0,0,2097151&_|0,0),g=0|o(),v=0|Qg(2097151&zA|0,0,2097151&QA|0,0),ZA=0|o(),pA=0|Qg(2097151&x|0,0,2097151&q|0,0),DA=0|o(),MI=0|vg(0|(wI=0|vg(0|(YI=0|vg(0|(g=0|vg(0|($=0|vg(0|(ZA=0|vg(0|(DA=0|vg(0|(G=0|vg(0|(mI=0|Qg(2097151&d|0,0,2097151&HA|0,0)),0|(m=0|o()),0|(G=0|Qg(2097151&G|0,0,0|GA,0|dA)),0|o())),0|o(),0|pA,0|DA)),0|o(),0|v,0|ZA)),0|o(),0|qA,0|$)),0|o(),0|J,0|g)),0|o(),0|K,0|YI)),0|o(),0|dI,0|wI)),0|o(),0|SI,0|MI),SI=0|o(),yI=0|Qg(0|rA,0|nA,2097151&yI|0,0),wI=0|o(),dI=0|Qg(2097151&NI|0,0,2097151&CA|0,0),YI=0|o(),K=0|Qg(2097151&IA|0,0,2097151&FA|0,0),g=0|o(),J=0|Qg(2097151&RA|0,0,2097151&_|0,0),$=0|o(),qA=0|Qg(2097151&sA|0,0,2097151&QA|0,0),ZA=0|o(),v=0|Qg(2097151&zA|0,0,2097151&q|0,0),DA=0|o(),pA=0|Qg(2097151&x|0,0,2097151&HA|0,0),G=0|o(),d=0|Qg(2097151&d|0,0,0|GA,0|dA),m=0|o(),CA=0|Qg(0|rA,0|nA,2097151&CA|0,0),mI=0|o(),QI=0|Qg(2097151&NI|0,0,2097151&FA|0,0),gA=0|o(),_A=0|Qg(2097151&IA|0,0,2097151&_|0,0),CI=0|o(),X=0|Qg(2097151&RA|0,0,2097151&QA|0,0),iA=0|o(),eA=0|Qg(2097151&sA|0,0,2097151&q|0,0),lA=0|o(),mI=0|vg(0|(gA=0|vg(0|(CI=0|vg(0|(lA=0|vg(0|(iA=0|vg(0|(x=0|vg(0|(R=0|Qg(2097151&zA|0,0,2097151&HA|0,0)),0|(VA=0|o()),0|(x=0|Qg(2097151&x|0,0,0|GA,0|dA)),0|o())),0|o(),0|X,0|iA)),0|o(),0|eA,0|lA)),0|o(),0|_A,0|CI)),0|o(),0|QI,0|gA)),0|o(),0|CA,0|mI),CA=0|o(),FA=0|Qg(0|rA,0|nA,2097151&FA|0,0),gA=0|o(),QI=0|Qg(2097151&NI|0,0,2097151&_|0,0),CI=0|o(),_A=0|Qg(2097151&IA|0,0,2097151&QA|0,0),lA=0|o(),eA=0|Qg(2097151&RA|0,0,2097151&q|0,0),iA=0|o(),X=0|Qg(2097151&sA|0,0,2097151&HA|0,0),x=0|o(),zA=0|Qg(2097151&zA|0,0,0|GA,0|dA),VA=0|o(),_=0|Qg(0|rA,0|nA,2097151&_|0,0),R=0|o(),XA=0|Qg(2097151&NI|0,0,2097151&QA|0,0),AA=0|o(),oI=0|Qg(2097151&IA|0,0,2097151&q|0,0),jA=0|o(),NA=0|Qg(2097151&RA|0,0,2097151&HA|0,0),eI=0|o(),R=0|vg(0|(AA=0|vg(0|(jA=0|vg(0|(eI=0|vg(0|(sA=0|Qg(2097151&sA|0,0,0|GA,0|dA)),0|o(),0|NA,0|eI)),0|o(),0|oI,0|jA)),0|o(),0|XA,0|AA)),0|o(),0|_,0|R),_=0|o(),QA=0|Qg(0|rA,0|nA,2097151&QA|0,0),AA=0|o(),XA=0|Qg(2097151&NI|0,0,2097151&q|0,0),jA=0|o(),oI=0|Qg(2097151&IA|0,0,2097151&HA|0,0),eI=0|o(),RA=0|Qg(2097151&RA|0,0,0|GA,0|dA),NA=0|o(),q=0|Qg(0|rA,0|nA,2097151&q|0,0),sA=0|o(),sA=0|vg(0|(IA=0|vg(0|Qg(2097151&NI|0,0,2097151&HA|0,0),0|(MA=0|o()),0|(IA=0|Qg(2097151&IA|0,0,0|GA,0|dA)),0|o())),0|o(),0|q,0|sA),q=0|o(),NI=0|vg(0|(HA=0|Qg(0|rA,0|nA,2097151&HA|0,0)),0|(IA=0|o()),0|(NI=0|Qg(2097151&NI|0,0,0|GA,0|dA)),0|o()),IA=0|o(),dA=0|Qg(0|rA,0|nA,0|GA,0|dA),GA=0|o(),HA=0|yg(0|(nA=0|vg(0|mA,0|LA,1048576,0)),0|(rA=0|o()),21),MA=0|o(),MA=0|vg(0|(BA=0|vg(0|($A=0|vg(0|F,0|D,0|h,0|$A)),0|o(),2097151&BA|0,0)),0|o(),0|HA,0|MA),HA=0|o(),rA=0|Ug(0|mA,0|LA,-2097152&nA|0,4095&rA|0),nA=0|o(),BA=0|yg(0|(LA=0|vg(0|KA,0|xA,1048576,0)),0|(mA=0|o()),21),$A=0|o(),$A=0|vg(0|(bA=0|vg(0|(vA=0|vg(0|(O=0|v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dI=0|o(),dI=0|vg(0|(gA=0|vg(0|(CI=0|vg(0|(lA=0|vg(0|(x=0|vg(0|(VA=0|vg(0|eA,0|iA,0|zA,0|VA)),0|o(),0|X,0|x)),0|o(),0|_A,0|lA)),0|o(),0|QI,0|CI)),0|o(),0|FA,0|gA)),0|o(),0|YI,0|dI),YI=0|o(),CI=0|ig(0|(gA=0|vg(0|R,0|_,1048576,0)),0|(FA=0|o()),21),QI=0|o(),QI=0|vg(0|(AA=0|vg(0|(jA=0|vg(0|(NA=0|vg(0|oI,0|eI,0|RA,0|NA)),0|o(),0|XA,0|jA)),0|o(),0|QA,0|AA)),0|o(),0|CI,0|QI),CI=0|o(),FA=0|Ug(0|R,0|_,-2097152&gA|0,0|FA),gA=0|o(),AA=0|vg(0|NI,0|IA,0|(AA=0|ig(0|(_=0|vg(0|sA,0|q,1048576,0)),0|(R=0|o()),21)),0|o()),IA=0|o(),R=0|Ug(0|sA,0|q,-2097152&_|0,0|R),_=0|o(),NI=0|ig(0|(q=0|vg(0|dA,0|GA,1048576,0)),0|(sA=0|o()),21),QA=0|o(),sA=0|Ug(0|dA,0|GA,-2097152&q|0,0|sA),q=0|o(),jA=0|yg(0|(GA=0|vg(0|MA,0|HA,1048576,0)),0|(dA=0|o()),21),XA=0|o(),dA=0|Ug(0|MA,0|HA,-2097152&GA|0,0|dA),GA=0|o(),NA=0|ig(0|(HA=0|vg(0|$A,0|BA,1048576,0)),0|(MA=0|o()),21),RA=0|o(),MA=0|Ug(0|$A,0|BA,-2097152&HA|0,0|MA),HA=0|o(),eI=0|ig(0|(BA=0|vg(0|O,0|Z,1048576,0)),0|($A=0|o()),21),oI=0|o(),$A=0|Ug(0|O,0|Z,-2097152&BA|0,0|$A),BA=0|o(),lA=0|ig(0|(Z=0|vg(0|P,0|aA,1048576,0)),0|(O=0|o()),21),_A=0|o(),VA=0|ig(0|(x=0|vg(0|S,0|I,1048576,0)),0|(X=0|o()),21),zA=0|o(),g=0|ig(0|(iA=0|vg(0|j,0|T,1048576,0)),0|(eA=0|o()),21),K=0|o(),$=0|ig(0|(ZA=0|vg(0|z,0|W,1048576,0)),0|(qA=0|o()),21),J=0|o(),m=0|ig(0|(DA=0|vg(0|hA,0|N,1048576,0)),0|(v=0|o()),21),d=0|o(),gA=0|vg(0|(RI=0|ig(0|(G=0|vg(0|dI,0|YI,1048576,0)),0|(pA=0|o()),21)),0|o(),0|FA,0|gA),FA=0|o(),pA=0|Ug(0|dI,0|YI,-2097152&G|0,0|pA),G=0|o(),_=0|vg(0|(RI=0|ig(0|(YI=0|vg(0|QI,0|CI,1048576,0)),0|(dI=0|o()),21)),0|o(),0|R,0|_),R=0|o(),dI=0|Ug(0|QI,0|CI,-2097152&YI|0,0|dI),YI=0|o(),q=0|vg(0|(RI=0|ig(0|(CI=0|vg(0|AA,0|IA,1048576,0)),0|(QI=0|o()),21)),0|o(),0|sA,0|q),sA=0|o(),QI=0|Ug(0|AA,0|IA,-2097152&CI|0,0|QI),CI=0|o(),IA=0|Qg(0|NI,0|QA,666643,0),AA=0|o(),RI=0|Qg(0|NI,0|QA,470296,0),PI=0|o(),L=0|Qg(0|NI,0|QA,654183,0),uA=0|o(),cA=0|Qg(0|NI,0|QA,-997805,-1),oA=0|o(),UA=0|Qg(0|NI,0|QA,136657,0),SA=0|o(),d=0|vg(0|(yI=0|Ug(0|(QA=0|vg(0|mI,0|CA,0|(QA=0|Qg(0|NI,0|QA,-683901,-1)),0|o())),0|o(),-2097152&wI|0,0|yI)),0|o(),0|m,0|d),m=0|o(),yI=0|Qg(0|q,0|sA,666643,0),wI=0|o(),QA=0|Qg(0|q,0|sA,470296,0),CA=0|o(),mI=0|Qg(0|q,0|sA,654183,0),NI=0|o(),YA=0|Qg(0|q,0|sA,-997805,-1),kA=0|o(),tI=0|Qg(0|q,0|sA,136657,0),fI=0|o(),sA=0|Qg(0|q,0|sA,-683901,-1),q=0|o(),BI=0|Qg(0|QI,0|CI,666643,0),gI=0|o(),hI=0|Qg(0|QI,0|CI,470296,0),sI=0|o(),yA=0|Qg(0|QI,0|CI,654183,0),wA=0|o(),JI=0|Qg(0|QI,0|CI,-997805,-1),bI=0|o(),EA=0|Qg(0|QI,0|CI,136657,0),b=0|o(),CI=0|Qg(0|QI,0|CI,-683901,-1),QI=0|o(),J=0|vg(0|(uI=0|Ug(0|(QI=0|vg(0|(fI=0|vg(0|(oA=0|vg(0|MI,0|SI,0|cA,0|oA)),0|o(),0|tI,0|fI)),0|o(),0|CI,0|QI)),0|o(),-2097152&pI|0,0|uI)),0|o(),0|$,0|J),$=0|o(),uI=0|Qg(0|_,0|R,666643,0),pI=0|o(),QI=0|Qg(0|_,0|R,470296,0),CI=0|o(),fI=0|Qg(0|_,0|R,654183,0),tI=0|o(),oA=0|Qg(0|_,0|R,-997805,-1),cA=0|o(),SI=0|Qg(0|_,0|R,136657,0),MI=0|o(),R=0|Qg(0|_,0|R,-683901,-1),_=0|o(),iI=0|Qg(0|dI,0|YI,666643,0),EI=0|o(),lI=0|Qg(0|dI,0|YI,470296,0),HI=0|o(),II=0|Qg(0|dI,0|YI,654183,0),AI=0|o(),rI=0|Qg(0|dI,0|YI,-997805,-1),nI=0|o(),V=0|Qg(0|dI,0|YI,136657,0),C=0|o(),YI=0|Qg(0|dI,0|YI,-683901,-1),dI=0|o(),K=0|vg(0|(FI=0|Ug(0|(dI=0|vg(0|(MI=0|vg(0|(UI=0|vg(0|(bI=0|vg(0|(PI=0|vg(0|mI,0|NI,0|RI,0|PI)),0|o(),0|JI,0|bI)),0|o(),0|vI,0|UI)),0|o(),0|SI,0|MI)),0|o(),0|YI,0|dI)),0|o(),-2097152&GI|0,0|FI)),0|o(),0|g,0|K),g=0|o(),OA=0|Ug(0|(oI=0|vg(0|(FI=0|vg(0|_I,0|DI,0|(FI=0|Qg(0|gA,0|FA,666643,0)),0|o())),0|o(),0|eI,0|oI)),0|o(),-2097152&WA|0,0|OA),WA=0|o(),oI=0|Qg(0|gA,0|FA,470296,0),eI=0|o(),FI=0|Q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|AA)),0|o(),0|yA,0|wA)),0|o(),0|oA,0|cA)),0|o(),0|V,0|C)),0|o(),0|FA,0|gA)),0|o(),0|j,0|T)),0|o(),-2097152&iA|0,0|eA)),0|o(),0|I,0|S),I=0|o(),T=0|ig(0|(eA=0|vg(0|K,0|g,1048576,0)),0|(iA=0|o()),21),j=0|o(),j=0|vg(0|(qA=0|Ug(0|(W=0|vg(0|(_=0|vg(0|(b=0|vg(0|(uA=0|vg(0|YA,0|kA,0|L,0|uA)),0|o(),0|EA,0|b)),0|o(),0|R,0|_)),0|o(),0|z,0|W)),0|o(),-2097152&ZA|0,0|qA)),0|o(),0|T,0|j),T=0|o(),iA=0|Ug(0|K,0|g,-2097152&eA|0,0|iA),eA=0|o(),qA=0|ig(0|(g=0|vg(0|J,0|$,1048576,0)),0|(K=0|o()),21),ZA=0|o(),ZA=0|vg(0|(v=0|Ug(0|(N=0|vg(0|(SA=0|vg(0|sA,0|q,0|UA,0|SA)),0|o(),0|hA,0|N)),0|o(),-2097152&DA|0,0|v)),0|o(),0|qA,0|ZA),qA=0|o(),K=0|Ug(0|J,0|$,-2097152&g|0,0|K),g=0|o(),G=0|vg(0|(v=0|ig(0|($=0|vg(0|d,0|m,1048576,0)),0|(J=0|o()),21)),0|o(),0|pA,0|G),pA=0|o(),J=0|Ug(0|d,0|m,-2097152&$|0,0|J),$=0|o(),v=0|ig(0|(m=0|vg(0|tA,0|fA,1048576,0)),0|(d=0|o()),21),DA=0|o(),SA=0|ig(0|(N=0|vg(0|P,0|aA,1048576,0)),0|(hA=0|o()),21),UA=0|o(),eA=0|vg(0|(W=0|ig(0|(q=0|vg(0|S,0|I,1048576,0)),0|(sA=0|o()),21)),0|o(),0|iA,0|eA),iA=0|o(),sA=0|Ug(0|S,0|I,-2097152&q|0,0|sA),q=0|o(),g=0|vg(0|(W=0|ig(0|(I=0|vg(0|j,0|T,1048576,0)),0|(S=0|o()),21)),0|o(),0|K,0|g),K=0|o(),S=0|Ug(0|j,0|T,-2097152&I|0,0|S),I=0|o(),$=0|vg(0|(W=0|ig(0|(T=0|vg(0|ZA,0|qA,1048576,0)),0|(j=0|o()),21)),0|o(),0|J,0|$),J=0|o(),j=0|Ug(0|ZA,0|qA,-2097152&T|0,0|j),T=0|o(),qA=0|vg(0|$A,0|BA,0|(qA=0|Qg(0|G,0|pA,666643,0)),0|o()),BA=0|o(),$A=0|Qg(0|G,0|pA,470296,0),ZA=0|o(),W=0|Qg(0|G,0|pA,654183,0),z=0|o(),_=0|Qg(0|G,0|pA,-997805,-1),R=0|o(),b=0|Qg(0|G,0|pA,136657,0),EA=0|o(),x=0|Ug(0|(UA=0|vg(0|(pA=0|vg(0|M,0|TA,0|(pA=0|Qg(0|G,0|pA,-683901,-1)),0|o())),0|o(),0|SA,0|UA)),0|o(),-2097152&X|0,0|x),X=0|o(),UA=0|Qg(0|$,0|J,666643,0),SA=0|o(),pA=0|vg(0|qA,0|BA,0|(pA=0|Qg(0|$,0|J,470296,0)),0|o()),BA=0|o(),qA=0|Qg(0|$,0|J,654183,0),TA=0|o(),M=0|Qg(0|$,0|J,-997805,-1),G=0|o(),uA=0|Qg(0|$,0|J,136657,0),L=0|o(),J=0|Qg(0|$,0|J,-683901,-1),$=0|o(),kA=0|vg(0|MA,0|HA,0|(kA=0|Qg(0|j,0|T,666643,0)),0|o()),HA=0|o(),MA=0|Qg(0|j,0|T,470296,0),YA=0|o(),gA=0|vg(0|pA,0|BA,0|(gA=0|Qg(0|j,0|T,654183,0)),0|o()),BA=0|o(),pA=0|Qg(0|j,0|T,-997805,-1),FA=0|o(),C=0|Qg(0|j,0|T,136657,0),V=0|o(),T=0|Qg(0|j,0|T,-683901,-1),j=0|o(),j=0|vg(0|(L=0|vg(0|(Z=0|Ug(0|(DA=0|vg(0|(R=0|vg(0|_A,0|lA,0|_,0|R)),0|o(),0|v,0|DA)),0|o(),-2097152&O|0,0|Z)),0|o(),0|uA,0|L)),0|o(),0|T,0|j),T=0|o(),L=0|Qg(0|g,0|K,666643,0),uA=0|o(),Z=0|Qg(0|g,0|K,470296,0),O=0|o(),DA=0|Qg(0|g,0|K,654183,0),v=0|o(),R=0|Qg(0|g,0|K,-997805,-1),_=0|o(),lA=0|Qg(0|g,0|K,136657,0),_A=0|o(),K=0|Qg(0|g,0|K,-683901,-1),g=0|o(),cA=0|Qg(0|S,0|I,666643,0),oA=0|o(),wA=0|Qg(0|S,0|I,470296,0),yA=0|o(),AA=0|Qg(0|S,0|I,654183,0),IA=0|o(),CA=0|Qg(0|S,0|I,-997805,-1),QA=0|o(),U=0|Qg(0|S,0|I,136657,0),Y=0|o(),I=0|Qg(0|S,0|I,-683901,-1),S=0|o(),S=0|vg(0|(_A=0|vg(0|(FA=0|vg(0|(TA=0|vg(0|(VA=0|Ug(0|(WA=0|vg(0|$A,0|ZA,0|OA,0|WA)),0|o(),-2097152&zA|0,0|VA)),0|o(),0|qA,0|TA)),0|o(),0|pA,0|FA)),0|o(),0|lA,0|_A)),0|o(),0|I,0|S),I=0|o(),nA=0|vg(0|(_A=0|Qg(0|eA,0|iA,666643,0)),0|o(),0|rA,0|nA),rA=0|o(),_A=0|Qg(0|eA,0|iA,470296,0),lA=0|o(),FA=0|Qg(0|eA,0|iA,654183,0),pA=0|o(),yA=0|vg(0|(uA=0|vg(0|(pA=0|vg(0|(mA=0|Ug(0|(xA=0|vg(0|jA,0|XA,0|KA,0|xA)),0|o(),-2097152&LA|0,0|mA)),0|o(),0|FA,0|pA)),0|o(),0|L,0|uA)),0|o(),0|wA,0|yA),wA=0|o(),uA=0|Qg(0|eA,0|iA,-997805,-1),L=0|o(),pA=0|Qg(0|eA,0|iA,136657,0),FA=0|o(),QA=0|vg(0|(v=0|vg(0|(FA=0|vg(0|(YA=0|vg(0|(SA=0|vg(0|(vA=0|Ug(0|(JA=0|vg(0|NA,0|RA,0|PA,0|JA)),0|o(),-2097152&bA|0,0|vA)),0|o(),0|UA,0|SA)),0|o(),0|MA,0|YA)),0|o(),0|pA,0|FA)),0|o(),0|DA,0|v)),0|o(),0|CA,0|QA),CA=0|o(),iA=0|Qg(0|eA,0|iA,-683901,-1),eA=0|o(),FA=0|ig(0|(v=0|vg(0|nA,0|rA,1048576,0)),0|(DA=0|o()),21),pA=0|o(),pA=0|vg(0|(oA=0|vg(0|(lA=0|vg(0|dA,0|GA,0|_A,0|lA)),0|o(),0|cA,0|oA)),0|o(),0|FA,0|pA),FA=0|o(),DA=0|Ug(0|nA,0|rA,-2097152&v|0,0|DA),v=0|o(),oA=0|ig(0|(rA=0|vg(0|yA,0|wA,1048576,0)),0|(nA=0|o()),21),cA=0|o(),cA=0|vg(0|(IA=0|vg(0|(O=0|vg(0|(L=0|vg(0|kA,0|HA,0|uA,0|L)),0|o(),0|Z,0|O)),0|o(),0|AA,0|IA)),0|o(),0|oA,0|cA),oA=0|o(),O=0|ig(0|(IA=0|vg(0|QA,0|CA,1048576,0)),0|(AA=0|o()),21),Z=0|o(),Z=0|vg(0|(Y=0|vg(0|(_=0|vg(0|(eA=0|vg(0|gA,0|BA,0|iA,0|eA)),0|o(),0|R,0|_)),0|o(),0|U,0|Y)),0|o(),0|O,0|Z),O=0|o(),_=0|ig(0|(Y=0|vg(0|S,0|I,1048576,0)),0|(U=0|o()),21),R=0|o(),R=0|vg(0|(g=0|vg(0|(V=0|vg(0|(G=0|vg(0|(d=0|Ug(0|(z=0|vg(0|tA,0|fA,0|W,0|z)),0|o(),-2097152&m|0,0|d)),0|o(),0|M,0|G)),0|o(),0|C,0|V)),0|o(),0|K,0|g)),0|o(),0|_,0|R),_=0|o(),U=0|Ug(0|S,0|I,-2097152&Y|0,0|U),Y=0|o(),g=0|ig(0|(I=0|vg(0|j,0|T,1048576,0)),0|(S=0|o()),21),K=0|o(),K=0|vg(0|(hA=0|Ug(0|(aA=0|vg(0|(EA=0|vg(0|J,0|$,0|b,0|EA)),0|o(),0|P,0|aA)),0|o(),-2097152&N|0,0|hA)),0|o(),0|g,0|K),g=0|o(),S=0|Ug(0|j,0|T,-2097152&I|0,0|S),I=0|o(),hA=0|vg(0|sA,0|q,0|(hA=0|ig(0|(T=0|vg(0|x,0|X,1048576,0)),0|(j=0|o()),21)),0|o()),q=0|o(),aA=0|ig(0|(sA=0|vg(0|pA,0|FA,1048576,0)),0|(N=0|o()),21),P=0|o(),$=0|ig(0|(EA=0|vg(0|cA,0|oA,1048576,0)),0|(b=0|o()),21),J=0|o(),G=0|vg(0|U,0|Y,0|(G=0|ig(0|(V=0|vg(0|Z,0|O,1048576,0)),0|(C=0|o()),21)),0|o()),Y=0|o(),d=0|vg(0|S,0|I,0|(d=0|ig(0|(U=0|vg(0|R,0|_,1048576,0)),0|(M=0|o()),21)),0|o()),I=0|o(),M=0|Ug(0|R,0|_,-2097152&U|0,0|M),U=0|o(),S=0|ig(0|(_=0|vg(0|K,0|g,1048576,0)),0|(R=0|o()),21),m=0|o(),R=0|Ug(0|K,0|g,-2097152&_|0,0|R),_=0|o(),z=0|ig(0|(g=0|vg(0|hA,0|q,1048576,0)),0|(K=0|o()),21),W=0|o(),K=0|Ug(0|hA,0|q,-2097152&g|0,0|K),g=0|o(),q=0|vg(0|DA,0|v,0|(q=0|Qg(0|z,0|W,666643,0)),0|o()),v=0|o(),DA=0|Qg(0|z,0|W,470296,0),hA=0|o(),fA=0|Qg(0|z,0|W,654183,0),tA=0|o(),eA=0|Qg(0|z,0|W,-997805,-1),iA=0|o(),BA=0|Qg(0|z,0|W,136657,0),gA=0|o(),W=0|Qg(0|z,0|W,-683901,-1),z=0|o(),v=0|ig(0|q,0|v,21),L=0|o(),v=0|ig(0|(L=0|vg(0|(N=0|Ug(0|(hA=0|vg(0|pA,0|FA,0|DA,0|hA)),0|o(),-2097152&sA|0,0|N)),0|o(),0|v,0|L)),0|o(),21),N=0|o(),v=0|ig(0|(N=0|vg(0|(P=0|vg(0|(nA=0|Ug(0|(tA=0|vg(0|yA,0|wA,0|fA,0|tA)),0|o(),-2097152&rA|0,0|nA)),0|o(),0|aA,0|P)),0|o(),0|v,0|N)),0|o(),21),P=0|o(),v=0|ig(0|(P=0|vg(0|(b=0|Ug(0|(iA=0|vg(0|cA,0|oA,0|eA,0|iA)),0|o(),-2097152&EA|0,0|b)),0|o(),0|v,0|P)),0|o(),21),b=0|o(),v=0|ig(0|(b=0|vg(0|(J=0|vg(0|(AA=0|Ug(0|(gA=0|vg(0|QA,0|CA,0|BA,0|gA)),0|o(),-2097152&IA|0,0|AA)),0|o(),0|$,0|J)),0|o(),0|v,0|b)),0|o(),21),J=0|o(),R=0|ig(0|(_=0|vg(0|(I=0|ig(0|(M=0|vg(0|d,0|I,0|(M=0|ig(0|(U=0|vg(0|(Y=0|ig(0|(v=0|vg(0|G,0|Y,0|(v=0|ig(0|(J=0|vg(0|(C=0|Ug(0|(z=0|vg(0|Z,0|O,0|W,0|z)),0|o(),-2097152&V|0,0|C)),0|o(),0|v,0|J)),0|o(),21)),0|o())),0|o(),21)),0|o(),0|M,0|U)),0|o(),21)),0|o())),0|o(),21)),0|o(),0|R,0|_)),0|o(),21),I=0|o(),q=0|vg(0|(j=0|Qg(0|(K=0|ig(0|(g=0|vg(0|(R=0|ig(0|(I=0|vg(0|(j=0|Ug(0|(X=0|vg(0|S,0|m,0|x,0|X)),0|o(),-2097152&T|0,0|j)),0|o(),0|R,0|I)),0|o(),21)),0|o(),0|K,0|g)),0|o(),21)),0|(R=0|o()),666643,0)),0|o(),2097151&q|0,0),j=0|o(),L=0|vg(0|(T=0|Qg(0|K,0|R,470296,0)),0|o(),2097151&L|0,0),T=0|o(),N=0|vg(0|(X=0|Qg(0|K,0|R,654183,0)),0|o(),2097151&N|0,0),X=0|o(),P=0|vg(0|(x=0|Qg(0|K,0|R,-997805,-1)),0|o(),2097151&P|0,0),x=0|o(),b=0|vg(0|(m=0|Qg(0|K,0|R,136657,0)),0|o(),2097151&b|0,0),m=0|o(),g=0|vg(0|(C=0|ig(0|(I=0|vg(0|(G=0|ig(0|(_=0|vg(0|(Y=0|ig(0|(M=0|vg(0|(d=0|ig(0|(U=0|vg(0|(S=0|ig(0|(v=0|vg(0|(J=0|ig(0|(b=0|vg(0|(J=0|vg(0|(R=0|Qg(0|K,0|R,-683901,-1)),0|o(),2097151&J|0,0)),0|(R=0|o()),0|(b=0|ig(0|(P=0|vg(0|b,0|m,0|(P=0|ig(0|(N=0|vg(0|P,0|x,0|(N=0|ig(0|(L=0|vg(0|N,0|X,0|(L=0|ig(0|(K=0|vg(0|L,0|T,0|(K=0|ig(0|q,0|j,21)),0|o())),0|(T=0|o()),21)),0|o())),0|(X=0|o()),21)),0|o())),0|(x=0|o()),21)),0|o())),0|(m=0|o()),21)),0|o())),0|(R=0|o()),21)),0|o(),2097151&v|0,0)),0|(J=0|o()),21)),0|o(),2097151&U|0,0)),0|(S=0|o()),21)),0|o(),2097151&M|0,0)),0|(d=0|o()),21)),0|o(),2097151&_|0,0)),0|(Y=0|o()),21)),0|o(),2097151&I|0,0)),0|(G=0|o()),21)),0|o(),2097151&g|0,0),C=0|o(),B[A>>0]=q,V=0|yg(0|q,0|j,8),o(),B[A+1>>0]=V,j=0|yg(0|q,0|j,16),o(),q=0|rg(2097151&K|0,0,5),o(),B[A+2>>0]=q|31&j,j=0|yg(0|K,0|T,3),o(),B[A+3>>0]=j,T=0|yg(0|K,0|T,11),o(),B[A+4>>0]=T,K=0|yg(2097151&K|0,0,19),T=0|o(),j=0|rg(2097151&L|0,0,2),o(),B[A+5>>0]=j|K,X=0|yg(0|L,0|X,6),o(),B[A+6>>0]=X,L=0|yg(2097151&L|0,0,14),X=0|o(),K=0|rg(2097151&N|0,0,7),o(),B[A+7>>0]=K|L,L=0|yg(0|N,0|x,1),o(),B[A+8>>0]=L,x=0|yg(0|N,0|x,9),o(),B[A+9>>0]=x,N=0|yg(2097151&N|0,0,17),x=0|o(),L=0|rg(2097151&P|0,0,4),o(),B[A+10>>0]=L|N,N=0|yg(0|P,0|m,4),o(),B[A+11>>0]=N,m=0|yg(0|P,0|m,12),o(),B[A+12>>0]=m,P=0|yg(2097151&P|0,0,20),m=0|o(),N=0|rg(2097151&b|0,0,1),o(),B[A+13>>0]=N|P,R=0|yg(0|b,0|R,7),o(),B[A+14>>0]=R,b=0|yg(2097151&b|0,0,15),R=0|o(),P=0|rg(2097151&v|0,0,6),o(),B[A+15>>0]=P|b,b=0|yg(0|v,0|J,2),o(),B[A+16>>0]=b,J=0|yg(0|v,0|J,10),o(),B[A+17>>0]=J,v=0|yg(2097151&v|0,0,18),J=0|o(),b=0|rg(0|U,0|S,3),o(),B[A+18>>0]=b|v,v=0|yg(0|U,0|S,5),o(),B[A+19>>0]=v,S=0|yg(0|U,0|S,13),o(),B[A+20>>0]=S,B[A+21>>0]=M,S=0|yg(0|M,0|d,8),o(),B[A+22>>0]=S,d=0|yg(0|M,0|d,16),o(),M=0|rg(2097151&_|0,0,5),o(),B[A+23>>0]=M|31&d,d=0|yg(0|_,0|Y,3),o(),B[A+24>>0]=d,Y=0|yg(0|_,0|Y,11),o(),B[A+25>>0]=Y,_=0|yg(2097151&_|0,0,19),Y=0|o(),d=0|rg(2097151&I|0,0,2),o(),B[A+26>>0]=d|_,G=0|yg(0|I,0|G,6),o(),B[A+27>>0]=G,I=0|yg(2097151&I|0,0,14),G=0|o(),_=0|rg(0|g,0|C,7),o(),B[A+28>>0]=_|I,I=0|yg(0|g,0|C,1),o(),B[A+29>>0]=I,I=0|yg(0|g,0|C,9),o(),B[A+30>>0]=I,C=0|ig(0|g,0|C,17),o(),B[A+31>>0]=C;}function D(A,I,g,B){A|=0,B|=0;var Q=0,E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0,m=0,L=0,x=0,K=0,X=0;!function(A,I){A|=0,I|=0;var g=0,B=0,Q=0,E=0;g=0;do{E=0|jA(I+(g<<3)|0),Q=0|o(),C[(B=A+(g<<3)|0)>>2]=E,C[B+4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0)>>>0>>0)?g:c,g=A,a=o?A:a;}if((o=a+t|0)>>>0>a>>>0){E=0|C[a+24>>2],A=0|C[a+12>>2];do{if((0|A)==(0|a)){if(!(A=0|C[(g=a+20|0)>>2])&&!(A=0|C[(g=a+16|0)>>2])){g=0;break;}for(;;){if(B=0|C[(Q=A+20|0)>>2])A=B,g=Q;else{if(!(B=0|C[(Q=A+16|0)>>2]))break;A=B,g=Q;}}C[g>>2]=0,g=A;}else g=0|C[a+8>>2],C[g+12>>2]=A,C[A+8>>2]=g,g=A;}while(0);do{if(0|E){if(A=0|C[a+28>>2],(0|a)==(0|C[35020+(A<<2)>>2])){if(C[35020+(A<<2)>>2]=g,!g){C[8680]=e&~(1<>2])==(0|a)?E+16|0:E+20|0)>>2]=g,!g)break;C[g+24>>2]=E,0|(A=0|C[a+16>>2])&&(C[g+16>>2]=A,C[A+24>>2]=g),0|(A=0|C[a+20>>2])&&(C[g+20>>2]=A,C[A+24>>2]=g);}}while(0);return c>>>0<16?(u=c+t|0,C[a+4>>2]=3|u,C[(u=a+u+4|0)>>2]=1|C[u>>2]):(C[a+4>>2]=3|t,C[o+4>>2]=1|c,C[o+c>>2]=c,0|r&&(B=0|C[8684],1<<(r>>>3)&n?(A=34756+(r>>>3<<1<<2)+8|0,g=0|C[34756+(r>>>3<<1<<2)+8>>2]):(C[8679]=1<<(r>>>3)|n,A=34756+(r>>>3<<1<<2)+8|0,g=34756+(r>>>3<<1<<2)|0),C[A>>2]=B,C[g+12>>2]=B,C[B+8>>2]=g,C[B+12>>2]=34756+(r>>>3<<1<<2)),C[8681]=c,C[8684]=o),y=I,0|a+8;}}}}else if(A>>>0<=4294967231){if(t=A+11&-8,Q=0|C[8680]){c=(A+11|0)>>>8?t>>>0>16777215?31:t>>>(7+(c=14-((520192+(c=(A+11|0)>>>8<<((1048320+((A+11|0)>>>8)|0)>>>16&8))|0)>>>16&4|(1048320+((A+11|0)>>>8)|0)>>>16&8|(245760+(c<<((c+520192|0)>>>16&4))|0)>>>16&2)+(c<<((c+520192|0)>>>16&4)<<((245760+(c<<((c+520192|0)>>>16&4))|0)>>>16&2)>>>15)|0)|0)&1|c<<1:0,A=0|C[35020+(c<<2)>>2];A:do{if(A)for(B=0-t|0,g=0,o=t<<(31==(0|c)?0:25-(c>>>1)|0),e=0;;){if((E=(-8&C[A+4>>2])-t|0)>>>0>>0){if(!E){B=0,g=A,h=65;break A;}B=E,e=A;}if(g=0==(0|(h=0|C[A+20>>2]))|(0|h)==(0|(A=0|C[A+16+(o>>>31<<2)>>2]))?g:h,!A){A=e,h=61;break;}o<<=1;}else B=0-t|0,g=0,A=0,h=61;}while(0);if(61==(0|h)){if(0==(0|g)&0==(0|A)){if(!(((A=2<>>(r>>>12&16)>>>5&8|r>>>12&16|(A=r>>>(r>>>12&16)>>>(r>>>(r>>>12&16)>>>5&8))>>>2&4|A>>>(A>>>2&4)>>>1&2|(g=A>>>(A>>>2&4)>>>(A>>>(A>>>2&4)>>>1&2))>>>1&1)+(g>>>(g>>>1&1))<<2)>>2],A=0;}g?h=65:(e=B,o=A);}if(65==(0|h))for(;;){if(B=(E=(r=(-8&C[g+4>>2])-t|0)>>>0>>0)?r:B,E=E?g:A,(A=0|C[g+16>>2])||(A=0|C[g+20>>2]),!A){e=B,o=E;break;}g=A,A=E;}if(0!=(0|o)&&e>>>0<((0|C[8681])-t|0)>>>0&&(a=o+t|0)>>>0>o>>>0){i=0|C[o+24>>2],A=0|C[o+12>>2];do{if((0|A)==(0|o)){if(!(A=0|C[(g=o+20|0)>>2])&&!(A=0|C[(g=o+16|0)>>2])){A=0;break;}for(;;){if(B=0|C[(E=A+20|0)>>2])A=B,g=E;else{if(!(B=0|C[(E=A+16|0)>>2]))break;A=B,g=E;}}C[g>>2]=0;}else u=0|C[o+8>>2],C[u+12>>2]=A,C[A+8>>2]=u;}while(0);do{if(i){if(g=0|C[o+28>>2],(0|o)==(0|C[35020+(g<<2)>>2])){if(C[35020+(g<<2)>>2]=A,!A){C[8680]=Q&~(1<>2])==(0|o)?i+16|0:i+20|0)>>2]=A,!A)break;C[A+24>>2]=i,0|(g=0|C[o+16>>2])&&(C[A+16>>2]=g,C[g+24>>2]=A),(g=0|C[o+20>>2])&&(C[A+20>>2]=g,C[g+24>>2]=A);}}while(0);A:do{if(e>>>0<16)u=e+t|0,C[o+4>>2]=3|u,C[(u=o+u+4|0)>>2]=1|C[u>>2];else{if(C[o+4>>2]=3|t,C[a+4>>2]=1|e,C[a+e>>2]=e,B=e>>>3,e>>>0<256){(A=0|C[8679])&1<>2]):(C[8679]=A|1<>2]=a,C[g+12>>2]=a,C[a+8>>2]=g,C[a+12>>2]=34756+(B<<1<<2);break;}if(A=35020+((B=(A=e>>>8)?e>>>0>16777215?31:e>>>(7+(B=14-((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4|(A+1048320|0)>>>16&8|(245760+(B=A<<((A+1048320|0)>>>16&8)<<((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4))|0)>>>16&2)+(B<<((B+245760|0)>>>16&2)>>>15)|0)|0)&1|B<<1:0)<<2)|0,C[a+28>>2]=B,C[a+16+4>>2]=0,C[a+16>>2]=0,!(Q&(g=1<>2]=a,C[a+24>>2]=A,C[a+12>>2]=a,C[a+8>>2]=a;break;}A=0|C[A>>2];I:do{if((-8&C[A+4>>2]|0)!=(0|e)){for(Q=e<<(31==(0|B)?0:25-(B>>>1)|0);g=0|C[(B=A+16+(Q>>>31<<2)|0)>>2];){if((-8&C[g+4>>2]|0)==(0|e)){A=g;break I;}Q<<=1,A=g;}C[B>>2]=a,C[a+24>>2]=A,C[a+12>>2]=a,C[a+8>>2]=a;break A;}}while(0);u=0|C[(p=A+8|0)>>2],C[u+12>>2]=a,C[p>>2]=a,C[a+8>>2]=u,C[a+12>>2]=A,C[a+24>>2]=0;}}while(0);return y=I,0|o+8;}}}else t=-1;}while(0);if((B=0|C[8681])>>>0>=t>>>0)return g=B-t|0,A=0|C[8684],g>>>0>15?(u=A+t|0,C[8684]=u,C[8681]=g,C[u+4>>2]=1|g,C[A+B>>2]=g,C[A+4>>2]=3|t):(C[8681]=0,C[8684]=0,C[A+4>>2]=3|B,C[A+B+4>>2]=1|C[A+B+4>>2]),y=I,0|A+8;if((E=0|C[8682])>>>0>t>>>0)return F=E-t|0,C[8682]=F,p=(u=0|C[8685])+t|0,C[8685]=p,C[p+4>>2]=1|F,C[u+4>>2]=3|t,y=I,0|u+8;if(0|C[8797]?A=0|C[8799]:(C[8799]=4096,C[8798]=4096,C[8800]=-1,C[8801]=-1,C[8802]=0,C[8790]=0,C[8797]=-16&f^1431655768,A=4096),e=t+48|0,((a=A+(o=t+47|0)|0)&(c=0-A|0))>>>0<=t>>>0)return y=I,0;if(0|(A=0|C[8789])&&(((f=0|C[8787])+(a&c)|0)>>>0<=f>>>0||(f+(a&c)|0)>>>0>A>>>0))return y=I,0;A:do{if(4&C[8790])A=0,h=143;else{g=0|C[8685];I:do{if(g){for(B=35164;!((A=0|C[B>>2])>>>0<=g>>>0&&(A+(0|C[(s=B+4|0)>>2])|0)>>>0>g>>>0);){if(!(A=0|C[B+8>>2])){h=128;break I;}B=A;}if((a-E&c)>>>0<2147483647){if((0|(A=0|bI(a-E&c)))==((0|C[B>>2])+(0|C[s>>2])|0)){if(-1!=(0|A)){e=A,i=a-E&c,h=145;break A;}A=a-E&c;}else Q=A,B=a-E&c,h=136;}else A=0;}else h=128;}while(0);do{if(128==(0|h))if(-1!=(0|(g=0|bI(0)))&&(i=(0==((i=0|C[8798])-1&g|0)?0:(i+-1+g&0-i)-g|0)+(a&c)|0,w=0|C[8787],i>>>0>t>>>0&i>>>0<2147483647)){if(0|(s=0|C[8789])&&(i+w|0)>>>0<=w>>>0|(i+w|0)>>>0>s>>>0){A=0;break;}if((0|(A=0|bI(i)))==(0|g)){e=g,h=145;break A;}Q=A,B=i,h=136;}else A=0;}while(0);do{if(136==(0|h)){if(g=0-B|0,!(e>>>0>B>>>0&B>>>0<2147483647&-1!=(0|Q))){if(-1==(0|Q)){A=0;break;}e=Q,i=B,h=145;break A;}if((A=o-B+(A=0|C[8799])&0-A)>>>0>=2147483647){e=Q,i=B,h=145;break A;}if(-1==(0|bI(A))){bI(g),A=0;break;}e=Q,i=A+B|0,h=145;break A;}}while(0);C[8790]=4|C[8790],h=143;}}while(0);if(143==(0|h)&&(a&c)>>>0<2147483647&&!(-1==(0|(D=0|bI(a&c)))|1^(p=((F=0|bI(0))-D|0)>>>0>(t+40|0)>>>0)|D>>>0>>0&-1!=(0|D)&-1!=(0|F)^1)&&(e=D,i=p?F-D|0:A,h=145),145==(0|h)){A=(0|C[8787])+i|0,C[8787]=A,A>>>0>(0|C[8788])>>>0&&(C[8788]=A),c=0|C[8685];A:do{if(c){for(E=35164;;){if((0|e)==((A=0|C[E>>2])+(g=0|C[(Q=E+4|0)>>2])|0)){h=154;break;}if(!(B=0|C[E+8>>2]))break;E=B;}if(154==(0|h)&&0==(8&C[E+12>>2]|0)&&e>>>0>c>>>0&A>>>0<=c>>>0){C[Q>>2]=g+i,u=(0|C[8682])+i|0,p=0==(c+8&7|0)?0:0-(c+8)&7,C[8685]=c+p,C[8682]=u-p,C[c+p+4>>2]=u-p|1,C[c+u+4>>2]=40,C[8686]=C[8801];break;}for(e>>>0<(0|C[8683])>>>0&&(C[8683]=e),B=e+i|0,g=35164;;){if((0|C[g>>2])==(0|B)){h=162;break;}if(!(A=0|C[g+8>>2]))break;g=A;}if(162==(0|h)&&0==(8&C[g+12>>2]|0)){C[g>>2]=e,C[(n=g+4|0)>>2]=(0|C[n>>2])+i,a=(n=e+(0==(7&(n=e+8|0)|0)?0:0-n&7)|0)+t|0,o=(A=B+(0==(B+8&7|0)?0:0-(B+8)&7)|0)-n-t|0,C[n+4>>2]=3|t;I:do{if((0|c)==(0|A))u=(0|C[8682])+o|0,C[8682]=u,C[8685]=a,C[a+4>>2]=1|u;else{if((0|C[8684])==(0|A)){u=(0|C[8681])+o|0,C[8681]=u,C[8684]=a,C[a+4>>2]=1|u,C[a+u>>2]=u;break;}if(1==(3&(e=0|C[A+4>>2])|0)){g:do{if(e>>>0<256){if(g=0|C[A+8>>2],(0|(B=0|C[A+12>>2]))==(0|g)){C[8679]=C[8679]&~(1<<(e>>>3));break;}C[g+12>>2]=B,C[B+8>>2]=g;break;}i=0|C[A+24>>2],g=0|C[A+12>>2];do{if((0|g)==(0|A)){if(g=0|C[A+16+4>>2])B=A+16+4|0;else{if(!(g=0|C[A+16>>2])){g=0;break;}B=A+16|0;}for(;;){if(Q=0|C[(E=g+20|0)>>2])g=Q,B=E;else{if(!(Q=0|C[(E=g+16|0)>>2]))break;g=Q,B=E;}}C[B>>2]=0;}else u=0|C[A+8>>2],C[u+12>>2]=g,C[g+8>>2]=u;}while(0);if(!i)break;B=0|C[A+28>>2];do{if((0|C[35020+(B<<2)>>2])==(0|A)){if(C[35020+(B<<2)>>2]=g,0|g)break;C[8680]=C[8680]&~(1<>2])==(0|A)?i+16|0:i+20|0)>>2]=g,!g)break g;}while(0);if(C[g+24>>2]=i,0|(B=0|C[A+16>>2])&&(C[g+16>>2]=B,C[B+24>>2]=g),!(B=0|C[A+16+4>>2]))break;C[g+20>>2]=B,C[B+24>>2]=g;}while(0);A=A+(-8&e)|0,E=(-8&e)+o|0;}else E=o;if(C[(B=A+4|0)>>2]=-2&C[B>>2],C[a+4>>2]=1|E,C[a+E>>2]=E,B=E>>>3,E>>>0<256){(A=0|C[8679])&1<>2]):(C[8679]=A|1<>2]=a,C[g+12>>2]=a,C[a+8>>2]=g,C[a+12>>2]=34756+(B<<1<<2);break;}A=E>>>8;do{if(A){if(E>>>0>16777215){Q=31;break;}Q=E>>>(7+(Q=14-((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4|(A+1048320|0)>>>16&8|(245760+(Q=A<<((A+1048320|0)>>>16&8)<<((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4))|0)>>>16&2)+(Q<<((Q+245760|0)>>>16&2)>>>15)|0)|0)&1|Q<<1;}else Q=0;}while(0);if(g=35020+(Q<<2)|0,C[a+28>>2]=Q,C[a+16+4>>2]=0,C[a+16>>2]=0,!((A=0|C[8680])&(B=1<>2]=a,C[a+24>>2]=g,C[a+12>>2]=a,C[a+8>>2]=a;break;}A=0|C[g>>2];g:do{if((-8&C[A+4>>2]|0)!=(0|E)){for(Q=E<<(31==(0|Q)?0:25-(Q>>>1)|0);g=0|C[(B=A+16+(Q>>>31<<2)|0)>>2];){if((-8&C[g+4>>2]|0)==(0|E)){A=g;break g;}Q<<=1,A=g;}C[B>>2]=a,C[a+24>>2]=A,C[a+12>>2]=a,C[a+8>>2]=a;break I;}}while(0);u=0|C[(p=A+8|0)>>2],C[u+12>>2]=a,C[p>>2]=a,C[a+8>>2]=u,C[a+12>>2]=A,C[a+24>>2]=0;}}while(0);return y=I,0|n+8;}for(g=35164;!((A=0|C[g>>2])>>>0<=c>>>0&&(u=A+(0|C[g+4>>2])|0)>>>0>c>>>0);){g=0|C[g+8>>2];}E=(E=u+-47+(0==(u+-47+8&7|0)?0:0-(u+-47+8)&7)|0)>>>0<(c+16|0)>>>0?c:E,A=i+-40|0,p=e+(F=0==(7&(F=e+8|0)|0)?0:0-F&7)|0,C[8685]=p,C[8682]=A-F,C[p+4>>2]=A-F|1,C[e+A+4>>2]=40,C[8686]=C[8801],C[E+4>>2]=27,C[E+8>>2]=C[8791],C[E+8+4>>2]=C[8792],C[E+8+8>>2]=C[8793],C[E+8+12>>2]=C[8794],C[8791]=e,C[8792]=i,C[8794]=0,C[8793]=E+8,A=E+24|0;do{p=A,C[(A=A+4|0)>>2]=7;}while((p+8|0)>>>0>>0);if((0|E)!=(0|c)){if(C[E+4>>2]=-2&C[E+4>>2],C[c+4>>2]=E-c|1,C[E>>2]=E-c,(E-c|0)>>>0<256){B=34756+((E-c|0)>>>3<<1<<2)|0,(A=0|C[8679])&1<<((E-c|0)>>>3)?(A=B+8|0,g=0|C[B+8>>2]):(C[8679]=A|1<<((E-c|0)>>>3),A=B+8|0,g=B),C[A>>2]=c,C[g+12>>2]=c,C[c+8>>2]=g,C[c+12>>2]=B;break;}if(g=35020+((Q=(E-c|0)>>>8?(E-c|0)>>>0>16777215?31:(E-c|0)>>>(7+(Q=14-((520192+(Q=(E-c|0)>>>8<<((1048320+((E-c|0)>>>8)|0)>>>16&8))|0)>>>16&4|(1048320+((E-c|0)>>>8)|0)>>>16&8|(245760+(Q<<((Q+520192|0)>>>16&4))|0)>>>16&2)+(Q<<((Q+520192|0)>>>16&4)<<((245760+(Q<<((Q+520192|0)>>>16&4))|0)>>>16&2)>>>15)|0)|0)&1|Q<<1:0)<<2)|0,C[c+28>>2]=Q,C[c+20>>2]=0,C[c+16>>2]=0,!((A=0|C[8680])&(B=1<>2]=c,C[c+24>>2]=g,C[c+12>>2]=c,C[c+8>>2]=c;break;}A=0|C[g>>2];I:do{if((-8&C[A+4>>2]|0)!=(E-c|0)){for(Q=E-c<<(31==(0|Q)?0:25-(Q>>>1)|0);g=0|C[(B=A+16+(Q>>>31<<2)|0)>>2];){if((-8&C[g+4>>2]|0)==(E-c|0)){A=g;break I;}Q<<=1,A=g;}C[B>>2]=c,C[c+24>>2]=A,C[c+12>>2]=c,C[c+8>>2]=c;break A;}}while(0);u=0|C[(p=A+8|0)>>2],C[u+12>>2]=c,C[p>>2]=c,C[c+8>>2]=u,C[c+12>>2]=A,C[c+24>>2]=0;}}else 0==(0|(u=0|C[8683]))|e>>>0>>0&&(C[8683]=e),C[8791]=e,C[8792]=i,C[8794]=0,C[8688]=C[8797],C[8687]=-1,C[8692]=34756,C[8691]=34756,C[8694]=34764,C[8693]=34764,C[8696]=34772,C[8695]=34772,C[8698]=34780,C[8697]=34780,C[8700]=34788,C[8699]=34788,C[8702]=34796,C[8701]=34796,C[8704]=34804,C[8703]=34804,C[8706]=34812,C[8705]=34812,C[8708]=34820,C[8707]=34820,C[8710]=34828,C[8709]=34828,C[8712]=34836,C[8711]=34836,C[8714]=34844,C[8713]=34844,C[8716]=34852,C[8715]=34852,C[8718]=34860,C[8717]=34860,C[8720]=34868,C[8719]=34868,C[8722]=34876,C[8721]=34876,C[8724]=34884,C[8723]=34884,C[8726]=34892,C[8725]=34892,C[8728]=34900,C[8727]=34900,C[8730]=34908,C[8729]=34908,C[8732]=34916,C[8731]=34916,C[8734]=34924,C[8733]=34924,C[8736]=34932,C[8735]=34932,C[8738]=34940,C[8737]=34940,C[8740]=34948,C[8739]=34948,C[8742]=34956,C[8741]=34956,C[8744]=34964,C[8743]=34964,C[8746]=34972,C[8745]=34972,C[8748]=34980,C[8747]=34980,C[8750]=34988,C[8749]=34988,C[8752]=34996,C[8751]=34996,C[8754]=35004,C[8753]=35004,u=i+-40|0,p=e+(F=0==(7&(F=e+8|0)|0)?0:0-F&7)|0,C[8685]=p,C[8682]=u-F,C[p+4>>2]=u-F|1,C[e+u+4>>2]=40,C[8686]=C[8801];}while(0);if((A=0|C[8682])>>>0>t>>>0)return F=A-t|0,C[8682]=F,p=(u=0|C[8685])+t|0,C[8685]=p,C[p+4>>2]=1|F,C[u+4>>2]=3|t,y=I,0|u+8;}return C[8678]=48,y=I,0;}function p(A){var I,g,C,Q,E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0,m=0,L=0,x=0,K=0,X=0,j=0,T=0,q=0,V=0,z=0,W=0,O=0,Z=0,$=0,AA=0,IA=0,gA=0,BA=0,CA=0,QA=0,EA=0,iA=0,eA=0,oA=0,cA=0,aA=0,nA=0,rA=0,tA=0,fA=0,wA=0,yA=0;j=0|Bg(0|B[(A|=0)>>0],0|B[A+1>>0],0|B[A+2>>0]),o(),V=0|yg(0|(V=0|kI(A+2|0)),0|o(),5),o(),J=0|yg(0|(J=0|Bg(0|B[A+5>>0],0|B[A+6>>0],0|B[A+7>>0])),0|o(),2),o(),y=0|yg(0|(y=0|kI(A+7|0)),0|o(),7),o(),T=0|yg(0|(T=0|kI(A+10|0)),0|o(),4),o(),Z=0|yg(0|(Z=0|Bg(0|B[A+13>>0],0|B[A+14>>0],0|B[A+15>>0])),0|o(),1),o(),l=0|yg(0|(l=0|kI(A+15|0)),0|o(),6),o(),oA=0|yg(0|(oA=0|Bg(0|B[A+18>>0],0|B[A+19>>0],0|B[A+20>>0])),0|o(),3),o(),rA=0|Bg(0|B[A+21>>0],0|B[A+22>>0],0|B[A+23>>0]),o(),EA=0|yg(0|(EA=0|kI(A+23|0)),0|o(),5),o(),nA=0|yg(0|(nA=0|Bg(0|B[A+26>>0],0|B[A+27>>0],0|B[A+28>>0])),0|o(),2),o(),gA=0|yg(0|(gA=0|kI(A+28|0)),0|o(),7),o(),wA=0|yg(0|(wA=0|kI(A+31|0)),0|o(),4),o(),Y=0|yg(0|(Y=0|Bg(0|B[A+34>>0],0|B[A+35>>0],0|B[A+36>>0])),0|o(),1),o(),K=0|yg(0|(K=0|kI(A+36|0)),0|o(),6),o(),p=0|yg(0|(p=0|Bg(0|B[A+39>>0],0|B[A+40>>0],0|B[A+41>>0])),0|o(),3),o(),e=0|Bg(0|B[A+42>>0],0|B[A+43>>0],0|B[A+44>>0]),o(),L=0|yg(0|(L=0|kI(A+44|0)),0|o(),5),o(),CA=0|yg(0|(CA=0|Bg(0|B[A+47>>0],0|B[A+48>>0],0|B[A+49>>0])),0|o(),2),o(),yA=0|yg(0|(yA=0|kI(A+49|0)),0|o(),7),o(),f=0|yg(0|(f=0|kI(A+52|0)),0|o(),4),o(),G=0|yg(0|(G=0|Bg(0|B[A+55>>0],0|B[A+56>>0],0|B[A+57>>0])),0|o(),1),o(),U=0|yg(0|(U=0|kI(A+57|0)),0|o(),6),o(),r=0|Qg(0|(q=0|yg(0|(q=0|kI(A+60|0)),0|o(),3)),0|(c=0|o()),666643,0),F=0|o(),aA=0|Qg(0|q,0|c,470296,0),u=0|o(),M=0|Qg(0|q,0|c,654183,0),a=0|o(),_=0|Qg(0|q,0|c,-997805,-1),t=0|o(),p=0|vg(0|(E=0|Qg(0|q,0|c,136657,0)),0|o(),2097151&p|0,0),E=0|o(),e=0|vg(0|(c=0|Qg(0|q,0|c,-683901,-1)),0|o(),2097151&e|0,0),c=0|o(),q=0|Qg(2097151&U|0,0,666643,0),x=0|o(),k=0|Qg(2097151&U|0,0,470296,0),IA=0|o(),v=0|Qg(2097151&U|0,0,654183,0),i=0|o(),W=0|Qg(2097151&U|0,0,-997805,-1),z=0|o(),X=0|Qg(2097151&U|0,0,136657,0),D=0|o(),U=0|vg(0|p,0|E,0|(U=0|Qg(2097151&U|0,0,-683901,-1)),0|o()),E=0|o(),p=0|Qg(2097151&G|0,0,666643,0),O=0|o(),d=0|Qg(2097151&G|0,0,470296,0),BA=0|o(),m=0|Qg(2097151&G|0,0,654183,0),n=0|o(),tA=0|Qg(2097151&G|0,0,-997805,-1),cA=0|o(),AA=0|Qg(2097151&G|0,0,136657,0),b=0|o(),D=0|vg(0|(t=0|vg(0|(K=0|vg(0|(G=0|Qg(2097151&G|0,0,-683901,-1)),0|o(),2097151&K|0,0)),0|o(),0|_,0|t)),0|o(),0|X,0|D),X=0|o(),t=0|Qg(2097151&f|0,0,666643,0),_=0|o(),K=0|Qg(2097151&f|0,0,470296,0),G=0|o(),s=0|Qg(2097151&f|0,0,654183,0),$=0|o(),P=0|Qg(2097151&f|0,0,-997805,-1),R=0|o(),Q=0|Qg(2097151&f|0,0,136657,0),fA=0|o(),f=0|Qg(2097151&f|0,0,-683901,-1),w=0|o(),h=0|Qg(2097151&yA|0,0,666643,0),S=0|o(),iA=0|Qg(2097151&yA|0,0,470296,0),eA=0|o(),g=0|Qg(2097151&yA|0,0,654183,0),QA=0|o(),C=0|Qg(2097151&yA|0,0,-997805,-1),N=0|o(),I=0|Qg(2097151&yA|0,0,136657,0),H=0|o(),i=0|vg(0|(u=0|vg(0|(cA=0|vg(0|(fA=0|vg(0|(wA=0|vg(0|(yA=0|Qg(2097151&yA|0,0,-683901,-1)),0|o(),2097151&wA|0,0)),0|o(),0|Q,0|fA)),0|o(),0|tA,0|cA)),0|o(),0|aA,0|u)),0|o(),0|v,0|i),v=0|o(),l=0|vg(0|(u=0|Qg(2097151&CA|0,0,666643,0)),0|o(),2097151&l|0,0),u=0|o(),aA=0|Qg(2097151&CA|0,0,470296,0),cA=0|o(),_=0|vg(0|(eA=0|vg(0|(rA=0|vg(0|(tA=0|Qg(2097151&CA|0,0,654183,0)),0|o(),2097151&rA|0,0)),0|o(),0|iA,0|eA)),0|o(),0|t,0|_),t=0|o(),eA=0|Qg(2097151&CA|0,0,-997805,-1),iA=0|o(),x=0|vg(0|(BA=0|vg(0|($=0|vg(0|(N=0|vg(0|(nA=0|vg(0|(rA=0|Qg(2097151&CA|0,0,136657,0)),0|o(),2097151&nA|0,0)),0|o(),0|C,0|N)),0|o(),0|s,0|$)),0|o(),0|d,0|BA)),0|o(),0|q,0|x),q=0|o(),CA=0|Qg(2097151&CA|0,0,-683901,-1),BA=0|o(),s=0|yg(0|(d=0|vg(0|l,0|u,1048576,0)),0|($=0|o()),21),N=0|o(),N=0|vg(0|(S=0|vg(0|(oA=0|vg(0|aA,0|cA,2097151&oA|0,0)),0|o(),0|h,0|S)),0|o(),0|s,0|N),s=0|o(),$=0|Ug(0|l,0|u,-2097152&d|0,2047&$|0),d=0|o(),S=0|yg(0|(u=0|vg(0|_,0|t,1048576,0)),0|(l=0|o()),21),h=0|o(),h=0|vg(0|(O=0|vg(0|(G=0|vg(0|(QA=0|vg(0|(EA=0|vg(0|eA,0|iA,2097151&EA|0,0)),0|o(),0|g,0|QA)),0|o(),0|K,0|G)),0|o(),0|p,0|O)),0|o(),0|S,0|h),S=0|o(),G=0|ig(0|(O=0|vg(0|x,0|q,1048576,0)),0|(p=0|o()),21),K=0|o(),K=0|vg(0|(IA=0|vg(0|(F=0|vg(0|(n=0|vg(0|(R=0|vg(0|(H=0|vg(0|(gA=0|vg(0|CA,0|BA,2097151&gA|0,0)),0|o(),0|I,0|H)),0|o(),0|P,0|R)),0|o(),0|m,0|n)),0|o(),0|r,0|F)),0|o(),0|k,0|IA)),0|o(),0|G,0|K),G=0|o(),F=0|ig(0|(IA=0|vg(0|i,0|v,1048576,0)),0|(k=0|o()),21),r=0|o(),r=0|vg(0|(z=0|vg(0|(a=0|vg(0|(b=0|vg(0|(Y=0|vg(0|f,0|w,2097151&Y|0,0)),0|o(),0|AA,0|b)),0|o(),0|M,0|a)),0|o(),0|W,0|z)),0|o(),0|F,0|r),F=0|o(),k=0|Ug(0|i,0|v,-2097152&IA|0,0|k),IA=0|o(),z=0|vg(0|U,0|E,0|(z=0|ig(0|(v=0|vg(0|D,0|X,1048576,0)),0|(i=0|o()),21)),0|o()),E=0|o(),i=0|Ug(0|D,0|X,-2097152&v|0,0|i),v=0|o(),L=0|vg(0|(U=0|ig(0|(X=0|vg(0|e,0|c,1048576,0)),0|(D=0|o()),21)),0|o(),2097151&L|0,0),U=0|o(),D=0|Ug(0|e,0|c,-2097152&X|0,0|D),X=0|o(),W=0|yg(0|(c=0|vg(0|N,0|s,1048576,0)),0|(e=0|o()),21),a=0|o(),e=0|Ug(0|N,0|s,-2097152&c|0,0|e),c=0|o(),M=0|ig(0|(s=0|vg(0|h,0|S,1048576,0)),0|(N=0|o()),21),b=0|o(),IA=0|vg(0|(w=0|ig(0|(AA=0|vg(0|K,0|G,1048576,0)),0|(Y=0|o()),21)),0|o(),0|k,0|IA),k=0|o(),Y=0|Ug(0|K,0|G,-2097152&AA|0,0|Y),AA=0|o(),v=0|vg(0|(w=0|ig(0|(G=0|vg(0|r,0|F,1048576,0)),0|(K=0|o()),21)),0|o(),0|i,0|v),i=0|o(),K=0|Ug(0|r,0|F,-2097152&G|0,0|K),G=0|o(),X=0|vg(0|(w=0|ig(0|(F=0|vg(0|z,0|E,1048576,0)),0|(r=0|o()),21)),0|o(),0|D,0|X),D=0|o(),r=0|Ug(0|z,0|E,-2097152&F|0,0|r),F=0|o(),Z=0|vg(0|(E=0|Qg(0|L,0|U,666643,0)),0|o(),2097151&Z|0,0),E=0|o(),z=0|vg(0|$,0|d,0|(z=0|Qg(0|L,0|U,470296,0)),0|o()),d=0|o(),$=0|vg(0|e,0|c,0|($=0|Qg(0|L,0|U,654183,0)),0|o()),c=0|o(),e=0|Qg(0|L,0|U,-997805,-1),w=0|o(),f=0|Qg(0|L,0|U,136657,0),n=0|o(),p=0|Ug(0|(b=0|vg(0|(q=0|vg(0|(U=0|Qg(0|L,0|U,-683901,-1)),0|o(),0|x,0|q)),0|o(),0|M,0|b)),0|o(),-2097152&O|0,0|p),O=0|o(),T=0|vg(0|(b=0|Qg(0|X,0|D,666643,0)),0|o(),2097151&T|0,0),b=0|o(),M=0|vg(0|Z,0|E,0|(M=0|Qg(0|X,0|D,470296,0)),0|o()),E=0|o(),Z=0|vg(0|z,0|d,0|(Z=0|Qg(0|X,0|D,654183,0)),0|o()),d=0|o(),z=0|vg(0|$,0|c,0|(z=0|Qg(0|X,0|D,-997805,-1)),0|o()),c=0|o(),$=0|Qg(0|X,0|D,136657,0),q=0|o(),D=0|Qg(0|X,0|D,-683901,-1),X=0|o(),y=0|vg(0|(x=0|Qg(0|r,0|F,666643,0)),0|o(),2097151&y|0,0),x=0|o(),U=0|vg(0|T,0|b,0|(U=0|Qg(0|r,0|F,470296,0)),0|o()),b=0|o(),T=0|vg(0|M,0|E,0|(T=0|Qg(0|r,0|F,654183,0)),0|o()),E=0|o(),M=0|vg(0|Z,0|d,0|(M=0|Qg(0|r,0|F,-997805,-1)),0|o()),d=0|o(),Z=0|vg(0|z,0|c,0|(Z=0|Qg(0|r,0|F,136657,0)),0|o()),c=0|o(),F=0|Qg(0|r,0|F,-683901,-1),r=0|o(),r=0|vg(0|(q=0|vg(0|(w=0|vg(0|(l=0|Ug(0|(t=0|vg(0|W,0|a,0|_,0|t)),0|o(),-2097152&u|0,0|l)),0|o(),0|e,0|w)),0|o(),0|$,0|q)),0|o(),0|F,0|r),F=0|o(),J=0|vg(0|(q=0|Qg(0|v,0|i,666643,0)),0|o(),2097151&J|0,0),q=0|o(),$=0|vg(0|y,0|x,0|($=0|Qg(0|v,0|i,470296,0)),0|o()),x=0|o(),y=0|vg(0|U,0|b,0|(y=0|Qg(0|v,0|i,654183,0)),0|o()),b=0|o(),U=0|vg(0|T,0|E,0|(U=0|Qg(0|v,0|i,-997805,-1)),0|o()),E=0|o(),T=0|vg(0|M,0|d,0|(T=0|Qg(0|v,0|i,136657,0)),0|o()),d=0|o(),i=0|vg(0|Z,0|c,0|(i=0|Qg(0|v,0|i,-683901,-1)),0|o()),c=0|o(),V=0|vg(0|(Z=0|Qg(0|K,0|G,666643,0)),0|o(),2097151&V|0,0),Z=0|o(),v=0|vg(0|J,0|q,0|(v=0|Qg(0|K,0|G,470296,0)),0|o()),q=0|o(),J=0|vg(0|$,0|x,0|(J=0|Qg(0|K,0|G,654183,0)),0|o()),x=0|o(),$=0|vg(0|y,0|b,0|($=0|Qg(0|K,0|G,-997805,-1)),0|o()),b=0|o(),y=0|vg(0|U,0|E,0|(y=0|Qg(0|K,0|G,136657,0)),0|o()),E=0|o(),G=0|vg(0|T,0|d,0|(G=0|Qg(0|K,0|G,-683901,-1)),0|o()),d=0|o(),j=0|vg(0|(T=0|Qg(0|IA,0|k,666643,0)),0|o(),2097151&j|0,0),T=0|o(),K=0|vg(0|V,0|Z,0|(K=0|Qg(0|IA,0|k,470296,0)),0|o()),Z=0|o(),V=0|vg(0|v,0|q,0|(V=0|Qg(0|IA,0|k,654183,0)),0|o()),q=0|o(),v=0|vg(0|J,0|x,0|(v=0|Qg(0|IA,0|k,-997805,-1)),0|o()),x=0|o(),J=0|vg(0|$,0|b,0|(J=0|Qg(0|IA,0|k,136657,0)),0|o()),b=0|o(),k=0|vg(0|y,0|E,0|(k=0|Qg(0|IA,0|k,-683901,-1)),0|o()),E=0|o(),$=0|vg(0|K,0|Z,0|($=0|ig(0|(y=0|vg(0|j,0|T,1048576,0)),0|(IA=0|o()),21)),0|o()),Z=0|o(),IA=0|Ug(0|j,0|T,-2097152&y|0,0|IA),y=0|o(),K=0|vg(0|v,0|x,0|(K=0|ig(0|(T=0|vg(0|V,0|q,1048576,0)),0|(j=0|o()),21)),0|o()),x=0|o(),M=0|vg(0|k,0|E,0|(M=0|ig(0|(v=0|vg(0|J,0|b,1048576,0)),0|(U=0|o()),21)),0|o()),E=0|o(),e=0|vg(0|i,0|c,0|(e=0|ig(0|(k=0|vg(0|G,0|d,1048576,0)),0|(w=0|o()),21)),0|o()),c=0|o(),w=0|Ug(0|G,0|d,-2097152&k|0,0|w),k=0|o(),i=0|ig(0|(d=0|vg(0|r,0|F,1048576,0)),0|(G=0|o()),21),l=0|o(),l=0|vg(0|(X=0|vg(0|(N=0|Ug(0|(S=0|vg(0|f,0|n,0|h,0|S)),0|o(),-2097152&s|0,0|N)),0|o(),0|D,0|X)),0|o(),0|i,0|l),i=0|o(),G=0|Ug(0|r,0|F,-2097152&d|0,0|G),d=0|o(),AA=0|vg(0|(X=0|ig(0|(F=0|vg(0|p,0|O,1048576,0)),0|(r=0|o()),21)),0|o(),0|Y,0|AA),Y=0|o(),r=0|Ug(0|p,0|O,-2097152&F|0,0|r),F=0|o(),X=0|ig(0|(O=0|vg(0|$,0|Z,1048576,0)),0|(p=0|o()),21),D=0|o(),S=0|ig(0|(N=0|vg(0|K,0|x,1048576,0)),0|(s=0|o()),21),h=0|o(),u=0|vg(0|w,0|k,0|(u=0|ig(0|(n=0|vg(0|M,0|E,1048576,0)),0|(f=0|o()),21)),0|o()),k=0|o(),_=0|vg(0|G,0|d,0|(_=0|ig(0|(w=0|vg(0|e,0|c,1048576,0)),0|(t=0|o()),21)),0|o()),d=0|o(),t=0|Ug(0|e,0|c,-2097152&w|0,0|t),w=0|o(),G=0|vg(0|r,0|F,0|(G=0|ig(0|(c=0|vg(0|l,0|i,1048576,0)),0|(e=0|o()),21)),0|o()),F=0|o(),e=0|Ug(0|l,0|i,-2097152&c|0,0|e),c=0|o(),r=0|ig(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0|o(),21)),0|o())),0|o(),21)),0|o(),0|t,0|w)),0|o(),21)),0|o())),0|o(),21)),0|o(),0|e,0|c)),0|o(),21)),0|o())),0|o(),21)),0|o(),0|l,0|i)),0|o(),21)),0|(F=0|o()),666643,0)),0|o(),2097151&Y|0,0),G=0|o(),H=0|vg(0|(d=0|Qg(0|l,0|F,470296,0)),0|o(),2097151&H|0,0),d=0|o(),p=0|vg(0|(_=0|Qg(0|l,0|F,654183,0)),0|o(),2097151&p|0,0),_=0|o(),D=0|vg(0|(k=0|Qg(0|l,0|F,-997805,-1)),0|o(),2097151&D|0,0),k=0|o(),s=0|vg(0|(u=0|Qg(0|l,0|F,136657,0)),0|o(),2097151&s|0,0),u=0|o(),i=0|vg(0|(E=0|ig(0|(e=0|vg(0|(a=0|ig(0|(c=0|vg(0|(r=0|ig(0|(t=0|vg(0|(n=0|ig(0|(w=0|vg(0|(f=0|ig(0|(y=0|vg(0|(h=0|ig(0|(s=0|vg(0|(h=0|vg(0|(F=0|Qg(0|l,0|F,-683901,-1)),0|o(),2097151&h|0,0)),0|(F=0|o()),0|(s=0|ig(0|(D=0|vg(0|s,0|u,0|(D=0|ig(0|(p=0|vg(0|D,0|k,0|(p=0|ig(0|(H=0|vg(0|p,0|_,0|(H=0|ig(0|(l=0|vg(0|H,0|d,0|(l=0|ig(0|Y,0|G,21)),0|o())),0|(d=0|o()),21)),0|o())),0|(_=0|o()),21)),0|o())),0|(k=0|o()),21)),0|o())),0|(u=0|o()),21)),0|o())),0|(F=0|o()),21)),0|o(),2097151&y|0,0)),0|(h=0|o()),21)),0|o(),2097151&w|0,0)),0|(f=0|o()),21)),0|o(),2097151&t|0,0)),0|(n=0|o()),21)),0|o(),2097151&c|0,0)),0|(r=0|o()),21)),0|o(),2097151&e|0,0)),0|(a=0|o()),21)),0|o(),2097151&i|0,0),E=0|o(),B[A>>0]=Y,M=0|yg(0|Y,0|G,8),o(),B[A+1>>0]=M,G=0|yg(0|Y,0|G,16),o(),Y=0|rg(2097151&l|0,0,5),o(),B[A+2>>0]=Y|31&G,G=0|yg(0|l,0|d,3),o(),B[A+3>>0]=G,d=0|yg(0|l,0|d,11),o(),B[A+4>>0]=d,l=0|yg(2097151&l|0,0,19),d=0|o(),G=0|rg(2097151&H|0,0,2),o(),B[A+5>>0]=G|l,_=0|yg(0|H,0|_,6),o(),B[A+6>>0]=_,H=0|yg(2097151&H|0,0,14),_=0|o(),l=0|rg(2097151&p|0,0,7),o(),B[A+7>>0]=l|H,H=0|yg(0|p,0|k,1),o(),B[A+8>>0]=H,k=0|yg(0|p,0|k,9),o(),B[A+9>>0]=k,p=0|yg(2097151&p|0,0,17),k=0|o(),H=0|rg(2097151&D|0,0,4),o(),B[A+10>>0]=H|p,p=0|yg(0|D,0|u,4),o(),B[A+11>>0]=p,u=0|yg(0|D,0|u,12),o(),B[A+12>>0]=u,D=0|yg(2097151&D|0,0,20),u=0|o(),p=0|rg(2097151&s|0,0,1),o(),B[A+13>>0]=p|D,F=0|yg(0|s,0|F,7),o(),B[A+14>>0]=F,s=0|yg(2097151&s|0,0,15),F=0|o(),D=0|rg(2097151&y|0,0,6),o(),B[A+15>>0]=D|s,s=0|yg(0|y,0|h,2),o(),B[A+16>>0]=s,h=0|yg(0|y,0|h,10),o(),B[A+17>>0]=h,y=0|yg(2097151&y|0,0,18),h=0|o(),s=0|rg(0|w,0|f,3),o(),B[A+18>>0]=s|y,y=0|yg(0|w,0|f,5),o(),B[A+19>>0]=y,f=0|yg(0|w,0|f,13),o(),B[A+20>>0]=f,B[A+21>>0]=t,f=0|yg(0|t,0|n,8),o(),B[A+22>>0]=f,n=0|yg(0|t,0|n,16),o(),t=0|rg(2097151&c|0,0,5),o(),B[A+23>>0]=t|31&n,n=0|yg(0|c,0|r,3),o(),B[A+24>>0]=n,r=0|yg(0|c,0|r,11),o(),B[A+25>>0]=r,c=0|yg(2097151&c|0,0,19),r=0|o(),n=0|rg(2097151&e|0,0,2),o(),B[A+26>>0]=n|c,a=0|yg(0|e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(0|ZA,0|XA,-67108864&LA|0,0),o(),qA=0|vg(0|(ZA=0|ig(0|(XA=0|vg(0|g,0|mA,16777216,0)),0|o(),25)),0|o(),0|I,0|qA),I=0|o(),XA=0|Ug(0|g,0|mA,-33554432&XA|0,0),o(),g=0|ig(0|(mA=0|vg(0|xA,0|KA,16777216,0)),0|o(),25),ZA=0|o(),ZA=0|vg(0|(aI=0|vg(0|(rI=0|vg(0|(tI=0|vg(0|(fI=0|vg(0|(wI=0|vg(0|(yI=0|vg(0|(sI=0|vg(0|(hI=0|vg(0|(DI=0|vg(0|u,0|p,0|F,0|DI)),0|o(),0|D,0|hI)),0|o(),0|h,0|sI)),0|o(),0|s,0|yI)),0|o(),0|y,0|wI)),0|o(),0|w,0|fI)),0|o(),0|f,0|tI)),0|o(),0|t,0|rI)),0|o(),0|nI,0|aI)),0|o(),0|g,0|ZA),g=0|o(),mA=0|Ug(0|xA,0|KA,-33554432&mA|0,0),o(),xA=0|vg(0|cI,0|TA,0|(xA=0|yg(0|(KA=0|vg(0|qA,0|I,33554432,0)),0|o(),26)),0|o()),o(),KA=0|Ug(0|qA,0|I,-67108864&KA|0,0),o(),qA=0|ig(0|(I=0|vg(0|ZA,0|g,33554432,0)),0|o(),26),TA=0|o(),TA=0|vg(0|($A=0|vg(0|(II=0|vg(0|(gI=0|vg(0|(BI=0|vg(0|(CI=0|vg(0|(QI=0|vg(0|(EI=0|vg(0|(iI=0|vg(0|(eI=0|vg(0|r,0|n,0|oI,0|eI)),0|o(),0|a,0|iI)),0|o(),0|c,0|EI)),0|o(),0|e,0|QI)),0|o(),0|i,0|CI)),0|o(),0|E,0|BI)),0|o(),0|Q,0|gI)),0|o(),0|B,0|II)),0|o(),0|AI,0|$A)),0|o(),0|qA,0|TA),qA=0|o(),I=0|Ug(0|ZA,0|g,-67108864&I|0,0),o(),zA=0|vg(0|(ZA=0|Qg(0|(ZA=0|ig(0|(g=0|vg(0|TA,0|qA,16777216,0)),0|o(),25)),0|o(),19,0)),0|o(),0|VA,0|zA),VA=0|o(),g=0|Ug(0|TA,0|qA,-33554432&g|0,0),o(),TA=0|vg(0|OA,0|WA,0|(TA=0|yg(0|(qA=0|vg(0|zA,0|VA,33554432,0)),0|o(),26)),0|o()),o(),qA=0|Ug(0|zA,0|VA,-67108864&qA|0,0),o(),C[A>>2]=qA,C[A+4>>2]=TA,C[A+8>>2]=jA,C[A+12>>2]=XA,C[A+16>>2]=KA,C[A+20>>2]=xA,C[A+24>>2]=LA,C[A+28>>2]=mA,C[A+32>>2]=I,C[A+36>>2]=g;}function H(A,I,g){A|=0,g|=0;var B,Q,E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0;B=y,Q=y=y+63&-64,y=y+2048|0,fB(Q+1024|0,I|=0),SI(Q+1024|0,A),fB(Q,Q+1024|0),SI(Q,g),A=0;do{i=0|C[Q+1024+((4|(I=A<<4))<<3)>>2],e=0|C[Q+1024+((4|I)<<3)+4>>2],b=0|uI(0|C[Q+1024+(I<<3)>>2],0|C[Q+1024+(I<<3)+4>>2],i,e),N=0|o(),Y=0|ZI(C[Q+1024+((12|I)<<3)>>2]^b,C[Q+1024+((12|I)<<3)+4>>2]^N,32),H=0|o(),H=0|ZI((N=0|uI(b,N,e=0|ZI((F=0|uI(0|C[Q+1024+((8|I)<<3)>>2],0|C[Q+1024+((8|I)<<3)+4>>2],Y,H))^i,(D=0|o())^e,24),i=0|o()))^Y,(b=0|o())^H,16),Y=0|o(),C[Q+1024+((12|I)<<3)>>2]=H,C[Q+1024+((12|I)<<3)+4>>2]=Y,D=0|uI(F,D,H,Y),F=0|o(),C[Q+1024+((8|I)<<3)>>2]=D,C[Q+1024+((8|I)<<3)+4>>2]=F,i=0|ZI(D^e,F^i,63),e=0|o(),C[Q+1024+((4|I)<<3)>>2]=i,C[Q+1024+((4|I)<<3)+4>>2]=e,U=0|C[Q+1024+((5|I)<<3)>>2],v=0|C[Q+1024+((5|I)<<3)+4>>2],_=0|uI(0|C[Q+1024+((1|I)<<3)>>2],0|C[Q+1024+((1|I)<<3)+4>>2],U,v),M=0|o(),p=0|ZI(C[Q+1024+((13|I)<<3)>>2]^_,C[Q+1024+((13|I)<<3)+4>>2]^M,32),f=0|o(),a=0|uI(n=0|uI(0|C[Q+1024+((9|I)<<3)>>2],0|C[Q+1024+((9|I)<<3)+4>>2],p,f),a=0|o(),f=0|ZI((M=0|uI(_,M,v=0|ZI(n^U,a^v,24),U=0|o()))^p,(_=0|o())^f,16),p=0|o()),n=0|o(),C[Q+1024+((9|I)<<3)>>2]=a,C[Q+1024+((9|I)<<3)+4>>2]=n,U=0|ZI(a^v,n^U,63),v=0|o(),k=0|C[Q+1024+((6|I)<<3)>>2],l=0|C[Q+1024+((6|I)<<3)+4>>2],h=0|uI(0|C[Q+1024+((2|I)<<3)>>2],0|C[Q+1024+((2|I)<<3)+4>>2],k,l),u=0|o(),r=0|ZI(C[Q+1024+((14|I)<<3)>>2]^h,C[Q+1024+((14|I)<<3)+4>>2]^u,32),E=0|o(),k=0|ZI((J=0|uI(P=0|uI(0|C[Q+1024+((10|I)<<3)>>2],0|C[Q+1024+((10|I)<<3)+4>>2],r,E),J=0|o(),E=0|ZI((u=0|uI(h,u,l=0|ZI(P^k,J^l,24),k=0|o()))^r,(h=0|o())^E,16),r=0|o()))^l,(P=0|o())^k,63),l=0|o(),w=0|C[Q+1024+((7|I)<<3)>>2],s=0|C[Q+1024+((7|I)<<3)+4>>2],c=0|uI(0|C[Q+1024+((3|I)<<3)>>2],0|C[Q+1024+((3|I)<<3)+4>>2],w,s),t=0|o(),R=0|ZI(C[Q+1024+((15|I)<<3)>>2]^c,C[Q+1024+((15|I)<<3)+4>>2]^t,32),S=0|o(),w=0|ZI((G=0|uI(d=0|uI(0|C[Q+1024+((11|I)<<3)>>2],0|C[Q+1024+((11|I)<<3)+4>>2],R,S),G=0|o(),S=0|ZI((t=0|uI(c,t,s=0|ZI(d^w,G^s,24),w=0|o()))^R,(c=0|o())^S,16),R=0|o()))^s,(d=0|o())^w,63),s=0|o(),N=0|uI(b=0|uI(N,b,U,v),N=0|o(),v=0|ZI((P=0|uI(J,P,R=0|ZI(b^S,N^R,32),S=0|o()))^U,(J=0|o())^v,24),U=0|o()),b=0|o(),C[Q+1024+(I<<3)>>2]=N,C[Q+1024+(I<<3)+4>>2]=b,S=0|ZI(N^R,b^S,16),b=0|o(),C[Q+1024+((15|I)<<3)>>2]=S,C[Q+1024+((15|I)<<3)+4>>2]=b,b=0|uI(P,J,S,b),S=0|o(),C[Q+1024+((10|I)<<3)>>2]=b,C[Q+1024+((10|I)<<3)+4>>2]=S,U=0|ZI(b^v,S^U,63),S=0|o(),C[Q+1024+((5|I)<<3)>>2]=U,C[Q+1024+((5|I)<<3)+4>>2]=S,M=0|uI(_=0|uI(M,_,k,l),M=0|o(),l=0|ZI((d=0|uI(G,d,Y=0|ZI(_^H,M^Y,32),H=0|o()))^k,(G=0|o())^l,24),k=0|o()),_=0|o(),C[Q+1024+((1|I)<<3)>>2]=M,C[Q+1024+((1|I)<<3)+4>>2]=_,H=0|ZI(M^Y,_^H,16),_=0|o(),C[Q+1024+((12|I)<<3)>>2]=H,C[Q+1024+((12|I)<<3)+4>>2]=_,_=0|uI(d,G,H,_),H=0|o(),C[Q+1024+((11|I)<<3)>>2]=_,C[Q+1024+((11|I)<<3)+4>>2]=H,k=0|ZI(_^l,H^k,63),H=0|o(),C[Q+1024+((6|I)<<3)>>2]=k,C[Q+1024+((6|I)<<3)+4>>2]=H,u=0|uI(h=0|uI(u,h,w,s),u=0|o(),s=0|ZI((F=0|uI(D,F,p=0|ZI(h^f,u^p,32),f=0|o()))^w,(D=0|o())^s,24),w=0|o()),h=0|o(),C[Q+1024+((2|I)<<3)>>2]=u,C[Q+1024+((2|I)<<3)+4>>2]=h,f=0|ZI(u^p,h^f,16),h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(F,D,H,Y),F=0|o(),C[Q+1024+((8|I)<<3)>>2]=D,C[Q+1024+((8|I)<<3)+4>>2]=F,i=0|ZI(D^e,F^i,63),e=0|o(),C[Q+1024+((4|I)<<3)>>2]=i,C[Q+1024+((4|I)<<3)+4>>2]=e,U=0|C[Q+1024+((5|I)<<3)>>2],v=0|C[Q+1024+((5|I)<<3)+4>>2],_=0|uI(0|C[Q+1024+((1|I)<<3)>>2],0|C[Q+1024+((1|I)<<3)+4>>2],U,v),M=0|o(),p=0|ZI(C[Q+1024+((13|I)<<3)>>2]^_,C[Q+1024+((13|I)<<3)+4>>2]^M,32),f=0|o(),a=0|uI(n=0|uI(0|C[Q+1024+((9|I)<<3)>>2],0|C[Q+1024+((9|I)<<3)+4>>2],p,f),a=0|o(),f=0|ZI((M=0|uI(_,M,v=0|ZI(n^U,a^v,24),U=0|o()))^p,(_=0|o())^f,16),p=0|o()),n=0|o(),C[Q+1024+((9|I)<<3)>>2]=a,C[Q+1024+((9|I)<<3)+4>>2]=n,U=0|ZI(a^v,n^U,63),v=0|o(),k=0|C[Q+1024+((6|I)<<3)>>2],l=0|C[Q+1024+((6|I)<<3)+4>>2],h=0|uI(0|C[Q+1024+((2|I)<<3)>>2],0|C[Q+1024+((2|I)<<3)+4>>2],k,l),u=0|o(),r=0|ZI(C[Q+1024+((14|I)<<3)>>2]^h,C[Q+1024+((14|I)<<3)+4>>2]^u,32),E=0|o(),k=0|ZI((J=0|uI(P=0|uI(0|C[Q+1024+((10|I)<<3)>>2],0|C[Q+1024+((10|I)<<3)+4>>2],r,E),J=0|o(),E=0|ZI((u=0|uI(h,u,l=0|ZI(P^k,J^l,24),k=0|o()))^r,(h=0|o())^E,16),r=0|o()))^l,(P=0|o())^k,63),l=0|o(),w=0|C[Q+1024+((7|I)<<3)>>2],s=0|C[Q+1024+((7|I)<<3)+4>>2],c=0|uI(0|C[Q+1024+((3|I)<<3)>>2],0|C[Q+1024+((3|I)<<3)+4>>2],w,s),t=0|o(),R=0|ZI(C[Q+1024+((15|I)<<3)>>2]^c,C[Q+1024+((15|I)<<3)+4>>2]^t,32),S=0|o(),w=0|ZI((G=0|uI(d=0|uI(0|C[Q+1024+((11|I)<<3)>>2],0|C[Q+1024+((11|I)<<3)+4>>2],R,S),G=0|o(),S=0|ZI((t=0|uI(c,t,s=0|ZI(d^w,G^s,24),w=0|o()))^R,(c=0|o())^S,16),R=0|o()))^s,(d=0|o())^w,63),s=0|o(),N=0|uI(b=0|uI(N,b,U,v),N=0|o(),v=0|ZI((P=0|uI(J,P,R=0|ZI(b^S,N^R,32),S=0|o()))^U,(J=0|o())^v,24),U=0|o()),b=0|o(),C[Q+1024+(I<<3)>>2]=N,C[Q+1024+(I<<3)+4>>2]=b,S=0|ZI(N^R,b^S,16),b=0|o(),C[Q+1024+((15|I)<<3)>>2]=S,C[Q+1024+((15|I)<<3)+4>>2]=b,b=0|uI(P,J,S,b),S=0|o(),C[Q+1024+((10|I)<<3)>>2]=b,C[Q+1024+((10|I)<<3)+4>>2]=S,U=0|ZI(b^v,S^U,63),S=0|o(),C[Q+1024+((5|I)<<3)>>2]=U,C[Q+1024+((5|I)<<3)+4>>2]=S,M=0|uI(_=0|uI(M,_,k,l),M=0|o(),l=0|ZI((d=0|uI(G,d,Y=0|ZI(_^H,M^Y,32),H=0|o()))^k,(G=0|o())^l,24),k=0|o()),_=0|o(),C[Q+1024+((1|I)<<3)>>2]=M,C[Q+1024+((1|I)<<3)+4>>2]=_,H=0|ZI(M^Y,_^H,16),_=0|o(),C[Q+1024+((12|I)<<3)>>2]=H,C[Q+1024+((12|I)<<3)+4>>2]=_,_=0|uI(d,G,H,_),H=0|o(),C[Q+1024+((11|I)<<3)>>2]=_,C[Q+1024+((11|I)<<3)+4>>2]=H,k=0|ZI(_^l,H^k,63),H=0|o(),C[Q+1024+((6|I)<<3)>>2]=k,C[Q+1024+((6|I)<<3)+4>>2]=H,u=0|uI(h=0|uI(u,h,w,s),u=0|o(),s=0|ZI((F=0|uI(D,F,p=0|ZI(h^f,u^p,32),f=0|o()))^w,(D=0|o())^s,24),w=0|o()),h=0|o(),C[Q+1024+((2|I)<<3)>>2]=u,C[Q+1024+((2|I)<<3)+4>>2]=h,f=0|ZI(u^p,h^f,16),h=0|o(),C[Q+1024+((13|I)<<3)>>2]=f,C[Q+1024+((13|I)<<3)+4>>2]=h,h=0|uI(F,D,f,h),f=0|o(),C[Q+1024+((8|I)<<3)>>2]=h,C[Q+1024+((8|I)<<3)+4>>2]=f,w=0|ZI(h^s,f^w,63),f=0|o(),C[Q+1024+((7|I)<<3)>>2]=w,C[Q+1024+((7|I)<<3)+4>>2]=f,t=0|uI(c=0|uI(t,c,i,e),t=0|o(),e=0|ZI((n=0|uI(a,n,r=0|ZI(c^E,t^r,32),E=0|o()))^i,(a=0|o())^e,24),i=0|o()),c=0|o(),C[Q+1024+((3|I)<<3)>>2]=t,C[Q+1024+((3|I)<<3)+4>>2]=c,E=0|ZI(t^r,c^E,16),c=0|o(),C[Q+1024+((14|I)<<3)>>2]=E,C[Q+1024+((14|I)<<3)+4>>2]=c,c=0|uI(n,a,E,c),E=0|o(),C[Q+1024+((9|I)<<3)>>2]=c,C[Q+1024+((9|I)<<3)+4>>2]=E,i=0|ZI(c^e,E^i,63),E=0|o(),C[Q+1024+((4|I)<<3)>>2]=i,C[Q+1024+((4|I)<<3)+4>>2]=E,A=A+1|0;}while(8!=(0|A));A=0;do{P=0|C[(J=Q+1024+(32+(N=A<<1)<<3)|0)>>2],J=0|C[J+4>>2],c=0|uI(0|C[Q+1024+(N<<3)>>2],0|C[Q+1024+(N<<3)+4>>2],P,J),I=0|o(),f=0|ZI(C[(f=Q+1024+(N+96<<3)|0)>>2]^c,C[f+4>>2]^I,32),F=0|o(),F=0|ZI((I=0|uI(c,I,J=0|ZI((k=0|uI(0|C[(k=Q+1024+(N+64<<3)|0)>>2],0|C[k+4>>2],f,F))^P,(l=0|o())^J,24),P=0|o()))^f,(c=0|o())^F,16),f=0|o(),C[(r=Q+1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BA,((0|BA)<0)<<31>>31|0),GA=0|o(),B=0|Qg(BA<<1|0,((BA<<1|0)<0)<<31>>31|0,0|pA,((0|pA)<0)<<31>>31|0),HA=0|o(),Z=0|Qg(19*yA|0,((19*yA|0)<0)<<31>>31|0,BA<<1|0,((BA<<1|0)<0)<<31>>31|0),BI=0|o(),T=0|Qg(38*iA|0,0|xA,0|BA,((0|BA)<0)<<31>>31|0),$A=0|o(),N=0|Qg(19*EA|0,0|UA,BA<<1|0,((BA<<1|0)<0)<<31>>31|0),VA=0|o(),BA=0|Qg(38*I|0,0|fA,0|BA,((0|BA)<0)<<31>>31|0),hA=0|o(),IA=0|Qg(38*pA|0,((38*pA|0)<0)<<31>>31|0,0|pA,((0|pA)<0)<<31>>31|0),AA=0|o(),z=0|Qg(19*yA|0,((19*yA|0)<0)<<31>>31|0,pA<<1|0,((pA<<1|0)<0)<<31>>31|0),V=0|o(),m=0|Qg(38*iA|0,0|xA,pA<<1|0,((pA<<1|0)<0)<<31>>31|0),zA=0|o(),v=0|Qg(19*EA|0,0|UA,pA<<1|0,((pA<<1|0)<0)<<31>>31|0),jA=0|o(),pA=0|Qg(38*I|0,0|fA,pA<<1|0,((pA<<1|0)<0)<<31>>31|0),tA=0|o(),L=0|Qg(19*yA|0,((19*yA|0)<0)<<31>>31|0,0|yA,((0|yA)<0)<<31>>31|0),WA=0|o(),b=0|Qg(38*iA|0,0|xA,0|yA,((0|yA)<0)<<31>>31|0),TA=0|o(),d=0|Qg(19*EA|0,0|UA,yA<<1|0,((yA<<1|0)<0)<<31>>31|0),mA=0|o(),yA=0|Qg(38*I|0,0|fA,0|yA,((0|yA)<0)<<31>>31|0),eA=0|o(),xA=0|Qg(38*iA|0,0|xA,0|iA,((0|iA)<0)<<31>>31|0),LA=0|o(),H=0|Qg(19*EA|0,0|UA,iA<<1|0,((iA<<1|0)<0)<<31>>31|0),PA=0|o(),iA=0|Qg(38*I|0,0|fA,iA<<1|0,((iA<<1|0)<0)<<31>>31|0),DA=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)),0|o(),0|iA,0|DA),iA=0|o(),QA=0|vg(0|(dA=0|vg(0|(YA=0|vg(0|(MA=0|vg(0|s,0|y,0|w,0|MA)),0|o(),0|f,0|YA)),0|o(),0|t,0|dA)),0|o(),0|EA,0|QA),EA=0|o(),fA=0|vg(0|(kA=0|vg(0|(lA=0|vg(0|(_A=0|vg(0|(GA=0|vg(0|r,0|n,0|a,0|GA)),0|o(),0|c,0|_A)),0|o(),0|e,0|lA)),0|o(),0|i,0|kA)),0|o(),0|I,0|fA),I=0|o(),oA=0|vg(0|(nA=0|vg(0|(uA=0|vg(0|(HA=0|vg(0|E,0|Q,0|B,0|HA)),0|o(),0|g,0|uA)),0|o(),0|aA,0|nA)),0|o(),0|cA,0|oA),cA=0|o(),gA=0|rg(0|wA,0|gA,1),wA=0|o(),rA=0|rg(0|sA,0|rA,1),sA=0|o(),CA=0|rg(0|FA,0|CA,1),FA=0|o(),BA=0|rg(0|hA,0|BA,1),hA=0|o(),pA=0|rg(0|tA,0|pA,1),tA=0|o(),yA=0|rg(0|eA,0|yA,1),eA=0|o(),iA=0|rg(0|DA,0|iA,1),DA=0|o(),EA=0|rg(0|QA,0|EA,1),QA=0|o(),I=0|rg(0|fA,0|I,1),fA=0|o(),cA=0|rg(0|oA,0|cA,1),oA=0|o(),sA=0|vg(0|(uA=0|ig(0|(nA=0|vg(0|gA,0|wA,33554432,0)),0|(aA=0|o()),26)),0|o(),0|rA,0|sA),rA=0|o(),aA=0|Ug(0|gA,0|wA,-67108864&nA|0,0|aA),nA=0|o(),eA=0|vg(0|(uA=0|ig(0|(wA=0|vg(0|pA,0|tA,33554432,0)),0|(gA=0|o()),26)),0|o(),0|yA,0|eA),yA=0|o(),gA=0|Ug(0|pA,0|tA,-67108864&wA|0,0|gA),wA=0|o(),FA=0|vg(0|(pA=0|ig(0|(tA=0|vg(0|sA,0|rA,16777216,0)),0|o(),25)),0|o(),0|CA,0|FA),CA=0|o(),tA=0|Ug(0|sA,0|rA,-33554432&tA|0,0),rA=0|o(),DA=0|vg(0|(pA=0|ig(0|(sA=0|vg(0|eA,0|yA,16777216,0)),0|o(),25)),0|o(),0|iA,0|DA),iA=0|o(),sA=0|Ug(0|eA,0|yA,-33554432&sA|0,0),yA=0|o(),hA=0|vg(0|(pA=0|ig(0|(eA=0|vg(0|FA,0|CA,33554432,0)),0|o(),26)),0|o(),0|BA,0|hA),BA=0|o(),eA=0|Ug(0|FA,0|CA,-67108864&eA|0,0),o(),QA=0|vg(0|(FA=0|ig(0|(CA=0|vg(0|DA,0|iA,33554432,0)),0|o(),26)),0|o(),0|EA,0|QA),EA=0|o(),CA=0|Ug(0|DA,0|iA,-67108864&CA|0,0),o(),wA=0|vg(0|(DA=0|ig(0|(iA=0|vg(0|hA,0|BA,16777216,0)),0|o(),25)),0|o(),0|gA,0|wA),gA=0|o(),iA=0|Ug(0|hA,0|BA,-33554432&iA|0,0),o(),fA=0|vg(0|(hA=0|ig(0|(BA=0|vg(0|QA,0|EA,16777216,0)),0|o(),25)),0|o(),0|I,0|fA),I=0|o(),BA=0|Ug(0|QA,0|EA,-33554432&BA|0,0),o(),QA=0|vg(0|sA,0|yA,0|(QA=0|yg(0|(EA=0|vg(0|wA,0|gA,33554432,0)),0|o(),26)),0|o()),o(),EA=0|Ug(0|wA,0|gA,-67108864&EA|0,0),o(),oA=0|vg(0|(wA=0|ig(0|(gA=0|vg(0|fA,0|I,33554432,0)),0|o(),26)),0|o(),0|cA,0|oA),cA=0|o(),gA=0|Ug(0|fA,0|I,-67108864&gA|0,0),o(),nA=0|vg(0|(fA=0|Qg(0|(fA=0|ig(0|(I=0|vg(0|oA,0|cA,16777216,0)),0|o(),25)),0|o(),19,0)),0|o(),0|aA,0|nA),aA=0|o(),I=0|Ug(0|oA,0|cA,-33554432&I|0,0),o(),oA=0|vg(0|tA,0|rA,0|(oA=0|yg(0|(cA=0|vg(0|nA,0|aA,33554432,0)),0|o(),26)),0|o()),o(),cA=0|Ug(0|nA,0|aA,-67108864&cA|0,0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($A=0|vg(0|(AI=0|vg(0|K,0|x,0|L,0|AI)),0|o(),0|m,0|$A)),0|o(),0|hA,0|aA)),0|o(),0|oA,0|cA)),0|o(),0|nA,0|gA),nA=0|o(),aA=0|ig(0|(cA=0|vg(0|AA,0|eA,33554432,0)),0|(oA=0|o()),26),hA=0|o(),hA=0|vg(0|(iA=0|vg(0|(WA=0|vg(0|(OA=0|vg(0|(ZA=0|vg(0|N,0|R,0|P,0|ZA)),0|o(),0|J,0|OA)),0|o(),0|b,0|WA)),0|o(),0|EA,0|iA)),0|o(),0|aA,0|hA),aA=0|o(),oA=0|Ug(0|AA,0|eA,-67108864&cA|0,0|oA),cA=0|o(),iA=0|ig(0|(eA=0|vg(0|gA,0|nA,33554432,0)),0|(AA=0|o()),26),EA=0|o(),EA=0|vg(0|(CA=0|vg(0|(qA=0|vg(0|(VA=0|vg(0|(zA=0|vg(0|v,0|U,0|S,0|zA)),0|o(),0|M,0|VA)),0|o(),0|Y,0|qA)),0|o(),0|TA,0|CA)),0|o(),0|iA,0|EA),iA=0|o(),AA=0|Ug(0|gA,0|nA,-67108864&eA|0,0|AA),eA=0|o(),gA=0|ig(0|(nA=0|vg(0|hA,0|aA,16777216,0)),0|o(),25),CA=0|o(),CA=0|vg(0|(QA=0|vg(0|(LA=0|vg(0|(xA=0|vg(0|(KA=0|vg(0|jA,0|XA,0|d,0|KA)),0|o(),0|G,0|xA)),0|o(),0|_,0|LA)),0|o(),0|rA,0|QA)),0|o(),0|gA,0|CA),gA=0|o(),nA=0|Ug(0|hA,0|aA,-33554432&nA|0,0),aA=0|o(),QA=0|ig(0|(hA=0|vg(0|EA,0|iA,16777216,0)),0|o(),25),rA=0|o(),rA=0|vg(0|(IA=0|vg(0|(JA=0|vg(0|(RA=0|vg(0|(NA=0|vg(0|(mA=0|vg(0|l,0|k,0|H,0|mA)),0|o(),0|u,0|NA)),0|o(),0|p,0|RA)),0|o(),0|PA,0|JA)),0|o(),0|I,0|IA)),0|o(),0|QA,0|rA),QA=0|o(),hA=0|Ug(0|EA,0|iA,-33554432&hA|0,0),iA=0|o(),IA=0|ig(0|(EA=0|vg(0|CA,0|gA,33554432,0)),0|o(),26),I=0|o(),I=0|vg(0|(BA=0|vg(0|(SA=0|vg(0|(UA=0|vg(0|bA,0|vA,0|F,0|UA)),0|o(),0|D,0|SA)),0|o(),0|MA,0|BA)),0|o(),0|IA,0|I),IA=0|o(),EA=0|Ug(0|CA,0|gA,-67108864&EA|0,0),o(),CA=0|ig(0|(gA=0|vg(0|rA,0|QA,33554432,0)),0|o(),26),BA=0|o(),BA=0|vg(0|(lA=0|vg(0|(GA=0|vg(0|(dA=0|vg(0|(YA=0|vg(0|h,0|s,0|y,0|YA)),0|o(),0|w,0|dA)),0|o(),0|f,0|GA)),0|o(),0|_A,0|lA)),0|o(),0|CA,0|BA),CA=0|o(),gA=0|Ug(0|rA,0|QA,-67108864&gA|0,0),o(),eA=0|vg(0|(rA=0|ig(0|(QA=0|vg(0|I,0|IA,16777216,0)),0|o(),25)),0|o(),0|AA,0|eA),AA=0|o(),QA=0|Ug(0|I,0|IA,-33554432&QA|0,0),o(),I=0|ig(0|(IA=0|vg(0|BA,0|CA,16777216,0)),0|o(),25),rA=0|o(),rA=0|vg(0|(DA=0|vg(0|(pA=0|vg(0|(uA=0|vg(0|(HA=0|vg(0|(kA=0|vg(0|t,0|r,0|n,0|kA)),0|o(),0|a,0|HA)),0|o(),0|c,0|uA)),0|o(),0|e,0|pA)),0|o(),0|FA,0|DA)),0|o(),0|I,0|rA),I=0|o(),IA=0|Ug(0|BA,0|CA,-33554432&IA|0,0),o(),BA=0|vg(0|hA,0|iA,0|(BA=0|yg(0|(CA=0|vg(0|eA,0|AA,33554432,0)),0|o(),26)),0|o()),o(),CA=0|Ug(0|eA,0|AA,-67108864&CA|0,0),o(),eA=0|ig(0|(AA=0|vg(0|rA,0|I,33554432,0)),0|o(),26),iA=0|o(),iA=0|vg(0|(tA=0|vg(0|(wA=0|vg(0|(yA=0|vg(0|(sA=0|vg(0|i,0|E,0|Q,0|sA)),0|o(),0|B,0|yA)),0|o(),0|g,0|wA)),0|o(),0|fA,0|tA)),0|o(),0|eA,0|iA),eA=0|o(),AA=0|Ug(0|rA,0|I,-67108864&AA|0,0),o(),cA=0|vg(0|(rA=0|Qg(0|(rA=0|ig(0|(I=0|vg(0|iA,0|eA,16777216,0)),0|o(),25)),0|o(),19,0)),0|o(),0|oA,0|cA),oA=0|o(),I=0|Ug(0|iA,0|eA,-33554432&I|0,0),o(),iA=0|vg(0|nA,0|aA,0|(iA=0|yg(0|(eA=0|vg(0|cA,0|oA,33554432,0)),0|o(),26)),0|o()),o(),eA=0|Ug(0|cA,0|oA,-67108864&eA|0,0),o(),C[A>>2]=eA,C[A+4>>2]=iA,C[A+8>>2]=EA,C[A+12>>2]=QA,C[A+16>>2]=CA,C[A+20>>2]=BA,C[A+24>>2]=gA,C[A+28>>2]=IA,C[A+32>>2]=AA,C[A+36>>2]=I;}function G(A,I,g,B,C){A|=0,I|=0,g|=0,B|=0;var E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0;if(n=0|qI(C|=0),t=0|o(),E=0|qI(C+8|0),i=0|o(),B=0|rg(0|g,0|B,56),C=0|o(),(I+g+(0-(7&g))|0)==(0|I))y=2037671283^E,e=1952801890^i,w=1886610805^n,r=1936682341^t,a=1852075885^E,c=1685025377^i,F=1852142177^n,E=1819895653^t,i=I;else for(D=2037671283^E,e=1952801890^i,y=1886610805^n,r=1936682341^t,a=1852075885^E,c=1685025377^i,i=1852142177^n,E=1819895653^t,w=I;;){if(u=(s=0|qI(w))^D,e^=h=0|o(),F=0|vg(0|y,0|r,0|a,0|c),D=0|o(),n=0|$I(a,c,13),a=(0|o())^D,c=0|$I(F,D,32),D=0|o(),t=0|vg(0|u,0|e,0|i,0|E),f=0|o(),D=0|vg((e=0|$I(u,e,16))^t|0,0|(i=(0|o())^f),0|c,0|D),c=0|o(),i=0|$I(e^t,i,21),e=c^(0|o()),f=0|vg(0|t,0|f,n^F|0,0|a),t=0|o(),a=0|$I(n^F,a,17),E=(0|o())^t,t=0|$I(f,t,32),F=0|o(),c=0|vg(a^f|0,0|E,0|D,0|c),n=0|o(),E=0|$I(a^f,E,13),f=(0|o())^n,n=0|$I(c,n,32),a=0|o(),F=0|vg(0|t,0|F,D^i|0,0|e),t=0|o(),a=0|vg((e=0|$I(D^i,e,16))^F|0,0|(i=(0|o())^t),0|n,0|a),n=0|o(),i=0|$I(e^F,i,21),e=n^(0|o()),t=0|vg(E^c|0,0|f,0|F,0|t),F=0|o(),f=0|$I(E^c,f,17),c=(0|o())^F,F=0|$I(t,F,32),E=0|o(),(0|(w=w+8|0))==(I+g+(0-(7&g))|0)){y=a^i,w=a^s,r=n^h,a=f^t,i=I+g+(0-(7&g))|0;break;}D=a^i,y=a^s,r=n^h,a=f^t,i=F;}switch(7&g){case 7:p=0|rg(0|Q[i+6>>0],0,48),C=0|o()|C,B|=p,p=6;break;case 6:p=6;break;case 5:p=7;break;case 4:p=8;break;case 3:p=9;break;case 2:p=10;break;case 1:p=11;}6==(0|p)&&(u=0|rg(0|Q[i+5>>0],0,40),C=0|o()|C,B|=u,p=7),7==(0|p)&&(C=0|Q[i+4>>0]|C,p=8),8==(0|p)&&(B|=u=0|rg(0|Q[i+3>>0],0,24),C=0|o()|C,p=9),9==(0|p)&&(B|=u=0|rg(0|Q[i+2>>0],0,16),C=0|o()|C,p=10),10==(0|p)&&(B|=u=0|rg(0|Q[i+1>>0],0,8),C=0|o()|C,p=11),11==(0|p)&&(B=0|B|Q[i>>0]),g=B^y,h=C^e,w=0|vg(0|w,0|r,0|a,0|c),y=0|o(),s=0|$I(a,c,13),I=(0|o())^y,y=0|$I(w,y,32),p=0|o(),F=0|vg(0|g,0|h,0|F,0|E),u=0|o(),p=0|vg((h=0|$I(g,h,16))^F|0,0|(g=(0|o())^u),0|y,0|p),y=0|o(),g=0|$I(h^F,g,21),h=y^(0|o()),u=0|vg(0|F,0|u,s^w|0,0|I),F=0|o(),I=0|$I(s^w,I,17),w=(0|o())^F,F=0|$I(u,F,32),s=0|o(),y=0|vg(I^u|0,0|w,0|p,0|y),D=0|o(),w=0|$I(I^u,w,13),u=(0|o())^D,D=0|$I(y,D,32),I=0|o(),s=0|vg(0|F,0|s,p^g|0,0|h),F=0|o(),I=0|vg((h=0|$I(p^g,h,16))^s|0,0|(g=(0|o())^F),0|D,0|I),D=0|o(),g=0|$I(h^s,g,21),h=D^(0|o()),F=0|vg(w^y|0,0|u,0|s,0|F),s=0|o(),u=0|$I(w^y,u,17),y=(0|o())^s,s=0|$I(F,s,32),w=0|o(),D=0|vg(I^B|0,D^C|0,u^F|0,0|y),p=0|o(),y=0|$I(u^F,y,13),F=(0|o())^p,p=0|$I(D,p,32),u=0|o(),w=0|vg(255^s|0,0|w,I^g|0,0|h),s=0|o(),u=0|vg((h=0|$I(I^g,h,16))^w|0,0|(g=(0|o())^s),0|p,0|u),p=0|o(),g=0|$I(h^w,g,21),h=p^(0|o()),s=0|vg(0|w,0|s,y^D|0,0|F),w=0|o(),F=0|$I(y^D,F,17),D=(0|o())^w,w=0|$I(s,w,32),y=0|o(),p=0|vg(F^s|0,0|D,0|u,0|p),I=0|o(),D=0|$I(F^s,D,13),s=(0|o())^I,I=0|$I(p,I,32),F=0|o(),y=0|vg(0|w,0|y,u^g|0,0|h),w=0|o(),F=0|vg((h=0|$I(u^g,h,16))^y|0,0|(g=(0|o())^w),0|I,0|F),I=0|o(),g=0|$I(h^y,g,21),h=I^(0|o()),w=0|vg(D^p|0,0|s,0|y,0|w),y=0|o(),s=0|$I(D^p,s,17),p=(0|o())^y,y=0|$I(w,y,32),D=0|o(),I=0|vg(s^w|0,0|p,0|F,0|I),u=0|o(),p=0|$I(s^w,p,13),w=(0|o())^u,u=0|$I(I,u,32),s=0|o(),D=0|vg(0|y,0|D,F^g|0,0|h),y=0|o(),s=0|vg((h=0|$I(F^g,h,16))^D|0,0|(g=(0|o())^y),0|u,0|s),u=0|o(),g=0|$I(h^D,g,21),h=u^(0|o()),y=0|vg(p^I|0,0|w,0|D,0|y),D=0|o(),w=0|$I(p^I,w,17),I=(0|o())^D,D=0|$I(y,D,32),p=0|o(),u=0|vg(w^y|0,0|I,0|s,0|u),F=0|o(),I=0|$I(w^y,I,13),F=(0|o())^F,p=0|vg(0|D,0|p,s^g|0,0|h),D=0|o(),h=0|$I((h=0|$I(s^g,h,16))^p,(0|o())^D,21),g=0|o(),D=0|vg(I^u|0,0|F,0|p,0|D),p=0|o(),F=0|$I(I^u,F,17),u=0|o(),LI(A,h^D^F^(I=0|$I(D,p,32)),g^p^u^(0|o()));}function d(A){var I=0,g=0,B=0,Q=0,E=0,i=0,e=0,o=0,c=0;if(A|=0){I=0|C[8683],c=A+-8+(-8&(g=0|C[A+-4>>2]))|0;do{if(1&g)e=A+-8|0,o=A+-8|0,A=-8&g;else{if(B=0|C[A+-8>>2],!(3&g))return;if(i=B+(-8&g)|0,(E=A+-8+(0-B)|0)>>>0>>0)return;if((0|C[8684])==(0|E)){if(3!=(3&(A=0|C[c+4>>2])|0)){e=E,o=E,A=i;break;}return C[8681]=i,C[c+4>>2]=-2&A,C[E+4>>2]=1|i,void(C[E+i>>2]=i);}if(B>>>0<256){if(A=0|C[E+8>>2],(0|(I=0|C[E+12>>2]))==(0|A)){C[8679]=C[8679]&~(1<<(B>>>3)),e=E,o=E,A=i;break;}C[A+12>>2]=I,C[I+8>>2]=A,e=E,o=E,A=i;break;}Q=0|C[E+24>>2],A=0|C[E+12>>2];do{if((0|A)==(0|E)){if(A=0|C[E+16+4>>2])I=E+16+4|0;else{if(!(A=0|C[E+16>>2])){A=0;break;}I=E+16|0;}for(;;){if(g=0|C[(B=A+20|0)>>2])A=g,I=B;else{if(!(g=0|C[(B=A+16|0)>>2]))break;A=g,I=B;}}C[I>>2]=0;}else o=0|C[E+8>>2],C[o+12>>2]=A,C[A+8>>2]=o;}while(0);if(Q){if(I=0|C[E+28>>2],(0|C[35020+(I<<2)>>2])==(0|E)){if(C[35020+(I<<2)>>2]=A,!A){C[8680]=C[8680]&~(1<>2])==(0|E)?Q+16|0:Q+20|0)>>2]=A,!A){e=E,o=E,A=i;break;}C[A+24>>2]=Q,0|(I=0|C[E+16>>2])&&(C[A+16>>2]=I,C[I+24>>2]=A),(I=0|C[E+16+4>>2])?(C[A+20>>2]=I,C[I+24>>2]=A,e=E,o=E,A=i):(e=E,o=E,A=i);}else e=E,o=E,A=i;}}while(0);if(!(e>>>0>=c>>>0)&&1&(g=0|C[c+4>>2])){if(2&g)C[c+4>>2]=-2&g,C[o+4>>2]=1|A,C[e+A>>2]=A,Q=A;else{if((0|C[8685])==(0|c)){if(c=(0|C[8682])+A|0,C[8682]=c,C[8685]=o,C[o+4>>2]=1|c,(0|o)!=(0|C[8684]))return;return C[8684]=0,void(C[8681]=0);}if((0|C[8684])==(0|c))return c=(0|C[8681])+A|0,C[8681]=c,C[8684]=e,C[o+4>>2]=1|c,void(C[e+c>>2]=c);Q=(-8&g)+A|0;do{if(g>>>0<256){if(I=0|C[c+8>>2],(0|(A=0|C[c+12>>2]))==(0|I)){C[8679]=C[8679]&~(1<<(g>>>3));break;}C[I+12>>2]=A,C[A+8>>2]=I;break;}E=0|C[c+24>>2],A=0|C[c+12>>2];do{if((0|A)==(0|c)){if(A=0|C[c+16+4>>2])I=c+16+4|0;else{if(!(A=0|C[c+16>>2])){I=0;break;}I=c+16|0;}for(;;){if(g=0|C[(B=A+20|0)>>2])A=g,I=B;else{if(!(g=0|C[(B=A+16|0)>>2]))break;A=g,I=B;}}C[I>>2]=0,I=A;}else I=0|C[c+8>>2],C[I+12>>2]=A,C[A+8>>2]=I,I=A;}while(0);if(0|E){if(A=0|C[c+28>>2],(0|C[35020+(A<<2)>>2])==(0|c)){if(C[35020+(A<<2)>>2]=I,!I){C[8680]=C[8680]&~(1<>2])==(0|c)?E+16|0:E+20|0)>>2]=I,!I)break;C[I+24>>2]=E,0|(A=0|C[c+16>>2])&&(C[I+16>>2]=A,C[A+24>>2]=I),0|(A=0|C[c+16+4>>2])&&(C[I+20>>2]=A,C[A+24>>2]=I);}}while(0);if(C[o+4>>2]=1|Q,C[e+Q>>2]=Q,(0|o)==(0|C[8684]))return void(C[8681]=Q);}if(g=Q>>>3,Q>>>0<256)return(A=0|C[8679])&1<>2]):(C[8679]=A|1<>2]=o,C[I+12>>2]=o,C[o+8>>2]=I,void(C[o+12>>2]=34756+(g<<1<<2));I=35020+((B=(A=Q>>>8)?Q>>>0>16777215?31:Q>>>(7+(B=14-((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4|(A+1048320|0)>>>16&8|(245760+(B=A<<((A+1048320|0)>>>16&8)<<((520192+(A<<((A+1048320|0)>>>16&8))|0)>>>16&4))|0)>>>16&2)+(B<<((B+245760|0)>>>16&2)>>>15)|0)|0)&1|B<<1:0)<<2)|0,C[o+28>>2]=B,C[o+20>>2]=0,C[o+16>>2]=0,A=0|C[8680],g=1<>2];I:do{if((-8&C[A+4>>2]|0)!=(0|Q)){for(B=Q<<(31==(0|B)?0:25-(B>>>1)|0);I=0|C[(g=A+16+(B>>>31<<2)|0)>>2];){if((-8&C[I+4>>2]|0)==(0|Q)){A=I;break I;}B<<=1,A=I;}C[g>>2]=o,C[o+24>>2]=A,C[o+12>>2]=o,C[o+8>>2]=o;break A;}}while(0);c=0|C[(e=A+8|0)>>2],C[c+12>>2]=o,C[e>>2]=o,C[o+8>>2]=c,C[o+12>>2]=A,C[o+24>>2]=0;}else C[8680]=A|g,C[I>>2]=o,C[o+24>>2]=I,C[o+12>>2]=o,C[o+8>>2]=o;}while(0);if(c=(0|C[8687])-1|0,C[8687]=c,!(0|c)){for(A=35172;A=0|C[A>>2];){A=A+8|0;}C[8687]=-1;}}}}function Y(A,I){I|=0;var g=0,B=0,Q=0,E=0,i=0,e=0,o=0;g=0|C[4+(A|=0)>>2];do{if(1&g)o=A,g=I;else{if(e=0|C[A>>2],!(3&g))return;if((0|C[8684])==(A+(0-e)|0)){if(3!=(3&(g=0|C[A+I+4>>2])|0)){o=A+(0-e)|0,g=e+I|0;break;}return C[8681]=e+I,C[A+I+4>>2]=-2&g,C[A+(0-e)+4>>2]=e+I|1,void(C[A+I>>2]=e+I);}if(e>>>0<256){if(g=0|C[A+(0-e)+8>>2],(0|(B=0|C[A+(0-e)+12>>2]))==(0|g)){C[8679]=C[8679]&~(1<<(e>>>3)),o=A+(0-e)|0,g=e+I|0;break;}C[g+12>>2]=B,C[B+8>>2]=g,o=A+(0-e)|0,g=e+I|0;break;}i=0|C[A+(0-e)+24>>2],g=0|C[A+(0-e)+12>>2];do{if((0|g)==(A+(0-e)|0)){if(g=0|C[4+(B=A+(0-e)+16|0)>>2])B=B+4|0;else if(!(g=0|C[B>>2])){B=0;break;}for(;;){if(Q=0|C[(E=g+20|0)>>2])g=Q,B=E;else{if(!(Q=0|C[(E=g+16|0)>>2]))break;g=Q,B=E;}}C[B>>2]=0,B=g;}else B=0|C[A+(0-e)+8>>2],C[B+12>>2]=g,C[g+8>>2]=B,B=g;}while(0);if(i){if(g=0|C[A+(0-e)+28>>2],(0|C[35020+(g<<2)>>2])==(A+(0-e)|0)){if(C[35020+(g<<2)>>2]=B,!B){C[8680]=C[8680]&~(1<>2])==(A+(0-e)|0)?i+16|0:i+20|0)>>2]=B,!B){o=A+(0-e)|0,g=e+I|0;break;}C[B+24>>2]=i,0|(g=0|C[A+(0-e)+16>>2])&&(C[B+16>>2]=g,C[g+24>>2]=B),(g=0|C[A+(0-e)+16+4>>2])?(C[B+20>>2]=g,C[g+24>>2]=B,o=A+(0-e)|0,g=e+I|0):(o=A+(0-e)|0,g=e+I|0);}else o=A+(0-e)|0,g=e+I|0;}}while(0);if(2&(Q=0|C[A+I+4>>2]))C[A+I+4>>2]=-2&Q,C[o+4>>2]=1|g,C[o+g>>2]=g,i=g;else{if((0|C[8685])==(A+I|0)){if(I=(0|C[8682])+g|0,C[8682]=I,C[8685]=o,C[o+4>>2]=1|I,(0|o)!=(0|C[8684]))return;return C[8684]=0,void(C[8681]=0);}if((0|C[8684])==(A+I|0))return I=(0|C[8681])+g|0,C[8681]=I,C[8684]=o,C[o+4>>2]=1|I,void(C[o+I>>2]=I);i=(-8&Q)+g|0;do{if(Q>>>0<256){if(B=0|C[A+I+8>>2],(0|(g=0|C[A+I+12>>2]))==(0|B)){C[8679]=C[8679]&~(1<<(Q>>>3));break;}C[B+12>>2]=g,C[g+8>>2]=B;break;}e=0|C[A+I+24>>2],g=0|C[A+I+12>>2];do{if((0|g)==(A+I|0)){if(g=0|C[A+I+16+4>>2])B=A+I+16+4|0;else{if(!(g=0|C[A+I+16>>2])){B=0;break;}B=A+I+16|0;}for(;;){if(Q=0|C[(E=g+20|0)>>2])g=Q,B=E;else{if(!(Q=0|C[(E=g+16|0)>>2]))break;g=Q,B=E;}}C[B>>2]=0,B=g;}else B=0|C[A+I+8>>2],C[B+12>>2]=g,C[g+8>>2]=B,B=g;}while(0);if(0|e){if(g=0|C[A+I+28>>2],(0|C[35020+(g<<2)>>2])==(A+I|0)){if(C[35020+(g<<2)>>2]=B,!B){C[8680]=C[8680]&~(1<>2])==(A+I|0)?e+16|0:e+20|0)>>2]=B,!B)break;C[B+24>>2]=e,0|(g=0|C[A+I+16>>2])&&(C[B+16>>2]=g,C[g+24>>2]=B),0|(g=0|C[A+I+16+4>>2])&&(C[B+20>>2]=g,C[g+24>>2]=B);}}while(0);if(C[o+4>>2]=1|i,C[o+i>>2]=i,(0|o)==(0|C[8684]))return void(C[8681]=i);}if(Q=i>>>3,i>>>0<256)return(g=0|C[8679])&1<>2]):(C[8679]=g|1<>2]=o,C[B+12>>2]=o,C[o+8>>2]=B,void(C[o+12>>2]=34756+(Q<<1<<2));if(B=35020+((E=(g=i>>>8)?i>>>0>16777215?31:i>>>(7+(E=14-((520192+(g<<((g+1048320|0)>>>16&8))|0)>>>16&4|(g+1048320|0)>>>16&8|(245760+(E=g<<((g+1048320|0)>>>16&8)<<((520192+(g<<((g+1048320|0)>>>16&8))|0)>>>16&4))|0)>>>16&2)+(E<<((E+245760|0)>>>16&2)>>>15)|0)|0)&1|E<<1:0)<<2)|0,C[o+28>>2]=E,C[o+20>>2]=0,C[o+16>>2]=0,!((g=0|C[8680])&(Q=1<>2]=o,C[o+24>>2]=B,C[o+12>>2]=o,void(C[o+8>>2]=o);g=0|C[B>>2];A:do{if((-8&C[g+4>>2]|0)!=(0|i)){for(E=i<<(31==(0|E)?0:25-(E>>>1)|0);B=0|C[(Q=g+16+(E>>>31<<2)|0)>>2];){if((-8&C[B+4>>2]|0)==(0|i)){g=B;break A;}E<<=1,g=B;}return C[Q>>2]=o,C[o+24>>2]=g,C[o+12>>2]=o,void(C[o+8>>2]=o);}}while(0);I=0|C[(A=g+8|0)>>2],C[I+12>>2]=o,C[A>>2]=o,C[o+8>>2]=I,C[o+12>>2]=g,C[o+24>>2]=0;}function M(A,I,g,Q,E){A|=0,I|=0,g|=0;var i,e,c=0,a=0,n=0,r=0,t=0,f=0,w=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0,m=0,L=0,x=0,K=0,X=0,j=0,T=0,q=0,V=0,z=0,W=0,O=0,Z=0,$=0,AA=0,IA=0,gA=0,BA=0,CA=0,QA=0,EA=0,iA=0,eA=0,oA=0,cA=0,aA=0,nA=0,rA=0;if(e=y,i=y=y+63&-64,y=y+64|0,!(0==(0|(Q|=0))&0==(0|(E|=0)))){for(L=0|C[A>>2],x=0|C[A+4>>2],K=0|C[A+8>>2],X=0|C[A+12>>2],j=0|C[A+16>>2],S=0|C[A+20>>2],U=0|C[A+24>>2],v=0|C[A+28>>2],b=0|C[A+32>>2],J=0|C[A+36>>2],P=0|C[A+40>>2],R=0|C[A+44>>2],N=0|C[A+56>>2],m=0|C[A+60>>2],a=0,Y=0|C[A+48>>2],M=0|C[A+52>>2],n=I;;){if(d=E>>>0<0|0==(0|E)&Q>>>0<64){c=(I=i)+64|0;do{C[I>>2]=0,I=I+4|0;}while((0|I)<(0|c));I=0;do{B[i+I>>0]=0|B[n+I>>0],I=I+1|0;}while(E>>>0>0|0==(0|E)&Q>>>0>I>>>0);G=i,a=g,n=i;}else G=g;g=20,I=L,c=x,r=P,t=R,f=Y,w=M,s=N,h=m,D=K,F=X,p=j,u=S,H=U,k=v,l=b,_=J;do{W=0|wB((AA=0|wB((nA=0|wB(($=(AA=0|wB((aA=I+p|0)^f,16))+l|0)^p,12))+aA^AA,8))+$^nA,7),rA=0|wB((V=0|wB((eA=0|wB((q=(V=0|wB((iA=c+u|0)^w,16))+_|0)^u,12))+iA^V,8))+q^eA,7),oA=0|wB((z=0|wB((BA=0|wB((IA=(z=0|wB((gA=D+H|0)^s,16))+r|0)^H,12))+gA^z,8))+IA^BA,7),CA=0|wB((QA=0|wB((Z=0|wB((T=(QA=0|wB((O=F+k|0)^h,16))+t|0)^k,12))+O^QA,8))+T^Z,7),u=0|wB((r=(h=0|wB((I=(EA=0|wB((cA=0|wB(QA^rA+(nA+aA),16))+(z+IA)^rA,12))+(rA+(nA+aA))|0)^cA,8))+(cA+(z+IA))|0)^EA,7),H=0|wB((t=(f=0|wB((c=(IA=0|wB((EA=0|wB(oA+(eA+iA)^AA,16))+(QA+T)^oA,12))+(oA+(eA+iA))|0)^EA,8))+(EA+(QA+T))|0)^IA,7),k=0|wB((l=(w=0|wB((D=(T=0|wB((IA=0|wB(CA+(BA+gA)^V,16))+(AA+$)^CA,12))+(CA+(BA+gA))|0)^IA,8))+(IA+(AA+$))|0)^T,7),p=0|wB((_=(s=0|wB((F=(T=0|wB((z=0|wB(Z+O+W^z,16))+(V+q)^W,12))+(Z+O+W)|0)^z,8))+(z+(V+q))|0)^T,7),g=g+-2|0;}while(0!=(0|g));if(Z=(0|Vg(n))^I+L,$=(0|Vg(n+4|0))^c+x,AA=(0|Vg(n+8|0))^D+K,IA=(0|Vg(n+12|0))^F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|vg(0|(H=0|vg(0|(k=0|vg(0|(l=0|Qg(0|l,0,0|e,0)),0|o(),0|r,0|k)),0|(r=0|o()),0|(H=0|Qg(0|H,0,0|i,0)),0|o())),0|(r=0|o()),0|(u=0|Qg(0|u,0,0|E,0)),0|o())),0|(r=0|o()),0|(w=0|Qg(0|w,0,0|D,0)),0|o()),r=0|o(),n=0|yg(0|t,0|n,26),o(),y=0|yg(0|(n=0|vg(0|p,0|y,0|n,0)),0|o(),26),o(),s=0|yg(0|(y=0|vg(0|F,0|s,0|y,0)),0|o(),26),o(),h=0|yg(0|(s=0|vg(0|f,0|h,0|s,0)),0|o(),26),o(),r=0|yg(0|(h=0|vg(0|w,0|r,0|h,0)),0|o(),26),o(),g=0|vg(0|g,0|Q,-16,-1),!((Q=0|o())>>>0>0|0==(0|Q)&g>>>0>15)){g=(5*r|0)+(67108863&t)&67108863,f=(((5*r|0)+(67108863&t)|0)>>>26)+(67108863&n)|0,t=67108863&y,r=67108863&s,n=67108863&h;break;}w=(5*r|0)+(67108863&t)&67108863,f=(((5*r|0)+(67108863&t)|0)>>>26)+(67108863&n)|0,t=67108863&y,r=67108863&s,n=67108863&h,I=I+16|0;}else g=w;C[A+20>>2]=g,C[A+24>>2]=f,C[A+28>>2]=t,C[A+32>>2]=r,C[A+36>>2]=n;}function U(A,I){A|=0;var g=0,Q=0,E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0;a=0|kI(I|=0),c=0|o(),u=0|rg(0|(u=0|Bg(0|B[I+4>>0],0|B[I+5>>0],0|B[I+6>>0])),0|o(),6),H=0|o(),e=0|rg(0|(e=0|Bg(0|B[I+7>>0],0|B[I+8>>0],0|B[I+9>>0])),0|o(),5),i=0|o(),F=0|rg(0|(F=0|Bg(0|B[I+10>>0],0|B[I+11>>0],0|B[I+12>>0])),0|o(),3),p=0|o(),E=0|rg(0|(E=0|Bg(0|B[I+13>>0],0|B[I+14>>0],0|B[I+15>>0])),0|o(),2),Q=0|o(),h=0|kI(I+16|0),D=0|o(),n=0|rg(0|(n=0|Bg(0|B[I+20>>0],0|B[I+21>>0],0|B[I+22>>0])),0|o(),7),g=0|o(),r=0|rg(0|(r=0|Bg(0|B[I+23>>0],0|B[I+24>>0],0|B[I+25>>0])),0|o(),5),s=0|o(),t=0|rg(0|(t=0|Bg(0|B[I+26>>0],0|B[I+27>>0],0|B[I+28>>0])),0|o(),4),f=0|o(),w=0|rg(0|(w=0|Bg(0|B[I+29>>0],0|B[I+30>>0],0|B[I+31>>0])),0|o(),2),o(),k=0|Ug(0,0,0|(k=0|yg(0|(y=0|vg(33554428&w|0,0,16777216,0)),0|o(),25)),0|o()),o(),c=0|vg(19&k|0,0,0|a,0|c),a=0|o(),y=0|Ug(33554428&w|0,0,33554432&y|0,0),w=0|o(),i=0|vg(0|(I=0|ig(0|(k=0|vg(0|u,0|H,16777216,0)),0|o(),25)),0|o(),0|e,0|i),e=0|o(),k=0|Ug(0|u,0|H,-33554432&k|0,0),H=0|o(),Q=0|vg(0|(I=0|ig(0|(u=0|vg(0|F,0|p,16777216,0)),0|o(),25)),0|o(),0|E,0|Q),E=0|o(),u=0|Ug(0|F,0|p,-33554432&u|0,0),p=0|o(),I=0|vg(0|n,0|g,0|(I=0|ig(0|(F=0|vg(0|h,0|D,16777216,0)),0|o(),25)),0|o()),g=0|o(),F=0|Ug(0|h,0|D,-33554432&F|0,0),D=0|o(),f=0|vg(0|(n=0|ig(0|(h=0|vg(0|r,0|s,16777216,0)),0|o(),25)),0|o(),0|t,0|f),t=0|o(),h=0|Ug(0|r,0|s,-33554432&h|0,0),s=0|o(),n=0|vg(0|k,0|H,0|(n=0|yg(0|(r=0|vg(0|c,0|a,33554432,0)),0|o(),26)),0|o()),o(),r=0|Ug(0|c,0|a,-67108864&r|0,0),o(),c=0|vg(0|u,0|p,0|(c=0|yg(0|(a=0|vg(0|i,0|e,33554432,0)),0|o(),26)),0|o()),o(),a=0|Ug(0|i,0|e,-67108864&a|0,0),o(),i=0|vg(0|F,0|D,0|(i=0|yg(0|(e=0|vg(0|Q,0|E,33554432,0)),0|o(),26)),0|o()),o(),e=0|Ug(0|Q,0|E,-67108864&e|0,0),o(),Q=0|vg(0|h,0|s,0|(Q=0|yg(0|(E=0|vg(0|I,0|g,33554432,0)),0|o(),26)),0|o()),o(),E=0|Ug(0|I,0|g,-67108864&E|0,0),o(),I=0|vg(0|y,0|w,0|(I=0|yg(0|(g=0|vg(0|f,0|t,33554432,0)),0|o(),26)),0|o()),o(),g=0|Ug(0|f,0|t,-67108864&g|0,0),o(),C[A>>2]=r,C[A+4>>2]=n,C[A+8>>2]=a,C[A+12>>2]=c,C[A+16>>2]=e,C[A+20>>2]=i,C[A+24>>2]=E,C[A+28>>2]=Q,C[A+32>>2]=g,C[A+36>>2]=I;}function v(A,I){A|=0;var g=0,B=0,Q=0,E=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0;c=0|C[(I|=0)>>2],p=0|C[I+4>>2],i=0|C[I+8>>2],D=0|C[I+12>>2],Q=0|C[I+16>>2],s=0|C[I+20>>2],g=0|C[I+24>>2],n=0|C[I+28>>2],r=0|C[I+32>>2],H=0|C[I+36>>2],c=0|Qg(0|c,((0|c)<0)<<31>>31|0,121666,0),e=0|o(),p=0|Qg(0|p,((0|p)<0)<<31>>31|0,121666,0),u=0|o(),i=0|Qg(0|i,((0|i)<0)<<31>>31|0,121666,0),E=0|o(),D=0|Qg(0|D,((0|D)<0)<<31>>31|0,121666,0),F=0|o(),Q=0|Qg(0|Q,((0|Q)<0)<<31>>31|0,121666,0),B=0|o(),s=0|Qg(0|s,((0|s)<0)<<31>>31|0,121666,0),h=0|o(),g=0|Qg(0|g,((0|g)<0)<<31>>31|0,121666,0),I=0|o(),n=0|Qg(0|n,((0|n)<0)<<31>>31|0,121666,0),y=0|o(),r=0|Qg(0|r,((0|r)<0)<<31>>31|0,121666,0),t=0|o(),e=0|vg(0|(a=0|Qg(0|(a=0|ig(0|(w=0|vg(0|(H=0|Qg(0|H,((0|H)<0)<<31>>31|0,121666,0)),0|(f=0|o()),16777216,0)),0|o(),25)),0|o(),19,0)),0|o(),0|c,0|e),c=0|o(),w=0|Ug(0|H,0|f,-33554432&w|0,0),f=0|o(),E=0|vg(0|(a=0|ig(0|(H=0|vg(0|p,0|u,16777216,0)),0|o(),25)),0|o(),0|i,0|E),i=0|o(),H=0|Ug(0|p,0|u,-33554432&H|0,0),u=0|o(),B=0|vg(0|(a=0|ig(0|(p=0|vg(0|D,0|F,16777216,0)),0|o(),25)),0|o(),0|Q,0|B),Q=0|o(),p=0|Ug(0|D,0|F,-33554432&p|0,0),F=0|o(),I=0|vg(0|(a=0|ig(0|(D=0|vg(0|s,0|h,16777216,0)),0|o(),25)),0|o(),0|g,0|I),g=0|o(),D=0|Ug(0|s,0|h,-33554432&D|0,0),h=0|o(),t=0|vg(0|(a=0|ig(0|(s=0|vg(0|n,0|y,16777216,0)),0|o(),25)),0|o(),0|r,0|t),r=0|o(),s=0|Ug(0|n,0|y,-33554432&s|0,0),y=0|o(),a=0|vg(0|H,0|u,0|(a=0|yg(0|(n=0|vg(0|e,0|c,33554432,0)),0|o(),26)),0|o()),o(),n=0|Ug(0|e,0|c,-67108864&n|0,0),o(),e=0|vg(0|p,0|F,0|(e=0|yg(0|(c=0|vg(0|E,0|i,33554432,0)),0|o(),26)),0|o()),o(),c=0|Ug(0|E,0|i,-67108864&c|0,0),o(),E=0|vg(0|D,0|h,0|(E=0|yg(0|(i=0|vg(0|B,0|Q,33554432,0)),0|o(),26)),0|o()),o(),i=0|Ug(0|B,0|Q,-67108864&i|0,0),o(),B=0|vg(0|s,0|y,0|(B=0|yg(0|(Q=0|vg(0|I,0|g,33554432,0)),0|o(),26)),0|o()),o(),Q=0|Ug(0|I,0|g,-67108864&Q|0,0),o(),I=0|vg(0|w,0|f,0|(I=0|yg(0|(g=0|vg(0|t,0|r,33554432,0)),0|o(),26)),0|o()),o(),g=0|Ug(0|t,0|r,-67108864&g|0,0),o(),C[A>>2]=n,C[A+4>>2]=a,C[A+8>>2]=c,C[A+12>>2]=e,C[A+16>>2]=i,C[A+20>>2]=E,C[A+24>>2]=Q,C[A+28>>2]=B,C[A+32>>2]=g,C[A+36>>2]=I;}function b(A,I,g){A|=0,I|=0;var C,E,i=0,e=0,o=0;if(E=y,C=y=y+63&-64,y=y+64|0,(g|=0)<<24>>24&&(255&g)<=64){if(0|function(A,I){return 1&(0!=(0|(A|=0))|0!=(0|(I|=0)))|0;}(Q[A+80>>0]|Q[A+80+1>>0]<<8|Q[A+80+2>>0]<<16|Q[A+80+3>>0]<<24,Q[A+80+4>>0]|Q[A+80+4+1>>0]<<8|Q[A+80+4+2>>0]<<16|Q[A+80+4+3>>0]<<24))i=-1;else{i=Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24;do{if(i>>>0>128){if(aA(A,128,0),s(A,A+96|0),i=(Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24)-128|0,B[A+352>>0]=i,B[A+352+1>>0]=i>>8,B[A+352+2>>0]=i>>16,B[A+352+3>>0]=i>>24,i>>>0<129){BA(A+96|0,A+224|0,0|i),e=Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24,o=A+96|0;break;}c(33456,33488,306,33533);}else e=i,o=A+96|0;}while(0);aA(A,e,0),function(A){0|B[356+(A|=0)>>0]&&function(A){B[88+(A|=0)>>0]=-1,B[A+88+1>>0]=-1,B[A+88+2>>0]=-1,B[A+88+3>>0]=-1,B[A+88+4>>0]=-1,B[A+88+4+1>>0]=-1,B[A+88+4+2>>0]=-1,B[A+88+4+3>>0]=-1;}(A),B[A+80>>0]=-1,B[A+80+1>>0]=-1,B[A+80+2>>0]=-1,B[A+80+3>>0]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+4>>0]|Q[A+48+4+1>>0]<<8|Q[A+48+4+2>>0]<<16|Q[A+48+4+3>>0]<<24),LI(C+56|0,Q[A+56>>0]|Q[A+56+1>>0]<<8|Q[A+56+2>>0]<<16|Q[A+56+3>>0]<<24,Q[A+56+4>>0]|Q[A+56+4+1>>0]<<8|Q[A+56+4+2>>0]<<16|Q[A+56+4+3>>0]<<24),BA(0|I,0|C,255&g|0),MI(A,64),MI(o,256),i=0;}return y=E,0|i;}return SB(),0;}function J(A,I,g,Q){A|=0,I|=0,g|=0;var E,i,e=0,o=0,c=0,a=0,n=0,r=0;switch(i=y,E=y=y+63&-64,y=y+16|0,0|(Q|=0)){case 2:if(I>>>0<13)Q=-31;else{e=33688,o=(Q=A)+13|0;do{B[Q>>0]=0|B[e>>0],Q=Q+1|0,e=e+1|0;}while((0|Q)<(0|o));A=A+12|0,o=I+-12|0,e=6;}break;case 1:if(I>>>0<12)Q=-31;else{e=33701,o=(Q=A)+12|0;do{B[Q>>0]=0|B[e>>0],Q=Q+1|0,e=e+1|0;}while((0|Q)<(0|o));A=A+11|0,o=I+-11|0,e=6;}break;default:Q=-31;}do{if(6==(0|e)&&!(Q=0|oA(g))){if(cI(E,19),e=A+(Q=0|ZA(E))|0,a=o-Q|0,o>>>0<=Q>>>0){Q=-31;break;}if(BA(0|A,0|E,Q+1|0),a>>>0>=4){if(B[e>>0]=36,B[e+1>>0]=109,B[e+2>>0]=61,B[e+3>>0]=0,cI(E,0|C[g+44>>2]),o=e+3+(A=0|ZA(E))|0,(a+-3|0)>>>0<=A>>>0){Q=-31;break;}if(BA(e+3|0,0|E,A+1|0),(a+-3-A|0)>>>0>=4){if(B[o>>0]=44,B[o+1>>0]=116,B[o+2>>0]=61,B[o+3>>0]=0,cI(E,0|C[g+40>>2]),I=o+3+(Q=0|ZA(E))|0,c=a+-3-A-3-Q|0,(a+-3-A-3|0)>>>0<=Q>>>0){Q=-31;break;}if(BA(o+3|0,0|E,Q+1|0),c>>>0>=4){if(B[I>>0]=44,B[I+1>>0]=112,B[I+2>>0]=61,B[I+3>>0]=0,cI(E,0|C[g+48>>2]),(c+-3|0)>>>0<=(e=0|ZA(E))>>>0){Q=-31;break;}if(BA(I+3|0,0|E,e+1|0),Q=I+3+e+1|0,(c+-3-e|0)>>>0>=2&&(B[I+3+e>>0]=36,B[I+3+e+1>>0]=0,q(Q,c+-3-e-1|0,0|C[g+16>>2],0|C[g+20>>2],3),(r=c+-3-e-1-(n=0|ZA(Q))|0)>>>0>=2))return B[Q+n>>0]=36,B[Q+n+1>>0]=0,q(Q+n+1|0,r+-1|0,0|C[g>>2],0|C[g+4>>2],3),y=i,0;Q=-31;}else Q=-31;}else Q=-31;}else Q=-31;}}while(0);return y=i,0|Q;}function P(A,I,g,Q){A|=0,I|=0,g|=0,Q|=0;var E,i,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,s=0;i=y,E=y=y+63&-64,y=y+704|0;A:do{if(!(0==(0|g)&0==(0|Q))){if(r=0|yg(0|(s=0|C[A+72>>2]),0|(f=0|C[A+72+4>>2]),3),o(),t=0|rg(0|g,0|Q,3),w=0|o(),a=0|yg(0|g,0|Q,61),n=0|o(),f=0|vg(0|s,0|f,0|t,0|w),s=0|o(),C[A+72>>2]=f,C[A+72+4>>2]=s,e=0|C[A+64>>2],c=0|C[A+64+4>>2],s>>>0>>0|(0|s)==(0|w)&f>>>0>>0&&(e=0|vg(0|e,0|c,1,0),c=0|o(),C[A+64>>2]=e,C[A+64+4>>2]=c),e=0|vg(0|e,0|c,0|a,0|n),n=0|o(),C[A+64>>2]=e,C[A+64+4>>2]=n,n=0|Ug(128,0,127&r|0,0),(e=0|o())>>>0>Q>>>0|(0|e)==(0|Q)&n>>>0>g>>>0)for(e=0,c=0;;){if(w=0|B[I+e>>0],s=0|vg(0|e,0|c,127&r|0,0),o(),B[A+80+s>>0]=w,e=0|vg(0|e,0|c,1,0),!((c=0|o())>>>0>>0|(0|c)==(0|Q)&e>>>0>>0))break A;}if(!(0==(0|n)&0==(0|e))){c=0,a=0;do{w=0|B[I+c>>0],s=0|vg(0|c,0|a,127&r|0,0),o(),B[A+80+s>>0]=w,c=0|vg(0|c,0|a,1,0),a=0|o();}while(a>>>0>>0|(0|a)==(0|e)&c>>>0>>0);}if(D(A,A+80|0,E,E+640|0),e=0|Ug(0|g,0|Q,0|n,0|e),(a=0|o())>>>0>0|0==(0|a)&e>>>0>127){c=I+n|0;do{D(A,c,E,E+640|0),c=c+128|0,e=0|vg(0|e,0|a,-128,-1),a=0|o();}while(a>>>0>0|0==(0|a)&e>>>0>127);}else c=I+n|0;if(!(0==(0|(n=127&e))&!0)){e=0,a=0;do{B[A+80+e>>0]=0|B[c+e>>0],e=0|vg(0|e,0|a,1,0),a=0|o();}while(a>>>0<0|0==(0|a)&e>>>0>>0);}MI(E,704);}}while(0);y=i;}function R(A,I,g){A|=0,I|=0;var B=0,C=0,Q=0,E=0,i=0,e=0,o=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0;C=0|Vg(g|=0),Q=0|Vg(g+4|0),E=0|Vg(g+8|0),i=0|Vg(g+12|0),e=0|Vg(g+16|0),o=0|Vg(g+20|0),r=0|Vg(g+24|0),t=0|Vg(g+28|0),f=0|Vg(I),w=0|Vg(I+4|0),y=0|Vg(I+8|0),c=0,a=1634760805,n=857760878,g=0|Vg(I+12|0),I=2036477234,B=1797285236;do{p=0|wB((l=0|wB((R=0|wB((k=(l=0|wB(f^(P=C+a|0),16))+e|0)^C,12))+P^l,8))+k^R,7),N=0|wB((D=0|wB((v=0|wB((h=(D=0|wB(w^(U=Q+n|0),16))+o|0)^Q,12))+U^D,8))+h^v,7),b=0|wB((F=0|wB((d=0|wB((_=(F=0|wB(y^(G=E+I|0),16))+r|0)^E,12))+G^F,8))+_^d,7),Y=0|wB((M=0|wB((H=0|wB((s=(M=0|wB(g^(u=i+B|0),16))+t|0)^i,12))+u^M,8))+s^H,7),Q=0|wB((r=(g=0|wB((a=(S=0|wB((J=0|wB(M^N+(R+P),16))+(F+_)^N,12))+(N+(R+P))|0)^J,8))+(J+(F+_))|0)^S,7),E=0|wB((t=(f=0|wB((n=(_=0|wB((S=0|wB(b+(v+U)^l,16))+(M+s)^b,12))+(b+(v+U))|0)^S,8))+(S+(M+s))|0)^_,7),i=0|wB((e=(w=0|wB((I=(s=0|wB((_=0|wB(Y+(d+G)^D,16))+(l+k)^Y,12))+(Y+(d+G))|0)^_,8))+(_+(l+k))|0)^s,7),C=0|wB((o=(y=0|wB((B=(s=0|wB((F=0|wB(H+u+p^F,16))+(D+h)^p,12))+(H+u+p)|0)^F,8))+(F+(D+h))|0)^s,7),c=c+1|0;}while(10!=(0|c));Pg(A,a),Pg(A+4|0,n),Pg(A+8|0,I),Pg(A+12|0,B),Pg(A+16|0,f),Pg(A+20|0,w),Pg(A+24|0,y),Pg(A+28|0,g);}function N(A,I,g,C){A|=0,g|=0,C|=0;var Q,E,i=0,e=0;for(Q=y,E=y=y+63&-64,y=y+2272|0,yA(E+1536|0,I|=0),yA(E+1280|0,C),eg(E,g),og(E+2112|0,g),Eg(E+1792|0,E+2112|0),gI(E+2112|0,E+1792|0,E),Eg(E+1952|0,E+2112|0),eg(E+160|0,E+1952|0),gI(E+2112|0,E+1792|0,E+160|0),Eg(E+1952|0,E+2112|0),eg(E+320|0,E+1952|0),gI(E+2112|0,E+1792|0,E+320|0),Eg(E+1952|0,E+2112|0),eg(E+480|0,E+1952|0),gI(E+2112|0,E+1792|0,E+480|0),Eg(E+1952|0,E+2112|0),eg(E+640|0,E+1952|0),gI(E+2112|0,E+1792|0,E+640|0),Eg(E+1952|0,E+2112|0),eg(E+800|0,E+1952|0),gI(E+2112|0,E+1792|0,E+800|0),Eg(E+1952|0,E+2112|0),eg(E+960|0,E+1952|0),gI(E+2112|0,E+1792|0,E+960|0),Eg(E+1952|0,E+2112|0),eg(E+1120|0,E+1952|0),function(A){Kg(A|=0),Sg(A+40|0),Sg(A+80|0);}(A),g=255;;){if(0|B[E+1536+g>>0]){i=g,e=5;break;}if(0|B[E+1280+g>>0]){i=g,e=5;break;}if(!g)break;g=g+-1|0;}if(5==(0|e)&&(0|i)>-1)for(;aI(E+2112|0,A),(g=0|B[E+1536+i>>0])<<24>>24<=0?g<<24>>24<0&&(Eg(E+1952|0,E+2112|0),II(E+2112|0,E+1952|0,E+(160*(((g<<24>>24)/-2|0)<<24>>24)|0)|0)):(Eg(E+1952|0,E+2112|0),gI(E+2112|0,E+1952|0,E+(160*((255&g)>>>1&255)|0)|0)),(g=0|B[E+1280+i>>0])<<24>>24<=0?g<<24>>24<0&&(Eg(E+1952|0,E+2112|0),BI(E+2112|0,E+1952|0,160+(120*(((g<<24>>24)/-2|0)<<24>>24)|0)|0)):(Eg(E+1952|0,E+2112|0),CI(E+2112|0,E+1952|0,160+(120*((255&g)>>>1&255)|0)|0)),Hg(A,E+2112|0),(0|i)>0;){i=i+-1|0;}y=Q;}function m(A,I,g,Q,E,i,e,o){A|=0,I|=0,g|=0,Q|=0,E|=0,i|=0,e|=0,o|=0;var c,a,n=0,r=0,t=0,f=0,w=0,s=0,h=0;if(a=y,c=y=y+63&-64,y=y+16|0,C[c>>2]=0,EB(o),Q){f=0,r=0,t=0,n=0;A:for(;;){for(s=n;n=0|B[g+s>>0],255==(0|(w=4&o?0|VA(n):0|zA(n)));){if(!E){w=18;break A;}if(!(0|qg(E,n))){w=19;break A;}if(!((n=s+1|0)>>>0>>0)){w=17;break A;}s=n;}if(f=w+(f<<6)|0,(n=r+6|0)>>>0>7){if(r=r+-2|0,t>>>0>=I>>>0){w=13;break;}B[A+t>>0]=f>>>r,t=t+1|0;}else r=n;if((n=s+1|0)>>>0>=Q>>>0){w=16;break;}}13==(0|w)?(C[c>>2]=s,C[8678]=68,n=-1):16==(0|w)?(C[c>>2]=n,n=0):17==(0|w)?(C[c>>2]=n,n=0):18==(0|w)?(C[c>>2]=s,n=0):19==(0|w)&&(C[c>>2]=s,n=0),r>>>0>4?(t=0,n=-1):w=21;}else f=0,r=0,t=0,n=0,w=21;do{if(21==(0|w))if((1<>>1)),n)t=0;else if(0!=(0|E)&&(h=0|C[c>>2])>>>0>>0){for(n=h;;){if(!(0|qg(E,0|B[g+n>>0]))){w=31;break;}if((n=n+1|0)>>>0>=Q>>>0){w=30;break;}}if(30==(0|w)){C[c>>2]=n,n=0;break;}if(31==(0|w)){C[c>>2]=n,n=0;break;}}else n=0;}while(0);return r=0|C[c>>2],e?C[e>>2]=g+r:(0|r)!=(0|Q)&&(C[8678]=28,n=-1),0|i&&(C[i>>2]=t),y=a,0|n;}function L(A,I,g){I|=0,g|=0;var Q,E,i,e=0,o=0,c=0;switch(i=y,E=y=y+63&-64,y=y+16|0,c=0|C[20+(A|=0)>>2],Q=0|C[A+4>>2],C[A+20>>2]=0,C[A+4>>2]=0,0|g){case 2:0|oI(I,33653,9)?I=-32:(I=I+9|0,o=4);break;case 1:0|oI(I,33663,8)?I=-32:(I=I+8|0,o=4);break;default:I=-26;}do{if(4==(0|o))if(0==(0|oI(I,33672,3))&&0!=(0|(e=0|qA(I+3|0,E+4|0)))){if(19==(0|C[E+4>>2])){if(0|oI(e,33676,3))I=-32;else{if(!(I=0|qA(e+3|0,E+4|0))){I=-32;break;}if(C[A+44>>2]=C[E+4>>2],0|oI(I,33680,3))I=-32;else{if(!(I=0|qA(I+3|0,E+4|0))){I=-32;break;}if(C[A+40>>2]=C[E+4>>2],0|oI(I,33684,3))I=-32;else{if(!(I=0|qA(I+3|0,E+4|0))){I=-32;break;}if(o=0|C[E+4>>2],C[A+48>>2]=o,C[A+52>>2]=o,I=(o=36==(0|B[I>>0]))?I+1|0:I,o){if(C[E+4>>2]=c,0|m(o=0|C[A+16>>2],c,I,0|ZA(I),0,E+4|0,E,3)){I=-32;break;}if(C[A+20>>2]=C[E+4>>2],I=0|C[E>>2],I=(c=36==(0|B[I>>0]))?I+1|0:I,c){if(C[E+4>>2]=Q,0|m(c=0|C[A>>2],Q,I,0|ZA(I),0,E+4|0,E,3)){I=-32;break;}C[A+4>>2]=C[E+4>>2],g=0|C[E>>2],(I=0|oA(A))||(I=0==(0|B[g>>0])?0:-32);}else I=-32;}else I=-32;}}}}else I=-26;}else I=-32;}while(0);return y=i,0|I;}function x(A,I,g){A|=0,I|=0;var B=0,C=0,Q=0,E=0,i=0,e=0,o=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0;Q=0|Vg(g|=0),n=0|Vg(g+4|0),r=0|Vg(g+8|0),t=0|Vg(g+12|0),i=0|Vg(g+16|0),e=0|Vg(g+20|0),o=0|Vg(g+24|0),c=0|Vg(g+28|0),w=0|Vg(I),y=0|Vg(I+4|0),s=0|Vg(I+8|0),B=20,C=1634760805,E=2036477234,a=1797285236,f=857760878,g=0|Vg(I+12|0);do{Y=(0|wB((F=(0|wB((H=(0|wB((_=(0|wB(e+C|0,7))^t)+C|0,9))^s)+_|0,13))^e)+H|0,18))^C,l=(0|wB((U=(0|wB((D=(0|wB((u=(0|wB(f+Q|0,7))^g)+f|0,9))^o)+u|0,13))^Q)+D|0,18))^f,p=(0|wB((d=(0|wB((S=(0|wB((h=(0|wB(E+w|0,7))^c)+E|0,9))^n)+h|0,13))^w)+S|0,18))^E,I=(0|wB((k=(0|wB((G=(0|wB((M=(0|wB(a+i|0,7))^r)+a|0,9))^y)+M|0,13))^i)+G|0,18))^a,C=(0|wB((r=(0|wB((n=(0|wB((Q=(0|wB(M+Y|0,7))^U)+Y|0,9))^S)+Q|0,13))^M)+n|0,18))^Y,f=(0|wB((t=(0|wB((y=(0|wB((w=(0|wB(l+_|0,7))^d)+l|0,9))^G)+w|0,13))^_)+y|0,18))^l,E=(0|wB((g=(0|wB((s=(0|wB((i=(0|wB(p+u|0,7))^k)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>>0|(0|g)==(0|Q)&E>>>0>>0);r=0|vg(0|C[A+56>>2],0|C[A+56+4>>2],0|i,0|Q),t=0|o(),C[A+56>>2]=r,C[A+56+4>>2]=t;}}function X(A,I){A|=0,I|=0;var g=0,i=0,e=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0;A:do{if(0|A){do{if(2==(0|C[A+36>>2])){if(0==(0|(g=0|C[I>>2]))&&(0|Q[I+8>>0])<=1){i=6;break;}t=0|C[A+4>>2],r=0;}else i=6;}while(0);if(6==(0|i)&&(QA(A,I,t=0|C[A+4>>2]),g=0|C[I>>2],r=1),g=0==(0|g)&(e=0|B[I+8>>0])<<24>>24==0?2:0,i=0|C[A+24>>2],a=0|E(i,0|C[I+4>>2]),n=0|C[A+20>>2],e=a+g+(0|E(n,255&e))|0,g>>>0>>0)for(c=i,n=e,i=(0==(0|(e>>>0)%(i>>>0))?i+-1|0:-1)+e|0;;){if(a=1==(0|(n>>>0)%(c>>>0))?n+-1|0:i,i=r?t+(g<<3)|0:(0|C[4+(0|C[A>>2])>>2])+(a<<10)|0,y=0|C[(c=i)>>2],c=0|Ag(0|C[c+4>>2],0,0|C[A+28>>2],0),e=0|o(),f=0|C[I>>2],i=0|B[I+8>>0],w=0|C[I+4>>2],c=0==(0|f)&i<<24>>24==0?w:c,C[I+12>>2]=g,e=0|DA(A,f,i,g,y,1&((0|c)==(0|w)?0==(0|(0==(0|f)&i<<24>>24==0?0:e)):0)),e=(i=0|C[4+(0|C[A>>2])>>2])+((0|E(0|C[A+24>>2],c))<<10)+(e<<10)|0,c=i+(n<<10)|0,f?H(i+(a<<10)|0,e,c):k(i+(a<<10)|0,e,c),(g=g+1|0)>>>0>=(0|C[A+20>>2])>>>0)break A;c=0|C[A+24>>2],n=n+1|0,i=a+1|0;}}}while(0);}function j(A,I,g){var B,Q;g|=0,B=y,Q=y=y+63&-64,y=y+400|0,0==(0|(A|=0))|0==(0|(I|=0))||(HI(Q,0,0,64),Pg(Q+384|0,0|C[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+4|0;}while((0|e)<(0|c));if((I+-32|0)>>>0>64){Q=A+32|0,g=I+-32|0;do{if((0|TI(i+448|0,64,i+384|0,64,0,0,0))<0)break A;o=i+448|0,c=(e=Q)+32|0;do{B[e>>0]=0|B[o>>0],e=e+1|0,o=o+1|0;}while((0|e)<(0|c));g=g+-32|0,Q=Q+32|0,o=i+448|0,c=64+(e=i+384|0)|0;do{C[e>>2]=C[o>>2],e=e+4|0,o=o+4|0;}while((0|e)<(0|c));}while(g>>>0>64);}else Q=A+32|0,g=I+-32|0;(0|TI(i+448|0,g,i+384|0,64,0,0,0))>=0&&BA(0|Q,i+448|0,0|g);}}while(0);MI(i,384),y=E;}function q(A,I,g,C,i){A|=0,I|=0,g|=0,C|=0;var e=0,o=0,a=0,n=0,r=0,t=0;EB(i|=0),o=(0|E((C>>>0)/3|0,-3))+C|0,e=((C>>>0)/3|0)<<2;do{if(o){if(2&i){e=(2|e)+(o>>>1)|0;break;}e=e+4|0;break;}}while(0);if(e>>>0>=I>>>0&&SB(),4&i){if(0|C){n=0,i=0,o=0,r=0;do{if(t=r,r=r+1|0,n=n<<8|0|Q[g+t>>0],(i=i+8|0)>>>0>5)for(;;){if(t=255&(0|XI(n>>>(i=i+-6|0)&63)),a=o+1|0,B[A+o>>0]=t,!(i>>>0>5)){o=a;break;}o=a;}}while((0|r)!=(0|C));i&&(t=255&(0|XI(n<<6-i&63)),B[A+o>>0]=t,o=o+1|0);}else o=0;}else if(0|C){n=0,i=0,o=0,r=0;do{if(a=r,r=r+1|0,n=n<<8|0|Q[g+a>>0],(i=i+8|0)>>>0>5)for(;;){if(t=255&(0|jI(n>>>(i=i+-6|0)&63)),a=o+1|0,B[A+o>>0]=t,!(i>>>0>5)){o=a;break;}o=a;}}while((0|r)!=(0|C));i&&(t=255&(0|jI(n<<6-i&63)),B[A+o>>0]=t,o=o+1|0);}else o=0;return e>>>0>>0&&c(34564,34583,230,34599),e>>>0>o>>>0?YA(A+o|0,61,e-o|0):e=o,YA(A+e|0,0,((t=e+1|0)>>>0>>0?I:t)-e|0),0|A;}function V(A,I,g,E,i,e,c,a){A|=0,I|=0,i|=0,e|=0,c|=0,a|=0;var n,r,t=0,f=0;if(n=y,r=y=y+63&-64,y=y+112|0,!(0==(0|(g|=0))&0==(0|(E|=0)))){t=(f=r)+32|0;do{B[f>>0]=0|B[a>>0],f=f+1|0,a=a+1|0;}while((0|f)<(0|t));a=Q[i+4>>0]|Q[i+4+1>>0]<<8|Q[i+4+2>>0]<<16|Q[i+4+3>>0]<<24,C[r+96>>2]=Q[i>>0]|Q[i+1>>0]<<8|Q[i+2>>0]<<16|Q[i+3>>0]<<24,C[r+96+4>>2]=a,a=8;do{B[r+96+a>>0]=e,e=0|yg(0|e,0|c,8),c=0|o(),a=a+1|0;}while(16!=(0|a));if(E>>>0>0|0==(0|E)&g>>>0>63)for(e=E;;){iB(r+32|0,r+96|0,r),c=0;do{B[A+c>>0]=B[r+32+c>>0]^B[I+c>>0],c=c+1|0;}while(64!=(0|c));for(a=8,c=1;c=c+(0|Q[(E=r+96+a|0)>>0])|0,B[E>>0]=c,16!=(0|(a=a+1|0));){c>>>=8;}if(c=0|vg(0|g,0|e,-64,-1),A=A+64|0,I=I+64|0,!((a=0|o())>>>0>0|0==(0|a)&c>>>0>63)){e=c;break;}g=c,e=a;}else e=g,a=E;if(!(0==(0|e)&0==(0|a))&&(iB(r+32|0,r+96|0,r),0|e)){c=0;do{B[A+c>>0]=B[r+32+c>>0]^B[I+c>>0],c=c+1|0;}while((0|c)!=(0|e));}MI(r+32|0,64),MI(r,32);}y=n;}function z(A,I){I|=0;var g,Q,E,i,e,c,a=0,n=0,r=0,t=0;0==(0|(n=0|C[56+(A|=0)>>2]))&0==(0|(a=0|C[A+56+4>>2]))||(B[A+64+n>>0]=1,a=0|vg(0|n,0|a,1,0),(r=0|o())>>>0<0|0==(0|r)&a>>>0<16&&YA(A+64+a|0,0,14-n+1|0),B[A+80>>0]=1,S(A,A+64|0,16,0)),n=0|C[A+24>>2],t=(E=(-67108864|(Q=((t=((r=(0|C[A+28>>2])+(n>>>26)|0)>>>26)+(0|C[A+32>>2])|0)>>>26)+(0|C[A+36>>2])|0))+((((((i=((c=(5*(Q>>>26)|0)+(0|C[A+20>>2])|0)>>>26)+(67108863&n)+((5+(67108863&c)|0)>>>26)|0)>>>26)+(67108863&r)|0)>>>26)+(67108863&t)|0)>>>26)|0)>>31&67108863&t|(e=(E>>>31)-1&67108863)&(((i>>>26)+(67108863&r)|0)>>>26)+(67108863&t),g=0|vg(E>>31&67108863&c|e&5+(67108863&c)|(E>>31&(c>>>26)+(67108863&n)|e&i)<<26|0,0,0|C[A+40>>2],0),a=0|o(),a=0|vg(0|(n=0|vg((E>>31&(c>>>26)+(67108863&n)|e&i)>>>6|(E>>31&67108863&r|e&(i>>>26)+(67108863&r))<<20|0,0,0|C[A+44>>2],0)),0|o(),0|a,0),n=0|o(),n=0|vg(0|(r=0|vg((E>>31&67108863&r|e&(i>>>26)+(67108863&r))>>>12|t<<14|0,0,0|C[A+48>>2],0)),0|o(),0|n,0),r=0|o(),r=0|vg(0|(t=0|vg(((E>>>31)-1&E|E>>31&Q)<<8|t>>>18|0,0,0|C[A+52>>2],0)),0|o(),0|r,0),o(),Pg(I,g),Pg(I+4|0,a),Pg(I+8|0,n),Pg(I+12|0,r),MI(A,88);}function W(A,I){var g,B;A|=0,g=y,B=y=y+63&-64,y=y+192|0,_(B+144|0,I|=0),_(B+96|0,B+144|0),_(B+96|0,B+96|0),u(B+96|0,I,B+96|0),u(B+144|0,B+144|0,B+96|0),_(B+48|0,B+144|0),u(B+96|0,B+96|0,B+48|0),_(B+48|0,B+96|0),I=1;do{_(B+48|0,B+48|0),I=I+1|0;}while(5!=(0|I));u(B+96|0,B+48|0,B+96|0),_(B+48|0,B+96|0),I=1;do{_(B+48|0,B+48|0),I=I+1|0;}while(10!=(0|I));u(B+48|0,B+48|0,B+96|0),_(B,B+48|0),I=1;do{_(B,B),I=I+1|0;}while(20!=(0|I));u(B+48|0,B,B+48|0),_(B+48|0,B+48|0),I=1;do{_(B+48|0,B+48|0),I=I+1|0;}while(10!=(0|I));u(B+96|0,B+48|0,B+96|0),_(B+48|0,B+96|0),I=1;do{_(B+48|0,B+48|0),I=I+1|0;}while(50!=(0|I));u(B+48|0,B+48|0,B+96|0),_(B,B+48|0),I=1;do{_(B,B),I=I+1|0;}while(100!=(0|I));u(B+48|0,B,B+48|0),_(B+48|0,B+48|0),I=1;do{_(B+48|0,B+48|0),I=I+1|0;}while(50!=(0|I));u(B+96|0,B+48|0,B+96|0),_(B+96|0,B+96|0),I=1;do{_(B+96|0,B+96|0),I=I+1|0;}while(5!=(0|I));u(A,B+96|0,B+144|0),y=g;}function O(A,I){A|=0;var g,C,Q=0;for(g=y,C=y=y+63&-64,y=y+1760|0,eg(C,I|=0),og(C+1600|0,I),Eg(C+1280|0,C+1600|0),gI(C+1600|0,C+1280|0,C),Eg(C+1440|0,C+1600|0),eg(C+160|0,C+1440|0),gI(C+1600|0,C+1280|0,C+160|0),Eg(C+1440|0,C+1600|0),eg(C+320|0,C+1440|0),gI(C+1600|0,C+1280|0,C+320|0),Eg(C+1440|0,C+1600|0),eg(C+480|0,C+1440|0),gI(C+1600|0,C+1280|0,C+480|0),Eg(C+1440|0,C+1600|0),eg(C+640|0,C+1440|0),gI(C+1600|0,C+1280|0,C+640|0),Eg(C+1440|0,C+1600|0),eg(C+800|0,C+1440|0),gI(C+1600|0,C+1280|0,C+800|0),Eg(C+1440|0,C+1600|0),eg(C+960|0,C+1440|0),gI(C+1600|0,C+1280|0,C+960|0),Eg(C+1440|0,C+1600|0),eg(C+1120|0,C+1440|0),Og(A),Q=252;og(C+1600|0,A),(I=0|B[31840+Q>>0])<<24>>24<=0?I<<24>>24<0&&(Eg(C+1440|0,C+1600|0),II(C+1600|0,C+1440|0,C+(160*(((I<<24>>24)/-2|0)<<24>>24)|0)|0)):(Eg(C+1440|0,C+1600|0),gI(C+1600|0,C+1440|0,C+(160*((255&I)>>>1&255)|0)|0)),Eg(A,C+1600|0),Q;){Q=Q+-1|0;}y=g;}function Z(A,I,g,B,Q,E,i){A|=0,I|=0,g|=0,B|=0,Q|=0;var e,c,a=0,n=0;return e=y,c=y=y+63&-64,y=y+352|0,x(c,E|=0,i|=0),A>>>0>g>>>0&&0>>0|0==(0|Q)&(A-g|0)>>>0>>0?n=5:g>>>0>A>>>0&&0>>0|0==(0|Q)&(g-A|0)>>>0>>0?n=5:a=g,5==(0|n)&&(YI(0|A,0|g,0|B),a=A),C[c+32>>2]=0,C[c+32+4>>2]=0,C[c+32+8>>2]=0,C[c+32+12>>2]=0,C[c+32+16>>2]=0,C[c+32+20>>2]=0,C[c+32+24>>2]=0,C[c+32+28>>2]=0,0==(0|(i=Q>>>0>0|0==(0|Q)&B>>>0>32?32:B))&0==(0|(g=Q>>>0>0|0==(0|Q)&B>>>0>32?0:Q))||BA(c+32+32|0,0|a,-2-(n=~Q>>>0>4294967295|-1==(0|~Q)&~B>>>0>4294967263?~B:-33)+1|0),Yg(c+32|0,c+32|0,n=0|vg(0|i,0|g,32,0),0|o(),E+16|0,c),gB(c+96|0,c+32|0),0==(0|i)&0==(0|g)||BA(0|A,c+32+32|0,-2-(n=~Q>>>0>4294967295|-1==(0|~Q)&~B>>>0>4294967263?~B:-33)+1|0),MI(c+32|0,64),Q>>>0>0|0==(0|Q)&B>>>0>32&&_g(A+i|0,a+i|0,n=0|Ug(0|B,0|Q,0|i,0|g),0|o(),E+16|0,c),MI(c,32),bg(c+96|0,A,B,Q),IB(c+96|0,I),MI(c+96|0,256),y=e,0;}function $(A,I,g,C){A|=0,I|=0,g|=0,C|=0;var E=0,i=0,e=0,c=0;A:do{if(!(0==(0|g)&0==(0|C))){for(E=Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24,e=I;I=A+96+E|0,C>>>0>0|0==(0|C)&g>>>0>(c=256-E|0)>>>0;){BA(0|I,0|e,0|c),I=(Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24)+c|0,B[A+352>>0]=I,B[A+352+1>>0]=I>>8,B[A+352+2>>0]=I>>16,B[A+352+3>>0]=I>>24,aA(A,128,0),s(A,A+96|0),E=A+224|0,i=128+(I=A+96|0)|0;do{B[I>>0]=0|B[E>>0],I=I+1|0,E=E+1|0;}while((0|I)<(0|i));if(E=(Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24)-128|0,B[A+352>>0]=E,B[A+352+1>>0]=E>>8,B[A+352+2>>0]=E>>16,B[A+352+3>>0]=E>>24,0==(0|(g=0|Ug(0|g,0|C,0|c,0)))&0==(0|(C=0|o())))break A;e=e+c|0;}BA(0|I,0|e,0|g),c=(Q[A+352>>0]|Q[A+352+1>>0]<<8|Q[A+352+2>>0]<<16|Q[A+352+3>>0]<<24)+g|0,B[A+352>>0]=c,B[A+352+1>>0]=c>>8,B[A+352+2>>0]=c>>16,B[A+352+3>>0]=c>>24;}}while(0);}function AA(A,I,g){var B,Q,E,i,e,o,c,a,n,r,t,f,w,y,s,h,D,F,p,u;I|=0,g|=0,u=0|C[(A|=0)>>2],F=0|C[A+4>>2],h=0|C[A+8>>2],y=0|C[A+12>>2],f=0|C[A+16>>2],r=0|C[A+20>>2],a=0|C[A+24>>2],o=0|C[A+28>>2],i=0|C[A+32>>2],Q=0|C[A+36>>2],p=0|C[I>>2],D=0|C[I+4>>2],s=0|C[I+8>>2],w=0|C[I+12>>2],t=0|C[I+16>>2],n=0|C[I+20>>2],c=0|C[I+24>>2],e=0|C[I+28>>2],E=0|C[I+32>>2],B=0|C[I+36>>2],C[A>>2]=(p^u)&0-g^u,C[A+4>>2]=(D^F)&0-g^F,C[A+8>>2]=(s^h)&0-g^h,C[A+12>>2]=(w^y)&0-g^y,C[A+16>>2]=(t^f)&0-g^f,C[A+20>>2]=(n^r)&0-g^r,C[A+24>>2]=(c^a)&0-g^a,C[A+28>>2]=(e^o)&0-g^o,C[A+32>>2]=(E^i)&0-g^i,C[A+36>>2]=(B^Q)&0-g^Q,C[I>>2]=(p^u)&0-g^p,C[I+4>>2]=(D^F)&0-g^D,C[I+8>>2]=(s^h)&0-g^s,C[I+12>>2]=(w^y)&0-g^w,C[I+16>>2]=(t^f)&0-g^t,C[I+20>>2]=(n^r)&0-g^n,C[I+24>>2]=(c^a)&0-g^c,C[I+28>>2]=(e^o)&0-g^e,C[I+32>>2]=(E^i)&0-g^E,C[I+36>>2]=(B^Q)&0-g^B;}function IA(A,I,g,E,i){A|=0,E|=0,i|=0;var e,c,a=0,n=0,r=0,t=0,f=0;if(e=y,c=y=y+63&-64,y=y+112|0,!(0==(0|(I|=0))&0==(0|(g|=0)))){a=(n=c)+32|0;do{B[n>>0]=0|B[i>>0],n=n+1|0,i=i+1|0;}while((0|n)<(0|a));if(n=Q[E+4>>0]|Q[E+4+1>>0]<<8|Q[E+4+2>>0]<<16|Q[E+4+3>>0]<<24,C[c+96>>2]=Q[E>>0]|Q[E+1>>0]<<8|Q[E+2>>0]<<16|Q[E+3>>0]<<24,C[c+96+4>>2]=n,C[c+96+8>>2]=0,C[c+96+8+4>>2]=0,g>>>0>0|0==(0|g)&I>>>0>63){do{for(iB(A,c+96|0,c),a=8,i=1;i=i+(0|Q[(n=c+96+a|0)>>0])|0,B[n>>0]=i,16!=(0|(a=a+1|0));){i>>>=8;}I=0|vg(0|I,0|g,-64,-1),g=0|o(),A=A+64|0;}while(g>>>0>0|0==(0|g)&I>>>0>63);0==(0|I)&0==(0|g)||(t=A,f=I,r=8);}else t=A,f=I,r=8;if(8==(0|r)&&(iB(c+32|0,c+96|0,c),0|f)){i=0;do{B[t+i>>0]=0|B[c+32+i>>0],i=i+1|0;}while((0|i)!=(0|f));}MI(c+32|0,64),MI(c,32);}y=e;}function gA(A,I,g,B,C,Q,E){A|=0,I|=0,g|=0,B|=0,C|=0;var i,e,c=0;return e=y,i=y=y+63&-64,y=y+96|0,x(i,Q|=0,E|=0),function(A,I,g){IA(A|=0,32,0,I|=0,g|=0);}(i+32|0,Q+16|0,i),0|function(A,I,g,B,C){return 0|function(A,I,g,B,C){var Q,E;return A|=0,Q=y,E=y=y+63&-64,y=y+16|0,function(A,I,g,B,C){var Q,E;A|=0,I|=0,g|=0,B|=0,Q=y,E=y=y+63&-64,y=y+96|0,MA(E,C|=0),K(E,I,g,B),z(E,A),y=Q;}(E,I|=0,g|=0,B|=0,C|=0),C=0|tB(A,E),y=Q,0|C;}(A|=0,I|=0,g|=0,B|=0,C|=0);}(g,I,B,C,i+32|0)?(MI(i,32),I=-1):A?(I>>>0>=A>>>0&&0>>0|0==(0|C)&(I-A|0)>>>0>>0?c=8:A>>>0>=I>>>0&&0>>0|0==(0|C)&(A-I|0)>>>0>>0?c=8:g=I,8==(0|c)&&(YI(0|A,0|I,0|B),g=A),0==(0|(I=C>>>0>0|0==(0|C)&B>>>0>32?32:B))&0==(0|(E=C>>>0>0|0==(0|C)&B>>>0>32?0:C))?Yg(i+32|0,i+32|0,32,0,Q+16|0,i):(BA(i+32+32|0,0|g,-2-(c=~C>>>0>4294967295|-1==(0|~C)&~B>>>0>4294967263?~B:-33)+1|0),Yg(i+32|0,i+32|0,0|vg(0|I,0|E,32,0),0|o(),Q+16|0,i),BA(0|A,i+32+32|0,-2-c+1|0)),C>>>0>0|0==(0|C)&B>>>0>32&&_g(A+I|0,g+I|0,0|Ug(0|B,0|C,0|I,0|E),0|o(),Q+16|0,i),MI(i,32),I=0):I=0,y=e,0|I;}function BA(A,I,g){A|=0,I|=0;var Q,E,i=0;if((0|(g|=0))>=8192)return t(0|A,0|I,0|g),0|A;if(E=0|A,Q=A+g|0,(3&A)==(3&I)){for(;3&A;){if(!g)return 0|E;B[A>>0]=0|B[I>>0],A=A+1|0,I=I+1|0,g=g-1|0;}for(i=(g=-4&Q|0)-64|0;(0|A)<=(0|i);){C[A>>2]=C[I>>2],C[A+4>>2]=C[I+4>>2],C[A+8>>2]=C[I+8>>2],C[A+12>>2]=C[I+12>>2],C[A+16>>2]=C[I+16>>2],C[A+20>>2]=C[I+20>>2],C[A+24>>2]=C[I+24>>2],C[A+28>>2]=C[I+28>>2],C[A+32>>2]=C[I+32>>2],C[A+36>>2]=C[I+36>>2],C[A+40>>2]=C[I+40>>2],C[A+44>>2]=C[I+44>>2],C[A+48>>2]=C[I+48>>2],C[A+52>>2]=C[I+52>>2],C[A+56>>2]=C[I+56>>2],C[A+60>>2]=C[I+60>>2],A=A+64|0,I=I+64|0;}for(;(0|A)<(0|g);){C[A>>2]=C[I>>2],A=A+4|0,I=I+4|0;}}else for(g=Q-4|0;(0|A)<(0|g);){B[A>>0]=0|B[I>>0],B[A+1>>0]=0|B[I+1>>0],B[A+2>>0]=0|B[I+2>>0],B[A+3>>0]=0|B[I+3>>0],A=A+4|0,I=I+4|0;}for(;(0|A)<(0|Q);){B[A>>0]=0|B[I>>0],A=A+1|0,I=I+1|0;}return 0|E;}function CA(A,I){A|=0;var g,Q,E=0;g=y,Q=y=y+63&-64,y=y+48|0,function(A,I){var g,B,Q,E,i,e,o,c,a,n,r;A|=0,a=0|C[(I|=0)>>2],r=0|C[I+4>>2],o=0|C[I+8>>2],e=0|C[I+12>>2],i=0|C[I+16>>2],n=0|C[I+20>>2],Q=0|C[I+24>>2],B=0|C[I+28>>2],g=0|C[I+32>>2],E=(((((c=((19*((((((((((((16777216+(19*(I=0|C[I+36>>2])|0)|0)>>>25)+a>>26)+r>>25)+o>>26)+e>>25)+i>>26)+n>>25)+Q>>26)+B>>25)+g>>26)+I>>25)|0)+a>>26)+r|0)>>25)+o>>26)+e>>25)+i>>26)+n|0,C[A>>2]=(19*((((((((((((16777216+(19*I|0)|0)>>>25)+a>>26)+r>>25)+o>>26)+e>>25)+i>>26)+n>>25)+Q>>26)+B>>25)+g>>26)+I>>25)|0)+a&67108863,C[A+4>>2]=33554431&c,C[A+8>>2]=(c>>25)+o&67108863,C[A+12>>2]=((c>>25)+o>>26)+e&33554431,C[A+16>>2]=(((c>>25)+o>>26)+e>>25)+i&67108863,C[A+20>>2]=33554431&E,C[A+24>>2]=(E>>25)+Q&67108863,C[A+28>>2]=((E>>25)+Q>>26)+B&33554431,C[A+32>>2]=(((E>>25)+Q>>26)+B>>25)+g&67108863,C[A+36>>2]=((((E>>25)+Q>>26)+B>>25)+g>>26)+I&33554431;}(Q,I|=0),I=0|C[Q>>2],B[A>>0]=I,B[A+1>>0]=I>>>8,B[A+2>>0]=I>>>16,E=0|C[Q+4>>2],B[A+3>>0]=E<<2|I>>>24,B[A+4>>0]=E>>>6,B[A+5>>0]=E>>>14,I=0|C[Q+8>>2],B[A+6>>0]=I<<3|E>>>22,B[A+7>>0]=I>>>5,B[A+8>>0]=I>>>13,E=0|C[Q+12>>2],B[A+9>>0]=E<<5|I>>>21,B[A+10>>0]=E>>>3,B[A+11>>0]=E>>>11,I=0|C[Q+16>>2],B[A+12>>0]=I<<6|E>>>19,B[A+13>>0]=I>>>2,B[A+14>>0]=I>>>10,B[A+15>>0]=I>>>18,I=0|C[Q+20>>2],B[A+16>>0]=I,B[A+17>>0]=I>>>8,B[A+18>>0]=I>>>16,E=0|C[Q+24>>2],B[A+19>>0]=E<<1|I>>>24,B[A+20>>0]=E>>>7,B[A+21>>0]=E>>>15,I=0|C[Q+28>>2],B[A+22>>0]=I<<3|E>>>23,B[A+23>>0]=I>>>5,B[A+24>>0]=I>>>13,E=0|C[Q+32>>2],B[A+25>>0]=E<<4|I>>>21,B[A+26>>0]=E>>>4,B[A+27>>0]=E>>>12,I=0|C[Q+36>>2],B[A+28>>0]=I<<6|E>>>20,B[A+29>>0]=I>>>2,B[A+30>>0]=I>>>10,B[A+31>>0]=I>>>18,y=g;}function QA(A,I,g){A|=0,I|=0,g|=0;var B,E,i=0,e=0,c=0;if(B=y,E=y=y+63&-64,y=y+4096|0,yB(E+3072|0),yB(E+2048|0),0!=(0|A)&0!=(0|I)&&(C[E+2048>>2]=C[I>>2],C[E+2048+4>>2]=0,C[E+2048+8>>2]=C[I+4>>2],C[E+2048+8+4>>2]=0,C[E+2048+16>>2]=Q[I+8>>0],C[E+2048+16+4>>2]=0,C[E+2048+24>>2]=C[A+16>>2],C[E+2048+24+4>>2]=0,C[E+2048+32>>2]=C[A+8>>2],C[E+2048+32+4>>2]=0,C[E+2048+40>>2]=C[A+36>>2],C[E+2048+40+4>>2]=0,0|C[A+20>>2])){I=0;do{(i=127&I)||(c=0|vg(0|C[E+2048+48>>2],0|C[E+2048+48+4>>2],1,0),e=0|o(),C[E+2048+48>>2]=c,C[E+2048+48+4>>2]=e,yB(E),yB(E+1024|0),H(E+3072|0,E+2048|0,E),H(E+3072|0,E,E+1024|0)),e=0|C[E+1024+(i<<3)+4>>2],C[(c=g+(I<<3)|0)>>2]=C[E+1024+(i<<3)>>2],C[c+4>>2]=e,I=I+1|0;}while(I>>>0<(0|C[A+20>>2])>>>0);}y=B;}function EA(A,I,g,B){A|=0,I|=0,g|=0,B|=0;var Q,E,i,e,o=0,c=0,a=0;e=y,i=y=y+63&-64,y=y+64|0,c=52+(o=i+8|0)|0;do{C[o>>2]=0,o=o+4|0;}while((0|o)<(0|c));o=0|ZA(A),C[i+36>>2]=o,C[i+20>>2]=o,C[i+4>>2]=o,c=0|F(o),C[i+32>>2]=c,Q=0|F(o),C[i+16>>2]=Q,E=0|F(o),C[i>>2]=E;do{if(0==(0|c)|0==(0|Q)|0==(0|E))d(c),d(Q),d(E),o=-22;else{if(!(a=0|F(o))){d(c),d(Q),d(E),o=-22;break;}if(0|(o=0|L(i,A,B))){d(0|C[i+32>>2]),d(0|C[i+16>>2]),d(0|C[i>>2]),d(a);break;}B=0|nA(0|C[i+40>>2],0|C[i+44>>2],0|C[i+52>>2],I,g,0|C[i+16>>2],0|C[i+20>>2],a,0|C[i+4>>2],0,0,B),d(0|C[i+32>>2]),d(0|C[i+16>>2]),o=0==(0|B)&&0==(0|EI(a,0|C[i>>2],0|C[i+4>>2]))?0:-35,d(a),d(0|C[i>>2]);}}while(0);return y=e,0|o;}function iA(A,I){A|=0,I|=0;var g,C,E=0,i=0,e=0;g=y,C=y=y+63&-64,y=y+464|0,E=0;do{e=0|B[I+E>>0],B[C+(i=E<<1)>>0]=15&e,B[C+(1|i)>>0]=(255&e)>>>4,E=E+1|0;}while(32!=(0|E));I=0,E=0;do{I=134217728+((i=I+(0|Q[(e=C+E|0)>>0])|0)<<24)>>28,B[e>>0]=i-(I<<4),E=E+1|0;}while(63!=(0|E));B[C+63>>0]=I+(0|Q[C+63>>0]),Og(A),I=1;do{$g(C+64|0,I>>>1,0|B[C+I>>0]),CI(C+304|0,A,C+64|0),Eg(A,C+304|0),I=I+2|0;}while(I>>>0<64);og(C+304|0,A),Hg(C+184|0,C+304|0),aI(C+304|0,C+184|0),Hg(C+184|0,C+304|0),aI(C+304|0,C+184|0),Hg(C+184|0,C+304|0),aI(C+304|0,C+184|0),Eg(A,C+304|0),I=0;do{$g(C+64|0,I>>>1,0|B[C+I>>0]),CI(C+304|0,A,C+64|0),Eg(A,C+304|0),I=I+2|0;}while(I>>>0<64);y=g;}function eA(A,I,g,B,C,Q,E,i,e,c,a){var n;A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0,i|=0,e|=0,n=y,y=y+352|0,OI(n+16|0,64,0,c|=0,a|=0),gB(n+80|0,n+16|0),MI(n+16|0,64),bg(n+80|0,E,i,e),I=0|Ug(0,0,0|i,0|e),o(),bg(n+80|0,34624,15&I,0),bg(n+80|0,g,B,C),I=0|Ug(0,0,0|B,0|C),o(),bg(n+80|0,34624,15&I,0),LI(n+336|0,i,e),bg(n+80|0,n+336|0,8,0),LI(n+336|0,B,C),bg(n+80|0,n+336|0,8,0),IB(n+80|0,n),MI(n+80|0,256),I=0|tB(n,Q),MI(n,16);do{if(A){if(I){YA(0|A,0,0|B),I=-1;break;}rI(A,g,B,C,c,1,a),I=0;break;}}while(0);return y=n,0|I;}function oA(A){A|=0;var I=0,g=0;do{if(A){if(0|C[A>>2]){if((0|C[A+4>>2])>>>0>=16){if(0==(0|C[A+8>>2])&&0|C[A+12>>2]){I=-18;break;}if(I=0|C[A+20>>2],!(0|C[A+16>>2]))return 0|(0==(0|I)?-6:-19);if(I>>>0>=8){if(0==(0|C[A+24>>2])&&0|C[A+28>>2]){I=-20;break;}if(0==(0|C[A+32>>2])&&0|C[A+36>>2]){I=-21;break;}if((I=0|C[A+44>>2])>>>0>=8){if(I>>>0<=2097152){if(I>>>0>=(g=0|C[A+48>>2])<<3>>>0){if(0|C[A+40>>2]){if(g){if(!(g>>>0>16777215))return 0|(0==(0|(A=0|C[A+52>>2]))?-28:A>>>0>16777215?-29:0);I=-17;}else I=-16;}else I=-12;}else I=-14;}else I=-15;}else I=-14;}else I=-6;}else I=-2;}else I=-1;}else I=-25;}while(0);return 0|I;}function cA(A,I,g,Q,E){var i,e;A|=0,g|=0,Q|=0,E|=0,i=y,e=y=y+63&-64,y=y+192|0,((I|=0)-1&255)>63&&SB(),g||SB(),B[e+128>>0]=I,B[e+128+1>>0]=32,B[e+128+2>>0]=1,B[e+128+3>>0]=1,Wg(e+128+4|0),LI(e+128+8|0,0,0),C[e+128+16>>2]=0,C[e+128+16+4>>2]=0,C[e+128+16+8>>2]=0,C[e+128+16+12>>2]=0,Q?function(A,I){I|=0;var g=0;A=16+(g=32+(A|=0)|0)|0;do{B[g>>0]=0|B[I>>0],g=g+1|0,I=I+1|0;}while((0|g)<(0|A));}(e+128|0,Q):(C[e+128+32>>2]=0,C[e+128+32+4>>2]=0,C[e+128+32+8>>2]=0,C[e+128+32+12>>2]=0),E?function(A,I){I|=0;var g=0;A=16+(g=48+(A|=0)|0)|0;do{B[g>>0]=0|B[I>>0],g=g+1|0,I=I+1|0;}while((0|g)<(0|A));}(e+128|0,E):(C[e+128+48>>2]=0,C[e+128+48+4>>2]=0,C[e+128+48+8>>2]=0,C[e+128+48+12>>2]=0),XA(A,e+128|0),E=96+(I=e+32|0)|0;do{C[I>>2]=0,I=I+4|0;}while((0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>>2]=g,C[t+56>>2]=0,0|(I=0|pA(t,n))){MI(r,o),d(r);break;}if(0|e&&BA(0|e,0|r,0|o),0!=(0|c)&0!=(0|a)&&0|J(c,a,t,n)){MI(r,o),MI(c,a),d(r),I=-31;break;}MI(r,o),d(r),I=0;}else I=-22;}while(0);return y=f,0|I;}function rA(A,I){var g,B,C=0;return B=y,g=y=y+63&-64,y=y+288|0,U(40+(A|=0)|0,I|=0),Sg(A+80|0),_(g+240|0,A+40|0),u(g+192|0,g+240|0,16),lA(g+240|0,g+240|0,A+80|0),_A(g+192|0,g+192|0,A+80|0),_(g+144|0,g+192|0),u(g+144|0,g+144|0,g+192|0),_(A,g+144|0),u(A,A,g+192|0),u(A,A,g+240|0),function(A,I){A|=0;var g,B,C=0;g=y,B=y=y+63&-64,y=y+144|0,_(B+96|0,I|=0),_(B+48|0,B+96|0),_(B+48|0,B+48|0),u(B+48|0,I,B+48|0),u(B+96|0,B+96|0,B+48|0),_(B+96|0,B+96|0),u(B+96|0,B+48|0,B+96|0),_(B+48|0,B+96|0),C=1;do{_(B+48|0,B+48|0),C=C+1|0;}while(5!=(0|C));u(B+96|0,B+48|0,B+96|0),_(B+48|0,B+96|0),C=1;do{_(B+48|0,B+48|0),C=C+1|0;}while(10!=(0|C));u(B+48|0,B+48|0,B+96|0),_(B,B+48|0),C=1;do{_(B,B),C=C+1|0;}while(20!=(0|C));u(B+48|0,B,B+48|0),_(B+48|0,B+48|0),C=1;do{_(B+48|0,B+48|0),C=C+1|0;}while(10!=(0|C));u(B+96|0,B+48|0,B+96|0),_(B+48|0,B+96|0),C=1;do{_(B+48|0,B+48|0),C=C+1|0;}while(50!=(0|C));u(B+48|0,B+48|0,B+96|0),_(B,B+48|0),C=1;do{_(B,B),C=C+1|0;}while(100!=(0|C));u(B+48|0,B,B+48|0),_(B+48|0,B+48|0),C=1;do{_(B+48|0,B+48|0),C=C+1|0;}while(50!=(0|C));u(B+96|0,B+48|0,B+96|0),_(B+96|0,B+96|0),_(B+96|0,B+96|0),u(A,B+96|0,I),y=g;}(A,A),u(A,A,g+144|0),u(A,A,g+240|0),_(g+96|0,A),u(g+96|0,g+96|0,g+192|0),lA(g+48|0,g+96|0,g+240|0),0|cg(g+48|0)?C=4:(_A(g,g+96|0,g+240|0),0|cg(g)?(u(A,A,64),C=4):A=-1),4==(0|C)&&((0|(C=0|sg(A)))==((0|Q[I+31>>0])>>>7|0)&&xA(A,A),u(A+120|0,A,A+40|0),A=0),y=B,0|A;}function tA(A,I,g){var B,Q,E,i,e,o,c,a,n,r,t,f,w,y,s,h,D,F,p;I|=0,g|=0,p=0|C[(A|=0)>>2],D=0|C[A+4>>2],s=0|C[A+8>>2],w=0|C[A+12>>2],t=0|C[A+16>>2],n=0|C[A+20>>2],c=0|C[A+24>>2],e=0|C[A+28>>2],E=0|C[A+32>>2],B=0|C[A+36>>2],F=(C[I+4>>2]^D)&0-g,h=(C[I+8>>2]^s)&0-g,y=(C[I+12>>2]^w)&0-g,f=(C[I+16>>2]^t)&0-g,r=(C[I+20>>2]^n)&0-g,a=(C[I+24>>2]^c)&0-g,o=(C[I+28>>2]^e)&0-g,i=(C[I+32>>2]^E)&0-g,Q=(C[I+36>>2]^B)&0-g,C[A>>2]=(C[I>>2]^p)&0-g^p,C[A+4>>2]=F^D,C[A+8>>2]=h^s,C[A+12>>2]=y^w,C[A+16>>2]=f^t,C[A+20>>2]=r^n,C[A+24>>2]=a^c,C[A+28>>2]=o^e,C[A+32>>2]=i^E,C[A+36>>2]=Q^B;}function fA(A,I,g,B,Q,E,i,e,c,a,n,r){return A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,c|=0,a|=0,a=y,y=y+336|0,OI(a,64,0,n|=0,r|=0),gB(a+64|0,a),MI(a,64),bg(a+64|0,i,e,c),i=0|Ug(0,0,0|e,0|c),o(),bg(a+64|0,34624,15&i,0),rI(A,B,Q,E,n,1,r),bg(a+64|0,A,Q,E),n=0|Ug(0,0,0|Q,0|E),o(),bg(a+64|0,34624,15&n,0),LI(a+320|0,e,c),bg(a+64|0,a+320|0,8,0),LI(a+320|0,Q,E),bg(a+64|0,a+320|0,8,0),IB(a+64|0,I),MI(a+64|0,256),0|g&&(C[g>>2]=16,C[g+4>>2]=0),y=a,0;}function wA(A){var I,g,E=0,i=0,e=0;I=y,g=y=y+63&-64,y=y+48|0,i=A|=0,e=(E=g)+32|0;do{B[E>>0]=0|B[i>>0],E=E+1|0,i=i+1|0;}while((0|E)<(0|e));E=Q[A+36+4>>0]|Q[A+36+4+1>>0]<<8|Q[A+36+4+2>>0]<<16|Q[A+36+4+3>>0]<<24,C[g+32>>2]=Q[A+36>>0]|Q[A+36+1>>0]<<8|Q[A+36+2>>0]<<16|Q[A+36+3>>0]<<24,C[g+32+4>>2]=E,function(A,I,g,B){!function(A,I,g,B){fI(A|=0,I|=0,40,0,g|=0,0,B|=0);}(A|=0,I|=0,g|=0,B|=0);}(g,g,A+32|0,A),i=g,e=(E=A)+32|0;do{B[E>>0]=0|B[i>>0],E=E+1|0,i=i+1|0;}while((0|E)<(0|e));i=0|C[g+32>>2],e=0|C[g+32+4>>2],B[A+36>>0]=i,B[A+36+1>>0]=i>>8,B[A+36+2>>0]=i>>16,B[A+36+3>>0]=i>>24,B[A+36+4>>0]=e,B[A+36+4+1>>0]=e>>8,B[A+36+4+2>>0]=e>>16,B[A+36+4+3>>0]=e>>24,Mg(A),y=I;}function yA(A,I){A|=0,I|=0;var g=0,C=0,E=0,i=0,e=0;g=0;do{B[A+g>>0]=(0|Q[I+(g>>>3)>>0])>>>(7&g)&1,g=g+1|0;}while(256!=(0|g));e=0;do{E=A+e|0;A:do{if(0|B[E>>0]){i=1;do{if((g=i+e|0)>>>0>=256)break A;I=0|B[A+g>>0];I:do{if(I<<24>>24){if(((C=I<<24>>24<>0])|0)<16){B[E>>0]=C+I,B[A+g>>0]=0;break;}if((I-C|0)<-15)break A;for(B[E>>0]=I-C;0|B[(I=A+g|0)>>0];){if(B[I>>0]=0,(g=g+1|0)>>>0>=256)break I;}B[I>>0]=1;}}while(0);i=i+1|0;}while(i>>>0<7);}}while(0);e=e+1|0;}while(256!=(0|e));}function sA(A,I,g,B,C,Q,E,i,e,o,c){var a;A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0,i|=0,e|=0,a=y,y=y+352|0,QB(a+16|0,o|=0,c|=0),gB(a+80|0,a+16|0),MI(a+16|0,64),bg(a+80|0,E,i,e),LI(a+336|0,i,e),bg(a+80|0,a+336|0,8,0),bg(a+80|0,g,B,C),LI(a+336|0,B,C),bg(a+80|0,a+336|0,8,0),IB(a+80|0,a),MI(a+80|0,256),I=0|tB(a,Q),MI(a,16);do{if(A){if(I){YA(0|A,0,0|B),I=-1;break;}zI(A,g,B,C,o,c),I=0;break;}}while(0);return y=a,0|I;}function hA(A,I,g,B,Q,E,i){var e,o;A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0,e=y,o=y=y+63&-64,y=y+560|0,Jg(o+192|0,i|=0),RI(o+128|0,E,32,0),P(o+192|0,o+128+32|0,32,0),P(o+192|0,g,B,Q),VI(o+192|0,o+64|0),YI(A+32|0,E+32|0,32),p(o+64|0),iA(o+400|0,o+64|0),sI(A,o+400|0),Jg(o+192|0,i),P(o+192|0,A,64,0),P(o+192|0,g,B,Q),VI(o+192|0,o),p(o),Tg(o+128|0),h(A+32|0,o,o+128|0,o+64|0),MI(o+128|0,64),MI(o+64|0,64),0|I&&(C[I>>2]=64,C[I+4>>2]=0),y=e;}function DA(A,I,g,B,Q,i){A|=0,I|=0,g|=0,B|=0,Q|=0,i|=0;var e=0;do{if(I){if(e=(0|C[A+24>>2])-(0|C[A+20>>2])|0,i){e=B+-1+e|0;break;}e=e+((0==(0|B))<<31>>31)|0;break;}if(!(g<<24>>24)){e=B+-1|0;break;}if(e=0|E(0|C[A+20>>2],255&g),i){e=B+-1+e|0;break;}e=e+((0==(0|B))<<31>>31)|0;break;}while(0);return Qg(0|Q,0,0|Q,0),Qg(0|o(),0,0|e,0),i=0|Ug(e+-1|0,0,0|o(),0),Q=0|o(),0==(0|I)|g<<24>>24==3?(e=0,B=0):(e=0|E(0|C[A+20>>2],1+(255&g)|0),B=0),A=0|Ag(0|(I=0|vg(0|i,0|Q,0|e,0|B)),0|(g=0|o()),0|C[A+24>>2],0),o(),0|A;}function FA(A,I,g,B,Q){B|=0,Q|=0;var E,i,e,o=0;if(e=y,i=y=y+63&-64,y=y+64|0,(g|=0)>>>0>0|0==(0|g)&(I|=0)>>>0>4294967295|(E=0|ZA(A|=0))>>>0>127)C[8678]=28,g=-1;else{o=(g=i)+60|0;do{C[g>>2]=0,g=g+4|0;}while((0|g)<(0|o));(o=0|function(A){var I;return(I=0|F(A|=0))&&3&C[I+-4>>2]?(YA(0|I,0,0|A),0|I):0|I;}(E))?(C[i+16>>2]=o,C[i+8>>2]=o,C[i>>2]=o,C[i+20>>2]=E,C[i+12>>2]=E,C[i+4>>2]=E,C[i+24>>2]=0,C[i+24+4>>2]=0,C[i+24+8>>2]=0,C[i+24+12>>2]=0,0|L(i,A,Q)?(C[8678]=28,g=-1):g=(0|C[i+40>>2])==(0|I)?(0|C[i+44>>2])!=(B>>>10|0)&1:1,d(o)):g=-1;}return y=e,0|g;}function pA(A,I){I|=0;var g,B,Q=0,i=0,e=0;if(B=y,g=y=y+63&-64,y=y+48|0,!(Q=0|oA(A|=0)))if((I+-1|0)>>>0<=1){if(i=0|C[A+44>>2],Q=0|C[A+48>>2],e=0|E(i=((i>>>0>>0?Q<<3:i)>>>0)/(Q<<2>>>0)|0,Q<<2),C[g>>2]=0,C[g+8>>2]=C[A+40>>2],C[g+12>>2]=-1,C[g+16>>2]=e,C[g+20>>2]=i,C[g+24>>2]=i<<2,C[g+28>>2]=Q,C[g+32>>2]=C[A+52>>2],C[g+36>>2]=I,!(Q=0|function(A,I){A|=0,I|=0;var g,B,Q=0;B=y,g=y=y+63&-64,y=y+80|0;do{if(0==(0|A)|0==(0|I))Q=-25;else{if(Q=0|F(C[A+20>>2]<<3),C[A+4>>2]=Q,Q){if(Q=0|bA(A,0|C[A+16>>2])){ug(A,0|C[I+56>>2]);break;}j(g,I,0|C[A+36>>2]),MI(g+64|0,8),KA(g,A),MI(g,72),Q=0;break;}Q=-22;}}while(0);return y=B,0|Q;}(g,A))){if(0|C[g+8>>2]){Q=0;do{UA(g,Q),Q=Q+1|0;}while(Q>>>0<(0|C[g+8>>2])>>>0);}!function(A,I){var g,B,Q=0,i=0;if(g=y,B=y=y+63&-64,y=y+2048|0,0!=(0|(A|=0))&0!=(0|(I|=0))){if(fB(B+1024|0,(0|C[4+(0|C[I>>2])>>2])+(C[I+24>>2]<<10)-1024|0),(0|C[I+28>>2])>>>0>1){Q=1;do{i=(i=0|C[I+24>>2])-1+(0|E(i,Q))|0,SI(B+1024|0,(0|C[4+(0|C[I>>2])>>2])+(i<<10)|0),Q=Q+1|0;}while(Q>>>0<(0|C[I+28>>2])>>>0);}!function(A,I){A|=0,I|=0;var g=0,B=0;g=0;do{LI(A+(g<<3)|0,0|C[(B=I+(g<<3)|0)>>2],0|C[B+4>>2]),g=g+1|0;}while(128!=(0|g));}(B,B+1024|0),T(0|C[A>>2],0|C[A+4>>2],B,1024),MI(B+1024|0,1024),MI(B,1024),ug(I,0|C[A+56>>2]);}y=g;}(A,g),Q=0;}}else Q=-26;return y=B,0|Q;}function uA(A,I,g,B,C,Q){var E,i;return I|=0,g|=0,B|=0,C|=0,Q|=0,i=y,E=y=y+63&-64,y=y+592|0,0!=(0|pI(32+(A|=0)|0))&&0==(0|GA(A))&&0!=(0|WI(C))&&0==(0|GA(C))&&0==(0|rA(E+424|0,C))?(Jg(E+96|0,Q),P(E+96|0,A,32,0),P(E+96|0,C,32,0),P(E+96|0,I,g,B),VI(E+96|0,E+32|0),p(E+32|0),N(E+304|0,E+32|0,E+424|0,A+32|0),sI(E,E+304|0),g=0|rB(E,A),g=0|((0|E)==(0|A)?-1:g)|EI(A,E,32)):g=-1,y=i,0|g;}function HA(A,I){A|=0,I|=0;var g=0,Q=0;A:do{if(255&I){if(3&A)do{if((Q=0|B[A>>0])<<24>>24==0||Q<<24>>24==(255&I)<<24>>24)break A;A=A+1|0;}while(0!=(3&A|0));Q=0|E(255&I,16843009),g=0|C[A>>2];I:do{if(!((-2139062144&g^-2139062144)&g+-16843009))do{if((-2139062144&(g^=Q)^-2139062144)&g+-16843009|0)break I;g=0|C[(A=A+4|0)>>2];}while(!((-2139062144&g^-2139062144)&g+-16843009|0));}while(0);for(;(Q=0|B[A>>0])<<24>>24!=0&&Q<<24>>24!=(255&I)<<24>>24;){A=A+1|0;}}else A=A+(0|ZA(A))|0;}while(0);return 0|A;}function kA(A,I){I|=0;var g,Q=0,E=0;g=y,y=y+192|0,PI(A|=0),E=128+(Q=g+64|0)|0;do{C[Q>>2]=909522486,Q=Q+4|0;}while((0|Q)<(0|E));B[g+64>>0]=54^B[I>>0],Q=1;do{B[(E=g+64+Q|0)>>0]=B[E>>0]^B[I+Q>>0],Q=Q+1|0;}while(32!=(0|Q));P(A,g+64|0,128,0),PI(A+208|0),E=128+(Q=g+64|0)|0;do{C[Q>>2]=1549556828,Q=Q+4|0;}while((0|Q)<(0|E));B[g+64>>0]=92^B[I>>0],Q=1;do{B[(E=g+64+Q|0)>>0]=B[E>>0]^B[I+Q>>0],Q=Q+1|0;}while(32!=(0|Q));P(A+208|0,g+64|0,128,0),MI(g+64|0,128),MI(g,64),y=g;}function lA(A,I,g){var B,Q,E,i,e,o,c,a,n;A|=0,g|=0,n=(0|C[4+(I|=0)>>2])-(0|C[g+4>>2])|0,a=(0|C[I+8>>2])-(0|C[g+8>>2])|0,c=(0|C[I+12>>2])-(0|C[g+12>>2])|0,o=(0|C[I+16>>2])-(0|C[g+16>>2])|0,e=(0|C[I+20>>2])-(0|C[g+20>>2])|0,i=(0|C[I+24>>2])-(0|C[g+24>>2])|0,E=(0|C[I+28>>2])-(0|C[g+28>>2])|0,Q=(0|C[I+32>>2])-(0|C[g+32>>2])|0,B=(0|C[I+36>>2])-(0|C[g+36>>2])|0,C[A>>2]=(0|C[I>>2])-(0|C[g>>2]),C[A+4>>2]=n,C[A+8>>2]=a,C[A+12>>2]=c,C[A+16>>2]=o,C[A+20>>2]=e,C[A+24>>2]=i,C[A+28>>2]=E,C[A+32>>2]=Q,C[A+36>>2]=B;}function _A(A,I,g){var B,Q,E,i,e,o,c,a,n;A|=0,I|=0,n=(0|C[4+(g|=0)>>2])+(0|C[I+4>>2])|0,a=(0|C[g+8>>2])+(0|C[I+8>>2])|0,c=(0|C[g+12>>2])+(0|C[I+12>>2])|0,o=(0|C[g+16>>2])+(0|C[I+16>>2])|0,e=(0|C[g+20>>2])+(0|C[I+20>>2])|0,i=(0|C[g+24>>2])+(0|C[I+24>>2])|0,E=(0|C[g+28>>2])+(0|C[I+28>>2])|0,Q=(0|C[g+32>>2])+(0|C[I+32>>2])|0,B=(0|C[g+36>>2])+(0|C[I+36>>2])|0,C[A>>2]=(0|C[g>>2])+(0|C[I>>2]),C[A+4>>2]=n,C[A+8>>2]=a,C[A+12>>2]=c,C[A+16>>2]=o,C[A+20>>2]=e,C[A+24>>2]=i,C[A+28>>2]=E,C[A+32>>2]=Q,C[A+36>>2]=B;}function GA(A){A|=0;var I,g,C=0,E=0,i=0,e=0;I=y,g=y=y+63&-64,y=y+16|0,B[g>>0]=0,B[g+1>>0]=0,B[g+2>>0]=0,B[g+3>>0]=0,B[g+4>>0]=0,B[g+5>>0]=0,B[g+6>>0]=0,i=0;do{C=0|B[A+i>>0],E=0;do{B[(e=g+E|0)>>0]=B[e>>0]|B[32096+(E<<5)+i>>0]^C,E=E+1|0;}while(7!=(0|E));i=i+1|0;}while(31!=(0|i));C=127&B[A+31>>0],E=0;do{B[(e=g+E|0)>>0]=B[e>>0]|C^B[32096+(E<<5)+31>>0],E=E+1|0;}while(7!=(0|E));C=0,E=0;do{E=(0|Q[g+C>>0])-1|E,C=C+1|0;}while(7!=(0|C));return y=I,E>>>8&1|0;}function dA(A,I,g,B,Q,E,i,e,o,c,a,n){return A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,o|=0,c|=0,c=y,y=y+336|0,QB(c,a|=0,n|=0),gB(c+64|0,c),MI(c,64),bg(c+64|0,i,e,o),LI(c+320|0,e,o),bg(c+64|0,c+320|0,8,0),zI(A,B,Q,E,a,n),bg(c+64|0,A,Q,E),LI(c+320|0,Q,E),bg(c+64|0,c+320|0,8,0),IB(c+64|0,I),MI(c+64|0,256),0|g&&(C[g>>2]=16,C[g+4>>2]=0),y=c,0;}function YA(A,I,g){I|=0;var Q,E=0;if(Q=(A|=0)+(g|=0)|0,I&=255,(0|g)>=67){for(;3&A;){B[A>>0]=I,A=A+1|0;}for(E=I|I<<8|I<<16|I<<24;(0|A)<=((-4&Q)-64|0);){C[A>>2]=E,C[A+4>>2]=E,C[A+8>>2]=E,C[A+12>>2]=E,C[A+16>>2]=E,C[A+20>>2]=E,C[A+24>>2]=E,C[A+28>>2]=E,C[A+32>>2]=E,C[A+36>>2]=E,C[A+40>>2]=E,C[A+44>>2]=E,C[A+48>>2]=E,C[A+52>>2]=E,C[A+56>>2]=E,C[A+60>>2]=E,A=A+64|0;}for(;(0|A)<(-4&Q|0);){C[A>>2]=E,A=A+4|0;}}for(;(0|A)<(0|Q);){B[A>>0]=I,A=A+1|0;}return Q-g|0;}function MA(A,I){A|=0;var g=0;g=67108863&(0|Vg(I|=0)),C[A>>2]=g,g=(0|Vg(I+3|0))>>>2&67108611,C[A+4>>2]=g,g=(0|Vg(I+6|0))>>>4&67092735,C[A+8>>2]=g,g=(0|Vg(I+9|0))>>>6&66076671,C[A+12>>2]=g,g=(0|Vg(I+12|0))>>>8&1048575,C[A+16>>2]=g,C[A+20>>2]=0,C[A+20+4>>2]=0,C[A+20+8>>2]=0,C[A+20+12>>2]=0,C[A+20+16>>2]=0,g=0|Vg(I+16|0),C[A+40>>2]=g,g=0|Vg(I+20|0),C[A+44>>2]=g,g=0|Vg(I+24|0),C[A+48>>2]=g,I=0|Vg(I+28|0),C[A+52>>2]=I,C[A+56>>2]=0,C[A+56+4>>2]=0,B[A+80>>0]=0;}function SA(A,I,g,B,Q,E){A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0;var i=0,e=0,c=0;do{if(Q>>>0<0|0==(0|Q)&B>>>0<64||(i=0|vg(0|B,0|Q,-64,-1),(e=0|o())>>>0>0|0==(0|e)&i>>>0>4294967231))c=10;else{if(0|dg(g,g+64|0,i,e,E)){if(!A){c=10;break;}YA(0|A,0,0|i),c=10;break;}0|I&&(C[I>>2]=i,C[I+4>>2]=e),A?(YI(0|A,g+64|0,0|i),B=0):B=0;}}while(0);return 10==(0|c)&&(I?(C[I>>2]=0,C[I+4>>2]=0,B=-1):B=-1),0|B;}function UA(A,I){I|=0;var g,Q,E=0,i=0;if(g=y,Q=y=y+63&-64,y=y+32|0,0|(A|=0)&&0|(E=0|C[A+28>>2])){C[Q>>2]=I,i=0;do{if(B[Q+8>>0]=i,E){I=0;do{C[Q+4>>2]=I,C[Q+12>>2]=0,C[Q+16>>2]=C[Q>>2],C[Q+16+4>>2]=C[Q+4>>2],C[Q+16+8>>2]=C[Q+8>>2],C[Q+16+12>>2]=C[Q+12>>2],X(A,Q+16|0),I=I+1|0,E=0|C[A+28>>2];}while(I>>>0>>0);}else E=0;i=i+1|0;}while(4!=(0|i));}y=g;}function vA(A,I,g,Q){A|=0,g|=0,Q|=0;var E,i,e=0;if(E=y,i=y=y+63&-64,y=y+192|0,((I|=0)-1&255)>63&&SB(),!((Q+-1&255)>63|0==(0|g))){B[i+128>>0]=I,B[i+128+1>>0]=Q,B[i+128+2>>0]=1,B[i+128+3>>0]=1,Wg(i+128+4|0),LI(i+128+8|0,0,0),e=48+(I=i+128+16|0)|0;do{C[I>>2]=0,I=I+4|0;}while((0|I)<(0|e));return XA(A,i+128|0),YA(i+(255&Q)|0,0,128-(255&Q)|0),BA(0|i,0|g,255&Q|0),$(A,i,128,0),MI(i,128),void(y=E);}SB();}function bA(A,I){A|=0,I|=0;var g,B,Q=0;B=y,g=y=y+63&-64,y=y+16|0;do{if(0!=(0|A)&&0!=(0|I)&&1024==(0|(I<<10>>>0)/(I>>>0))&&(Q=0|F(12),C[A>>2]=Q,0!=(0|Q))){if(C[Q+4>>2]=0,C[Q>>2]=0,Q=0|wg(g,I<<10),C[8678]=Q,Q)C[g>>2]=0;else if(0|(Q=0|C[g>>2])){C[C[A>>2]>>2]=Q,C[4+(0|C[A>>2])>>2]=Q,C[8+(0|C[A>>2])>>2]=I<<10,Q=0;break;}d(0|C[A>>2]),C[A>>2]=0,Q=-22;}else Q=-22;}while(0);return y=B,0|Q;}function JA(A,I,g,B,E,i){var e,o,c;return A|=0,I|=0,g|=0,B|=0,i|=0,o=y,e=y=y+63&-64,y=y+32|0,c=Q[4+(E|=0)>>0]|Q[E+4+1>>0]<<8|Q[E+4+2>>0]<<16|Q[E+4+3>>0]<<24,C[e+16>>2]=Q[E>>0]|Q[E+1>>0]<<8|Q[E+2>>0]<<16|Q[E+3>>0]<<24,C[e+16+4>>2]=c,C[e+16+8>>2]=0,C[e+16+8+4>>2]=0,LI(e,g,B),C[e+8>>2]=0,C[e+8+4>>2]=0,(I+-16|0)>>>0>48?(C[8678]=28,g=-1):g=0|function(A,I,g,B,C){return g|=0,((I|=0)-1|0)>>>0>63?g=-1:(function(A,I,g,B,C){var Q,E;if(I|=0,g|=0,B|=0,C|=0,Q=y,E=y=y+63&-64,y=y+368|0,(A|=0)||SB(),(g+-1&255)>63&&SB(),I)return cA(E,g,I,B,C),$(E,0,0,0),b(E,A,g),void(y=Q);SB();}(A|=0,g,255&I,B|=0,C|=0),g=0),0|g;}(A,I,i,e,e+16|0),y=o,0|g;}function PA(A,I,g,B,E,i,e,c,a,n,r){var t;return A|=0,I|=0,g|=0,B|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0,r|=0,t=y,y=y+48|0,C[t+32>>2]=0,R(t,n,r),I=Q[n+16+4>>0]|Q[n+16+4+1>>0]<<8|Q[n+16+4+2>>0]<<16|Q[n+16+4+3>>0]<<24,C[t+32+4>>2]=Q[n+16>>0]|Q[n+16+1>>0]<<8|Q[n+16+2>>0]<<16|Q[n+16+3>>0]<<24,C[t+32+4+4>>2]=I,I=0|function(A,I,g,B,C,Q,E,i,e,c){var a;A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0,i|=0,a=y,y=y+352|0,gg(a+16|0,64,0,e|=0,c|=0),gB(a+80|0,a+16|0),MI(a+16|0,64),bg(a+80|0,Q,E,i),Q=0|Ug(0,0,0|E,0|i),o(),bg(a+80|0,34640,15&Q,0),bg(a+80|0,I,g,B),Q=0|Ug(0,0,0|g,0|B),o(),bg(a+80|0,34640,15&Q,0),LI(a+336|0,E,i),bg(a+80|0,a+336|0,8,0),LI(a+336|0,g,B),bg(a+80|0,a+336|0,8,0),IB(a+80|0,a),MI(a+80|0,256),E=0|tB(a,C),MI(a,16);do{if(A){if(E){YA(0|A,0,0|g),E=-1;break;}mI(A,I,g,B,e,1,c),E=0;break;}}while(0);return y=a,0|E;}(A,g,B,E,i,e,c,a,t+32|0,t),MI(t,32),y=t,0|I;}function RA(A,I,g,Q,E,i,e){I|=0,g|=0,Q|=0,E|=0,i|=0,e|=0;var o,c,a,n=0;a=y,o=y=y+63&-64,y=y+16|0,c=128+(n=A|=0)|0;do{B[n>>0]=0,n=n+1|0;}while((0|n)<(0|c));do{if(!((i|Q)>>>0>0|0==(i|Q|0)&(E|g)>>>0>4294967295|e>>>0>2147483648)){if(i>>>0<0|0==(0|i)&E>>>0<3|e>>>0<8192){C[8678]=28,g=-1;break;}Cg(o,16),g=(0!=(0|Gg(E,e>>>10,I,g,o,A)))<<31>>31;break;}C[8678]=22,g=-1;}while(0);return y=a,0|g;}function NA(A,I,g,B,E,i,e,c,a,n,r,t){return A|=0,I|=0,g|=0,B|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0,r|=0,t|=0,n=y,y=y+48|0,C[n+32>>2]=0,R(n,r,t),t=Q[r+16+4>>0]|Q[r+16+4+1>>0]<<8|Q[r+16+4+2>>0]<<16|Q[r+16+4+3>>0]<<24,C[n+32+4>>2]=Q[r+16>>0]|Q[r+16+1>>0]<<8|Q[r+16+2>>0]<<16|Q[r+16+3>>0]<<24,C[n+32+4+4>>2]=t,function(A,I,g,B,Q,E,i,e,c,a,n){var r;A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,c|=0,r=y,y=y+336|0,gg(r,64,0,a|=0,n|=0),gB(r+64|0,r),MI(r,64),bg(r+64|0,i,e,c),i=0|Ug(0,0,0|e,0|c),o(),bg(r+64|0,34640,15&i,0),mI(A,B,Q,E,a,1,n),bg(r+64|0,A,Q,E),a=0|Ug(0,0,0|Q,0|E),o(),bg(r+64|0,34640,15&a,0),LI(r+320|0,e,c),bg(r+64|0,r+320|0,8,0),LI(r+320|0,Q,E),bg(r+64|0,r+320|0,8,0),IB(r+64|0,I),MI(r+64|0,256),0|g&&(C[g>>2]=16,C[g+4>>2]=0),y=r;}(A,I,g,B,E,i,e,c,a,n+32|0,n),MI(n,32),y=n,0;}function mA(A,I,g,Q,E){A|=0,I|=0,g|=0,Q|=0,E|=0;var i=0,e=0;A:do{if(E){for(e=0|C[g>>2];;){if(e>>>0>=I>>>0){i=4;break;}if((i=0|B[A+e>>0])<<24>>24!=61){if(!Q){i=9;break;}if(!(0|qg(Q,i<<24>>24))){i=9;break;}}else E=E+-1|0;if(e=e+1|0,C[g>>2]=e,!E){E=0;break A;}}if(4==(0|i)){C[8678]=68,E=-1;break;}if(9==(0|i)){C[8678]=28,E=-1;break;}}else E=0;}while(0);return 0|E;}function LA(A,I,g,Q,E,i,e){I|=0,g|=0,Q|=0,E|=0,i|=0,e|=0;var o,c,a,n=0;a=y,o=y=y+63&-64,y=y+16|0,c=128+(n=A|=0)|0;do{B[n>>0]=0,n=n+1|0;}while((0|n)<(0|c));do{if(!((i|Q)>>>0>0|0==(i|Q|0)&(E|g)>>>0>4294967295|e>>>0>2147483648)){if(0==(0|E)&0==(0|i)|e>>>0<8192){C[8678]=28,g=-1;break;}Cg(o,16),g=(0!=(0|lg(E,e>>>10,I,g,o,A)))<<31>>31;break;}C[8678]=22,g=-1;}while(0);return y=a,0|g;}function xA(A,I){var g,B,Q,E,i,e,o,c,a;A|=0,a=0-(0|C[4+(I|=0)>>2])|0,c=0-(0|C[I+8>>2])|0,o=0-(0|C[I+12>>2])|0,e=0-(0|C[I+16>>2])|0,i=0-(0|C[I+20>>2])|0,E=0-(0|C[I+24>>2])|0,Q=0-(0|C[I+28>>2])|0,B=0-(0|C[I+32>>2])|0,g=0-(0|C[I+36>>2])|0,C[A>>2]=0-(0|C[I>>2]),C[A+4>>2]=a,C[A+8>>2]=c,C[A+12>>2]=o,C[A+16>>2]=e,C[A+20>>2]=i,C[A+24>>2]=E,C[A+28>>2]=Q,C[A+32>>2]=B,C[A+36>>2]=g;}function KA(A,I){A|=0;var g,B,Q=0;if(g=y,B=y=y+63&-64,y=y+1024|0,0|C[28+(I|=0)>>2]){Q=0;do{Pg(A+64|0,0),Pg(A+68|0,Q),T(B,1024,A,72),xI((0|C[4+(0|C[I>>2])>>2])+((0|E(0|C[I+24>>2],Q))<<10)|0,B),Pg(A+64|0,1),T(B,1024,A,72),xI((0|C[4+(0|C[I>>2])>>2])+(1+(0|E(0|C[I+24>>2],Q))<<10)|0,B),Q=Q+1|0;}while(Q>>>0<(0|C[I+28>>2])>>>0);}MI(B,1024),y=g;}function XA(A,I){I|=0;var g=0,C=0,E=0,i=0;!function(A){var I,g=0,C=0;C=32352,I=64+(g=A|=0)|0;do{B[g>>0]=0|B[C>>0],g=g+1|0,C=C+1|0;}while((0|g)<(0|I));YA(A+64|0,0,293);}(A|=0),g=0;do{i=0|qI(I+(g<<3)|0),E=0|o(),i=(Q[(C=A+(g<<3)|0)>>0]|Q[C+1>>0]<<8|Q[C+2>>0]<<16|Q[C+3>>0]<<24)^i,E=(Q[C+4>>0]|Q[C+4+1>>0]<<8|Q[C+4+2>>0]<<16|Q[C+4+3>>0]<<24)^E,B[C>>0]=i,B[C+1>>0]=i>>8,B[C+2>>0]=i>>16,B[C+3>>0]=i>>24,B[C+4>>0]=E,B[C+4+1>>0]=E>>8,B[C+4+2>>0]=E>>16,B[C+4+3>>0]=E>>24,g=g+1|0;}while(8!=(0|g));}function jA(A){var I,g,B,C,E,i,c=0;return E=0|Q[7+(A|=0)>>0],i=0|rg(0|Q[A+6>>0],0,8),c=0|o(),C=0|rg(0|Q[A+5>>0],0,16),c=0|c|o(),B=0|rg(0|Q[A+4>>0],0,24),c=0|(c=0|c|o())|Q[A+3>>0],g=0|rg(0|Q[A+2>>0],0,40),c=0|c|o(),I=0|rg(0|Q[A+1>>0],0,48),c=0|c|o(),A=0|rg(0|Q[A>>0],0,56),e(0|c|o()|0),i|E|C|B|g|I|A|0;}function TA(A,I,g,B,Q,E){I|=0,Q|=0,E|=0;var i,e=0;return i=y,e=y=y+63&-64,y=y+16|0,YI(64+(A|=0)|0,0|(g|=0),0|(B|=0)),kg(A,e,A+64|0,B,Q,E),64==(0|C[e>>2])&0==(0|C[e+4>>2])?0|I?(e=0|vg(0|B,0|Q,64,0),B=0|o(),C[I>>2]=e,C[I+4>>2]=B,B=0):B=0:(0|I&&(C[I>>2]=0,C[I+4>>2]=0),YA(0|A,0,B+64|0),B=-1),y=i,0|B;}function qA(A,I){I|=0;var g,Q=0,E=0,i=0,e=0;g=0|B[(A|=0)>>0];A:do{if((g+-48&255)<=9){for(E=g,i=0,e=A;;){if(!(i>>>0<429496730&((E=(E<<24>>24)-48|0)>>>0>~(Q=10*i|0)>>>0^1))){Q=0;break A;}if(i=(E>>>0>~Q>>>0?0:E)+Q|0,((E=0|B[(Q=e+1|0)>>0])-48&255)>9)break;e=Q;}(0|Q)!=(0|A)&&(0|e)==(0|A)|g<<24>>24!=48?C[I>>2]=i:Q=0;}else Q=0;}while(0);return 0|Q;}function VA(A){return((0-((0-(95^(A|=0))|0)>>>8&63^63|(0-(45^A)|0)>>>8&62^62|((A+65439|0)>>>8^255)&A+185&((122-A|0)>>>8&255^255)|((A+-65|0)>>>8^255)&A+-65&((90-A|0)>>>8&255^255)|((A+65488|0)>>>8^255)&A+4&((57-A|0)>>>8&255^255))|0)>>>8&255^255)&(0-(65^A)|0)>>>8|(0-(95^A)|0)>>>8&63^63|(0-(45^A)|0)>>>8&62^62|((A+65439|0)>>>8^255)&A+185&((122-A|0)>>>8&255^255)|((A+-65|0)>>>8^255)&A+-65&((90-A|0)>>>8&255^255)|((A+65488|0)>>>8^255)&A+4&((57-A|0)>>>8&255^255)|0;}function zA(A){return((0-((0-(47^(A|=0))|0)>>>8&63^63|(0-(43^A)|0)>>>8&62^62|((A+65439|0)>>>8^255)&A+185&((122-A|0)>>>8&255^255)|((A+-65|0)>>>8^255)&A+-65&((90-A|0)>>>8&255^255)|((A+65488|0)>>>8^255)&A+4&((57-A|0)>>>8&255^255))|0)>>>8&255^255)&(0-(65^A)|0)>>>8|(0-(47^A)|0)>>>8&63^63|(0-(43^A)|0)>>>8&62^62|((A+65439|0)>>>8^255)&A+185&((122-A|0)>>>8&255^255)|((A+-65|0)>>>8^255)&A+-65&((90-A|0)>>>8&255^255)|((A+65488|0)>>>8^255)&A+4&((57-A|0)>>>8&255^255)|0;}function WA(A,I){I|=0;var g=0,B=0;if(g=0|yg(0|C[72+(A|=0)>>2],0|C[A+72+4>>2],3),o(),(127&g)>>>0<112)112-(127&g)|0&&BA(A+80+(127&g)|0,33056,112-(127&g)|0);else{128-(127&g)|0&&BA(A+80+(127&g)|0,33056,128-(127&g)|0),D(A,A+80|0,I,I+640|0),B=112+(g=A+80|0)|0;do{C[g>>2]=0,g=g+4|0;}while((0|g)<(0|B));}NI(A+192|0,A+64|0,16),D(A,A+80|0,I,I+640|0);}function OA(A,I){var g,B,Q,E,i,e,o,c,a;A|=0,a=0|C[4+(I|=0)>>2],c=0|C[I+8>>2],o=0|C[I+12>>2],e=0|C[I+16>>2],i=0|C[I+20>>2],E=0|C[I+24>>2],Q=0|C[I+28>>2],B=0|C[I+32>>2],g=0|C[I+36>>2],C[A>>2]=C[I>>2],C[A+4>>2]=a,C[A+8>>2]=c,C[A+12>>2]=o,C[A+16>>2]=e,C[A+20>>2]=i,C[A+24>>2]=E,C[A+28>>2]=Q,C[A+32>>2]=B,C[A+36>>2]=g;}function ZA(A){A|=0;var I=0,g=0,Q=0;A:do{if(3&A)for(I=A,g=A;;){if(!(0|B[g>>0]))break A;if(!(3&(I=g=g+1|0))){I=g,Q=5;break;}}else I=A,Q=5;}while(0);if(5==(0|Q)){for(;!((-2139062144&(g=0|C[I>>2])^-2139062144)&g+-16843009);){I=I+4|0;}if((255&g)<<24>>24)do{I=I+1|0;}while(0!=(0|B[I>>0]));}return I-A|0;}function $A(A,I){I|=0;var g=0;C[(A|=0)>>2]=1634760805,C[A+4>>2]=857760878,C[A+8>>2]=2036477234,C[A+12>>2]=1797285236,g=0|Vg(I),C[A+16>>2]=g,g=0|Vg(I+4|0),C[A+20>>2]=g,g=0|Vg(I+8|0),C[A+24>>2]=g,g=0|Vg(I+12|0),C[A+28>>2]=g,g=0|Vg(I+16|0),C[A+32>>2]=g,g=0|Vg(I+20|0),C[A+36>>2]=g,g=0|Vg(I+24|0),C[A+40>>2]=g,I=0|Vg(I+28|0),C[A+44>>2]=I;}function AI(A,I,g){I|=0,g|=0;var C=0;B[7+(A|=0)>>0]=I,C=0|yg(0|I,0|g,8),o(),B[A+6>>0]=C,C=0|yg(0|I,0|g,16),o(),B[A+5>>0]=C,C=0|yg(0|I,0|g,24),o(),B[A+4>>0]=C,B[A+3>>0]=g,C=0|yg(0|I,0|g,40),o(),B[A+2>>0]=C,C=0|yg(0|I,0|g,48),o(),B[A+1>>0]=C,g=0|yg(0|I,0|g,56),o(),B[A>>0]=g;}function II(A,I,g){var B,C;g|=0,B=y,C=y=y+63&-64,y=y+48|0,_A(A|=0,40+(I|=0)|0,I),lA(A+40|0,I+40|0,I),u(A+80|0,A,g+40|0),u(A+40|0,A+40|0,g),u(A+120|0,g+120|0,I+120|0),u(A,I+80|0,g+80|0),_A(C,A,A),lA(A,A+80|0,A+40|0),_A(A+40|0,A+80|0,A+40|0),lA(A+80|0,C,A+120|0),_A(A+120|0,C,A+120|0),y=B;}function gI(A,I,g){var B,C;g|=0,B=y,C=y=y+63&-64,y=y+48|0,_A(A|=0,40+(I|=0)|0,I),lA(A+40|0,I+40|0,I),u(A+80|0,A,g),u(A+40|0,A+40|0,g+40|0),u(A+120|0,g+120|0,I+120|0),u(A,I+80|0,g+80|0),_A(C,A,A),lA(A,A+80|0,A+40|0),_A(A+40|0,A+80|0,A+40|0),_A(A+80|0,C,A+120|0),lA(A+120|0,C,A+120|0),y=B;}function BI(A,I,g){var B,C;g|=0,B=y,C=y=y+63&-64,y=y+48|0,_A(A|=0,40+(I|=0)|0,I),lA(A+40|0,I+40|0,I),u(A+80|0,A,g+40|0),u(A+40|0,A+40|0,g),u(A+120|0,g+80|0,I+120|0),_A(C,I+80|0,I+80|0),lA(A,A+80|0,A+40|0),_A(A+40|0,A+80|0,A+40|0),lA(A+80|0,C,A+120|0),_A(A+120|0,C,A+120|0),y=B;}function CI(A,I,g){var B,C;g|=0,B=y,C=y=y+63&-64,y=y+48|0,_A(A|=0,40+(I|=0)|0,I),lA(A+40|0,I+40|0,I),u(A+80|0,A,g),u(A+40|0,A+40|0,g+40|0),u(A+120|0,g+80|0,I+120|0),_A(C,I+80|0,I+80|0),lA(A,A+80|0,A+40|0),_A(A+40|0,A+80|0,A+40|0),_A(A+80|0,C,A+120|0),lA(A+120|0,C,A+120|0),y=B;}function QI(A,I){A|=0,I|=0;var g,C,Q=0;g=y,C=y=y+63&-64,y=y+208|0,Q=0;do{B[A+Q>>0]=0|B[I+Q>>0],Q=Q+1|0;}while(32!=(0|Q));return B[A>>0]=-8&B[A>>0],B[A+31>>0]=63&B[A+31>>0]|64,iA(C+40|0,A),function(A,I,g){var B,C;A|=0,B=y,C=y=y+63&-64,y=y+96|0,_A(C+48|0,g|=0,I|=0),lA(C,g,I),W(C,C),u(A,C+48|0,C),y=B;}(C,C+40+40|0,C+40+80|0),CA(A,C),y=g,0;}function EI(A,I,g){var E,i;if(A|=0,I|=0,g|=0,E=y,i=y=y+63&-64,y=y+16|0,C[i+4>>2]=A,C[i>>2]=I,B[i+8>>0]=0,0|g){A=0;do{B[i+8>>0]=B[i+8>>0]|B[(0|C[i>>2])+A>>0]^B[(0|C[i+4>>2])+A>>0],A=A+1|0;}while((0|A)!=(0|g));}return y=E,((511+(0|Q[i+8>>0])|0)>>>8&1)-1|0;}function iI(A,I){A|=0;var g,Q,E=0;if(g=y,Q=y=y+63&-64,y=y+64|0,!(((I|=0)-1&255)>63)){B[Q>>0]=I,B[Q+1>>0]=0,B[Q+2>>0]=1,B[Q+3>>0]=1,Wg(Q+4|0),LI(Q+8|0,0,0),E=48+(I=Q+16|0)|0;do{C[I>>2]=0,I=I+4|0;}while((0|I)<(0|E));return XA(A,Q),void(y=g);}SB();}function eI(A,I,g){var Q,E;A|=0,I|=0,g|=0,Q=y,E=y=y+63&-64,y=y+16|0,C[E+8>>2]=A,C[E+4>>2]=I,C[E>>2]=0,A=0;do{C[E>>2]=C[E>>2]|255&(B[(0|C[E+4>>2])+A>>0]^B[(0|C[E+8>>2])+A>>0]),A=A+1|0;}while((0|A)!=(0|g));return y=Q,((511+(0|C[E>>2])|0)>>>8&1)-1|0;}function oI(A,I,g){I|=0,g|=0;var C=0,E=0;C=0|B[(A|=0)>>0];A:do{if(C<<24>>24)for(;;){if(g=g+-1|0,!(C<<24>>24==(E=0|B[I>>0])<<24>>24&0!=(0|g)&E<<24>>24!=0))break A;if(I=I+1|0,!((C=0|B[(A=A+1|0)>>0])<<24>>24)){C=0;break;}}else C=0;}while(0);return(255&C)-(0|Q[I>>0])|0;}function cI(A,I){A|=0,I|=0;var g,C,Q=0,i=0,e=0,o=0;for(g=y,C=y=y+63&-64,y=y+16|0,i=10;o=255&((e=I)+(0|E(I=(I>>>0)/10|0,-10))|48),B[C+(Q=i+-1|0)>>0]=o,e>>>0>9&0!=(0|Q);){i=Q;}BA(0|A,C+Q|0,0|(o=11-i|0)),B[A+o>>0]=0,y=g;}function aI(A,I){var g,B;g=y,B=y=y+63&-64,y=y+48|0,_(A|=0,I|=0),_(A+80|0,I+40|0),l(A+120|0,I+80|0),_A(A+40|0,I,I+40|0),_(B,A+40|0),_A(A+40|0,A+80|0,A),lA(A+80|0,A+80|0,A),lA(A,B,A+40|0),lA(A+120|0,A+120|0,A+80|0),y=g;}function nI(A,I,g){var C,E;if(A|=0,I|=0,g|=0,E=y,C=y=y+63&-64,y=y+16|0,B[C>>0]=0,0|function(A,I,g){A|=0,I|=0;var C,E,i=0;if(E=y,C=y=y+63&-64,y=y+336|0,0|function(A){A|=0;var I,g,C=0,E=0,i=0,e=0;I=y,g=y=y+63&-64,y=y+16|0,B[g>>0]=0,B[g+1>>0]=0,B[g+2>>0]=0,B[g+3>>0]=0,B[g+4>>0]=0,B[g+5>>0]=0,B[g+6>>0]=0,i=0;do{C=0|B[A+i>>0],E=0;do{B[(e=g+E|0)>>0]=B[e>>0]|B[33184+(E<<5)+i>>0]^C,E=E+1|0;}while(7!=(0|E));i=i+1|0;}while(31!=(0|i));C=127&B[A+31>>0],E=0;do{B[(e=g+E|0)>>0]=B[e>>0]|C^B[33184+(E<<5)+31>>0],E=E+1|0;}while(7!=(0|E));C=0,E=0;do{E=(0|Q[g+C>>0])-1|E,C=C+1|0;}while(7!=(0|C));return y=I,E>>>8&1|0;}(g|=0))i=-1;else{i=0;do{B[A+i>>0]=0|B[I+i>>0],i=i+1|0;}while(32!=(0|i));for(B[A>>0]=-8&B[A>>0],B[A+31>>0]=63&B[A+31>>0]|64,U(C+288|0,g),Sg(C+240|0),Kg(C+192|0),OA(C+144|0,C+288|0),Sg(C+96|0),i=254,I=0;g=I,AA(C+240|0,C+144|0,g^=I=(0|Q[A+(i>>>3)>>0])>>>(7&i)&1),AA(C+192|0,C+96|0,g),lA(C+48|0,C+144|0,C+96|0),lA(C,C+240|0,C+192|0),_A(C+240|0,C+240|0,C+192|0),_A(C+192|0,C+144|0,C+96|0),u(C+96|0,C+48|0,C+240|0),u(C+192|0,C+192|0,C),_(C+48|0,C),_(C,C+240|0),_A(C+144|0,C+96|0,C+192|0),lA(C+192|0,C+96|0,C+192|0),u(C+240|0,C,C+48|0),lA(C,C,C+48|0),_(C+192|0,C+192|0),v(C+96|0,C),_(C+144|0,C+144|0),_A(C+48|0,C+48|0,C+96|0),u(C+96|0,C+288|0,C+192|0),u(C+192|0,C,C+48|0),i;){i=i+-1|0;}AA(C+240|0,C+144|0,I),AA(C+192|0,C+96|0,I),W(C+192|0,C+192|0),u(C+240|0,C+240|0,C+192|0),CA(A,C+240|0),i=0;}return y=E,0|i;}(A,I,g))I=-1;else{I=0;do{B[C>>0]=B[C>>0]|B[A+I>>0],I=I+1|0;}while(32!=(0|I));I=0-((511+(0|Q[C>>0])|0)>>>8&1)|0;}return y=E,0|I;}function rI(A,I,g,B,C,Q,E){A|=0,I|=0,C|=0,Q|=0,E|=0;var i,e=0;e=0|Ug(0,1,0|(e=0|yg(0|(e=0|vg(0|(g|=0),0|(B|=0),63,0)),0|o(),6)),0|o()),(i=0|o())>>>0<0|0==(0|i)&e>>>0>>0?SB():mI(A,I,g,B,C,Q,E);}function tI(A,I,g){A|=0,I|=0;var C,Q,E=0,i=0;Q=y,i=y=y+63&-64,y=y+64|0,RI(i,g|=0,32,0),E=i,C=(g=I)+32|0;do{B[g>>0]=0|B[E>>0],g=g+1|0,E=E+1|0;}while((0|g)<(0|C));return MI(i,64),i=0|AB(A,I),y=Q,0|i;}function fI(A,I,g,B,C,Q,E){var i,e;A|=0,I|=0,C|=0,E|=0,i=y,e=y=y+63&-64,y=y+80|0,0==(0|(g|=0))&0==(0|(B|=0))||(Pg(e+64|0,Q|=0),$A(e,E),UI(e,C,e+64|0),M(e,I,A,g,B),MI(e,64)),y=i;}function wI(A,I,g){var C,Q;A|=0,C=y,Q=y=y+63&-64,y=y+160|0,RI(I|=0,g|=0,32,0),B[I>>0]=-8&B[I>>0],B[I+31>>0]=63&B[I+31>>0]|64,iA(Q,I),sI(A,Q),YI(0|I,0|g,32),YI(I+32|0,0|A,32),y=C;}function yI(A,I,g,B){A|=0,I|=0,g|=0,B|=0;A:do{if(B>>>0>0|0==(0|B)&g>>>0>4294967295)C[8678]=22,g=-1;else{switch(0|oB(A,I,g)){case 0:g=0;break A;case-35:C[8678]=28;}g=-1;}}while(0);return 0|g;}function sI(A,I){var g,C;A|=0,g=y,C=y=y+63&-64,y=y+144|0,W(C+96|0,80+(I|=0)|0),u(C+48|0,I,C+96|0),u(C,I+40|0,C+96|0),CA(A,C),I=(0|sg(C+48|0))<<7,B[A+31>>0]=I^(0|Q[A+31>>0]),y=g;}function hI(A,I,g,B){A|=0,I|=0,g|=0,B|=0;A:do{if(B>>>0>0|0==(0|B)&g>>>0>4294967295)C[8678]=22,g=-1;else{switch(0|cB(A,I,g)){case 0:g=0;break A;case-35:C[8678]=28;}g=-1;}}while(0);return 0|g;}function DI(A,I,g,B,C,Q,E,i){var e;return A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,e=y,y=y+32|0,0|jg(e,E|=0,i|=0)?B=-1:(B=0|ng(A,I,g,B,C,Q,e),MI(e,32)),y=e,0|B;}function FI(A,I,g,B,C,Q,E,i){var e;return A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,e=y,y=y+32|0,0|jg(e,E|=0,i|=0)?B=-1:(tg(A,I,g,B,C,Q,e),MI(e,32),B=0),y=e,0|B;}function pI(A){A|=0;var I=0,g=0,C=0,Q=0,E=0;for(Q=0,E=32,I=1;Q=(255&(g=0|B[A+(E=E+-1|0)>>0]))-(255&(C=0|B[32320+E>>0]))>>8&(I&=255)|255&Q,E;){I&=(65535+(255&(C^g))|0)>>>8;}return 0!=(0|Q)|0;}function uI(A,I,g,B){return B=0|vg(0|vg(0|(g|=0),0|(B|=0),0|(A|=0),0|(I|=0)),0|o(),0|(B=0|Qg(-2&(B=0|rg(0|A,0|I,1))|0,1&(0|o())|0,0|g,0)),0|o()),e(0|o()),0|B;}function HI(A,I,g,B){A|=0,I|=0,g|=0,B|=0;do{if(!(g>>>0>64|(B+-1|0)>>>0>63)){if(0==(0|I)|0==(0|g)){iI(A,255&B),I=0;break;}vA(A,255&B,I,255&g),I=0;break;}I=-1;}while(0);return 0|I;}function kI(A){var I,g,B,C=0;return g=0|Q[(A|=0)>>0],B=0|rg(0|Q[A+1>>0],0,8),C=0|o(),I=0|rg(0|Q[A+2>>0],0,16),C=0|C|o(),A=0|rg(0|Q[A+3>>0],0,24),e(0|C|o()|0),B|g|I|A|0;}function lI(A,I){A|=0,I|=0;var g,C,E=0;g=y,C=y=y+63&-64,y=y+16|0,B[C>>0]=0,E=0;do{B[C>>0]=B[C>>0]|B[A+E>>0],E=E+1|0;}while((0|E)!=(0|I));return y=g,(511+(0|Q[C>>0])|0)>>>8&1|0;}function _I(A,I,g){A|=0,I|=0;var B=0;(g|=0)?(B=0|Vg(g),C[A+48>>2]=B,g=0|Vg(g+4|0)):(C[A+48>>2]=0,g=0),C[A+52>>2]=g,B=0|Vg(I),C[A+56>>2]=B,B=0|Vg(I+4|0),C[A+60>>2]=B;}function GI(A,I,g){var B,C;A|=0,I|=0,g|=0,B=y,C=y=y+63&-64,y=y+384|0,Lg(C,0,0,24),Rg(C,I,32,0),Rg(C,g,32,0),zg(C,A,24),y=B;}function dI(A,I,g,B,C,Q,E){return I|=0,C|=0,Q|=0,E|=0,0|((B|=0)>>>0<0|0==(0|B)&(g|=0)>>>0<16?-1:0|DI(A|=0,I+16|0,I,g=0|vg(0|g,0|B,-16,-1),0|o(),C,Q,E));}function YI(A,I,g){var C=0;if((0|(I|=0))<(0|(A|=0))&(0|A)<(I+(g|=0)|0)){for(C=A,I=I+g|0,A=A+g|0;(0|g)>0;){I=I-1|0,g=g-1|0,B[(A=A-1|0)>>0]=0|B[I>>0];}A=C;}else BA(A,I,g);return 0|A;}function MI(A,I){var g,Q;if(A|=0,I|=0,g=y,Q=y=y+63&-64,y=y+16|0,C[Q>>2]=A,0|I){A=0;do{B[(0|C[Q>>2])+A>>0]=0,A=A+1|0;}while((0|A)!=(0|I));}y=g;}function SI(A,I){A|=0,I|=0;var g=0,B=0,Q=0,E=0;g=0;do{E=I+(g<<3)|0,Q=C[4+(B=A+(g<<3)|0)>>2]^C[E+4>>2],C[B>>2]=C[B>>2]^C[E>>2],C[B+4>>2]=Q,g=g+1|0;}while(128!=(0|g));}function UI(A,I,g){A|=0,I|=0,g=(g|=0)?0|Vg(g):0,C[A+48>>2]=g,g=0|Vg(I),C[A+52>>2]=g,g=0|Vg(I+4|0),C[A+56>>2]=g,I=0|Vg(I+8|0),C[A+60>>2]=I;}function vI(A,I){var g,C;I|=0,C=y,y=y+64|0,function(A,I){var g;I|=0,g=y,y=y+64|0,VI(A|=0,g),P(A+208|0,g,64,0),VI(A+208|0,I),MI(g,64),y=g;}(A|=0,C),A=C,g=I+32|0;do{B[I>>0]=0|B[A>>0],I=I+1|0,A=A+1|0;}while((0|I)<(0|g));y=C;}function bI(A){var I;return A|=0,((I=0|C[8808])+A|0)>>>0>(0|r())>>>0&&0==(0|f(I+A|0))?(C[8678]=48,0|(A=-1)):(C[8808]=I+A,0|(A=I));}function JI(A,I,g,B,C){var Q;A|=0,I|=0,g|=0,B|=0,Q=y,y=y+416|0,function(A,I){kA(A|=0,I|=0);}(Q,C|=0),function(A,I,g,B){xg(A|=0,I|=0,g|=0,B|=0);}(Q,I,g,B),vI(Q,A),y=Q;}function PI(A){var I,g=0;C[64+(A|=0)>>2]=0,C[A+64+4>>2]=0,C[A+64+8>>2]=0,C[A+64+12>>2]=0,g=32352,I=A+64|0;do{C[A>>2]=C[g>>2],A=A+4|0,g=g+4|0;}while((0|A)<(0|I));}function RI(A,I,g,B){var C,Q;A|=0,I|=0,g|=0,B|=0,C=y,Q=y=y+63&-64,y=y+208|0,PI(Q),P(Q,I,g,B),VI(Q,A),y=C;}function NI(A,I,g){A|=0,I|=0;var B=0,Q=0;if((g|=0)>>>3|0){B=0;do{AI(A+(B<<3)|0,0|C[(Q=I+(B<<3)|0)>>2],0|C[Q+4>>2]),B=B+1|0;}while((0|B)!=(g>>>3|0));}}function mI(A,I,g,B,C,Q,E){A|=0,I|=0,C|=0,Q|=0,E|=0,(B|=0)>>>0>0|0==(0|B)&(g|=0)>>>0>4294967295?SB():fI(A,I,g,B,C,Q,E);}function LI(A,I,g){I|=0,g|=0,B[(A|=0)>>0]=I,B[A+1>>0]=I>>8,B[A+2>>0]=I>>16,B[A+3>>0]=I>>24,B[A+4>>0]=g,B[A+4+1>>0]=g>>8,B[A+4+2>>0]=g>>16,B[A+4+3>>0]=g>>24;}function xI(A,I){A|=0,I|=0;var g=0,B=0,Q=0,E=0;g=0;do{E=0|qI(I+(g<<3)|0),Q=0|o(),C[(B=A+(g<<3)|0)>>2]=E,C[B+4>>2]=Q,g=g+1|0;}while(128!=(0|g));}function KI(A,I,g,B,C,Q,E){return A|=0,I|=0,C|=0,Q|=0,E|=0,(B|=0)>>>0>0|0==(0|B)&(g|=0)>>>0>4294967279?(SB(),0):0|FI(A+16|0,A,I,g,B,C,Q,E);}function XI(A){return(0-(62^(A|=0))|0)>>>8&45^45|(A+65510|0)>>>8&255&A+65|(0-(63^A)|0)>>>8&95^95|(A+65484|0)>>>8&A+71&((A+65510|0)>>>8&255^255)|(A+65474|0)>>>8&A+252&((A+65484|0)>>>8&255^255)|0;}function jI(A){return(0-(62^(A|=0))|0)>>>8&43^43|(A+65510|0)>>>8&255&A+65|(0-(63^A)|0)>>>8&47^47|(A+65484|0)>>>8&A+71&((A+65510|0)>>>8&255^255)|(A+65474|0)>>>8&A+252&((A+65484|0)>>>8&255^255)|0;}function TI(A,I,g,B,C,Q,E){return B|=0,((I|=0)-1|0)>>>0>63|(E|=0)>>>0>64?B=-1:(function(A,I,g,B,C,Q,E){var i,e;A|=0,g|=0,B|=0,E|=0,i=y,e=y=y+63&-64,y=y+368|0,0==(0|(I|=0))&(0!=(0|(C|=0))|0!=(0|(Q|=0)))&&SB(),A||SB(),(B+-1&255)>63&&SB(),0!=(0|g)|E<<24>>24==0||SB(),(255&E)>64&&SB(),E<<24>>24?vA(e,B,g,E):iI(e,B),$(e,I,C,Q),b(e,A,B),y=i;}(A|=0,g|=0,Q|=0,255&I,B,C|=0,255&E),B=0),0|B;}function qI(A){var I;return I=Q[(A|=0)>>0]|Q[A+1>>0]<<8|Q[A+2>>0]<<16|Q[A+3>>0]<<24,e(Q[A+4>>0]|Q[A+4+1>>0]<<8|Q[A+4+2>>0]<<16|Q[A+4+3>>0]<<24|0),0|I;}function VI(A,I){var g,B;I|=0,g=y,B=y=y+63&-64,y=y+704|0,WA(A|=0,B),NI(I,A,64),MI(B,704),MI(A,208),y=g;}function zI(A,I,g,B,C,Q){A|=0,I|=0,C|=0,Q|=0,(B|=0)>>>0>0|0==(0|B)&(g|=0)>>>0>4294967295?SB():function(A,I,g,B,C,Q,E,i){var e,o;A|=0,I|=0,C|=0,i|=0,e=y,o=y=y+63&-64,y=y+80|0,0==(0|(g|=0))&0==(0|(B|=0))||(Pg(o+64|0,1),Pg(o+64+4|0,0),$A(o,i),_I(o,C,o+64|0),M(o,I,A,g,B),MI(o,64)),y=e;}(A,I,g,B,C,0,0,Q);}function WI(A){var I=0,g=0;I=127&B[31+(A|=0)>>0]^127,g=30;do{I|=~B[A+g>>0],g=g+-1|0;}while(0!=(0|g));return(236-(0|Q[A>>0])&511+(255&I))>>>8&1^1|0;}function OI(A,I,g,B,C){A|=0,B|=0,C|=0,(g|=0)>>>0>0|0==(0|g)&(I|=0)>>>0>4294967295?SB():gg(A,I,g,B,C);}function ZI(A,I,g){var B,C;return B=0|yg(0|(A|=0),0|(I|=0),0|(g|=0)),C=0|o(),g=0|rg(0|A,0|I,64-g|0),e(0|o()|C|0),g|B|0;}function $I(A,I,g){var B,C;return B=0|rg(0|(A|=0),0|(I|=0),0|(g|=0)),C=0|o(),g=0|yg(0|A,0|I,64-g|0),e(0|o()|C|0),g|B|0;}function Ag(A,I,g,B){var Q;return Q=y,y=y+16|0,function(A,I,g,B,Q){A|=0,g|=0,B|=0,Q|=0;var E=0,c=0,a=0,n=0,r=0,t=0,f=0,w=0,y=0,s=0;if(!(I|=0))return B?Q?(C[Q>>2]=0|A,C[Q+4>>2]=0&I,Q=0,0|(e(0|(B=0)),Q)):(Q=0,0|(e(0|(B=0)),Q)):(0|Q&&(C[Q>>2]=(A>>>0)%(g>>>0),C[Q+4>>2]=0),Q=(A>>>0)/(g>>>0)>>>0,0|(e(0|(B=0)),Q));do{if(g){if(0|B){if((c=(0|i(0|B))-(0|i(0|I))|0)>>>0<=31){w=c+1|0,a=A>>>((c+1|0)>>>0)&c-31>>31|I<<31-c,f=I>>>((c+1|0)>>>0)&c-31>>31,E=0,c=A<<31-c;break;}return Q?(C[Q>>2]=0|A,C[Q+4>>2]=I|0&I,Q=0,0|(e(0|(B=0)),Q)):(Q=0,0|(e(0|(B=0)),Q));}if(g-1&g|0){w=c=33+(0|i(0|g))-(0|i(0|I))|0,a=32-c-1>>31&I>>>((c-32|0)>>>0)|(I<<32-c|A>>>(c>>>0))&c-32>>31,f=c-32>>31&I>>>(c>>>0),E=A<<64-c&32-c>>31,c=(I<<64-c|A>>>((c-32|0)>>>0))&32-c>>31|A<<32-c&c-33>>31;break;}return 0|Q&&(C[Q>>2]=g-1&A,C[Q+4>>2]=0),1==(0|g)?(Q=0|A,0|(e(0|(B=I|0&I)),Q)):(B=I>>>((Q=0|nB(0|g))>>>0)|0,Q=I<<32-Q|A>>>(Q>>>0)|0,0|(e(0|B),Q));}if(!B)return 0|Q&&(C[Q>>2]=(I>>>0)%(g>>>0),C[Q+4>>2]=0),Q=(I>>>0)/(g>>>0)>>>0,0|(e(0|(B=0)),Q);if(!A)return 0|Q&&(C[Q>>2]=0,C[Q+4>>2]=(I>>>0)%(B>>>0)),Q=(I>>>0)/(B>>>0)>>>0,0|(e(0|(g=0)),Q);if(!(B-1&B))return 0|Q&&(C[Q>>2]=0|A,C[Q+4>>2]=B-1&I|0&I),g=0,Q=I>>>((0|nB(0|B))>>>0),0|(e(0|g),Q);if((c=(0|i(0|B))-(0|i(0|I))|0)>>>0<=30){w=c+1|0,a=I<<31-c|A>>>((c+1|0)>>>0),f=I>>>((c+1|0)>>>0),E=0,c=A<<31-c;break;}return Q?(C[Q>>2]=0|A,C[Q+4>>2]=I|0&I,Q=0,0|(e(0|(B=0)),Q)):(Q=0,0|(e(0|(B=0)),Q));}while(0);if(w){r=0|vg(0|g,B|0&B|0,-1,-1),t=0|o(),n=c,I=f,A=w,c=0;do{s=n,n=E>>>31|n<<1,E=c|E<<1,Ug(0|r,0|t,0|(s=a<<1|s>>>31|0),0|(y=a>>>31|I<<1|0)),c=1&(f=(w=0|o())>>31|((0|w)<0?-1:0)<<1),a=0|Ug(0|s,0|y,f&(0|g)|0,(((0|w)<0?-1:0)>>31|((0|w)<0?-1:0)<<1)&(B|0&B)|0),I=0|o(),A=A-1|0;}while(0!=(0|A));A=0;}else n=c,I=f,A=0,c=0;0|Q&&(C[Q>>2]=a,C[Q+4>>2]=I),s=-2&(E<<1|0)|c,e(0|(y=(0|E)>>>31|n<<1|0&(0|E>>>31)|A));}(A|=0,I|=0,g|=0,B|=0,0|Q),y=Q,0|(e(0|C[Q+4>>2]),0|C[Q>>2]);}function Ig(A){A|=0;var I=0,g=0,C=0;for(I=1,g=0;I=I+(0|Q[(C=A+g|0)>>0])|0,B[C>>0]=I,4!=(0|(g=g+1|0));){I>>>=8;}}function gg(A,I,g,B,C){A|=0,B|=0,C|=0,(g|=0)>>>0>0|0==(0|g)&(I|=0)>>>0>4294967295?SB():function(A,I,g,B,C){var Q,E;A|=0,B|=0,Q=y,E=y=y+63&-64,y=y+64|0,0==(0|(I|=0))&0==(0|(g|=0))||($A(E,C|=0),UI(E,B,0),YA(0|A,0,0|I),M(E,A,A,I,g),MI(E,64)),y=Q;}(A,I,g,B,C);}function Bg(A,I,g){var B;return A|=0,g|=0,I=0|rg(255&(I|=0)|0,0,8),B=0|o(),g=0|rg(255&g|0,0,16),e(0|B|o()|0),I|255&A|g|0;}function Cg(A,I){A|=0;var g=0,C=0;if(0|(I|=0)){g=0;do{C=255&(0|DB()),B[A+g>>0]=C,g=g+1|0;}while((0|g)!=(0|I));}}function Qg(A,I,g,B){var C,Q;return I|=0,B|=0,C=0|function(A,I){var g,B,C;return C=((g=0|E(65535&(I|=0),65535&(A|=0)))>>>16)+(0|E(65535&I,A>>>16))|0,B=0|E(I>>>16,65535&A),0|(e((C>>>16)+(0|E(I>>>16,A>>>16))+(((65535&C)+B|0)>>>16)|0),C+B<<16|65535&g|0);}(A|=0,g|=0),Q=0|o(),0|(e((0|E(I,g))+(0|E(B,A))+Q|0&Q|0),0|C);}function Eg(A,I){u(A|=0,I|=0,I+120|0),u(A+40|0,I+40|0,I+80|0),u(A+80|0,I+80|0,I+120|0),u(A+120|0,I,I+40|0);}function ig(A,I,g){return A|=0,I|=0,(0|(g|=0))<32?(e(I>>g|0),A>>>g|(I&(1<>g-32|0);}function eg(A,I){_A(A|=0,40+(I|=0)|0,I),lA(A+40|0,I+40|0,I),OA(A+80|0,I+80|0),u(A+120|0,I+120|0,112);}function og(A,I){var g,B;A|=0,g=y,B=y=y+63&-64,y=y+128|0,function(A,I){OA(A|=0,I|=0),OA(A+40|0,I+40|0),OA(A+80|0,I+80|0);}(B,I|=0),aI(A,B),y=g;}function cg(A){var I,g;return I=y,g=y=y+63&-64,y=y+32|0,CA(g,A|=0),A=0|lI(g,32),y=I,0|A;}function ag(A,I){A|=0,I|=0;var g=0,C=0;g=0;do{B[(C=A+g|0)>>0]=B[C>>0]^B[I+g>>0],g=g+1|0;}while(8!=(0|g));}function ng(A,I,g,B,C,Q,E){return 0|gA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0);}function rg(A,I,g){return A|=0,(0|(g|=0))<32?(e((I|=0)<>>32-g|0),A<>>0<256?0|b(A|=0,I|=0,255&g):(c(33547,33567,107,33620),0);}function wg(A,I){A|=0;var g=0;return(I|=0)>>>0<=4294967168&&0!=(0|(g=0|function(A){var I,g=0,B=0,Q=0,E=0;if((A|=0)>>>0>=4294967168)return C[8678]=48,0;if(!(B=0|F(76+(I=A>>>0<11?16:A+11&-8)|0)))return 0;do{if(63&B){if(g=(Q=((B+63&-64)-8-(B+-8)|0)>>>0>15?(B+63&-64)-8|0:56+(B+63&-64)|0)-(B+-8)|0,3&(A=0|C[B+-4>>2])){C[Q+4>>2]=(-8&A)-g|1&C[Q+4>>2]|2,C[Q+((-8&A)-g)+4>>2]=1|C[Q+((-8&A)-g)+4>>2],C[B+-4>>2]=g|1&C[B+-4>>2]|2,C[Q+4>>2]=1|C[Q+4>>2],Y(B+-8|0,g),E=Q,A=Q;break;}C[Q>>2]=(0|C[B+-8>>2])+g,C[Q+4>>2]=(-8&A)-g,E=Q,A=Q;break;}E=B+-8|0,A=B+-8|0;}while(0);return 3&(A=0|C[(g=A+4|0)>>2])|0&&(-8&A)>>>0>(I+16|0)>>>0&&(Q=E+I|0,C[g>>2]=I|1&A|2,C[Q+4>>2]=(-8&A)-I|3,C[(B=E+(-8&A)+4|0)>>2]=1|C[B>>2],Y(Q,(-8&A)-I|0)),0|E+8;}(I)))?(C[A>>2]=g,I=0):I=48,0|I;}function yg(A,I,g){return A|=0,I|=0,(0|(g|=0))<32?(e(I>>>g|0),A>>>g|(I&(1<>>g-32|0);}function sg(A){var I,g;return g=y,I=y=y+63&-64,y=y+32|0,CA(I,A|=0),y=g,1&B[I>>0]|0;}function hg(A,I,g){tA(A|=0,I|=0,255&(g|=0)),tA(A+40|0,I+40|0,255&g),tA(A+80|0,I+80|0,255&g);}function Dg(A,I,g,B,C,Q,E){return 0|TI(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0);}function Fg(A,I,g,B,C,Q,E){return 0|nA(A|=0,I|=0,1,g|=0,B|=0,C|=0,16,Q|=0,E|=0,0,0,2);}function pg(A,I,g,B,C,Q,E){return 0|nA(A|=0,I|=0,1,g|=0,B|=0,C|=0,16,Q|=0,E|=0,0,0,1);}function ug(A,I){(function(A,I){A|=0,0|(I|=0)&&(0|(I=0|C[A>>2])&&MI(0|C[I+4>>2],C[A+16>>2]<<10),0|(I=0|C[A+4>>2])&&MI(I,C[A+20>>2]<<3));})(A|=0,4&(I|=0)),d(0|C[A+4>>2]),C[A+4>>2]=0,function(A){var I=0;0|(A|=0)&&0|(I=0|C[A>>2])&&d(I),d(A);}(0|C[A>>2]),C[A>>2]=0;}function Hg(A,I){u(A|=0,I|=0,I+120|0),u(A+40|0,I+40|0,I+80|0),u(A+80|0,I+80|0,I+120|0);}function kg(A,I,g,B,C,Q){hA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,0);}function lg(A,I,g,B,C,Q){return 0|nA(A|=0,I|=0,1,g|=0,B|=0,C|=0,16,0,32,Q|=0,128,2);}function _g(A,I,g,B,C,Q){V(A|=0,I|=0,g|=0,B|=0,C|=0,1,0,Q|=0);}function Gg(A,I,g,B,C,Q){return 0|nA(A|=0,I|=0,1,g|=0,B|=0,C|=0,16,0,32,Q|=0,128,1);}function dg(A,I,g,B,C){return 0|uA(A|=0,I|=0,g|=0,B|=0,C|=0,0);}function Yg(A,I,g,B,C,Q){V(A|=0,I|=0,g|=0,B|=0,C|=0,0,0,Q|=0);}function Mg(A){B[32+(A|=0)>>0]=1,B[A+32+1>>0]=0,B[A+32+2>>0]=0,B[A+32+3>>0]=0;}function Sg(A){var I;C[(A|=0)>>2]=1,I=36+(A=A+4|0)|0;do{C[A>>2]=0,A=A+4|0;}while((0|A)<(0|I));}function Ug(A,I,g,B){return 0|(e(0|(B=(I|=0)-(B|=0)-((g|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-g>>>0|0);}function vg(A,I,g,B){return 0|(e((I|=0)+(B|=0)+((A|=0)+(g|=0)>>>0>>>0>>0|0)>>>0|0),A+g>>>0|0);}function bg(A,I,g,B){!function(A,I,g,B){K(A|=0,I|=0,g|=0,B|=0);}(A|=0,I|=0,g|=0,B|=0);}function Jg(A,I){I|=0,PI(A|=0),0|I&&P(A,33408,34,0);}function Pg(A,I){I|=0,B[(A|=0)>>0]=I,B[A+1>>0]=I>>8,B[A+2>>0]=I>>16,B[A+3>>0]=I>>24;}function Rg(A,I,g,B){return Xg(A|=0,I|=0,g|=0,B|=0),0;}function Ng(A,I,g,B){return 0|FA(A|=0,I|=0,g|=0,B|=0,2);}function mg(A,I,g,B){return 0|FA(A|=0,I|=0,g|=0,B|=0,1);}function Lg(A,I,g,B){return 0|HI(A|=0,I|=0,g|=0,B|=0);}function xg(A,I,g,B){P(A|=0,I|=0,g|=0,B|=0);}function Kg(A){var I;I=40+(A|=0)|0;do{C[A>>2]=0,A=A+4|0;}while((0|A)<(0|I));}function Xg(A,I,g,B){$(A|=0,I|=0,g|=0,B|=0);}function jg(A,I,g){return 0|function(A,I,g){var B,C;return A|=0,C=y,B=y=y+63&-64,y=y+32|0,0|nI(B,g|=0,I|=0)?A=-1:(x(A,34656,B),A=0),y=C,0|A;}(A|=0,I|=0,g|=0);}function Tg(A){B[(A|=0)>>0]=-8&B[A>>0],B[A+31>>0]=63&B[A+31>>0]|64;}function qg(A,I){return A=0|HA(A|=0,I|=0),0|((0|B[A>>0])==(255&I)<<24>>24?A:0);}function Vg(A){return Q[(A|=0)>>0]|Q[A+1>>0]<<8|Q[A+2>>0]<<16|Q[A+3>>0]<<24|0;}function zg(A,I,g){return 0|fg(A|=0,I|=0,g|=0);}function Wg(A){B[(A|=0)>>0]=0,B[A+1>>0]=0,B[A+2>>0]=0,B[A+3>>0]=0;}function Og(A){Kg(A|=0),Sg(A+40|0),Sg(A+80|0),Kg(A+120|0);}function Zg(A){C[(A|=0)>>2]=0,C[A+4>>2]=0,C[A+8>>2]=0,C[A+12>>2]=0;}function $g(A,I,g){!function(A,I,g){var B,C,Q;A|=0,I|=0,B=y,Q=y=y+63&-64,y=y+128|0,g=((g|=0)<<24>>24)-((0-(255&(C=0|function(A){return(255&(A|=0))>>>7|0;}(g)))&g<<24>>24)<<1)&255,function(A){Sg(A|=0),Sg(A+40|0),Kg(A+80|0);}(A),hg(A,I,0|aB(g,1)),hg(A,I+120|0,0|aB(g,2)),hg(A,I+240|0,0|aB(g,3)),hg(A,I+360|0,0|aB(g,4)),hg(A,I+480|0,0|aB(g,5)),hg(A,I+600|0,0|aB(g,6)),hg(A,I+720|0,0|aB(g,7)),hg(A,I+840|0,0|aB(g,8)),OA(Q,A+40|0),OA(Q+40|0,A),xA(Q+80|0,A+80|0),hg(A,Q,C),y=B;}(A|=0,1120+(960*(I|=0)|0)|0,g|=0);}function AB(A,I){return 0|QI(A|=0,I|=0);}function IB(A,I){!function(A,I){z(A|=0,I|=0);}(A|=0,I|=0);}function gB(A,I){!function(A,I){MA(A|=0,I|=0);}(A|=0,I|=0);}function BB(A,I,g){return 0|nI(A|=0,I|=0,g|=0);}function CB(A,I){return 0|function(A,I){return A|=0,Cg(I|=0,32),0|AB(A,I);}(A|=0,I|=0);}function QB(A,I,g){!function(A,I,g,B,C){var Q,E;A|=0,B|=0,Q=y,E=y=y+63&-64,y=y+64|0,0==(0|(I|=0))&0==(0|(g|=0))||($A(E,C|=0),_I(E,B,0),YA(0|A,0,64),M(E,A,A,64,0),MI(E,64)),y=Q;}(A|=0,64,0,I|=0,g|=0);}function EB(A){1!=(-7&(A|=0)|0)&&SB();}function iB(A,I,g){!function(A,I,g){A|=0,I|=0;var B,C,Q,E,i,e,o,c,a,n,r,t=0,f=0,w=0,y=0,s=0,h=0,D=0,F=0,p=0,u=0,H=0,k=0,l=0,_=0,G=0,d=0,Y=0,M=0,S=0,U=0,v=0,b=0,J=0,P=0,R=0,N=0,m=0,L=0,x=0,K=0,X=0,j=0;r=0|Vg(g|=0),i=0|Vg(g+4|0),e=0|Vg(g+8|0),o=0|Vg(g+12|0),c=0|Vg(g+16|0),a=0|Vg(g+20|0),n=0|Vg(g+24|0),B=0|Vg(g+28|0),C=0|Vg(I),Q=0|Vg(I+4|0),E=0|Vg(I+8|0),g=0|Vg(I+12|0),I=0,t=1634760805,f=r,w=2036477234,y=c,s=a,h=n,D=B,F=1797285236,p=i,u=e,H=o,k=857760878,l=C,_=Q,G=E,d=g;do{x=(0|wB((U=(0|wB((J=(0|wB((N=(0|wB(t+s|0,7))^H)+t|0,9))^G)+N|0,13))^s)+J|0,18))^t,R=(0|wB((j=(0|wB((S=(0|wB((b=(0|wB(f+k|0,7))^d)+k|0,9))^h)+b|0,13))^f)+S|0,18))^k,v=(0|wB((L=(0|wB((X=(0|wB((M=(0|wB(l+w|0,7))^D)+w|0,9))^p)+M|0,13))^l)+X|0,18))^w,Y=(0|wB((P=(0|wB((m=(0|wB((K=(0|wB(y+F|0,7))^u)+F|0,9))^_)+K|0,13))^y)+m|0,18))^F,t=(0|wB((u=(0|wB((p=(0|wB((f=(0|wB(K+x|0,7))^j)+x|0,9))^X)+f|0,13))^K)+p|0,18))^x,k=(0|wB((H=(0|wB((_=(0|wB((l=(0|wB(R+N|0,7))^L)+R|0,9))^m)+l|0,13))^N)+_|0,18))^R,w=(0|wB((d=(0|wB((G=(0|wB((y=(0|wB(v+b|0,7))^P)+v|0,9))^J)+y|0,13))^b)+G|0,18))^v,F=(0|wB((D=(0|wB((h=(0|wB((s=(0|wB(Y+M|0,7))^U)+Y|0,9))^S)+s|0,13))^M)+h|0,18))^Y,I=I+2|0;}while(I>>>0<20);Pg(A,t+1634760805|0),Pg(A+4|0,f+r|0),Pg(A+8|0,p+i|0),Pg(A+12|0,u+e|0),Pg(A+16|0,H+o|0),Pg(A+20|0,k+857760878|0),Pg(A+24|0,l+C|0),Pg(A+28|0,_+Q|0),Pg(A+32|0,G+E|0),Pg(A+36|0,d+g|0),Pg(A+40|0,w+2036477234|0),Pg(A+44|0,y+c|0),Pg(A+48|0,s+a|0),Pg(A+52|0,h+n|0),Pg(A+56|0,D+B|0),Pg(A+60|0,F+1797285236|0);}(A|=0,I|=0,g|=0);}function eB(A,I){return 0|AB(A|=0,I|=0);}function oB(A,I,g){return 0|EA(A|=0,I|=0,g|=0,2);}function cB(A,I,g){return 0|EA(A|=0,I|=0,g|=0,1);}function aB(A,I){return((255&((I|=0)^(A|=0)))-1|0)>>>31&255|0;}function nB(A){return 0|((A|=0)?31-(0|i(A^A-1))|0:32);}function rB(A,I){return 0|eI(A|=0,I|=0,32);}function tB(A,I){return 0|eI(A|=0,I|=0,16);}function fB(A,I){BA(0|(A|=0),0|(I|=0),1024);}function wB(A,I){return(A|=0)>>>(32-(I|=0)|0)|A<>>0>0|0==(0|E)&(Q|=0)>>>0>15?(E=0|sA(A|=0,0,B,g=0|vg(0|Q,0|E,-16,-1),r=0|o(),B+Q+-16|0,i,e,c,a,n),I&&(Q=0==(0|E)?g:0,g=0==(0|E)?r:0,t=4)):I?(Q=0,g=0,E=-1,t=4):E=-1,4==(0|t)&&(C[I>>2]=Q,C[I+4>>2]=g),0|E;},_crypto_aead_chacha20poly1305_decrypt_detached:sA,_crypto_aead_chacha20poly1305_encrypt:function _crypto_aead_chacha20poly1305_encrypt(A,I,g,B,Q,E,i,e,c,a,n){return A|=0,I|=0,g|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0,(Q|=0)>>>0>0|0==(0|Q)&(B|=0)>>>0>4294967279&&SB(),dA(A,A+B|0,0,g,B,Q,E,i,e,0,a,n),0|I&&(a=0|vg(0|B,0|Q,16,0),c=0|o(),C[I>>2]=a,C[I+4>>2]=c),0;},_crypto_aead_chacha20poly1305_encrypt_detached:dA,_crypto_aead_chacha20poly1305_ietf_abytes:GB,_crypto_aead_chacha20poly1305_ietf_decrypt:function _crypto_aead_chacha20poly1305_ietf_decrypt(A,I,g,B,Q,E,i,e,c,a,n){I|=0,g|=0,B|=0,i|=0,e|=0,c|=0,a|=0,n|=0;var r=0,t=0;return(E|=0)>>>0>0|0==(0|E)&(Q|=0)>>>0>15?(E=0|eA(A|=0,0,B,g=0|vg(0|Q,0|E,-16,-1),r=0|o(),B+Q+-16|0,i,e,c,a,n),I&&(Q=0==(0|E)?g:0,g=0==(0|E)?r:0,t=4)):I?(Q=0,g=0,E=-1,t=4):E=-1,4==(0|t)&&(C[I>>2]=Q,C[I+4>>2]=g),0|E;},_crypto_aead_chacha20poly1305_ietf_decrypt_detached:eA,_crypto_aead_chacha20poly1305_ietf_encrypt:function _crypto_aead_chacha20poly1305_ietf_encrypt(A,I,g,B,Q,E,i,e,c,a,n){return A|=0,I|=0,g|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0,(Q|=0)>>>0>0|0==(0|Q)&(B|=0)>>>0>4294967279&&SB(),fA(A,A+B|0,0,g,B,Q,E,i,e,0,a,n),0|I&&(a=0|vg(0|B,0|Q,16,0),c=0|o(),C[I>>2]=a,C[I+4>>2]=c),0;},_crypto_aead_chacha20poly1305_ietf_encrypt_detached:fA,_crypto_aead_chacha20poly1305_ietf_keybytes:YB,_crypto_aead_chacha20poly1305_ietf_keygen:sB,_crypto_aead_chacha20poly1305_ietf_messagebytes_max:FB,_crypto_aead_chacha20poly1305_ietf_npubbytes:function _crypto_aead_chacha20poly1305_ietf_npubbytes(){return 12;},_crypto_aead_chacha20poly1305_ietf_nsecbytes:MB,_crypto_aead_chacha20poly1305_keybytes:YB,_crypto_aead_chacha20poly1305_keygen:sB,_crypto_aead_chacha20poly1305_messagebytes_max:FB,_crypto_aead_chacha20poly1305_npubbytes:lB,_crypto_aead_chacha20poly1305_nsecbytes:MB,_crypto_aead_xchacha20poly1305_ietf_abytes:GB,_crypto_aead_xchacha20poly1305_ietf_decrypt:function _crypto_aead_xchacha20poly1305_ietf_decrypt(A,I,g,B,Q,E,i,e,c,a,n){I|=0,g|=0,B|=0,i|=0,e|=0,c|=0,a|=0,n|=0;var r=0,t=0;return(E|=0)>>>0>0|0==(0|E)&(Q|=0)>>>0>15?(E=0|PA(A|=0,0,B,g=0|vg(0|Q,0|E,-16,-1),r=0|o(),B+Q+-16|0,i,e,c,a,n),I&&(Q=0==(0|E)?g:0,g=0==(0|E)?r:0,t=4)):I?(Q=0,g=0,E=-1,t=4):E=-1,4==(0|t)&&(C[I>>2]=Q,C[I+4>>2]=g),0|E;},_crypto_aead_xchacha20poly1305_ietf_decrypt_detached:PA,_crypto_aead_xchacha20poly1305_ietf_encrypt:function _crypto_aead_xchacha20poly1305_ietf_encrypt(A,I,g,B,Q,E,i,e,c,a,n){return A|=0,I|=0,g|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0,(Q|=0)>>>0>0|0==(0|Q)&(B|=0)>>>0>4294967279&&SB(),NA(A,A+B|0,0,g,B,Q,E,i,e,0,a,n),0|I&&(a=0|vg(0|B,0|Q,16,0),c=0|o(),C[I>>2]=a,C[I+4>>2]=c),0;},_crypto_aead_xchacha20poly1305_ietf_encrypt_detached:NA,_crypto_aead_xchacha20poly1305_ietf_keybytes:YB,_crypto_aead_xchacha20poly1305_ietf_keygen:sB,_crypto_aead_xchacha20poly1305_ietf_messagebytes_max:FB,_crypto_aead_xchacha20poly1305_ietf_npubbytes:_B,_crypto_aead_xchacha20poly1305_ietf_nsecbytes:MB,_crypto_auth:function _crypto_auth(A,I,g,B,C){return JI(A|=0,I|=0,g|=0,B|=0,C|=0),0;},_crypto_auth_bytes:YB,_crypto_auth_keybytes:YB,_crypto_auth_keygen:sB,_crypto_auth_verify:function _crypto_auth_verify(A,I,g,B,C){return 0|function(A,I,g,B,C){var Q;return A|=0,Q=y,y=y+32|0,JI(Q,I|=0,g|=0,B|=0,C|=0),C=0|rB(A,Q),C=0|((0|Q)==(0|A)?-1:C)|EI(Q,A,32),y=Q,0|C;}(A|=0,I|=0,g|=0,B|=0,C|=0);},_crypto_box_beforenm:jg,_crypto_box_beforenmbytes:YB,_crypto_box_detached:FI,_crypto_box_detached_afternm:tg,_crypto_box_easy:KI,_crypto_box_easy_afternm:function _crypto_box_easy_afternm(A,I,g,B,C,Q){return A|=0,I|=0,C|=0,Q|=0,(B|=0)>>>0>0|0==(0|B)&(g|=0)>>>0>4294967279?(SB(),0):(tg(A+16|0,A,I,g,B,C,Q),0);},_crypto_box_keypair:CB,_crypto_box_macbytes:GB,_crypto_box_messagebytes_max:FB,_crypto_box_noncebytes:_B,_crypto_box_open_detached:DI,_crypto_box_open_detached_afternm:ng,_crypto_box_open_easy:dI,_crypto_box_open_easy_afternm:function _crypto_box_open_easy_afternm(A,I,g,B,C,Q){return I|=0,C|=0,Q|=0,0|((B|=0)>>>0<0|0==(0|B)&(g|=0)>>>0<16?-1:0|ng(A|=0,I+16|0,I,g=0|vg(0|g,0|B,-16,-1),0|o(),C,Q));},_crypto_box_publickeybytes:YB,_crypto_box_seal:function _crypto_box_seal(A,I,g,C,Q){A|=0,I|=0,g|=0,C|=0,Q|=0;var E,i=0,e=0,o=0;if(E=y,y=y+96|0,0|CB(E+32|0,E))g=-1;else{e=E+32|0,o=(i=A)+32|0;do{B[i>>0]=0|B[e>>0],i=i+1|0,e=e+1|0;}while((0|i)<(0|o));GI(E+64|0,E+32|0,Q),g=0|KI(A+32|0,I,g,C,E+64|0,Q,E),MI(E,32),MI(E+32|0,32),MI(E+64|0,24);}return y=E,0|g;},_crypto_box_seal_open:function _crypto_box_seal_open(A,I,g,B,C,Q){var E,i;return A|=0,I|=0,C|=0,Q|=0,i=y,E=y=y+63&-64,y=y+32|0,(B|=0)>>>0<0|0==(0|B)&(g|=0)>>>0<48?g=-1:(B=0|vg(0|g,0|B,-32,-1),g=0|o(),GI(E,I,C),g=0|dI(A,I+32|0,B,g,E,I,Q)),y=i,0|g;},_crypto_box_sealbytes:function _crypto_box_sealbytes(){return 48;},_crypto_box_secretkeybytes:YB,_crypto_box_seed_keypair:function _crypto_box_seed_keypair(A,I,g){return 0|tI(A|=0,I|=0,g|=0);},_crypto_box_seedbytes:YB,_crypto_generichash:Dg,_crypto_generichash_bytes:YB,_crypto_generichash_bytes_max:dB,_crypto_generichash_bytes_min:GB,_crypto_generichash_final:zg,_crypto_generichash_init:Lg,_crypto_generichash_keybytes:YB,_crypto_generichash_keybytes_max:dB,_crypto_generichash_keybytes_min:GB,_crypto_generichash_keygen:sB,_crypto_generichash_statebytes:function _crypto_generichash_statebytes(){return 384;},_crypto_generichash_update:Rg,_crypto_hash:function _crypto_hash(A,I,g,B){return RI(A|=0,I|=0,g|=0,B|=0),0;},_crypto_hash_bytes:dB,_crypto_kdf_bytes_max:dB,_crypto_kdf_bytes_min:GB,_crypto_kdf_contextbytes:lB,_crypto_kdf_derive_from_key:function _crypto_kdf_derive_from_key(A,I,g,B,C,Q){return 0|JA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0);},_crypto_kdf_keybytes:YB,_crypto_kdf_keygen:sB,_crypto_kx_client_session_keys:function _crypto_kx_client_session_keys(A,I,g,C,Q){var E,i,e;if(I|=0,g|=0,C|=0,Q|=0,e=y,i=y=y+63&-64,y=y+480|0,E=0==(0|(A|=0))?I:A,I=0==(0|I)?E:I,E||SB(),0|BB(i+448|0,C,Q))A=-1;else{Lg(i,0,0,64),Rg(i,i+448|0,32,0),MI(i+448|0,32),Rg(i,g,32,0),Rg(i,Q,32,0),zg(i,i+384|0,64),MI(i,384),A=0;do{B[E+A>>0]=0|B[i+384+A>>0],B[I+A>>0]=0|B[i+384+(A+32)>>0],A=A+1|0;}while(32!=(0|A));MI(i+384|0,64),A=0;}return y=e,0|A;},_crypto_kx_keypair:function _crypto_kx_keypair(A,I){return A|=0,Cg(I|=0,32),0|eB(A,I);},_crypto_kx_publickeybytes:YB,_crypto_kx_secretkeybytes:YB,_crypto_kx_seed_keypair:function _crypto_kx_seed_keypair(A,I,g){return A|=0,Dg(I|=0,32,g|=0,32,0,0,0),0|eB(A,I);},_crypto_kx_seedbytes:YB,_crypto_kx_server_session_keys:function _crypto_kx_server_session_keys(A,I,g,C,Q){var E,i,e;if(I|=0,g|=0,C|=0,Q|=0,e=y,i=y=y+63&-64,y=y+480|0,E=0==(0|(A|=0))?I:A,I=0==(0|I)?E:I,E||SB(),0|BB(i+448|0,C,Q))A=-1;else{Lg(i,0,0,64),Rg(i,i+448|0,32,0),MI(i+448|0,32),Rg(i,Q,32,0),Rg(i,g,32,0),zg(i,i+384|0,64),MI(i,384),A=0;do{B[I+A>>0]=0|B[i+384+A>>0],B[E+A>>0]=0|B[i+384+(A+32)>>0],A=A+1|0;}while(32!=(0|A));MI(i+384|0,64),A=0;}return y=e,0|A;},_crypto_kx_sessionkeybytes:YB,_crypto_pwhash:function _crypto_pwhash(A,I,g,B,Q,E,i,e,o,c,a){switch(A|=0,I|=0,g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,o|=0,c|=0,0|(a|=0)){case 1:I=0|function(A,I,g,B,Q,E,i,e,o,c){g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,o|=0,c|=0,YA(0|(A|=0),0,0|(I|=0));do{if(!(g>>>0>0|0==(0|g)&I>>>0>4294967295)){if(g>>>0<0|0==(0|g)&I>>>0<16){C[8678]=28,I=-1;break;}if((o|E)>>>0>0|0==(o|E|0)&(e|Q)>>>0>4294967295|c>>>0>2147483648){C[8678]=22,I=-1;break;}if(o>>>0<0|0==(0|o)&e>>>0<3|c>>>0<8192){C[8678]=28,I=-1;break;}I=(0!=(0|pg(e,c>>>10,B,Q,i,A,I)))<<31>>31;break;}C[8678]=22,I=-1;}while(0);return 0|I;}(A,I,g,B,Q,E,i,e,o,c);break;case 2:I=0|function(A,I,g,B,Q,E,i,e,o,c){g|=0,B|=0,Q|=0,E|=0,i|=0,e|=0,o|=0,c|=0,YA(0|(A|=0),0,0|(I|=0));do{if(!(g>>>0>0|0==(0|g)&I>>>0>4294967295)){if(g>>>0<0|0==(0|g)&I>>>0<16){C[8678]=28,I=-1;break;}if((o|E)>>>0>0|0==(o|E|0)&(e|Q)>>>0>4294967295|c>>>0>2147483648){C[8678]=22,I=-1;break;}if(0==(0|e)&0==(0|o)|c>>>0<8192){C[8678]=28,I=-1;break;}I=(0!=(0|Fg(e,c>>>10,B,Q,i,A,I)))<<31>>31;break;}C[8678]=22,I=-1;}while(0);return 0|I;}(A,I,g,B,Q,E,i,e,o,c);break;default:C[8678]=28,I=-1;}return 0|I;},_crypto_pwhash_alg_argon2i13:kB,_crypto_pwhash_alg_argon2id13:uB,_crypto_pwhash_alg_default:uB,_crypto_pwhash_bytes_max:HB,_crypto_pwhash_bytes_min:GB,_crypto_pwhash_memlimit_interactive:function _crypto_pwhash_memlimit_interactive(){return 67108864;},_crypto_pwhash_memlimit_max:function _crypto_pwhash_memlimit_max(){return-2147483648;},_crypto_pwhash_memlimit_min:function _crypto_pwhash_memlimit_min(){return 8192;},_crypto_pwhash_memlimit_moderate:function _crypto_pwhash_memlimit_moderate(){return 268435456;},_crypto_pwhash_memlimit_sensitive:function _crypto_pwhash_memlimit_sensitive(){return 1073741824;},_crypto_pwhash_opslimit_interactive:uB,_crypto_pwhash_opslimit_max:HB,_crypto_pwhash_opslimit_min:kB,_crypto_pwhash_opslimit_moderate:pB,_crypto_pwhash_opslimit_sensitive:function _crypto_pwhash_opslimit_sensitive(){return 4;},_crypto_pwhash_passwd_max:HB,_crypto_pwhash_passwd_min:MB,_crypto_pwhash_saltbytes:GB,_crypto_pwhash_str:function _crypto_pwhash_str(A,I,g,B,C,Q,E){return 0|LA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0);},_crypto_pwhash_str_alg:function _crypto_pwhash_str_alg(A,I,g,B,C,Q,E,i){A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0,E|=0;var e=0;switch(0|(i|=0)){case 1:e=0|RA(A,I,g,B,C,Q,E);break;case 2:e=0|LA(A,I,g,B,C,Q,E);break;default:SB();}return 0|e;},_crypto_pwhash_str_needs_rehash:function _crypto_pwhash_str_needs_rehash(A,I,g,B){A|=0,I|=0,g|=0,B|=0;do{if(0|oI(A,33713,10)){if(0|oI(A,33724,9)){C[8678]=28,I=-1;break;}I=0|mg(A,I,g,B);break;}I=0|Ng(A,I,g,B);}while(0);return 0|I;},_crypto_pwhash_str_verify:function _crypto_pwhash_str_verify(A,I,g,B){A|=0,I|=0,g|=0,B|=0;do{if(0|oI(A,33713,10)){if(0|oI(A,33724,9)){C[8678]=28,g=-1;break;}g=0|hI(A,I,g,B);break;}g=0|yI(A,I,g,B);}while(0);return 0|g;},_crypto_pwhash_strbytes:function _crypto_pwhash_strbytes(){return 128;},_crypto_pwhash_strprefix:function _crypto_pwhash_strprefix(){return 33713;},_crypto_scalarmult:BB,_crypto_scalarmult_base:eB,_crypto_scalarmult_bytes:YB,_crypto_scalarmult_scalarbytes:YB,_crypto_secretbox_detached:Z,_crypto_secretbox_easy:function _crypto_secretbox_easy(A,I,g,B,C,Q){return A|=0,I|=0,C|=0,Q|=0,(B|=0)>>>0>0|0==(0|B)&(g|=0)>>>0>4294967279?(SB(),0):(Z(A+16|0,A,I,g,B,C,Q),0);},_crypto_secretbox_keybytes:YB,_crypto_secretbox_keygen:sB,_crypto_secretbox_macbytes:GB,_crypto_secretbox_messagebytes_max:FB,_crypto_secretbox_noncebytes:_B,_crypto_secretbox_open_detached:gA,_crypto_secretbox_open_easy:function _crypto_secretbox_open_easy(A,I,g,B,C,Q){return I|=0,C|=0,Q|=0,0|((B|=0)>>>0<0|0==(0|B)&(g|=0)>>>0<16?-1:0|gA(A|=0,I+16|0,I,g=0|vg(0|g,0|B,-16,-1),0|o(),C,Q));},_crypto_secretstream_xchacha20poly1305_abytes:function _crypto_secretstream_xchacha20poly1305_abytes(){return 17;},_crypto_secretstream_xchacha20poly1305_headerbytes:_B,_crypto_secretstream_xchacha20poly1305_init_pull:function _crypto_secretstream_xchacha20poly1305_init_pull(A,I,g){var C;return R(A|=0,I|=0,g|=0),Mg(A),C=Q[I+16>>0]|Q[I+16+1>>0]<<8|Q[I+16+2>>0]<<16|Q[I+16+3>>0]<<24,g=Q[I+16+4>>0]|Q[I+16+4+1>>0]<<8|Q[I+16+4+2>>0]<<16|Q[I+16+4+3>>0]<<24,B[A+36>>0]=C,B[A+36+1>>0]=C>>8,B[A+36+2>>0]=C>>16,B[A+36+3>>0]=C>>24,B[A+36+4>>0]=g,B[A+36+4+1>>0]=g>>8,B[A+36+4+2>>0]=g>>16,B[A+36+4+3>>0]=g>>24,B[A+44>>0]=0,B[A+44+1>>0]=0,B[A+44+2>>0]=0,B[A+44+3>>0]=0,B[A+44+4>>0]=0,B[A+44+4+1>>0]=0,B[A+44+4+2>>0]=0,B[A+44+4+3>>0]=0,0;},_crypto_secretstream_xchacha20poly1305_init_push:function _crypto_secretstream_xchacha20poly1305_init_push(A,I,g){return A|=0,g|=0,Cg(I|=0,24),R(A,I,g),Mg(A),g=Q[I+16>>0]|Q[I+16+1>>0]<<8|Q[I+16+2>>0]<<16|Q[I+16+3>>0]<<24,I=Q[I+16+4>>0]|Q[I+16+4+1>>0]<<8|Q[I+16+4+2>>0]<<16|Q[I+16+4+3>>0]<<24,B[A+36>>0]=g,B[A+36+1>>0]=g>>8,B[A+36+2>>0]=g>>16,B[A+36+3>>0]=g>>24,B[A+36+4>>0]=I,B[A+36+4+1>>0]=I>>8,B[A+36+4+2>>0]=I>>16,B[A+36+4+3>>0]=I>>24,B[A+44>>0]=0,B[A+44+1>>0]=0,B[A+44+2>>0]=0,B[A+44+3>>0]=0,B[A+44+4>>0]=0,B[A+44+4+1>>0]=0,B[A+44+4+2>>0]=0,B[A+44+4+3>>0]=0,0;},_crypto_secretstream_xchacha20poly1305_keybytes:YB,_crypto_secretstream_xchacha20poly1305_keygen:sB,_crypto_secretstream_xchacha20poly1305_messagebytes_max:function _crypto_secretstream_xchacha20poly1305_messagebytes_max(){return-18;},_crypto_secretstream_xchacha20poly1305_pull:function _crypto_secretstream_xchacha20poly1305_pull(A,I,g,Q,E,i,e,c,a,n){A|=0,I|=0,Q|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0;var r,t,f=0,w=0,s=0;t=y,r=y=y+63&-64,y=y+352|0,0|(g|=0)&&(C[g>>2]=0,C[g+4>>2]=0),0|Q&&(B[Q>>0]=-1);do{if(e>>>0<0|0==(0|e)&i>>>0<17)c=-1;else{w=0|vg(0|i,0|e,-17,-1),(s=0|o())>>>0>0|0==(0|s)&w>>>0>4294967278&&SB(),OI(r+16|0,64,0,A+32|0,A),gB(r+80|0,r+16|0),MI(r+16|0,64),bg(r+80|0,c,a,n),c=0|Ug(0,0,0|a,0|n),o(),bg(r+80|0,34672,15&c,0),f=64+(c=r+16|0)|0;do{C[c>>2]=0,c=c+4|0;}while((0|c)<(0|f));if(B[r+16>>0]=0|B[E>>0],rI(r+16|0,r+16|0,64,0,A+32|0,1,A),c=0|B[r+16>>0],B[r+16>>0]=0|B[E>>0],bg(r+80|0,r+16|0,64,0),bg(r+80|0,E+1|0,w,s),f=0|vg(0|i,0|e,15,0),o(),bg(r+80|0,34672,15&f,0),LI(r+336|0,a,n),bg(r+80|0,r+336|0,8,0),LI(r+336|0,n=0|vg(0|i,0|e,47,0),0|o()),bg(r+80|0,r+336|0,8,0),IB(r+80|0,r),MI(r+80|0,256),0|EI(r,E+1+w|0,16)){MI(r,16),c=-1;break;}rI(I,E+1|0,w,s,A+32|0,2,A),ag(A+36|0,r),Ig(A+32|0),(0!=(2&c)||0|lI(A+32|0,4))&&wA(A),0|g&&(C[g>>2]=w,C[g+4>>2]=s),0|Q?(B[Q>>0]=c,c=0):c=0;}}while(0);return y=t,0|c;},_crypto_secretstream_xchacha20poly1305_push:function _crypto_secretstream_xchacha20poly1305_push(A,I,g,Q,E,i,e,c,a,n){A|=0,I|=0,Q|=0,E|=0,i|=0,e|=0,c|=0,a|=0,n|=0;var r,t,f=0;t=y,f=y=y+63&-64,y=y+336|0,0|(g|=0)&&(C[g>>2]=0,C[g+4>>2]=0),i>>>0>0|0==(0|i)&E>>>0>4294967278&&SB(),OI(f,64,0,A+32|0,A),gB(f+64|0,f),MI(f,64),bg(f+64|0,e,c,a),e=0|Ug(0,0,0|c,0|a),o(),bg(f+64|0,34672,15&e,0),r=(e=f)+64|0;do{C[e>>2]=0,e=e+4|0;}while((0|e)<(0|r));return B[f>>0]=n,rI(f,f,64,0,A+32|0,1,A),bg(f+64|0,f,64,0),B[I>>0]=0|B[f>>0],rI(I+1|0,Q,E,i,A+32|0,2,A),bg(f+64|0,I+1|0,E,i),bg(f+64|0,34672,15&E,0),LI(f+320|0,c,a),bg(f+64|0,f+320|0,8,0),LI(f+320|0,Q=0|vg(0|E,0|i,64,0),0|o()),bg(f+64|0,f+320|0,8,0),IB(f+64|0,I+1+E|0),MI(f+64|0,256),ag(A+36|0,I+1+E|0),Ig(A+32|0),(0!=(2&n)||0|lI(A+32|0,4))&&wA(A),0|g&&(n=0|vg(0|E,0|i,17,0),f=0|o(),C[g>>2]=n,C[g+4>>2]=f),y=t,0;},_crypto_secretstream_xchacha20poly1305_rekey:wA,_crypto_secretstream_xchacha20poly1305_statebytes:function _crypto_secretstream_xchacha20poly1305_statebytes(){return 52;},_crypto_secretstream_xchacha20poly1305_tag_final:pB,_crypto_secretstream_xchacha20poly1305_tag_message:MB,_crypto_secretstream_xchacha20poly1305_tag_push:kB,_crypto_secretstream_xchacha20poly1305_tag_rekey:uB,_crypto_shorthash:function _crypto_shorthash(A,I,g,B,C){return G(A|=0,I|=0,g|=0,B|=0,C|=0),0;},_crypto_shorthash_bytes:lB,_crypto_shorthash_keybytes:GB,_crypto_shorthash_keygen:function _crypto_shorthash_keygen(A){Cg(A|=0,16);},_crypto_sign:function _crypto_sign(A,I,g,B,C,Q){return 0|TA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0);},_crypto_sign_bytes:dB,_crypto_sign_detached:function _crypto_sign_detached(A,I,g,B,C,Q){return kg(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0),0;},_crypto_sign_ed25519_pk_to_curve25519:function _crypto_sign_ed25519_pk_to_curve25519(A,I){var g,B;return A|=0,B=y,g=y=y+63&-64,y=y+256|0,0==(0|GA(I|=0))&&0==(0|rA(g+88|0,I))&&0!=(0|function(A){var I,g;return I=y,g=y=y+63&-64,y=y+160|0,O(g,A|=0),A=0|cg(g),y=I,0|A;}(g+88|0))?(Sg(g),lA(g,g,g+88+40|0),Sg(g+48|0),_A(g+48|0,g+48|0,g+88+40|0),W(g,g),u(g+48|0,g+48|0,g),CA(A,g+48|0),A=0):A=-1,y=B,0|A;},_crypto_sign_ed25519_sk_to_curve25519:function _crypto_sign_ed25519_sk_to_curve25519(A,I){var g,C,Q;A|=0,C=y,Q=y=y+63&-64,y=y+64|0,RI(Q,I|=0,32,0),B[Q>>0]=-8&B[Q>>0],B[Q+31>>0]=63&B[Q+31>>0]|64,I=Q,g=A+32|0;do{B[A>>0]=0|B[I>>0],A=A+1|0,I=I+1|0;}while((0|A)<(0|g));return MI(Q,64),y=C,0;},_crypto_sign_final_create:function _crypto_sign_final_create(A,I,g,B){return function(A,I,g,B){var C,Q;I|=0,g|=0,B|=0,C=y,Q=y=y+63&-64,y=y+64|0,VI(A|=0,Q),hA(I,g,Q,64,0,B,1),y=C;}(A|=0,I|=0,g|=0,B|=0),0;},_crypto_sign_final_verify:function _crypto_sign_final_verify(A,I,g){return 0|function(A,I,g){var B,C;return I|=0,g|=0,B=y,C=y=y+63&-64,y=y+64|0,VI(A|=0,C),A=0|uA(I,C,64,0,g,1),y=B,0|A;}(A|=0,I|=0,g|=0);},_crypto_sign_init:function _crypto_sign_init(A){return function(A){PI(A|=0);}(A|=0),0;},_crypto_sign_keypair:function _crypto_sign_keypair(A,I){return function(A,I){var g,B;A|=0,I|=0,g=y,B=y=y+63&-64,y=y+32|0,Cg(B,32),wI(A,I,B),MI(B,32),y=g;}(A|=0,I|=0),0;},_crypto_sign_messagebytes_max:function _crypto_sign_messagebytes_max(){return-65;},_crypto_sign_open:function _crypto_sign_open(A,I,g,B,C,Q){return 0|SA(A|=0,I|=0,g|=0,B|=0,C|=0,Q|=0);},_crypto_sign_publickeybytes:YB,_crypto_sign_secretkeybytes:dB,_crypto_sign_seed_keypair:function _crypto_sign_seed_keypair(A,I,g){return wI(A|=0,I|=0,g|=0),0;},_crypto_sign_seedbytes:YB,_crypto_sign_statebytes:function _crypto_sign_statebytes(){return 208;},_crypto_sign_update:function _crypto_sign_update(A,I,g,B){return xg(A|=0,I|=0,g|=0,B|=0),0;},_crypto_sign_verify_detached:function _crypto_sign_verify_detached(A,I,g,B,C){return 0|dg(A|=0,I|=0,g|=0,B|=0,C|=0);},_emscripten_get_sbrk_ptr:function _emscripten_get_sbrk_ptr(){return 35232;},_emscripten_replace_memory:function _emscripten_replace_memory(A){return B=new Int8Array(A),Q=new Uint8Array(A),C=new Int32Array(A),g=A,!0;},_free:d,_i64Add:vg,_i64Subtract:Ug,_malloc:F,_memcpy:BA,_memmove:YI,_memset:YA,_randombytes:function _randombytes(A,I,g){(g|=0)>>>0<1|1==(0|g)&(I|=0)>>>0<0?Cg(A|=0,I):c(34506,34526,197,34552);},_randombytes_buf:Cg,_randombytes_buf_deterministic:function _randombytes_buf_deterministic(A,I,g){OI(A|=0,I|=0,0,34494,g|=0);},_randombytes_close:MB,_randombytes_random:DB,_randombytes_seedbytes:YB,_randombytes_stir:hB,_randombytes_uniform:function _randombytes_uniform(A){var I=0;if((A|=0)>>>0<2)I=0;else{do{I=0|DB();}while(I>>>0<(((0-A|0)>>>0)%(A>>>0)|0)>>>0);I=(I>>>0)%(A>>>0)|0;}return 0|I;},_sodium_base642bin:m,_sodium_base64_encoded_len:function _sodium_base64_encoded_len(A,I){var g;return A|=0,EB(I|=0),(((A>>>0)/3|0)<<2|1)+(4-(3-(g=(0|E((A>>>0)/3|0,-3))+A|0)&0-(I>>>1&1))&0-(1&(g>>>1|g)))|0;},_sodium_bin2base64:q,_sodium_bin2hex:function _sodium_bin2hex(A,I,g,C){A|=0,g|=0;var E=0,i=0;if((C|=0)>>>0<2147483647&C<<1>>>0<(I|=0)>>>0||SB(),C){I=0;do{i=0|Q[g+I>>0],B[A+(E=I<<1)>>0]=87+(i>>>4)+((65526+(i>>>4)|0)>>>8&217),B[A+(1|E)>>0]=(22272+((15&i)<<8)+(65526+(15&i)&55552)|0)>>>8,I=I+1|0;}while((0|I)!=(0|C));I=C<<1;}else I=0;return B[A+I>>0]=0,0|A;},_sodium_hex2bin:function _sodium_hex2bin(A,I,g,E,i,e,o){A|=0,I|=0,g|=0,E|=0,i|=0,e|=0,o|=0;var c=0,a=0,n=0,r=0,t=0,f=0,w=0;A:do{if(E){r=0,f=0,c=0,a=0;I:for(;;){for(;!(255&((t=(65526+(201+(223&(n=0|Q[g+c>>0]))&255)^65520+(201+(223&n)&255))>>>8)|(65526+(48^n)|0)>>>8)|0);){if(!(0!=(0|i)&a<<24>>24==0)){n=0;break I;}if(!(0|qg(i,n))){a=r,w=17;break A;}if(!((c=c+1|0)>>>0>>0)){a=r,w=17;break A;}a=0;}if(n=t&201+(223&n)|(65526+(48^n)|0)>>>8&(48^n),r>>>0>=I>>>0){w=9;break;}if(a<<24>>24?(B[A+r>>0]=n|255&f,r=r+1|0,n=f):n=n<<4&255,a=~a,!((c=c+1|0)>>>0>>0)){n=0;break;}f=n;}if(9==(0|w)&&(C[8678]=68,n=-1),a<<24>>24){C[8678]=28,n=0,a=c+-1|0,c=-1;break;}if(n){n=0,a=c,c=-1;break;}a=r,w=17;break;}a=0,c=0,w=17;}while(0);return 17==(0|w)&&(n=a,a=c,c=0),o?C[o>>2]=g+a:(0|a)!=(0|E)&&(C[8678]=28,c=-1),0|e&&(C[e>>2]=n),0|c;},_sodium_init:function _sodium_init(){var A=0;return 0|C[8676]?A=1:(function(){return A=y,I=y=y+63&-64,y=y+16|0,Zg(I),0|C[I>>2]&&Zg(I),void(y=A);var A,I;}(),hB(),function(){var A=0;(0|(A=0|w(30)))>0?C[8677]=A:A=0|C[8677],A>>>0<16?SB():Cg(34688,16);}(),C[8676]=1,A=0),0|A;},_sodium_library_minimal:kB,_sodium_library_version_major:function _sodium_library_version_major(){return 10;},_sodium_library_version_minor:pB,_sodium_pad:function _sodium_pad(A,I,g,E,i){A|=0,I|=0,g|=0,i|=0;var e,o,c=0,a=0;if(o=y,e=y=y+63&-64,y=y+16|0,E|=0){if((a=E+-1-(c=E+-1&E?(g>>>0)%(E>>>0)|0:E+-1&g)|0)>>>0>=~g>>>0&&SB(),(a+g|0)>>>0>>0){0|A&&(C[A>>2]=a+g+1),B[e>>0]=0,c=0;do{A=((c^a)-1|0)>>>24,B[(i=I+(a+g)+(0-c)|0)>>0]=128&A|B[e>>0]&B[i>>0]&255,B[e>>0]=0|A|Q[e>>0],c=c+1|0;}while((0|c)!=(0|E));c=0;}else c=-1;}else c=-1;return y=o,0|c;},_sodium_unpad:function _sodium_unpad(A,I,g,B){A|=0,I|=0,g|=0,B|=0;var E,i,e=0,o=0,c=0,a=0,n=0;if(i=y,E=y=y+63&-64,y=y+16|0,C[E>>2]=0,(B+-1|0)>>>0>>0){for(e=0,c=0,a=0;e&=255,o=0|Q[I+(g+-1)+(0-c)>>0],n=(511+(0|C[E>>2])&e+511&511+(128^o))>>>8&1,C[E>>2]=c&0-n|C[E>>2],a=n|255&a,(0|(c=c+1|0))!=(0|B);){e|=o;}C[A>>2]=g+-1-(0|C[E>>2]),e=a+-1|0;}else e=-1;return y=i,0|e;},_sodium_version_string:function _sodium_version_string(){return 34617;},establishStackSpace:function establishStackSpace(A,I){y=A|=0;},stackAlloc:function stackAlloc(A){var I;return I=y,y=15+(y=y+(A|=0)|0)&-16,0|I;},stackRestore:function stackRestore(A){y=A|=0;},stackSave:function stackSave(){return 0|y;}};}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array},{a:j,b:function b(A){s=A;},c:function c(){return s;},d:function d(A,I,g,B){j("Assertion failed: "+_d(A)+", at: "+[I?_d(I):"unknown filename",g,B?_d(B):"unknown function"]);},e:BA,f:function f(){j();},g:function g(A){return O[A]();},h:IA,i:function i(A,I,g){u.set(u.subarray(I,I+g),A);},j:function j(A){var I=IA();if(A>2130706432)return!1;for(var g=Math.max(I,16777216);g>0]=I;break;case"i16":H[A>>1]=I;break;case"i32":k[A>>2]=I;break;case"i64":q=[I>>>0,(T=I,+R(T)>=1?T>0?(0|L(+m(T/4294967296),4294967295))>>>0:~~+N((T-+(~~T>>>0))/4294967296)>>>0:0)],k[A>>2]=q[0],k[A+4>>2]=q[1];break;case"float":l[A>>2]=I;break;case"double":_[A>>3]=I;break;default:j("invalid type for setValue: "+g);}},I.getValue=function(A,I,g){switch("*"===(I=I||"i8").charAt(I.length-1)&&(I="i32"),I){case"i1":case"i8":return p[A>>0];case"i16":return H[A>>1];case"i32":case"i64":return k[A>>2];case"float":return l[A>>2];case"double":return _[A>>3];default:j("invalid type for getValue: "+I);}return null;},I.UTF8ToString=_d,V)if(W(V)||(eA=V,V=I.locateFile?I.locateFile(eA,f):f+eA),o||i){var nA=n(V);u.set(nA,8);}else{x++,I.monitorRunDependencies&&I.monitorRunDependencies(x);var rA=function rA(A){A.byteLength&&(A=new Uint8Array(A)),u.set(A,8),I.memoryInitializerRequest&&delete I.memoryInitializerRequest.response,function(A){if(x--,I.monitorRunDependencies&&I.monitorRunDependencies(x),0==x&&(null!==K&&(clearInterval(K),K=null),X)){var g=X;X=null,g();}}();},tA=function tA(){a(V,rA,function(){throw"could not load memory initializer "+V;});},fA=iA(V);if(fA)rA(fA.buffer);else if(I.memoryInitializerRequest){var wA=function wA(){var A=I.memoryInitializerRequest,g=A.response;if(200!==A.status&&0!==A.status){var B=iA(I.memoryInitializerRequestURL);if(!B)return void tA();g=B.buffer;}rA(g);};I.memoryInitializerRequest.response?setTimeout(wA,0):I.memoryInitializerRequest.addEventListener("load",wA);}else tA();}function yA(A){function g(){oA||(oA=!0,h||(U(b),U(J),I.onRuntimeInitialized&&I.onRuntimeInitialized(),function(){if(I.postRun)for("function"==typeof I.postRun&&(I.postRun=[I.postRun]);I.postRun.length;){A=I.postRun.shift(),P.unshift(A);}var A;U(P);}()));}A=A||e,x>0||(function(){if(I.preRun)for("function"==typeof I.preRun&&(I.preRun=[I.preRun]);I.preRun.length;){A=I.preRun.shift(),v.unshift(A);}var A;U(v);}(),x>0||(I.setStatus?(I.setStatus("Running..."),setTimeout(function(){setTimeout(function(){I.setStatus("");},1),g();},1)):g()));}if(X=function A(){oA||yA(),oA||(X=A);},I.run=yA,I.preInit)for("function"==typeof I.preInit&&(I.preInit=[I.preInit]);I.preInit.length>0;){I.preInit.pop()();}yA(),Object.keys(B).forEach(function(A){"getRandomValue"!==A&&delete B[A];}),Object.keys(I).forEach(function(A){B[A]=I[A];});};var g,C=void 0!==C?C:{},Q={};for(g in C){C.hasOwnProperty(g)&&(Q[g]=C[g]);}var E,i,e=[],o=!1,c=!1,a=!1;o="object"==(typeof window==="undefined"?"undefined":_typeof(window)),c="function"==typeof importScripts,E="object"==(typeof process==="undefined"?"undefined":_typeof(process))&&"object"==_typeof(process.versions)&&"string"==typeof process.versions.node,a=E&&!o&&!c,i=!o&&!a&&!c;var n,r,t,f,w="";a?(w=__dirname+"/",n=function n(A,I){var g;return(g=eA(A))||(t||(t=__webpack_require__(/*! fs */0)),f||(f=__webpack_require__(/*! path */"./node_modules/path-browserify/index.js")),A=f.normalize(A),g=t.readFileSync(A)),I?g:g.toString();},r=function r(A){var I=n(A,!0);return I.buffer||(I=new Uint8Array(I)),H(I.buffer),I;},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),e=process.argv.slice(2), true&&(module.exports=C),process.on("unhandledRejection",z),C.inspect=function(){return"[Emscripten Module object]";}):i?("undefined"!=typeof read&&(n=function n(A){var I=eA(A);return I?EA(I):read(A);}),r=function r(A){var I;return(I=eA(A))?I:"function"==typeof readbuffer?new Uint8Array(readbuffer(A)):(H("object"==_typeof(I=read(A,"binary"))),I);},"undefined"!=typeof scriptArgs?e=scriptArgs:void 0!==arguments&&(e=arguments),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(o||c)&&(c?w=self.location.href:document.currentScript&&(w=document.currentScript.src),w=0!==w.indexOf("blob:")?w.substr(0,w.lastIndexOf("/")+1):"",n=function n(A){try{var I=new XMLHttpRequest();return I.open("GET",A,!1),I.send(null),I.responseText;}catch(I){var g=eA(A);if(g)return EA(g);throw I;}},c&&(r=function r(A){try{var I=new XMLHttpRequest();return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response);}catch(I){var g=eA(A);if(g)return g;throw I;}}));var y=C.print||void 0,s=C.printErr||void 0;for(g in Q){Q.hasOwnProperty(g)&&(C[g]=Q[g]);}Q=null,C.arguments&&(e=C.arguments),C.thisProgram&&C.thisProgram,C.quit&&C.quit;var h,D,F={"f64-rem":function f64Rem(A,I){return A%I;},debugger:function _debugger(){}};new Array(8),C.wasmBinary&&(h=C.wasmBinary),C.noExitRuntime&&C.noExitRuntime,"object"!=(typeof WebAssembly==="undefined"?"undefined":_typeof(WebAssembly))&&s("no native wasm support detected");var p=new WebAssembly.Table({initial:0,maximum:0,element:"anyfunc"}),u=!1;function H(A,I){A||z("Assertion failed: "+I);}var k,l,_,G,_d2,Y,M,S="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function U(A,I){return A?function(A,I,g){for(var B=I+g,C=I;A[C]&&!(C>=B);){++C;}if(C-I>16&&A.subarray&&S)return S.decode(A.subarray(I,C));for(var Q="";I>10,56320|1023&o);}}else Q+=String.fromCharCode((31&E)<<6|i);}else Q+=String.fromCharCode(E);}return Q;}(_,A,I):"";}function v(A,I){return A%I>0&&(A+=I-A%I),A;}function b(A){k=A,C.HEAP8=l=new Int8Array(A),C.HEAP16=G=new Int16Array(A),C.HEAP32=_d2=new Int32Array(A),C.HEAPU8=_=new Uint8Array(A),C.HEAPU16=new Uint16Array(A),C.HEAPU32=new Uint32Array(A),C.HEAPF32=Y=new Float32Array(A),C.HEAPF64=M=new Float64Array(A);}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var J=C.TOTAL_MEMORY||16777216;function P(A){for(;A.length>0;){var I=A.shift();if("function"!=typeof I){var g=I.func;"number"==typeof g?void 0===I.arg?C.dynCall_v(g):C.dynCall_vi(g,I.arg):g(void 0===I.arg?null:I.arg);}else I();}}(D=C.wasmMemory?C.wasmMemory:new WebAssembly.Memory({initial:J/65536}))&&(k=D.buffer),J=k.byteLength,b(k),_d2[9312]=5280320;var R=[],N=[],m=[],L=[],x=Math.abs,K=Math.ceil,X=Math.floor,j=Math.min,T=0,q=null,V=null;function z(A){throw C.onAbort&&C.onAbort(A),y(A+=""),s(A),u=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info.";}C.preloadedImages={},C.preloadedAudios={};var W="data:application/octet-stream;base64,";function O(A){return String.prototype.startsWith?A.startsWith(W):0===A.indexOf(W);}var Z,$,AA,IA="data:application/octet-stream;base64,AGFzbQEAAAABxQM0YAR/f39/AGAAAGABfwF/YAABf2ADf39/AX9gAX8AYAJ/fwBgCX9/f39+f35/fwF/YAJ/fgBgCH9/f35/fn9/AX9gCH9/fn9/fn9/AX9gCX9/f39+f35/fwBgBH9/fn8AYAR/f35/AX9gAn9/AX9gBn9/f35/fwF/YAd/f39+f39/AX9gBX9/fn9/AX9gBn9/fn9/fwF/YAN/f38AYAF/AX5gA39/fwF+YAR/f39/AX9gA39/fgF/YAJ+fwF+YAN/f34AYAV/f39/fwBgBn9/f39+fwBgBX9/f39/AX9gBn9/f39/fwF/YAJ+fgF+YAx/f39/f39/f39/f38Bf2AHf35/fn9+fwF/YAV/f35+fwF/YAR/fn9/AX9gCH9+f35/fn9/AX9gBn9/fn5/fwF/YAN/fn8Bf2AIf39/f35/fn8Bf2AIf39/f39+f34Bf2AFf39/fn8Bf2AGf39/fn9/AGAFf39/fn8AYAV/f35/fwBgBH9+f38AYAZ/f35/f38AYAR/f39+AGAHf39/f39/fwF/YAh/f39/f39/fwF/YAZ/f35/fn8AYAt/f39/f39/f39/fwF/YAp/f39/f39/f39/AX8CSAgDZW52AWEAAQNlbnYBYgACA2VudgFjAAADZW52AWQAAgNlbnYBZQACA2VudgFmAAQDZW52AWcAAwNlbnYGbWVtb3J5AgCAAgPiAuACGA4eBgYTBhgZFRQIEw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F4cSADRg0CIAEhAAwBCwsgBiACNgIAIAIgADYCGCACIAI2AgwgAiACNgIIDAILCyABKAIIIgAgAjYCDCABIAI2AgggAiAANgIIIAIgATYCDCACQQA2AhgLBUGQlwIgBCAGcjYCACAAIAI2AgAgAiAANgIYIAIgAjYCDCACIAI2AggLQayXAkGslwIoAgBBf2oiADYCACAABEAPC0HUmgIhAANAIAAoAgAiAUEIaiEAIAENAAtBrJcCQX82AgALBABBIAvGAwEDfyACQYDAAE4EQCAAIAEgAhAFGiAADwsgACEEIAAgAmohAyAAQQNxIAFBA3FGBEADQCAAQQNxBEAgAkUEQCAEDwsgACABLAAAOgAAIABBAWohACABQQFqIQEgAkEBayECDAELCyADQXxxIgJBQGohBQNAIAAgBUwEQCAAIAEoAgA2AgAgACABKAIENgIEIAAgASgCCDYCCCAAIAEoAgw2AgwgACABKAIQNgIQIAAgASgCFDYCFCAAIAEoAhg2AhggACABKAIcNgIcIAAgASgCIDYCICAAIAEoAiQ2AiQgACABKAIoNgIoIAAgASgCLDYCLCAAIAEoAjA2AjAgACABKAI0NgI0IAAgASgCODYCOCAAIAEoAjw2AjwgAEFAayEAIAFBQGshAQwBCwsDQCAAIAJIBEAgACABKAIANgIAIABBBGohACABQQRqIQEMAQsLBSADQQRrIQIDQCAAIAJIBEAgACABLAAAOgAAIAAgASwAAToAASAAIAEsAAI6AAIgACABLAADOgADIABBBGohACABQQRqIQEMAQsLCwNAIAAgA0gEQCAAIAEsAAA6AAAgAEEBaiEAIAFBAWohAQwBCwsgBAsKACAAIAEgAhA7C5gCAQR/IAAgAmohBCABQf8BcSEDIAJBwwBOBEADQCAAQQNxBEAgACADOgAAIABBAWohAAwBCwsgA0EIdCADciADQRB0ciADQRh0ciEBIARBfHEiBUFAaiEGA0AgACAGTARAIAAgATYCACAAIAE2AgQgACABNgIIIAAgATYCDCAAIAE2AhAgACABNgIUIAAgATYCGCAAIAE2AhwgACABNgIgIAAgATYCJCAAIAE2AiggACABNgIsIAAgATYCMCAA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WKQMAIiBBARAHISUgFUEQakEDdCACaiAcICJ8ICBBCBAHICUgIEIHiIWFfCIiNwMAIB1BExAHIRwgHUE9EAcgHCAdQgaIhYUhHCAIQQlqQQN0IAJqKQMAISUgCEEBakEDdCACaikDACIdQQEQByEmIAhBEGpBA3QgAmogICAlfCAcfCAdQQgQByAmIB1CB4iFhXwiIDcDACAiQRMQByEcICJBPRAHIBwgIkIGiIWFISIgDUEJakEDdCACaikDACAifCEiIB5BARAHIRwgDUEQakEDdCACaiAdICJ8IB5BCBAHIBwgHkIHiIWFfCIdNwMAICBBExAHISIgIEE9EAcgIiAgQgaIhYUhIiAJQQlqQQN0IAJqKQMAIRwgCUEBakEDdCACaikDACIgQQEQByElIAlBEGpBA3QgAmogHCAefCAifCAgQQgQByAlICBCB4iFhXwiHjcDACAdQRMQByEiIB1BPRAHICIgHUIGiIWFIR0gDkEJakEDdCACaikDACAdfCEdIB9BARAHISIgDkEQakEDdCACaiAdICB8IB9BCBAHICIgH0IHiIWFfCIdNwMAIB5BExAHISAgHkE9EAcgICAeQgaIhYUhICAKQQlqQQN0IAJqKQMAISIgCkEBakEDdCACaikDACIeQQEQByEcIApBEGpBA3QgAmogHyAifCAgfCAeQQgQByAcIB5CB4iFhXwiHzcDACAdQRMQByEgIB1BPRAHICAgHUIGiIWFIR0gD0EJakEDdCACaikDACAdfCEdICFBARAHISAgD0EQakEDdCACaiAdIB58ICFBCBAHICAgIUIHiIWFfCIeNwMAIB9BExAHIR0gH0E9EAcgHSAfQgaIhYUhHSALQQlqQQN0IAJqKQMAISAgC0EBakEDdCACaikDACIfQQEQByEiIAtBEGpBA3QgAmogICAhfCAdfCAfQQgQByAiIB9CB4iFhXwiHzcDACAeQRMQByEhIB5BPRAHICEgHkIGiIWFIR4gEEEJakEDdCACaikDACEhICNBARAHIR0gEEEQakEDdCACaiAhICR8IB58ICNBCBAHIB0gI0IHiIWFfDcDACAfQRMQByEeIB9BPRAHIB4gH0IGiIWFIR8gDEEJakEDdCACa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YQCyAAQQhqIAwQCyAAQQxqIAUQCyAAQRBqIA4QCyAAQRRqIAMQCyAAQRhqIAcQCyAAQRxqIAEQCwveEwIIfx9+IAAsAAAgACwAASAAQQJqIgIsAAAQEEL///8AgyETAn4gAhARQgWIQv///wCDIScgACwABSAALAAGIABBB2oiAywAABAQQgKIQv///wCDIR8gAxARQgeIQv///wCDISAgAEEKaiIHEBFCBIhC////AIMhGSAALAANIAAsAA4gAEEPaiIELAAAEBBCAYhC////AIMhISAEEBFCBohC////AIMhFCAALAASIAAsABMgACwAFBAQQgOIQv///wCDIRogACwAFSAALAAWIABBF2oiBSwAABAQQv///wCDIRUgBRARQgWIQv///wCDIRsgACwAGiAALAAbIABBHGoiBiwAABAQQgKIQv///wCDIRYgBhARQgeIQv///wCDIRwgAEEfaiIIEBFCBIhC////AIMhECAALAAiIAAsACMgAEEkaiIBLAAAEBBCAYhC////AIMhESABEBFCBohC////AIMhEgJ+IAAsACcgACwAKCAALAApEBBCA4hC////AIMhJiAALAAqIAAsACsgAEEsaiIBLAAAEBBC////AIMhDCABEBFCBYhC////AIMhHSAALAAvIAAsADAgAEExaiIBLAAAEBBCAohC////AIMhCSABEBFCB4hC////AIMhCiAAQTRqEBFCBIhC////AIMhCyAALAA3IAAsADggAEE5aiIBLAAAEBBCAYhC////AIMhDSABEBFCBohC////AIMhDiAAQTxqEBFCA4giD0KDoVZ+IAx8IQwgC0KDoVZ+IBF8IA1C0asIfnwgD0Ln9id+fCAOQtOMQ358IApCg6FWfiAQfCALQtGrCH58IA1C04xDfnwgD0KY2hx+fCAOQuf2J358Ih5CgIBAfSIiQhWHfCERICYLIA9C0asIfnwgDkKDoVZ+fCANQoOhVn4gEnwgD0LTjEN+fCAOQtGrCH58IiNCgIBAfSIkQhWHfCESIB0gDEKAgEB9IhdCFYd8IRAgHiAiQoCAgH+DfSAJQoOhVn4gHHwgCkLRqwh+fCALQtOMQ358IA1C5/YnfnwgD0KT2Ch+fCAOQpjaHH58IBYgCULRqwh+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AAsPACAAQXlxQQFHBEAQAAsLEQAgACABIAIgA0IAIAQQiwELIAAgAkL/////D1YEQBAABSAAIAEgAiADIAQgBRCWAQsLHAAgAUL/////D1YEQBAABSAAIAEgAiADEJACCwsVACAAEDogAQRAIABB8IwCQiIQHQsLngEBA38CfyMAIQMjAEE/akFAcSQAIwAhASMAQTBqJAAgASAAKQAANwAAIAEgACkACDcACCABIAApABA3ABAgASAAKQAYNwAYIAEgACkAJDcDICABIAFCKCAAQSBqQQAgABCWASAAIAEpAAA3AAAgACABKQAINwAIIAAgASkAEDcAECAAIAEpABg3ABggACABKQMgNwAkIAAQZSADCyQACwkAIABBATYAIAuWAgIFfwJ+An8jACEKIwBBP2pBQHEkACMAIQYjAEHgAGokACAGIAQgBRBRIAZBIGoiBSAEQRBqIgQgBhD7ASACIAEgAyAFENMCBH8gBkEgEApBfwUgAARAIAEgAE9BACABIABrrSADVBsgACABT0EAIAAgAWutIANUG3IEQCAAIAEgA6cQLBogACEBC0IgIAMgA0IgViICGyILQgBRBEAgBSAFQiAgBCAGEGAFIAVBIGoiCCABQX8gA0J/hSIMQl8gDEJfVhunayIJEBgaIAUgBSALQiB8IAQgBhBgIAAgCCAJEBgaCyACBEAgACALpyICaiABIAJqIAMgC30gBCAGEJMBCyAGQSAQCgtBAAshACAKCyQAIAALxQICB38CfgJ/IwAhDCMAQT9qQUBxJAAjACEHIwBB4AJqJAAgB0EgaiEGIAciCCAEIAUQUSAAIAJLQQAgACIFIAIiCWutIANUGyACIABLQQAgCSAFa60gA1QbcgRAIAAgAiADpxAsGiAAIQILIAZCADcDACAGQgA3AwggBkIANwMQIAZCADcDGEIgIAMgA0IgViIFGyINQgBRIglFBEAgBkEgaiACQX8gA0J/hSIOQl8gDkJfVhunaxAYGgsgBiAGIA1CIHwgBEEQaiILIAgQYCAHQeAAaiIEIAYQJiAJRQRAIAAgBkEgakF/IANCf4UiDkJfIA5CX1Ybp2sQGBoLIAZBwAAQCiAFBEAgACANpyIFaiACIAVqI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wMAIABBAWoiAEEIRw0ACyACIAEQMCACIAQQMiAVCyQAC+0BAQF/IAAEfyAAKAIABH8gACgCBEEQSQR/QX4FAn8gACgCCEUEQEFuIAAoAgwNARoLIAAoAhQhASAAKAIQRQRAQW1BeiABGw8LIAFBCEkEf0F6BSAAKAIYRQRAQWwgACgCHA0CGgsgACgCIEUEQEFrIAAoAiQNAhoLIAAoAiwiAUEISQR/QXIFIAFBgICAAUsEf0FxBSABIAAoAjAiAUEDdEkEf0FyBSAAKAIoBH8gAQR/IAFB////B0sEf0FvBUFjQQAgACgCNCIAQf///wdLG0FkIAAbCwVBcAsFQXQLCwsLCwsLBUF/CwVBZwsLtQQCCn8RfkEAQYCAgAggACwAUBshDCAAKAIEIQggACgCCCEJIAAoAgwhCiAAKAIQIQsgACgCFCEEIAAoAhghAyAAKAIcIQUgACgCICEGIAAoAiQhByACQg9WBEAgACgCAK0hDiALQQVsrSEPIApBBWytIRUgCUEFbK0hGCAIQQVsrSEbIAitIRAgCa0hFiAKrSEZIAutIRwDQCABKAAAQf///x9xIARqrSINIA5+IAEoAANBAnZB////H3EgA2qtIhEgD358IAEoAAZBBHZB////H3EgBWqtIhIgFX58IAYgASgACUEGdmqtIhMgGH58IAcgDCABKAAMQQh2cmqtIhQgG358IRogDSAWfiAQIBF+fCAOIBJ+fCAPIBN+fCAUIBV+fCANIBB+IA4gEX58IA8gEn58IBMgFX58IBQgGH58IBpCGohC/////w+DfCIdQhqIQv////8Pg3wiF6dB////H3EhBSANIBl+IBEgFn58IBAgEn58IA4gE358IA8gFH58IBdCGohC/////w+DfCIXp0H///8fcSEGIA0gHH4gESAZfnwgEiAWfnwgECATfnwgDiAUfnwgF0IaiEL/////D4N8Ig2nQf///x9xIQcgDUIaiKdBBWwgGqdB////H3FqIgNB////H3EhBCAdp0H///8fcSADQRp2aiEDIAFBEGohASACQnB8IgJCD1YNAAsLIAAgBDYCFCAAIAM2AhggACAFNgIcIAAgBjYCICAAIAc2AiQLMAAgAUF/akE/SyAFQcAAS3IEf0F/BSAAIAIgBCABQf8BcSADIAVB/wFxEOECQQALC4QDAQd/IwAhByMAQT9qQUBxJAAjACEDIwBBQGskACACQf8BcQRAIAJB/wFxIQggAkH/AXFBwABMBEACfyAAKQBQQgBSBH9BfwUgACgA4AIiAkGAAUsEQCAAQoABEHQgACAAQeAAaiICEHcgACAAKADgAkGAf2oiBTYA4AIgBUGBAUkEQCACIABB4AFqIAUQGBogACgA4AIhBiACIQQFQaCNAkHAjQJBsgJB7Y0CEAILBSACIQYgAEHgAGohBAsgACAGrRB0IAAiAiwA5AIEQCACQn83AFgLIAJCfzcAUCAAKADgAiICIABB4ABqakEAQYACIAJrEBoaIAAgBBB3IAMgACkAABASIANBCGogACkACBASIANBEGogACkAEBASIANBGGogACkAGBASIANBIGogACkAIBASIANBKGogACkAKBASIANBMGogACkAMBASIANBOGogACkAOBASIAEgAyAIEBgaIABBwAAQCiAEQYACEApBAAshCSAHJAAgCQsPCwsQAEEACy0CAX8BfiABIABBQGsiAikAAHwhAyACIAM3AAAgACAAKQBIIAMgAVStfDcASAsJACAAQQA2AAALNgECfyAAEOMCA0AgAkEDdCAAaiIDIAEgAkEDdGopAAAgAykAAIU3AAAgAkEBaiICQQhHDQALC4s2AgV/In4CfyMAIQYjAEE/akFAcSQAIwAhAiMAQYACaiQAIAJBgAFqIQMDQCAEQQN0IANqIAEgBEEDdGopAAA3AwAgBEEBaiIEQRBHDQALIAIgACkAADcAACACIAApAAg3AAggAiAAKQAQNwAQIAIgACkAGDcAGCACIAApACA3ACAgAiAAKQAoNwAoIAIgACkAMDcAMCACIAApADg3ADggAkLx7fT4paf9p6V/NwNYIAApAEhCn9j52cKR2oKbf4UhFyAAKQBQQuv6htq/tfbBH4UhGwJ+IAApAFhC+cL4m5Gjs/DbAIUhKCACKQMAIAIpAyAiHyADKQMAIiR8fCIeIABBQGspAABC0YWa7/rPlIfRAIWFQSAQByIYQoiS853/zPmE6gB8IRkgGSAfhUEYEAchHCACIAMpAw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CAFc0H/AXFB//8DakEIdiACcSECIAENAAsgA0EARwvlIAIBfzd+IAEsAAAgASwAASABQQJqIgQsAAAQEEL///8AgyEFIAQQEUIFiEL///8AgyEGIAEsAAUgASwABiABQQdqIgQsAAAQEEICiEL///8AgyEOIAQQEUIHiEL///8AgyEPIAFBCmoQEUIEiEL///8AgyEKIAEsAA0gASwADiABQQ9qIgQsAAAQEEIBiEL///8AgyEHIAQQEUIGiEL///8AgyELIAEsABIgASwAEyABLAAUEBBCA4hC////AIMhDSABLAAVIAEsABYgAUEXaiIELAAAEBBC////AIMhCCAEEBFCBYhC////AIMhECABLAAaIAEsABsgAUEcaiIBLAAAEBBCAohC////AIMhDCABEBFCB4ghCSACLAAAIAIsAAEgAkECaiIBLAAAEBBC////AIMhGCABEBFCBYhC////AIMhGSACLAAFIAIsAAYgAkEHaiIBLAAAEBBCAohC////AIMhGyABEBFCB4hC////AIMhHCACQQpqEBFCBIhC////AIMhGiACLAANIAIsAA4gAkEPaiIBLAAAEBBCAYhC////AIMhFSABEBFCBohC////AIMhFiACLAASIAIsABMgAiwAFBAQQgOIQv///wCDIREgAiwAFSACLAAWIAJBF2oiASwAABAQQv///wCDIRMgARARQgWIQv///wCDIRQgAiwAGiACLAAbIAJBHGoiASwAABAQQgKIQv///wCDIRIgARARQgeIIRcgAywAACADLAABIANBAmoiASwAABAQQv///wCDIR0gARARQgWIQv///wCDIR4gAywABSADLAAGIANBB2oiASwAABAQQgKIQv///wCDITEgARARQgeIQv///wCDITIgA0EKahARQgSIQv///wCDITMgAywADSADLAAOIANBD2oiASwAABAQQgGIQv///wCDITQgARARQgaIQv///wCDISogAywAEiADLAATIAMsABQQEEIDiEL///8AgyE1IAMsABUgAywAFiADQRdqIgEsAAAQEEL///8AgyErIAEQEUIFiEL///8AgyEsIBAgGX4gDCAYfnwgCCAbfnwgDSAcfnwgCyAafnwgByAVfnwgCiAWfnwgDiATfnwgDyARfnwgBiAUfnwgBSASfnwgAywAGiADLAAbIANBHGoiAS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FxQQF2QfgAbEGQCWoQVQUgAkEASARAIAQgAxAUIAMgBCACQX5tQRh0QRh1QfgAbEGQCWoQugELCyAAIAMQPiABQX9qIQIgAUEASgRAIAIhAQwBCwsLCyAJCyQACzsAIANC7////w9WBEAQAAsgACAAIAOnakEAIAIgAyAEIAUgBiAHEIIBGiABBEAgASADQhB8NwMAC0EAC4YDAQZ/An8jACEHIwBBP2pBQHEkACMAIQUjAEGQAWokACAFQeAAaiIDIAEQDSAFQTBqIgIgAxANIAIgAhANIAIgASACEAwgAyADIAIQDCADIAMQDSADIAIgAxAMIAIgAxANQQEhBANAIAIgAhANIARBAWoiBEEFRw0ACyADIAIgAxAMIAIgAxANQQEhBANAIAIgAhANIARBAWoiBEEKRw0ACyACIAIgAxAMIAUgAhANQQEhBANAIAUgBRANIARBAWoiBEEURw0ACyACIAUgAhAMIAIgAhANQQEhBANAIAIgAhANIARBAWoiBEEKRw0ACyADIAIgAxAMIAIgAxANQQEhBANAIAIgAhANIARBAWoiBEEyRw0ACyACIAIgAxAMIAUgAhANQQEhBANAIAUgBRANIARBAWoiBEHkAEcNAAsgAiAFIAIQDCACIAIQDUEBIQQDQCACIAIQDSAEQQFqIgRBMkcNAAsgAyACIAMQDCADIAMQDSADIAMQDSAAIAMgARAMIAcLJAAL0gIBCX8gASgCACICIAEoAiQiCiABKAIgIgMgASgCHCIEIAEoAhgiBSABKAIUIgYgASgCECIHIAEoAgwiCCABKAIIIgkgASgCBCIBIAIgCkETbEGAgIAIakEZdmpBGnVqQRl1akEadWpBGXVqQRp1akEZdWpBGnVqQRl1akEadWpBGXVBE2xqIQIgAyAEIAUgBiAHIAggCSABIAJBGnVqIgRBGXVqIgVBGnVqIgZBGXVqIgdBGnVqIghBGXVqIglBGnVqIgFBGXVqIQMgACACQf///x9xNgIAIAAgBEH///8PcTYCBCAAIAVB////H3E2AgggACAGQf///w9xNgIMIAAgB0H///8fcTYCECAAIAhB////D3E2AhQgACAJQf///x9xNgIYIAAgAUH///8PcTYCHCAAIANB////H3E2AiAgACAKIANBGnVqQf///w9xNgIkC0MBA38CfyMAIQUjAEE/akFAcSQAIwAhAyMAQSBqJAAgAyACIAEQoQEEf0F/BSAAQdCWAiADEFFBAAshACAFCyQAIAALZQEDfwJ/IwAhBSMAQT9qQUBxJAAjACEDIwBBQGskACADIAJCIBA5IAEgAykAADcAACABIAMpAAg3AAggASADKQAQNwAQIAEgAykAGDcAGCADQcAAEAogACABEGghACAFCyQAIAALBABBMAtRAQN/An8jACEHIwBBP2pBQHEkACMAIQUjAEEgaiQAIAJCMFQEf0F/BSAFIAEgAxCDASAAIAFBIGogAkJgfCAFIAEgBBCEAQshACAHCyQAIAALigEBBH8jACEFIwBB4ABqJAAgBUFAayEGIAVBIGoiBCAFIgcQiAEEQEF/IQAFIAAgBCkAADcAACAAIAQpAAg3AAggACAEKQAQNwAQIAAgBCkAGDcAGCAGIAQgAxCDASAAQSBqIAEgAiAGIAMgBxCGASEAIAdBIBAKIARBIBAKIAZBGBAKCyAFJAAgAAshACACQhBUBH9BfwUgACABQRBqIAEgAkJwfCADIAQQWQsLKAAgAkLv////D1YEQBAABSAAQRBqIAAgASACIAMgBBBaGkEADwtBAAszAQF+IAGtIAKtQiCGhCIDQoCAgIAQVARAIAAgA6cQHwVBupUCQc6VAkHFAUHolQIQAgsLFQAgACABIAKtIAOtQiCGhCAEEJsBCxQAIAAgASACrSADrUIghoQQHUEACxcAIAAgASACIAOtIAStQiCGhCAFEJQCCxkAIAAgASACIAOtIAStQiCGhCAFEJkBQQALFwAgACABIAIgA60gBK1CIIaEIAUQkwILFwAgACABIAKtIAOtQiCGhCAEEKICQQALJQAgACABIAIgAyAErSAFrUIghoQgBiAHrSAIrUIghoQgCRCpAgslACAAIAEgAiADIAQgBa0gBq1CIIaEIAcgCK0gCa1CIIaEEKcCCxcAIAAgASACrSADrUIghoQgBCAFEKwCCxgAIAAgASACIAOtIAStQiCGhCAFIAYQZgsXACAAIAEgAq0gA61CIIaEIAQgBRCtAgsYACAAIAEgAiADrSAErUIghoQgBSAGEGcLEwAgACABIAKtIAOtQiCGhBC0AgsTACAAIAGtIAKtQiCGhCADELMCCyEAIAAgASACrSADrUIghoQgBK0gBa1CIIaEIAYgBxC1AgsfACAAIAEgAq0gA61CIIaEIAStIAWtQiCGhCAGEKIBCy0AIAAgAa0gAq1CIIaEIAMgBK0gBa1CIIaEIAYgB60gCK1CIIaEIAkgChC2AgsXACAAIAEgAq0gA61CIIaEIAQgBRDZAgsUACAAIAEgAq0gA61CIIaEEDlBAAsSACAAIAEgAq0gA61CIIaEECcLGQAgACABIAIgA60gBK1CIIaEIAUgBhCvAQsXACAAIAEgAq0gA61CIIaEIAQgBRDCAQsVACAAIAEgAq0gA61CIIaEIAQQwwELFwAgACABIAKtIAOtQiCGhCAEIAUQxAELGQAgACABIAKtIAOtQiCGhCAEIAUgBhCEAQsYACAAIAEgAiADrSAErUIghoQgBSAGEFkLGwAgACABIAIgA60gBK1CIIaEIAUgBiAHEIUBCwsAIAAgASACEMABCxcAIAAgASACrSADrUIghoQgBCAFEMUBCxkAIAAgASACrSADrUIghoQgBCAFIAYQhgELGAAgACABIAIgA60gBK1CIIaEIAUgBhBaCxsAIAAgASACIAOtIAStQiCGhCAFIAYgBxCHAQsVACAAIAEgAq0gA61CIIaEIAQQ7QELFwAgACABIAKtIAOtQiCGhCAEEIkBQQALJwAgACABIAIgAyAErSAFrUIghoQgBiAHrSAIrUIghoQgCiALEKABCyUAIAAgASACIAOtIAStQiCGhCAFIAatIAetQiCGhCAJIAoQnwILJQAgACACIAOtIAStQiCGhCAFIAYgB60gCK1CIIaEIAkgChCdAQslACAAIAEgAyAErSAFrUIghoQgBiAHrSAIrUIghoQgCSAKEI4CCz4BAn8jACEEIwBBIGokACAEIAEgAiADEIkBQX8gACAEEJEBIAAgBEYbIQEgBCAAQSAQQSABciEFIAQkACAFCyYAIAAgASACIAMgBK0gBa1CIIaEIAYgB60gCK1CIIaEIAogCxB7CyUAIAAgASACIAOtIAStQ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IQIDQCAAQQFqIQEgACwAACIDIAJBGHRBGHVGIANFckUEQCABIQAMAQsLCwUgABAjIABqIQALIAALQgEBfyMAIQIjAEFAayQAIAAgAhCBAiABIAIpAAA3AAAgASACKQAINwAIIAEgAikAEDcAECABIAIpABg3ABggAiQACwYAQYiXAguhAQEDfwJ/IwAhBSMAQT9qQUBxJAAjACEDIwBB8ABqJAAgAyACKQAANwAAIAMgAikACDcACCADIAIpABA3ABAgAyACKQAYNwAYIANB4ABqIgIgASkAADcDACACQgA3AwggA0EgaiIBIAIgAxB4QQAhAgNAIAAgAmogASACaiwAADoAACACQQFqIgJBIEcNAAsgAUHAABAKIANBIBAKIAULJAALBABBCgsGAEGplgILyAEBCH8CfyMAIQsjAEE/akFAcSQAIwAhBCMAQRBqJAAgBEEANgIAIANBf2ogAkkEfyABIAJBf2oiCGohCUEAIQJBACEBA0AgCSABay0AACIKQYABc0H/A2ogAkH/AXEiAkH/A2ogBCgCAEH/A2pxcUEIdkEBcSEGIAIgCnIhAiAEIAQoAgBBACAGayABcXI2AgAgBiAFQf8BcXIhBSABQQFqIgEgA0cNAAsgACAIIAQoAgBrNgIAIAVBf2oFQX8LIQAgCwskACAAC9YBAQV/An8jACEJIwBBP2pBQHEkACMAIQYjAEEQaiQAIAMEfyADIANBf2oiBXEEfyACIANwBSACIAVxCyEIIAUgCGsiBSACQX9zTwRAEAALIAIgBWoiAiAESQR/IAAEQCAAIAJBAWo2AgALIAEgAmohASAGQQA6AABBACEAA38gASAAayICIAIsAAAgBiwAAHFB/wFxIAAgBXNBf2pBGHYiAkGAAXFyOgAAIAYgBi0AACACcjoAACAAQQFqIgAgA0cNAEEACwVBfwsFQX8LIQAgCQskACAACzYBAX9BHhADIgBBAEoEQEGElwIgADYCAAVBhJcCKAIAIQALIABBEEkEQBAABUHwlgJBEBAfCws1AQF/IwAhAiMAQUBrJAAgACACECogAEHQAWoiACACQsAAEB0gACABECogAkHAABAKIAIkAAs2AQN/An8jACECIwBBP2pBQHEkAC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wADOeyAI9QWwGDXWX/kCcCAf/6sgAFEez+iyAuAMy8Jv71czT/v3FJ/r9sRf8WRfUBF8uyAKpjqgBB+G8AJWyZ/0AlRQAAWD7+WZSQ/79E4AHxJzUAKcvt/5F+wv/dKv3/GWOXAGH93wFKczH/Bq9I/zuwywB8t/kB5ORjAIEMz/6owMP/zLAQ/pjqqwBNJVX/IXiH/47C4wEf1joA1bt9/+guPP++dCr+l7IT/zM+7f7M7MEAwug8AKwinf+9ELj+ZwNf/43pJP4pGQv/FcOmAHb1LQBD1ZX/nwwS/7uk4wGgGQUADE7DASvF4QAwjin+xJs8/9/HEgGRiJwA/HWp/pHi7gDvF2sAbbW8/+ZwMf5Jqu3/57fj/1DcFADCa38Bf81lAC40xQHSqyT/WANa/ziXjQBgu///Kk7IAP5GRgH0fagAzESKAXzXRgBmQsj+ETTkAHXcj/7L+HsAOBKu/7qXpP8z6NABoOQr//kdGQFEvj8ADQAAAAD/AAAAAPUAAAAAAAD7AAAAAAAA/QAAAADzAAAAAAcAAAAAAAMAAAAA8wAAAAAFAEGLgQILQAsAAAAAAAsAAAAA8wAAAAAAAP0AAAAAAP8AAAAAAwAAAAD1AAAAAAAAAA8AAAAAAP8AAAAA/wAAAAAHAAAAAAUAQcyCAgsBAQBB8IICCwEBAEGQgwILsAEm6JWPwrInsEXD9Iny75jw1d+sBdPGMzmxOAKIbVP8BccXanA9TdhPujwLdg0QZw8qIFP6LDnMxk7H/XeSrAN67P///////////////////////////////////////3/t////////////////////////////////////////f+7///////////////////////////////////////9/7dP1XBpjEljWnPei3vneFABBz4QCC8IFEAjJvPNn5glqO6fKhIWuZ7sr+JT+cvNuPPE2HV869U+l0YLmrX9SDlEfbD4rjGgFm2u9Qfur2YMfeSF+ExnN4FsirijXmC+KQs1l7yORRDdxLztN7M/7wLW824mBpdu16Ti1SPNbwlY5GdAFtvER8VmbTxmvpII/khiBbdrVXhyrQgIDo5iqB9i+b3BFAVuDEoyy5E6+hTEk4rT/1cN9DFVviXvydF2+crGWFjv+sd6ANRLHJacG3JuUJmnPdPGbwdJK8Z7BaZvk4yVPOIZHvu+11YyLxp3BD2WcrHfMoQwkdQIrWW8s6S2D5KZuqoR0StT7Qb3cqbBctVMRg9qI+Xar32buUlE+mBAytC1txjGoPyH7mMgnA7DkDu++x39Zv8KPqD3zC+DGJacKk0eRp9VvggPgUWPKBnBuDgpnKSkU/C/SRoUKtycmySZcOCEbLu0qxFr8bSxN37OVnRMNOFPeY6+LVHMKZaiydzy7Cmp25q7tRy7JwoE7NYIUhSxykmQD8Uyh6L+iATBCvEtmGqiRl/jQcItLwjC+VAajUWzHGFLv1hnoktEQqWVVJAaZ1iogcVeFNQ70uNG7MnCgahDI0NK4FsGkGVOrQVEIbDcemeuO30x3SCeoSJvhtbywNGNaycWzDBw5y4pB40qq2E5z42N3T8qcW6O4stbzby5o/LLvXe6Cj3RgLxdDb2OleHKr8KEUeMiE7DlkGggCx4woHmMj+v++kOm9gt7rbFCkFXnGsvej+b4rU3Lj8nhxxpxhJurOPifKB8LAIce4htEe6+DN1n3a6njRbu5/T331um8Xcqpn8AammMiixX1jCq4N+b4EmD8RG0ccEzULcRuEfQQj9XfbKJMkx0B7q8oyvL7JFQq+njxMDRCcxGcdQ7ZCPsu+1MVMKn5l/Jwpf1ns+tY6q2/LXxdYR0qMGURsgABBsIsCCwEBAEHQiwILwQHg63p8O0G4rhZW4/rxn8Rq2gmN65wysf2GYgUWX0m4AF+clbyjUIwksdCxVZyD71sERFzEWByOhtgiTt3QnxFX7P///////////////////////////////////////3/t////////////////////////////////////////f+7///////////////////////////////////////9/U2lnRWQyNTUxOSBubyBFZDI1NTE5IGNvbGxpc2lvbnMBAEGgjQILjwlTLT5idWZsZW4gPD0gQkxBS0UyQl9CTE9DS0JZVEVTAGNyeXB0b19nZW5lcmljaGFzaC9ibGFrZTJiL3JlZi9ibGFrZTJiLXJlZi5jAGJsYWtlMmJfZmluYWwAb3V0bGVuIDw9IFVJTlQ4X01BWABjcnlwdG9f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U5vZGVKUygpOyBNb2R1bGUuZ2V0UmFuZG9tVmFsdWUgPSByYW5kb21WYWx1ZU5vZGVKUzsgfSBjYXRjaCAoZSkgeyB0aHJvdyAnTm8gc2VjdXJlIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIGZvdW5kJzsgfSB9IH0gfQBMaWJzb2RpdW1EUkdidWZfbGVuIDw9IFNJWkVfTUFYAHJhbmRvbWJ5dGVzL3JhbmRvbWJ5dGVzLmMAcmFuZG9tYnl0ZXMAYjY0X3BvcyA8PSBiNjRfbGVuAHNvZGl1bS9jb2RlY3MuYwBzb2RpdW1fYmluMmJhc2U2NAAxLjAuMTg=";function gA(){try{if(h)return new Uint8Array(h);var A=eA(IA);if(A)return A;if(r)return r(IA);throw"both async and sync fetching of the wasm failed";}catch(A){z(A);}}O(IA)||(Z=IA,IA=C.locateFile?C.locateFile(Z,w):w+Z),C.asm=function(){var A={env:cA,wasi_unstable:cA,global:{NaN:NaN,Infinity:1/0},"global.Math":Math,asm2wasm:F};function I(A,I){var g=A.exports;C.asm=g,function(A){if(T--,C.monitorRunDependencies&&C.monitorRunDependencies(T),0==T&&(null!==q&&(clearInterval(q),q=null),V)){var I=V;V=null,I();}}();}function g(A){I(A.instance);}function B(I){return(h||!o&&!c||"function"!=typeof fetch?new Promise(function(A,I){A(gA());}):fetch(IA,{credentials:"same-origin"}).then(function(A){if(!A.ok)throw"failed to load wasm binary file at '"+IA+"'";return A.arrayBuffer();}).catch(function(){return gA();})).then(function(I){return WebAssembly.instantiate(I,A);}).then(I,function(A){s("failed to asynchronously prepare wasm: "+A),z(A);});}if(T++,C.monitorRunDependencies&&C.monitorRunDependencies(T),C.instantiateWasm)try{return C.instantiateWasm(A,I);}catch(A){return s("Module.instantiateWasm callback failed with error: "+A),!1;}return function(){if(h||"function"!=typeof WebAssembly.instantiateStreaming||O(IA)||"function"!=typeof fetch)return B(g);fetch(IA,{credentials:"same-origin"}).then(function(I){return WebAssembly.instantiateStreaming(I,A).then(g,function(A){s("wasm streaming compile failed: "+A),s("falling back to ArrayBuffer instantiation"),B(g);});});}(),{};};var BA=[function(){return C.getRandomValue();},function(){if(void 0===C.getRandomValue)try{var A="object"==(typeof window==="undefined"?"undefined":_typeof(window))?window:self,I=void 0!==A.crypto?A.crypto:A.msCrypto,g=function g(){var A=new Uint32Array(1);return I.getRandomValues(A),A[0]>>>0;};g(),C.getRandomValue=g;}catch(A){try{var B=__webpack_require__(/*! crypto */"./node_modules/crypto-browserify/index.js"),Q=function Q(){var A=B.randomBytes(4);return(A[0]<<24|A[1]<<16|A[2]<<8|A[3])>>>0;};Q(),C.getRandomValue=Q;}catch(A){throw"No secure random number generator found";}}}];function CA(){return l.length;}var QA=!1;function EA(A){for(var I=[],g=0;g255&&(QA&&H(!1,"Character code "+B+" ("+String.fromCharCode(B)+") at offset "+g+" not in 0x00-0xFF."),B&=255),I.push(String.fromCharCode(B));}return I.join("");}var iA="function"==typeof atob?atob:function(A){var I,g,B,C,Q,E,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="",o=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{I=i.indexOf(A.charAt(o++))<<2|(C=i.indexOf(A.charAt(o++)))>>4,g=(15&C)<<4|(Q=i.indexOf(A.charAt(o++)))>>2,B=(3&Q)<<6|(E=i.indexOf(A.charAt(o++))),e+=String.fromCharCode(I),64!==Q&&(e+=String.fromCharCode(g)),64!==E&&(e+=String.fromCharCode(B));}while(o2147418112)return!1;for(var g=Math.max(I,16777216);g>16),b(D.buffer),1;}catch(A){}}(g);},d:function d(A){switch(A){case 30:return 16384;case 85:return 131068;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&navigator.hardwareConcurrency||1;}return C.___errno_location&&(_d2[C.___errno_location()>>2]=28),-1;},memory:D,table:p},aA=C.asm({},cA,k);function nA(A){function I(){oA||(oA=!0,u||(P(N),P(m),C.onRuntimeInitialized&&C.onRuntimeInitialized(),function(){if(C.postRun)for("function"==typeof C.postRun&&(C.postRun=[C.postRun]);C.postRun.length;){A=C.postRun.shift(),L.unshift(A);}var A;P(L);}()));}A=A||e,T>0||(function(){if(C.preRun)for("function"==typeof C.preRun&&(C.preRun=[C.preRun]);C.preRun.length;){A=C.preRun.shift(),R.unshift(A);}var A;P(R);}(),T>0||(C.setStatus?(C.setStatus("Running..."),setTimeout(function(){setTimeout(function(){C.setStatus("");},1),I();},1)):I()));}if(C.asm=aA,C.___errno_location=function(){return C.asm.h.apply(null,arguments);},C._crypto_aead_chacha20poly1305_abytes=function(){return C.asm.i.apply(null,arguments);},C._crypto_aead_chacha20poly1305_decrypt=function(){return C.asm.j.apply(null,arguments);},C._crypto_aead_chacha20poly1305_decrypt_detached=function(){return C.asm.k.apply(null,arguments);},C._crypto_aead_chacha20poly1305_encrypt=function(){return C.asm.l.apply(null,arguments);},C._crypto_aead_chacha20poly1305_encrypt_detached=function(){return C.asm.m.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_abytes=function(){return C.asm.n.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_decrypt=function(){return C.asm.o.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_decrypt_detached=function(){return C.asm.p.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_encrypt=function(){return C.asm.q.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_encrypt_detached=function(){return C.asm.r.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_keybytes=function(){return C.asm.s.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_keygen=function(){return C.asm.t.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_messagebytes_max=function(){return C.asm.u.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_npubbytes=function(){return C.asm.v.apply(null,arguments);},C._crypto_aead_chacha20poly1305_ietf_nsecbytes=function(){return C.asm.w.apply(null,arguments);},C._crypto_aead_chacha20poly1305_keybytes=function(){return C.asm.x.apply(null,arguments);},C._crypto_aead_chacha20poly1305_keygen=function(){return C.asm.y.apply(null,arguments);},C._crypto_aead_chacha20poly1305_messagebytes_max=function(){return C.asm.z.apply(null,arguments);},C._crypto_aead_chacha20poly1305_npubbytes=function(){return C.asm.A.apply(null,arguments);},C._crypto_aead_chacha20poly1305_nsecbytes=function(){return C.asm.B.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_abytes=function(){return C.asm.C.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_decrypt=function(){return C.asm.D.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_decrypt_detached=function(){return C.asm.E.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_encrypt=function(){return C.asm.F.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_encrypt_detached=function(){return C.asm.G.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_keybytes=function(){return C.asm.H.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_keygen=function(){return C.asm.I.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_messagebytes_max=function(){return C.asm.J.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_npubbytes=function(){return C.asm.K.apply(null,arguments);},C._crypto_aead_xchacha20poly1305_ietf_nsecbytes=function(){return C.asm.L.apply(null,arguments);},C._crypto_auth=function(){return C.asm.M.apply(null,arguments);},C._crypto_auth_bytes=function(){return C.asm.N.apply(null,arguments);},C._crypto_auth_keybytes=function(){return C.asm.O.apply(null,arguments);},C._crypto_auth_keygen=function(){return C.asm.P.apply(null,arguments);},C._crypto_auth_verify=function(){return C.asm.Q.apply(null,arguments);},C._crypto_box_beforenm=function(){return C.asm.R.apply(null,arguments);},C._crypto_box_beforenmbytes=function(){return C.asm.S.apply(null,arguments);},C._crypto_box_detached=function(){return C.asm.T.apply(null,arguments);},C._crypto_box_detached_afternm=function(){return C.asm.U.apply(null,arguments);},C._crypto_box_easy=function(){return C.asm.V.apply(null,arguments);},C._crypto_box_easy_afternm=function(){return C.asm.W.apply(null,arguments);},C._crypto_box_keypair=function(){return C.asm.X.apply(null,arguments);},C._crypto_box_macbytes=function(){return C.asm.Y.apply(null,arguments);},C._crypto_box_messagebytes_max=function(){return C.asm.Z.apply(null,arguments);},C._crypto_box_noncebytes=function(){return C.asm._.apply(null,arguments);},C._crypto_box_open_detached=function(){return C.asm.$.apply(null,arguments);},C._crypto_box_open_detached_afternm=function(){return C.asm.aa.apply(null,arguments);},C._crypto_box_open_easy=function(){return C.asm.ba.apply(null,arguments);},C._crypto_box_open_easy_afternm=function(){return C.asm.ca.apply(null,arguments);},C._crypto_box_publickeybytes=function(){return C.asm.da.apply(null,arguments);},C._crypto_box_seal=function(){return C.asm.ea.apply(null,arguments);},C._crypto_box_seal_open=function(){return C.asm.fa.apply(null,arguments);},C._crypto_box_sealbytes=function(){return C.asm.ga.apply(null,arguments);},C._crypto_box_secretkeybytes=function(){return C.asm.ha.apply(null,arguments);},C._crypto_box_seed_keypair=function(){return C.asm.ia.apply(null,arguments);},C._crypto_box_seedbytes=function(){return C.asm.ja.apply(null,arguments);},C._crypto_generichash=function(){return C.asm.ka.apply(null,arguments);},C._crypto_generichash_bytes=function(){return C.asm.la.apply(null,arguments);},C._crypto_generichash_bytes_max=function(){return C.asm.ma.apply(null,arguments);},C._crypto_generichash_bytes_min=function(){return C.asm.na.apply(null,arguments);},C._crypto_generichash_final=function(){return C.asm.oa.apply(null,arguments);},C._crypto_generichash_init=function(){return C.asm.pa.apply(null,arguments);},C._crypto_generichash_keybytes=function(){return C.asm.qa.apply(null,arguments);},C._crypto_generichash_keybytes_max=function(){return C.asm.ra.apply(null,arguments);},C._crypto_generichash_keybytes_min=function(){return C.asm.sa.apply(null,arguments);},C._crypto_generichash_keygen=function(){return C.asm.ta.apply(null,arguments);},C._crypto_generichash_statebytes=function(){return C.asm.ua.apply(null,arguments);},C._crypto_generichash_update=function(){return C.asm.va.apply(null,arguments);},C._crypto_hash=function(){return C.asm.wa.apply(null,arguments);},C._crypto_hash_bytes=function(){return C.asm.xa.apply(null,arguments);},C._crypto_kdf_bytes_max=function(){return C.asm.ya.apply(null,arguments);},C._crypto_kdf_bytes_min=function(){return C.asm.za.apply(null,arguments);},C._crypto_kdf_contextbytes=function(){return C.asm.Aa.apply(null,arguments);},C._crypto_kdf_derive_from_key=function(){return C.asm.Ba.apply(null,arguments);},C._crypto_kdf_keybytes=function(){return C.asm.Ca.apply(null,arguments);},C._crypto_kdf_keygen=function(){return C.asm.Da.apply(null,arguments);},C._crypto_kx_client_session_keys=function(){return C.asm.Ea.apply(null,arguments);},C._crypto_kx_keypair=function(){return C.asm.Fa.apply(null,arguments);},C._crypto_kx_publickeybytes=function(){return C.asm.Ga.apply(null,arguments);},C._crypto_kx_secretkeybytes=function(){return C.asm.Ha.apply(null,arguments);},C._crypto_kx_seed_keypair=function(){return C.asm.Ia.apply(null,arguments);},C._crypto_kx_seedbytes=function(){return C.asm.Ja.apply(null,arguments);},C._crypto_kx_server_session_keys=function(){return C.asm.Ka.apply(null,arguments);},C._crypto_kx_sessionkeybytes=function(){return C.asm.La.apply(null,arguments);},C._crypto_pwhash=function(){return C.asm.Ma.apply(null,arguments);},C._crypto_pwhash_alg_argon2i13=function(){return C.asm.Na.apply(null,arguments);},C._crypto_pwhash_alg_argon2id13=function(){return C.asm.Oa.apply(null,arguments);},C._crypto_pwhash_alg_default=function(){return C.asm.Pa.apply(null,arguments);},C._crypto_pwhash_bytes_max=function(){return C.asm.Qa.apply(null,arguments);},C._crypto_pwhash_bytes_min=function(){return C.asm.Ra.apply(null,arguments);},C._crypto_pwhash_memlimit_interactive=function(){return C.asm.Sa.apply(null,arguments);},C._crypto_pwhash_memlimit_max=function(){return C.asm.Ta.apply(null,arguments);},C._crypto_pwhash_memlimit_min=function(){return C.asm.Ua.apply(null,arguments);},C._crypto_pwhash_memlimit_moderate=function(){return C.asm.Va.apply(null,arguments);},C._crypto_pwhash_memlimit_sensitive=function(){return C.asm.Wa.apply(null,arguments);},C._crypto_pwhash_opslimit_interactive=function(){return C.asm.Xa.apply(null,arguments);},C._crypto_pwhash_opslimit_max=function(){return C.asm.Ya.apply(null,arguments);},C._crypto_pwhash_opslimit_min=function(){return C.asm.Za.apply(null,arguments);},C._crypto_pwhash_opslimit_moderate=function(){return C.asm._a.apply(null,arguments);},C._crypto_pwhash_opslimit_sensitive=function(){return C.asm.$a.apply(null,arguments);},C._crypto_pwhash_passwd_max=function(){return C.asm.ab.apply(null,arguments);},C._crypto_pwhash_passwd_min=function(){return C.asm.bb.apply(null,arguments);},C._crypto_pwhash_saltbytes=function(){return C.asm.cb.apply(null,arguments);},C._crypto_pwhash_str=function(){return C.asm.db.apply(null,arguments);},C._crypto_pwhash_str_alg=function(){return C.asm.eb.apply(null,arguments);},C._crypto_pwhash_str_needs_rehash=function(){return C.asm.fb.apply(null,arguments);},C._crypto_pwhash_str_verify=function(){return C.asm.gb.apply(null,arguments);},C._crypto_pwhash_strbytes=function(){return C.asm.hb.apply(null,arguments);},C._crypto_pwhash_strprefix=function(){return C.asm.ib.apply(null,arguments);},C._crypto_scalarmult=function(){return C.asm.jb.apply(null,arguments);},C._crypto_scalarmult_base=function(){return C.asm.kb.apply(null,arguments);},C._crypto_scalarmult_bytes=function(){return C.asm.lb.apply(null,arguments);},C._crypto_scalarmult_scalarbytes=function(){return C.asm.mb.apply(null,arguments);},C._crypto_secretbox_detached=function(){return C.asm.nb.apply(null,arguments);},C._crypto_secretbox_easy=function(){return C.asm.ob.apply(null,arguments);},C._crypto_secretbox_keybytes=function(){return C.asm.pb.apply(null,arguments);},C._crypto_secretbox_keygen=function(){return C.asm.qb.apply(null,arguments);},C._crypto_secretbox_macbytes=function(){return C.asm.rb.apply(null,arguments);},C._crypto_secretbox_messagebytes_max=function(){return C.asm.sb.apply(null,arguments);},C._crypto_secretbox_noncebytes=function(){return C.asm.tb.apply(null,arguments);},C._crypto_secretbox_open_detached=function(){return C.asm.ub.apply(null,arguments);},C._crypto_secretbox_open_easy=function(){return C.asm.vb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_abytes=function(){return C.asm.wb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_headerbytes=function(){return C.asm.xb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_init_pull=function(){return C.asm.yb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_init_push=function(){return C.asm.zb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_keybytes=function(){return C.asm.Ab.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_keygen=function(){return C.asm.Bb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_messagebytes_max=function(){return C.asm.Cb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_pull=function(){return C.asm.Db.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_push=function(){return C.asm.Eb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_rekey=function(){return C.asm.Fb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_statebytes=function(){return C.asm.Gb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_tag_final=function(){return C.asm.Hb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_tag_message=function(){return C.asm.Ib.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_tag_push=function(){return C.asm.Jb.apply(null,arguments);},C._crypto_secretstream_xchacha20poly1305_tag_rekey=function(){return C.asm.Kb.apply(null,arguments);},C._crypto_shorthash=function(){return C.asm.Lb.apply(null,arguments);},C._crypto_shorthash_bytes=function(){return C.asm.Mb.apply(null,arguments);},C._crypto_shorthash_keybytes=function(){return C.asm.Nb.apply(null,arguments);},C._crypto_shorthash_keygen=function(){return C.asm.Ob.apply(null,arguments);},C._crypto_sign=function(){return C.asm.Pb.apply(null,arguments);},C._crypto_sign_bytes=function(){return C.asm.Qb.apply(null,arguments);},C._crypto_sign_detached=function(){return C.asm.Rb.apply(null,arguments);},C._crypto_sign_ed25519_pk_to_curve25519=function(){return C.asm.Sb.apply(null,arguments);},C._crypto_sign_ed25519_sk_to_curve25519=function(){return C.asm.Tb.apply(null,arguments);},C._crypto_sign_final_create=function(){return C.asm.Ub.apply(null,arguments);},C._crypto_sign_final_verify=function(){return C.asm.Vb.apply(null,arguments);},C._crypto_sign_init=function(){return C.asm.Wb.apply(null,arguments);},C._crypto_sign_keypair=function(){return C.asm.Xb.apply(null,arguments);},C._crypto_sign_messagebytes_max=function(){return C.asm.Yb.apply(null,arguments);},C._crypto_sign_open=function(){return C.asm.Zb.apply(null,arguments);},C._crypto_sign_publickeybytes=function(){return C.asm._b.apply(null,arguments);},C._crypto_sign_secretkeybytes=function(){return C.asm.$b.apply(null,arguments);},C._crypto_sign_seed_keypair=function(){return C.asm.ac.apply(null,arguments);},C._crypto_sign_seedbytes=function(){return C.asm.bc.apply(null,arguments);},C._crypto_sign_statebytes=function(){return C.asm.cc.apply(null,arguments);},C._crypto_sign_update=function(){return C.asm.dc.apply(null,arguments);},C._crypto_sign_verify_detached=function(){return C.asm.ec.apply(null,arguments);},C._free=function(){return C.asm.fc.apply(null,arguments);},C._malloc=function(){return C.asm.gc.apply(null,arguments);},C._randombytes=function(){return C.asm.hc.apply(null,arguments);},C._randombytes_buf=function(){return C.asm.ic.apply(null,arguments);},C._randombytes_buf_deterministic=function(){return C.asm.jc.apply(null,arguments);},C._randombytes_close=function(){return C.asm.kc.apply(null,arguments);},C._randombytes_random=function(){return C.asm.lc.apply(null,arguments);},C._randombytes_seedbytes=function(){return C.asm.mc.apply(null,arguments);},C._randombytes_stir=function(){return C.asm.nc.apply(null,arguments);},C._randombytes_uniform=function(){return C.asm.oc.apply(null,arguments);},C._sodium_base642bin=function(){return C.asm.pc.apply(null,arguments);},C._sodium_base64_encoded_len=function(){return C.asm.qc.apply(null,arguments);},C._sodium_bin2base64=function(){return C.asm.rc.apply(null,arguments);},C._sodium_bin2hex=function(){return C.asm.sc.apply(null,arguments);},C._sodium_hex2bin=function(){return C.asm.tc.apply(null,arguments);},C._sodium_init=function(){return C.asm.uc.apply(null,arguments);},C._sodium_library_minimal=function(){return C.asm.vc.apply(null,arguments);},C._sodium_library_version_major=function(){return C.asm.wc.apply(null,arguments);},C._sodium_library_version_minor=function(){return C.asm.xc.apply(null,arguments);},C._sodium_pad=function(){return C.asm.yc.apply(null,arguments);},C._sodium_unpad=function(){return C.asm.zc.apply(null,arguments);},C._sodium_version_string=function(){return C.asm.Ac.apply(null,arguments);},C.asm=aA,C.setValue=function(A,I,g,B){switch("*"===(g=g||"i8").charAt(g.length-1)&&(g="i32"),g){case"i1":case"i8":l[A>>0]=I;break;case"i16":G[A>>1]=I;break;case"i32":_d2[A>>2]=I;break;case"i64":AA=[I>>>0,($=I,+x($)>=1?$>0?(0|j(+X($/4294967296),4294967295))>>>0:~~+K(($-+(~~$>>>0))/4294967296)>>>0:0)],_d2[A>>2]=AA[0],_d2[A+4>>2]=AA[1];break;case"float":Y[A>>2]=I;break;case"double":M[A>>3]=I;break;default:z("invalid type for setValue: "+g);}},C.getValue=function(A,I,g){switch("*"===(I=I||"i8").charAt(I.length-1)&&(I="i32"),I){case"i1":case"i8":return l[A>>0];case"i16":return G[A>>1];case"i32":case"i64":return _d2[A>>2];case"float":return Y[A>>2];case"double":return M[A>>3];default:z("invalid type for getValue: "+I);}return null;},C.UTF8ToString=U,V=function A(){oA||nA(),oA||(V=A);},C.run=nA,C.preInit)for("function"==typeof C.preInit&&(C.preInit=[C.preInit]);C.preInit.length>0;){C.preInit.pop()();}nA();}).catch(function(){B.useBackupModule();}),"object"==(typeof process==="undefined"?"undefined":_typeof(process))&&"function"==typeof process.removeAllListeners&&(process.removeAllListeners("uncaughtException"),process.removeAllListeners("unhandledRejection")),I;}true?!(__WEBPACK_AMD_DEFINE_ARRAY__=[exports],__WEBPACK_AMD_DEFINE_FACTORY__=I,__WEBPACK_AMD_DEFINE_RESULT__=typeof __WEBPACK_AMD_DEFINE_FACTORY__==='function'?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__!==undefined&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)):undefined;}(this);/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../../../process/browser.js */"./node_modules/process/browser.js"),"/",__webpack_require__(/*! ./../../../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/md5.js/index.js":/*!**************************************!*\ - !*** ./node_modules/md5.js/index.js ***! - \**************************************/ /*! no static exports found */ /***/function node_modulesMd5JsIndexJs(module,exports,__webpack_require__){"use strict";var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var HashBase=__webpack_require__(/*! hash-base */"./node_modules/hash-base/index.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var ARRAY16=new Array(16);function MD5(){HashBase.call(this,64);// state -this._a=0x67452301;this._b=0xefcdab89;this._c=0x98badcfe;this._d=0x10325476;}inherits(MD5,HashBase);MD5.prototype._update=function(){var M=ARRAY16;for(var i=0;i<16;++i){M[i]=this._block.readInt32LE(i*4);}var a=this._a;var b=this._b;var c=this._c;var d=this._d;a=fnF(a,b,c,d,M[0],0xd76aa478,7);d=fnF(d,a,b,c,M[1],0xe8c7b756,12);c=fnF(c,d,a,b,M[2],0x242070db,17);b=fnF(b,c,d,a,M[3],0xc1bdceee,22);a=fnF(a,b,c,d,M[4],0xf57c0faf,7);d=fnF(d,a,b,c,M[5],0x4787c62a,12);c=fnF(c,d,a,b,M[6],0xa8304613,17);b=fnF(b,c,d,a,M[7],0xfd469501,22);a=fnF(a,b,c,d,M[8],0x698098d8,7);d=fnF(d,a,b,c,M[9],0x8b44f7af,12);c=fnF(c,d,a,b,M[10],0xffff5bb1,17);b=fnF(b,c,d,a,M[11],0x895cd7be,22);a=fnF(a,b,c,d,M[12],0x6b901122,7);d=fnF(d,a,b,c,M[13],0xfd987193,12);c=fnF(c,d,a,b,M[14],0xa679438e,17);b=fnF(b,c,d,a,M[15],0x49b40821,22);a=fnG(a,b,c,d,M[1],0xf61e2562,5);d=fnG(d,a,b,c,M[6],0xc040b340,9);c=fnG(c,d,a,b,M[11],0x265e5a51,14);b=fnG(b,c,d,a,M[0],0xe9b6c7aa,20);a=fnG(a,b,c,d,M[5],0xd62f105d,5);d=fnG(d,a,b,c,M[10],0x02441453,9);c=fnG(c,d,a,b,M[15],0xd8a1e681,14);b=fnG(b,c,d,a,M[4],0xe7d3fbc8,20);a=fnG(a,b,c,d,M[9],0x21e1cde6,5);d=fnG(d,a,b,c,M[14],0xc33707d6,9);c=fnG(c,d,a,b,M[3],0xf4d50d87,14);b=fnG(b,c,d,a,M[8],0x455a14ed,20);a=fnG(a,b,c,d,M[13],0xa9e3e905,5);d=fnG(d,a,b,c,M[2],0xfcefa3f8,9);c=fnG(c,d,a,b,M[7],0x676f02d9,14);b=fnG(b,c,d,a,M[12],0x8d2a4c8a,20);a=fnH(a,b,c,d,M[5],0xfffa3942,4);d=fnH(d,a,b,c,M[8],0x8771f681,11);c=fnH(c,d,a,b,M[11],0x6d9d6122,16);b=fnH(b,c,d,a,M[14],0xfde5380c,23);a=fnH(a,b,c,d,M[1],0xa4beea44,4);d=fnH(d,a,b,c,M[4],0x4bdecfa9,11);c=fnH(c,d,a,b,M[7],0xf6bb4b60,16);b=fnH(b,c,d,a,M[10],0xbebfbc70,23);a=fnH(a,b,c,d,M[13],0x289b7ec6,4);d=fnH(d,a,b,c,M[0],0xeaa127fa,11);c=fnH(c,d,a,b,M[3],0xd4ef3085,16);b=fnH(b,c,d,a,M[6],0x04881d05,23);a=fnH(a,b,c,d,M[9],0xd9d4d039,4);d=fnH(d,a,b,c,M[12],0xe6db99e5,11);c=fnH(c,d,a,b,M[15],0x1fa27cf8,16);b=fnH(b,c,d,a,M[2],0xc4ac5665,23);a=fnI(a,b,c,d,M[0],0xf4292244,6);d=fnI(d,a,b,c,M[7],0x432aff97,10);c=fnI(c,d,a,b,M[14],0xab9423a7,15);b=fnI(b,c,d,a,M[5],0xfc93a039,21);a=fnI(a,b,c,d,M[12],0x655b59c3,6);d=fnI(d,a,b,c,M[3],0x8f0ccc92,10);c=fnI(c,d,a,b,M[10],0xffeff47d,15);b=fnI(b,c,d,a,M[1],0x85845dd1,21);a=fnI(a,b,c,d,M[8],0x6fa87e4f,6);d=fnI(d,a,b,c,M[15],0xfe2ce6e0,10);c=fnI(c,d,a,b,M[6],0xa3014314,15);b=fnI(b,c,d,a,M[13],0x4e0811a1,21);a=fnI(a,b,c,d,M[4],0xf7537e82,6);d=fnI(d,a,b,c,M[11],0xbd3af235,10);c=fnI(c,d,a,b,M[2],0x2ad7d2bb,15);b=fnI(b,c,d,a,M[9],0xeb86d391,21);this._a=this._a+a|0;this._b=this._b+b|0;this._c=this._c+c|0;this._d=this._d+d|0;};MD5.prototype._digest=function(){// create padding and handle blocks -this._block[this._blockOffset++]=0x80;if(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();// produce result -var buffer=Buffer.allocUnsafe(16);buffer.writeInt32LE(this._a,0);buffer.writeInt32LE(this._b,4);buffer.writeInt32LE(this._c,8);buffer.writeInt32LE(this._d,12);return buffer;};function rotl(x,n){return x<>>32-n;}function fnF(a,b,c,d,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+b|0;}function fnG(a,b,c,d,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+b|0;}function fnH(a,b,c,d,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+b|0;}function fnI(a,b,c,d,m,k,s){return rotl(a+(c^(b|~d))+m+k|0,s)+b|0;}module.exports=MD5;/***/},/***/"./node_modules/miller-rabin/lib/mr.js":/*!*********************************************!*\ - !*** ./node_modules/miller-rabin/lib/mr.js ***! - \*********************************************/ /*! no static exports found */ /***/function node_modulesMillerRabinLibMrJs(module,exports,__webpack_require__){var bn=__webpack_require__(/*! bn.js */"./node_modules/bn.js/lib/bn.js");var brorand=__webpack_require__(/*! brorand */"./node_modules/brorand/index.js");function MillerRabin(rand){this.rand=rand||new brorand.Rand();}module.exports=MillerRabin;MillerRabin.create=function create(rand){return new MillerRabin(rand);};MillerRabin.prototype._randbelow=function _randbelow(n){var len=n.bitLength();var min_bytes=Math.ceil(len/8);// Generage random bytes until a number less than n is found. -// This ensures that 0..n-1 have an equal probability of being selected. -do{var a=new bn(this.rand.generate(min_bytes));}while(a.cmp(n)>=0);return a;};MillerRabin.prototype._randrange=function _randrange(start,stop){// Generate a random number greater than or equal to start and less than stop. -var size=stop.sub(start);return start.add(this._randbelow(size));};MillerRabin.prototype.test=function test(n,k,cb){var len=n.bitLength();var red=bn.mont(n);var rone=new bn(1).toRed(red);if(!k)k=Math.max(1,len/48|0);// Find d and s, (n - 1) = (2 ^ s) * d; -var n1=n.subn(1);for(var s=0;!n1.testn(s);s++){}var d=n.shrn(s);var rn1=n1.toRed(red);var prime=true;for(;k>0;k--){var a=this._randrange(new bn(2),n1);if(cb)cb(a);var x=a.toRed(red).redPow(d);if(x.cmp(rone)===0||x.cmp(rn1)===0)continue;for(var i=1;i0;k--){var a=this._randrange(new bn(2),n1);var g=n.gcd(a);if(g.cmpn(1)!==0)return g;var x=a.toRed(red).redPow(d);if(x.cmp(rone)===0||x.cmp(rn1)===0)continue;for(var i=1;i>8;var lo=c&0xff;if(hi)res.push(hi,lo);else res.push(lo);}}return res;}utils.toArray=toArray;function zero2(word){if(word.length===1)return'0'+word;else return word;}utils.zero2=zero2;function toHex(msg){var res='';for(var i=0;it?e:t}function Q(e,t,n){return A()(e.concat(t),(function(e,t){var r=!0,i=!1,a=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(e[c]!==t[c])return!1}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return!0}))}function S(e){return p()(e)}function x(e){return e[e.length-1]}function D(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;e.push(s)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}function P(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;e.splice(e.indexOf(s),1)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}function M(e,t){e.splice(e.indexOf(t),1)}function F(e,t){(function(e,t){return e.indexOf(t)>=0})(e,t)||e.push(t)}function O(e,t){return e.filter((function(e){return!t.includes(e)})).concat(t.filter((function(t){return!e.includes(t)})))}function R(e,t){e.splice(t,1)}function j(e,t){var n=e.slice();return R(n,t),n}function T(e){for(var t=[],n=0,r=Object.keys(e);n1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,c=arguments.length>5?arguments[5]:void 0;d(this,e),v(this,"map",{}),v(this,"typedMap",(p(t={}),t)),v(this,"referenceMap",void 0),v(this,"conflictMap",void 0),r?(this.map=i,this.typedMap=a,this.referenceMap=s,this.conflictMap=c):(this.referenceMap=new o,this.conflictMap=new o,this.set(n))}return y(e,[{key:"immutablePayloadCopy",value:function(){var e=Object.freeze(Object.assign({},this.map)),t=Object.freeze(Object.assign({},this.typedMap)),n=Object.freeze(this.referenceMap.makeCopy()),r=Object.freeze(this.conflictMap.makeCopy());return new m(void 0,void 0,!0,e,t,n,r)}},{key:"uuids",value:function(){return Object.keys(this.map)}},{key:"all",value:function(e){var t=this;return e?this.typedMap[e]||[]:Object.keys(this.map).map((function(e){return t.map[e]}))}},{key:"find",value:function(e){return this.map[e]}},{key:"findAll",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value,u=this.map[c];(u||t)&&n.push(u)}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}},{key:"set",value:function(e){e=Array.isArray(e)?e:[e];var t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;if(this.map[o.uuid]=o,this.setToTypedMap(o),o.deleted)this.referenceMap.removeFromMap(o.uuid);else{var s=o.safeContent.conflict_of;s&&this.conflictMap.establishRelationship(s,o.uuid),this.referenceMap.setAllRelationships(o.uuid,o.references.map((function(e){return e.uuid})))}}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"discard",value:function(e){e=Array.isArray(e)?e:[e];var t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;this.conflictMap.removeFromMap(o.uuid),this.referenceMap.removeFromMap(o.uuid),this.deleteFromTypedMap(o),delete this.map[o.uuid]}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"setToTypedMap",value:function(e){var t=this.typedMap[e.content_type]||[];c()(t,{uuid:e.uuid}),t.push(e),this.typedMap[e.content_type]=t}},{key:"deleteFromTypedMap",value:function(e){var t=this.typedMap[e.content_type]||[];c()(t,{uuid:e.uuid}),this.typedMap[e.content_type]=t}},{key:"uuidsThatReferenceUuid",value:function(e){if(!Object(r.o)(e))throw Error("Must use uuid string");return this.referenceMap.getInverseRelationships(e)}},{key:"elementsReferencingElement",value:function(e){var t=this.uuidsThatReferenceUuid(e.uuid);return this.findAll(t)}},{key:"conflictsOf",value:function(e){var t=this.conflictMap.getDirectRelationships(e);return this.findAll(t)}}]),e}(),m=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0;return d(this,t),v(A(e=l(this,f(t).call(this,n,i,a,o,s,c))),"source",void 0),e.source=r,Object.freeze(A(e)),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),y(t,[{key:"payloads",get:function(){return this.all()}}]),t}(b)},function(e,t,n){"use strict";var r;function i(e,t){return Number(e)-Number(t)}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i})),function(e){e.V000Base64Decrypted="000",e.V001="001",e.V002="002",e.V003="003",e.V004="004",e[e.VersionLength=3]="VersionLength"}(r||(r={}))},function(e,t,n){"use strict";var r;function i(e){return e===r.LocalStorageEncrypted||e===r.LocalStorageDecrypted||e===r.LocalStoragePreferEncrypted}function a(e){return e===r.FileEncrypted||e===r.FileDecrypted||e===r.FilePreferEncrypted}function o(e){return e===r.SyncDecrypted||e===r.LocalStorageDecrypted||e===r.FileDecrypted}function s(e){return e===r.Sync||e===r.LocalStorageEncrypted||e===r.FileEncrypted}n.d(t,"a",(function(){return r})),n.d(t,"e",(function(){return i})),n.d(t,"d",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s})),function(e){e[e.Sync=0]="Sync",e[e.SyncDecrypted=1]="SyncDecrypted",e[e.LocalStorageEncrypted=2]="LocalStorageEncrypted",e[e.LocalStorageDecrypted=3]="LocalStorageDecrypted",e[e.LocalStoragePreferEncrypted=4]="LocalStoragePreferEncrypted",e[e.FileEncrypted=5]="FileEncrypted",e[e.FileDecrypted=6]="FileDecrypted",e[e.FilePreferEncrypted=7]="FilePreferEncrypted"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return y})),n.d(t,"b",(function(){return v}));var r,i=n(7),a=n(6),o=n(5);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n"===t.operator?d>p:"<="===t.operator?d<=p:">="===t.operator?d>=p:"startsWith"===t.operator?d.startsWith(p):"in"===t.operator?-1!==p.indexOf(d):"includes"===t.operator?this.resolveIncludesPredicate(d,p):"matches"===t.operator&&new RegExp(p).test(d)}},{key:"resolveIncludesPredicate",value:function(t,n){if(Object(r.o)(n))return t.includes(n);var i;i=Array.isArray(n)?e.FromArray(n):n;var a=!0,o=!1,s=void 0;try{for(var c,u=t[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var l=c.value;if(this.ObjectSatisfiesPredicate(l,i))return!0}}catch(e){o=!0,s=e}finally{try{a||null==u.return||u.return()}finally{if(o)throw s}}return!1}},{key:"ItemSatisfiesPredicate",value:function(t,n){return Array.isArray(n)&&(n=e.FromArray(n)),this.ObjectSatisfiesPredicate(t,n)}},{key:"ItemSatisfiesPredicates",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(!this.ItemSatisfiesPredicate(e,s))return!1}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return!0}},{key:"DateFromString",value:function(e){var t=e.split("."),n=t[1],r=new Date,i=parseInt(t[0]);return"days"===n?r.setDate(r.getDate()-i):"hours"===n&&r.setHours(r.getHours()-i),r}}],(n=[{key:"isRecursive",value:function(){return["and","or"].includes(this.operator)}},{key:"arrayRepresentation",value:function(){return[this.keypath,this.operator,this.value]}},{key:"valueAsArray",value:function(){return this.value}}])&&i(t.prototype,n),o&&i(t,o),e}()},function(e,t,n){"use strict";n.d(t,"b",(function(){return j})),n.d(t,"c",(function(){return Y})),n.d(t,"d",(function(){return ee})),n.d(t,"e",(function(){return ce})),n.d(t,"f",(function(){return ge})),n.d(t,"a",(function(){return f}));var r=n(0),i=n.n(r),a=n(2);function o(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function s(e,t){for(var n=0;n * @license MIT - */ /* eslint-disable no-proto */var base64=__webpack_require__(/*! base64-js */"./node_modules/base64-js/index.js");var ieee754=__webpack_require__(/*! ieee754 */"./node_modules/ieee754/index.js");var isArray=__webpack_require__(/*! isarray */"./node_modules/isarray/index.js");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();/* - * Export kMaxLength after typed array support is determined. - */exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function foo(){return 42;}};return arr.foo()===42&&// typed array instances can be augmented -typeof arr.subarray==='function'&&// chrome 9-10 lack `subarray` -arr.subarray(1,1).byteLength===0;// ie10 has broken `subarray` -}catch(e){return false;}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?0x7fffffff:0x3fffffff;}function createBuffer(that,length){if(kMaxLength()=kMaxLength()){throw new RangeError('Attempt to allocate Buffer larger than maximum '+'size: 0x'+kMaxLength().toString(16)+' bytes');}return length|0;}function SlowBuffer(length){if(+length!=length){// eslint-disable-line eqeqeq -length=0;}return Buffer.alloc(+length);}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer);};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('Arguments must be Buffers');}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i>>1;case'base64':return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;// assume utf8 -encoding=(''+encoding).toLowerCase();loweredCase=true;}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;// No need to verify that "this.length <= MAX_UINT32" since it's a read-only -// property of a typed array. -// This behaves neither like String nor Uint8Array in that we set start/end -// to their upper/lower bounds if the value passed is out of range. -// undefined is handled specially as per ECMA-262 6th Edition, -// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. -if(start===undefined||start<0){start=0;}// Return early if start > this.length. Done here to prevent potential uint32 -// coercion fail below. -if(start>this.length){return'';}if(end===undefined||end>this.length){end=this.length;}if(end<=0){return'';}// Force coersion to uint32. This will also coerce falsey/NaN values to 0. -end>>>=0;start>>>=0;if(end<=start){return'';}if(!encoding)encoding='utf8';while(true){switch(encoding){case'hex':return hexSlice(this,start,end);case'utf8':case'utf-8':return utf8Slice(this,start,end);case'ascii':return asciiSlice(this,start,end);case'latin1':case'binary':return latin1Slice(this,start,end);case'base64':return base64Slice(this,start,end);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError('Unknown encoding: '+encoding);encoding=(encoding+'').toLowerCase();loweredCase=true;}}}// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i;}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError('Buffer size must be a multiple of 16-bits');}for(var i=0;i0){str=this.toString('hex',0,max).match(/.{2}/g).join(' ');if(this.length>max)str+=' ... ';}return'';};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError('Argument must be a Buffer');}if(start===undefined){start=0;}if(end===undefined){end=target?target.length:0;}if(thisStart===undefined){thisStart=0;}if(thisEnd===undefined){thisEnd=this.length;}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError('out of range index');}if(thisStart>=thisEnd&&start>=end){return 0;}if(thisStart>=thisEnd){return-1;}if(start>=end){return 1;}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match -if(buffer.length===0)return-1;// Normalize byteOffset -if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byteOffset=-0x80000000;}byteOffset=+byteOffset;// Coerce to Number. -if(isNaN(byteOffset)){// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer -byteOffset=dir?0:buffer.length-1;}// Normalize byteOffset: negative offsets start from the end of the buffer -if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1;}else if(byteOffset<0){if(dir)byteOffset=0;else return-1;}// Normalize val -if(typeof val==='string'){val=Buffer.from(val,encoding);}// Finally, search either indexOf (if dir is true) or lastIndexOf -if(Buffer.isBuffer(val)){// Special case: looking for empty string/buffer always fails -if(val.length===0){return-1;}return arrayIndexOf(buffer,val,byteOffset,encoding,dir);}else if(typeof val==='number'){val=val&0xFF;// Search for a byte value [0-255] -if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==='function'){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset);}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset);}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir);}throw new TypeError('val must be string, number or Buffer');}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==='ucs2'||encoding==='ucs-2'||encoding==='utf16le'||encoding==='utf-16le'){if(arr.length<2||val.length<2){return-1;}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2;}}function read(buf,i){if(indexSize===1){return buf[i];}else{return buf.readUInt16BE(i*indexSize);}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining;}}// must be an even number of digits -var strLen=string.length;if(strLen%2!==0)throw new TypeError('Invalid hex string');if(length>strLen/2){length=strLen/2;}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError('Attempt to write outside buffer bounds');}if(!encoding)encoding='utf8';var loweredCase=false;for(;;){switch(encoding){case'hex':return hexWrite(this,string,offset,length);case'utf8':case'utf-8':return utf8Write(this,string,offset,length);case'ascii':return asciiWrite(this,string,offset,length);case'latin1':case'binary':return latin1Write(this,string,offset,length);case'base64':// Warning: maxLength not taken into account in base64Write -return base64Write(this,string,offset,length);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError('Unknown encoding: '+encoding);encoding=(''+encoding).toLowerCase();loweredCase=true;}}};Buffer.prototype.toJSON=function toJSON(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)};};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf);}else{return base64.fromByteArray(buf.slice(start,end));}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i0xEF?4:firstByte>0xDF?3:firstByte>0xBF?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<0x80){codePoint=firstByte;}break;case 2:secondByte=buf[i+1];if((secondByte&0xC0)===0x80){tempCodePoint=(firstByte&0x1F)<<0x6|secondByte&0x3F;if(tempCodePoint>0x7F){codePoint=tempCodePoint;}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&0xC0)===0x80&&(thirdByte&0xC0)===0x80){tempCodePoint=(firstByte&0xF)<<0xC|(secondByte&0x3F)<<0x6|thirdByte&0x3F;if(tempCodePoint>0x7FF&&(tempCodePoint<0xD800||tempCodePoint>0xDFFF)){codePoint=tempCodePoint;}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&0xC0)===0x80&&(thirdByte&0xC0)===0x80&&(fourthByte&0xC0)===0x80){tempCodePoint=(firstByte&0xF)<<0x12|(secondByte&0x3F)<<0xC|(thirdByte&0x3F)<<0x6|fourthByte&0x3F;if(tempCodePoint>0xFFFF&&tempCodePoint<0x110000){codePoint=tempCodePoint;}}}}if(codePoint===null){// we did not generate a valid codePoint so insert a -// replacement char (U+FFFD) and advance only 1 byte -codePoint=0xFFFD;bytesPerSequence=1;}else if(codePoint>0xFFFF){// encode to utf16 (surrogate pair dance) -codePoint-=0x10000;res.push(codePoint>>>10&0x3FF|0xD800);codePoint=0xDC00|codePoint&0x3FF;}res.push(codePoint);i+=bytesPerSequence;}return decodeCodePointsArray(res);}// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH=0x1000;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints);// avoid extra slice() -}// Decode in chunks to avoid "call stack size exceeded". -var res='';var i=0;while(ilen)end=len;var out='';for(var i=start;ilen){start=len;}if(end<0){end+=len;if(end<0)end=0;}else if(end>len){end=len;}if(endlength)throw new RangeError('Trying to access beyond buffer length');}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=0x100)){val+=this[offset+--byteLength]*mul;}return val;};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset];};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8;};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1];};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*0x1000000;};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*0x1000000+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3]);};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val;};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=0x100)){val+=this[offset+--i]*mul;}mul*=0x80;if(val>=mul)val-=Math.pow(2,8*byteLength);return val;};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&0x80))return this[offset];return(0xff-this[offset]+1)*-1;};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&0x8000?val|0xFFFF0000:val;};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&0x8000?val|0xFFFF0000:val;};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24;};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3];};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4);};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4);};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8);};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8);};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError('Index out of range');}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0);}var mul=1;var i=0;this[offset]=value&0xFF;while(++i=0&&(mul*=0x100)){this[offset+i]=value/mul&0xFF;}return offset+byteLength;};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,0xff,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&0xff;return offset+1;};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=0xffff+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8;}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0xffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;}else{objectWriteUInt16(this,value,offset,true);}return offset+2;};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0xffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&0xff;}else{objectWriteUInt16(this,value,offset,false);}return offset+2;};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=0xffffffff+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&0xff;}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0xffffffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&0xff;}else{objectWriteUInt32(this,value,offset,true);}return offset+4;};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0xffffffff,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&0xff;}else{objectWriteUInt32(this,value,offset,false);}return offset+4;};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit);}var i=0;var mul=1;var sub=0;this[offset]=value&0xFF;while(++i>0)-sub&0xFF;}return offset+byteLength;};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit);}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&0xFF;while(--i>=0&&(mul*=0x100)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1;}this[offset+i]=(value/mul>>0)-sub&0xFF;}return offset+byteLength;};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,0x7f,-0x80);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=0xff+value+1;this[offset]=value&0xff;return offset+1;};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0x7fff,-0x8000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;}else{objectWriteUInt16(this,value,offset,true);}return offset+2;};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,0x7fff,-0x8000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&0xff;}else{objectWriteUInt16(this,value,offset,false);}return offset+2;};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0x7fffffff,-0x80000000);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&0xff;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;}else{objectWriteUInt32(this,value,offset,true);}return offset+4;};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,0x7fffffff,-0x80000000);if(value<0)value=0xffffffff+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&0xff;}else{objectWriteUInt32(this,value,offset,false);}return offset+4;};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError('Index out of range');if(offset<0)throw new RangeError('Index out of range');}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e+38,-3.4028234663852886e+38);}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4;}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert);};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert);};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157E+308,-1.7976931348623157E+308);}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8;}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert);};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert);};// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError('sourceStart out of bounds');if(end<0)throw new RangeError('sourceEnd out of bounds');// Are we oob? -if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start];}}else if(len<1000||!Buffer.TYPED_ARRAY_SUPPORT){// ascending copy from start -for(i=0;i>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==='number'){for(i=start;i0xD7FF&&codePoint<0xE000){// last char was a lead -if(!leadSurrogate){// no lead yet -if(codePoint>0xDBFF){// unexpected trail -if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}else if(i+1===length){// unpaired lead -if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);continue;}// valid lead -leadSurrogate=codePoint;continue;}// 2 leads in a row -if(codePoint<0xDC00){if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);leadSurrogate=codePoint;continue;}// valid surrogate pair -codePoint=(leadSurrogate-0xD800<<10|codePoint-0xDC00)+0x10000;}else if(leadSurrogate){// valid bmp char, but last char was a lead -if((units-=3)>-1)bytes.push(0xEF,0xBF,0xBD);}leadSurrogate=null;// encode utf8 -if(codePoint<0x80){if((units-=1)<0)break;bytes.push(codePoint);}else if(codePoint<0x800){if((units-=2)<0)break;bytes.push(codePoint>>0x6|0xC0,codePoint&0x3F|0x80);}else if(codePoint<0x10000){if((units-=3)<0)break;bytes.push(codePoint>>0xC|0xE0,codePoint>>0x6&0x3F|0x80,codePoint&0x3F|0x80);}else if(codePoint<0x110000){if((units-=4)<0)break;bytes.push(codePoint>>0x12|0xF0,codePoint>>0xC&0x3F|0x80,codePoint>>0x6&0x3F|0x80,codePoint&0x3F|0x80);}else{throw new Error('Invalid code point');}}return bytes;}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi);}return byteArray;}function base64ToBytes(str){return base64.toByteArray(base64clean(str));}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i];}return i;}function isnan(val){return val!==val;// eslint-disable-line no-self-compare -}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/parse-asn1/aesid.json":/*!********************************************!*\ - !*** ./node_modules/parse-asn1/aesid.json ***! - \********************************************/ /*! exports provided: 2.16.840.1.101.3.4.1.1, 2.16.840.1.101.3.4.1.2, 2.16.840.1.101.3.4.1.3, 2.16.840.1.101.3.4.1.4, 2.16.840.1.101.3.4.1.21, 2.16.840.1.101.3.4.1.22, 2.16.840.1.101.3.4.1.23, 2.16.840.1.101.3.4.1.24, 2.16.840.1.101.3.4.1.41, 2.16.840.1.101.3.4.1.42, 2.16.840.1.101.3.4.1.43, 2.16.840.1.101.3.4.1.44, default */ /***/function node_modulesParseAsn1AesidJson(module){module.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\"}");/***/},/***/"./node_modules/parse-asn1/asn1.js":/*!*****************************************!*\ - !*** ./node_modules/parse-asn1/asn1.js ***! - \*****************************************/ /*! no static exports found */ /***/function node_modulesParseAsn1Asn1Js(module,exports,__webpack_require__){"use strict";// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js -// Fedor, you are amazing. -var asn1=__webpack_require__(/*! asn1.js */"./node_modules/asn1.js/lib/asn1.js");exports.certificate=__webpack_require__(/*! ./certificate */"./node_modules/parse-asn1/certificate.js");var RSAPrivateKey=asn1.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());});exports.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=asn1.define('RSAPublicKey',function(){this.seq().obj(this.key('modulus').int(),this.key('publicExponent').int());});exports.RSAPublicKey=RSAPublicKey;var PublicKey=asn1.define('SubjectPublicKeyInfo',function(){this.seq().obj(this.key('algorithm').use(AlgorithmIdentifier),this.key('subjectPublicKey').bitstr());});exports.PublicKey=PublicKey;var AlgorithmIdentifier=asn1.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());});var PrivateKeyInfo=asn1.define('PrivateKeyInfo',function(){this.seq().obj(this.key('version').int(),this.key('algorithm').use(AlgorithmIdentifier),this.key('subjectPrivateKey').octstr());});exports.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=asn1.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());});exports.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=asn1.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());});exports.DSAPrivateKey=DSAPrivateKey;exports.DSAparam=asn1.define('DSAparam',function(){this.int();});var ECPrivateKey=asn1.define('ECPrivateKey',function(){this.seq().obj(this.key('version').int(),this.key('privateKey').octstr(),this.key('parameters').optional().explicit(0).use(ECParameters),this.key('publicKey').optional().explicit(1).bitstr());});exports.ECPrivateKey=ECPrivateKey;var ECParameters=asn1.define('ECParameters',function(){this.choice({namedCurve:this.objid()});});exports.signature=asn1.define('signature',function(){this.seq().obj(this.key('r').int(),this.key('s').int());});/***/},/***/"./node_modules/parse-asn1/certificate.js":/*!************************************************!*\ - !*** ./node_modules/parse-asn1/certificate.js ***! - \************************************************/ /*! no static exports found */ /***/function node_modulesParseAsn1CertificateJs(module,exports,__webpack_require__){"use strict";// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js -// thanks to @Rantanen -var asn=__webpack_require__(/*! asn1.js */"./node_modules/asn1.js/lib/asn1.js");var Time=asn.define('Time',function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()});});var AttributeTypeValue=asn.define('AttributeTypeValue',function(){this.seq().obj(this.key('type').objid(),this.key('value').any());});var AlgorithmIdentifier=asn.define('AlgorithmIdentifier',function(){this.seq().obj(this.key('algorithm').objid(),this.key('parameters').optional(),this.key('curve').objid().optional());});var SubjectPublicKeyInfo=asn.define('SubjectPublicKeyInfo',function(){this.seq().obj(this.key('algorithm').use(AlgorithmIdentifier),this.key('subjectPublicKey').bitstr());});var RelativeDistinguishedName=asn.define('RelativeDistinguishedName',function(){this.setof(AttributeTypeValue);});var RDNSequence=asn.define('RDNSequence',function(){this.seqof(RelativeDistinguishedName);});var Name=asn.define('Name',function(){this.choice({rdnSequence:this.use(RDNSequence)});});var Validity=asn.define('Validity',function(){this.seq().obj(this.key('notBefore').use(Time),this.key('notAfter').use(Time));});var Extension=asn.define('Extension',function(){this.seq().obj(this.key('extnID').objid(),this.key('critical').bool().def(false),this.key('extnValue').octstr());});var TBSCertificate=asn.define('TBSCertificate',function(){this.seq().obj(this.key('version').explicit(0).int().optional(),this.key('serialNumber').int(),this.key('signature').use(AlgorithmIdentifier),this.key('issuer').use(Name),this.key('validity').use(Validity),this.key('subject').use(Name),this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),this.key('issuerUniqueID').implicit(1).bitstr().optional(),this.key('subjectUniqueID').implicit(2).bitstr().optional(),this.key('extensions').explicit(3).seqof(Extension).optional());});var X509Certificate=asn.define('X509Certificate',function(){this.seq().obj(this.key('tbsCertificate').use(TBSCertificate),this.key('signatureAlgorithm').use(AlgorithmIdentifier),this.key('signatureValue').bitstr());});module.exports=X509Certificate;/***/},/***/"./node_modules/parse-asn1/fixProc.js":/*!********************************************!*\ - !*** ./node_modules/parse-asn1/fixProc.js ***! - \********************************************/ /*! no static exports found */ /***/function node_modulesParseAsn1FixProcJs(module,exports,__webpack_require__){// adapted from https://github.com/apatil/pemstrip -var findProc=/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;var startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m;var fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m;var evp=__webpack_require__(/*! evp_bytestokey */"./node_modules/evp_bytestokey/index.js");var ciphers=__webpack_require__(/*! browserify-aes */"./node_modules/browserify-aes/browser.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;module.exports=function(okey,password){var key=okey.toString();var match=key.match(findProc);var decrypted;if(!match){var match2=key.match(fullRegex);decrypted=new Buffer(match2[2].replace(/[\r\n]/g,''),'base64');}else{var suite='aes'+match[1];var iv=Buffer.from(match[2],'hex');var cipherText=Buffer.from(match[3].replace(/[\r\n]/g,''),'base64');var cipherKey=evp(password,iv.slice(0,8),parseInt(match[1],10)).key;var out=[];var cipher=ciphers.createDecipheriv(suite,cipherKey,iv);out.push(cipher.update(cipherText));out.push(cipher.final());decrypted=Buffer.concat(out);}var tag=key.match(startRegex)[1];return{tag:tag,data:decrypted};};/***/},/***/"./node_modules/parse-asn1/index.js":/*!******************************************!*\ - !*** ./node_modules/parse-asn1/index.js ***! - \******************************************/ /*! no static exports found */ /***/function node_modulesParseAsn1IndexJs(module,exports,__webpack_require__){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var asn1=__webpack_require__(/*! ./asn1 */"./node_modules/parse-asn1/asn1.js");var aesid=__webpack_require__(/*! ./aesid.json */"./node_modules/parse-asn1/aesid.json");var fixProc=__webpack_require__(/*! ./fixProc */"./node_modules/parse-asn1/fixProc.js");var ciphers=__webpack_require__(/*! browserify-aes */"./node_modules/browserify-aes/browser.js");var compat=__webpack_require__(/*! pbkdf2 */"./node_modules/pbkdf2/browser.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;module.exports=parseKeys;function parseKeys(buffer){var password;if(_typeof(buffer)==='object'&&!Buffer.isBuffer(buffer)){password=buffer.passphrase;buffer=buffer.key;}if(typeof buffer==='string'){buffer=Buffer.from(buffer);}var stripped=fixProc(buffer,password);var type=stripped.tag;var data=stripped.data;var subtype,ndata;switch(type){case'CERTIFICATE':ndata=asn1.certificate.decode(data,'der').tbsCertificate.subjectPublicKeyInfo;// falls through -case'PUBLIC KEY':if(!ndata){ndata=asn1.PublicKey.decode(data,'der');}subtype=ndata.algorithm.algorithm.join('.');switch(subtype){case'1.2.840.113549.1.1.1':return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data,'der');case'1.2.840.10045.2.1':ndata.subjectPrivateKey=ndata.subjectPublicKey;return{type:'ec',data:ndata};case'1.2.840.10040.4.1':ndata.algorithm.params.pub_key=asn1.DSAparam.decode(ndata.subjectPublicKey.data,'der');return{type:'dsa',data:ndata.algorithm.params};default:throw new Error('unknown key id '+subtype);}throw new Error('unknown key type '+type);case'ENCRYPTED PRIVATE KEY':data=asn1.EncryptedPrivateKey.decode(data,'der');data=decrypt(data,password);// falls through -case'PRIVATE KEY':ndata=asn1.PrivateKey.decode(data,'der');subtype=ndata.algorithm.algorithm.join('.');switch(subtype){case'1.2.840.113549.1.1.1':return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey,'der');case'1.2.840.10045.2.1':return{curve:ndata.algorithm.curve,privateKey:asn1.ECPrivateKey.decode(ndata.subjectPrivateKey,'der').privateKey};case'1.2.840.10040.4.1':ndata.algorithm.params.priv_key=asn1.DSAparam.decode(ndata.subjectPrivateKey,'der');return{type:'dsa',params:ndata.algorithm.params};default:throw new Error('unknown key id '+subtype);}throw new Error('unknown key type '+type);case'RSA PUBLIC KEY':return asn1.RSAPublicKey.decode(data,'der');case'RSA PRIVATE KEY':return asn1.RSAPrivateKey.decode(data,'der');case'DSA PRIVATE KEY':return{type:'dsa',params:asn1.DSAPrivateKey.decode(data,'der')};case'EC PRIVATE KEY':data=asn1.ECPrivateKey.decode(data,'der');return{curve:data.parameters.value,privateKey:data.privateKey};default:throw new Error('unknown key type '+type);}}parseKeys.signature=asn1.signature;function decrypt(data,password){var salt=data.algorithm.decrypt.kde.kdeparams.salt;var iters=parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(),10);var algo=aesid[data.algorithm.decrypt.cipher.algo.join('.')];var iv=data.algorithm.decrypt.cipher.iv;var cipherText=data.subjectPrivateKey;var keylen=parseInt(algo.split('-')[1],10)/8;var key=compat.pbkdf2Sync(password,salt,iters,keylen,'sha1');var cipher=ciphers.createDecipheriv(algo,key,iv);var out=[];out.push(cipher.update(cipherText));out.push(cipher.final());return Buffer.concat(out);}/***/},/***/"./node_modules/path-browserify/index.js":/*!***********************************************!*\ - !*** ./node_modules/path-browserify/index.js ***! - \***********************************************/ /*! no static exports found */ /***/function node_modulesPathBrowserifyIndexJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(process){// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0 -var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to go above the root, restore leading ..s -if(allowAboveRoot){for(;up--;up){parts.unshift('..');}}return parts;}// path.resolve([from ...], to) -// posix version -exports.resolve=function(){var resolvedPath='',resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();// Skip empty and invalid entries -if(typeof path!=='string'){throw new TypeError('Arguments to path.resolve must be strings');}else if(!path){continue;}resolvedPath=path+'/'+resolvedPath;resolvedAbsolute=path.charAt(0)==='/';}// At this point the path should be resolved to a full absolute path, but -// handle relative paths to be safe (might happen when process.cwd() fails) -// Normalize the path -resolvedPath=normalizeArray(filter(resolvedPath.split('/'),function(p){return!!p;}),!resolvedAbsolute).join('/');return(resolvedAbsolute?'/':'')+resolvedPath||'.';};// path.normalize(path) -// posix version -exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==='/';// Normalize the path -path=normalizeArray(filter(path.split('/'),function(p){return!!p;}),!isAbsolute).join('/');if(!path&&!isAbsolute){path='.';}if(path&&trailingSlash){path+='/';}return(isAbsolute?'/':'')+path;};// posix version -exports.isAbsolute=function(path){return path.charAt(0)==='/';};// posix version -exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=='string'){throw new TypeError('Arguments to path.join must be strings');}return p;}).join('/'));};// path.relative(from, to) -// posix version -exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=='')break;}if(start>end)return[];return arr.slice(start,end-start+1);}var fromParts=trim(from.split('/'));var toParts=trim(to.split('/'));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i=1;--i){code=path.charCodeAt(i);if(code===47/*/*/){if(!matchedSlash){end=i;break;}}else{// We saw the first non-path separator -matchedSlash=false;}}if(end===-1)return hasRoot?'/':'.';if(hasRoot&&end===1){// return '//'; -// Backwards-compat fix: -return'/';}return path.slice(0,end);};function basename(path){if(typeof path!=='string')path=path+'';var start=0;var end=-1;var matchedSlash=true;var i;for(i=path.length-1;i>=0;--i){if(path.charCodeAt(i)===47/*/*/){// If we reached a path separator that was not part of a set of path -// separators at the end of the string, stop now -if(!matchedSlash){start=i+1;break;}}else if(end===-1){// We saw the first non-path separator, mark this as the end of our -// path component -matchedSlash=false;end=i+1;}}if(end===-1)return'';return path.slice(start,end);}// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename=function(path,ext){var f=basename(path);if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length);}return f;};exports.extname=function(path){if(typeof path!=='string')path=path+'';var startDot=-1;var startPart=0;var end=-1;var matchedSlash=true;// Track the state of characters (if any) we see before our first dot and -// after any path separator we find -var preDotState=0;for(var i=path.length-1;i>=0;--i){var code=path.charCodeAt(i);if(code===47/*/*/){// If we reached a path separator that was not part of a set of path -// separators at the end of the string, stop now -if(!matchedSlash){startPart=i+1;break;}continue;}if(end===-1){// We saw the first non-path separator, mark this as the end of our -// extension -matchedSlash=false;end=i+1;}if(code===46/*.*/){// If this is our first dot, mark it as the start of our extension -if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(startDot!==-1){// We saw a non-dot and non-path separator before our dot, so we should -// have a good chance at having a non-empty extension -preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot -preDotState===0||// The (right-most) trimmed path component is exactly '..' -preDotState===1&&startDot===end-1&&startDot===startPart+1){return'';}return path.slice(startDot,end);};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i=6?'utf-8':'binary';}module.exports=defaultEncoding;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../process/browser.js */"./node_modules/process/browser.js"));/***/},/***/"./node_modules/pbkdf2/lib/precondition.js":/*!*************************************************!*\ - !*** ./node_modules/pbkdf2/lib/precondition.js ***! - \*************************************************/ /*! no static exports found */ /***/function node_modulesPbkdf2LibPreconditionJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(Buffer){var MAX_ALLOC=Math.pow(2,30)-1;// default in iojs -function checkBuffer(buf,name){if(typeof buf!=='string'&&!Buffer.isBuffer(buf)){throw new TypeError(name+' must be a buffer or string');}}module.exports=function(password,salt,iterations,keylen){checkBuffer(password,'Password');checkBuffer(salt,'Salt');if(typeof iterations!=='number'){throw new TypeError('Iterations not a number');}if(iterations<0){throw new TypeError('Bad iterations');}if(typeof keylen!=='number'){throw new TypeError('Key length not a number');}if(keylen<0||keylen>MAX_ALLOC||keylen!==keylen){/* eslint no-self-compare: 0 */throw new TypeError('Bad key length');}};/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/pbkdf2/lib/sync-browser.js":/*!*************************************************!*\ - !*** ./node_modules/pbkdf2/lib/sync-browser.js ***! - \*************************************************/ /*! no static exports found */ /***/function node_modulesPbkdf2LibSyncBrowserJs(module,exports,__webpack_require__){var md5=__webpack_require__(/*! create-hash/md5 */"./node_modules/create-hash/md5.js");var RIPEMD160=__webpack_require__(/*! ripemd160 */"./node_modules/ripemd160/index.js");var sha=__webpack_require__(/*! sha.js */"./node_modules/sha.js/index.js");var checkParameters=__webpack_require__(/*! ./precondition */"./node_modules/pbkdf2/lib/precondition.js");var defaultEncoding=__webpack_require__(/*! ./default-encoding */"./node_modules/pbkdf2/lib/default-encoding.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var ZEROS=Buffer.alloc(128);var sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(alg,key,saltLen){var hash=getDigest(alg);var blocksize=alg==='sha512'||alg==='sha384'?128:64;if(key.length>blocksize){key=hash(key);}else if(key.length1){for(var i=1;ik||new BN(enc).cmp(key.modulus)>=0){throw new Error('decryption error');}var msg;if(reverse){msg=withPublic(new BN(enc),key);}else{msg=crt(enc,key);}var zBuffer=Buffer.alloc(k-msg.length);msg=Buffer.concat([zBuffer,msg],k);if(padding===4){return oaep(key,msg);}else if(padding===1){return pkcs1(key,msg,reverse);}else if(padding===3){return msg;}else{throw new Error('unknown padding');}};function oaep(key,msg){var k=key.modulus.byteLength();var iHash=createHash('sha1').update(Buffer.alloc(0)).digest();var hLen=iHash.length;if(msg[0]!==0){throw new Error('decryption error');}var maskedSeed=msg.slice(1,hLen+1);var maskedDb=msg.slice(hLen+1);var seed=xor(maskedSeed,mgf(maskedDb,hLen));var db=xor(maskedDb,mgf(seed,k-hLen-1));if(compare(iHash,db.slice(0,hLen))){throw new Error('decryption error');}var i=hLen;while(db[i]===0){i++;}if(db[i++]!==1){throw new Error('decryption error');}return db.slice(i);}function pkcs1(key,msg,reverse){var p1=msg.slice(0,2);var i=2;var status=0;while(msg[i++]!==0){if(i>=msg.length){status++;break;}}var ps=msg.slice(2,i-1);if(p1.toString('hex')!=='0002'&&!reverse||p1.toString('hex')!=='0001'&&reverse){status++;}if(ps.length<8){status++;}if(status){throw new Error('decryption error');}return msg.slice(i);}function compare(a,b){a=Buffer.from(a);b=Buffer.from(b);var dif=0;var len=a.length;if(a.length!==b.length){dif++;len=Math.min(a.length,b.length);}var i=-1;while(++i=0){throw new Error('data too long for modulus');}}else{throw new Error('unknown padding');}if(reverse){return crt(paddedMsg,key);}else{return withPublic(paddedMsg,key);}};function oaep(key,msg){var k=key.modulus.byteLength();var mLen=msg.length;var iHash=createHash('sha1').update(Buffer.alloc(0)).digest();var hLen=iHash.length;var hLen2=2*hLen;if(mLen>k-hLen2-2){throw new Error('message too long');}var ps=Buffer.alloc(k-mLen-hLen2-2);var dblen=k-hLen-1;var seed=randomBytes(hLen);var maskedDb=xor(Buffer.concat([iHash,ps,Buffer.alloc(1,1),msg],dblen),mgf(seed,dblen));var maskedSeed=xor(seed,mgf(maskedDb,hLen));return new BN(Buffer.concat([Buffer.alloc(1),maskedSeed,maskedDb],k));}function pkcs1(key,msg,reverse){var mLen=msg.length;var k=key.modulus.byteLength();if(mLen>k-11){throw new Error('message too long');}var ps;if(reverse){ps=Buffer.alloc(k-mLen-3,0xff);}else{ps=nonZero(k-mLen-3);}return new BN(Buffer.concat([Buffer.from([0,reverse?1:2]),ps,Buffer.alloc(1),msg],k));}function nonZero(len){var out=Buffer.allocUnsafe(len);var i=0;var cache=randomBytes(len*2);var cur=0;var num;while(iMAX_UINT32)throw new RangeError('requested too many random bytes');var bytes=Buffer.allocUnsafe(size);if(size>0){// getRandomValues fails on IE if size == 0 -if(size>MAX_BYTES){// this is the max bytes crypto.getRandomValues -// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues -for(var generated=0;generatedkMaxUint32||offset<0){throw new TypeError('offset must be a uint32');}if(offset>kBufferMaxLength||offset>length){throw new RangeError('offset out of range');}}function assertSize(size,offset,length){if(typeof size!=='number'||size!==size){// eslint-disable-line no-self-compare -throw new TypeError('size must be a number');}if(size>kMaxUint32||size<0){throw new TypeError('size must be a uint32');}if(size+offset>length||size>kBufferMaxLength){throw new RangeError('buffer too small');}}if(crypto&&crypto.getRandomValues||!process.browser){exports.randomFill=randomFill;exports.randomFillSync=randomFillSync;}else{exports.randomFill=oldBrowser;exports.randomFillSync=oldBrowser;}function randomFill(buf,offset,size,cb){if(!Buffer.isBuffer(buf)&&!(buf instanceof global.Uint8Array)){throw new TypeError('"buf" argument must be a Buffer or Uint8Array');}if(typeof offset==='function'){cb=offset;offset=0;size=buf.length;}else if(typeof size==='function'){cb=size;size=buf.length-offset;}else if(typeof cb!=='function'){throw new TypeError('"cb" argument must be a function');}assertOffset(offset,buf.length);assertSize(size,offset,buf.length);return actualFill(buf,offset,size,cb);}function actualFill(buf,offset,size,cb){if(process.browser){var ourBuf=buf.buffer;var uint=new Uint8Array(ourBuf,offset,size);crypto.getRandomValues(uint);if(cb){process.nextTick(function(){cb(null,buf);});return;}return buf;}if(cb){randombytes(size,function(err,bytes){if(err){return cb(err);}bytes.copy(buf,offset);cb(null,buf);});return;}var bytes=randombytes(size);bytes.copy(buf,offset);return buf;}function randomFillSync(buf,offset,size){if(typeof offset==='undefined'){offset=0;}if(!Buffer.isBuffer(buf)&&!(buf instanceof global.Uint8Array)){throw new TypeError('"buf" argument must be a Buffer or Uint8Array');}assertOffset(offset,buf.length);if(size===undefined)size=buf.length-offset;assertSize(size,offset,buf.length);return actualFill(buf,offset,size);}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../process/browser.js */"./node_modules/process/browser.js"));/***/},/***/"./node_modules/readable-stream/duplex-browser.js":/*!********************************************************!*\ - !*** ./node_modules/readable-stream/duplex-browser.js ***! - \********************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamDuplexBrowserJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! ./lib/_stream_duplex.js */"./node_modules/readable-stream/lib/_stream_duplex.js");/***/},/***/"./node_modules/readable-stream/lib/_stream_duplex.js":/*!************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***! - \************************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamLib_stream_duplexJs(module,exports,__webpack_require__){"use strict";// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. -/**/var pna=__webpack_require__(/*! process-nextick-args */"./node_modules/process-nextick-args/index.js");/**/ /**/var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key);}return keys;};/**/module.exports=Duplex;/**/var util=Object.create(__webpack_require__(/*! core-util-is */"./node_modules/core-util-is/lib/util.js"));util.inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");/**/var Readable=__webpack_require__(/*! ./_stream_readable */"./node_modules/readable-stream/lib/_stream_readable.js");var Writable=__webpack_require__(/*! ./_stream_writable */"./node_modules/readable-stream/lib/_stream_writable.js");util.inherits(Duplex,Readable);{// avoid scope creep, the keys array can then be collected -var keys=objectKeys(Writable.prototype);for(var v=0;v*/var util=Object.create(__webpack_require__(/*! core-util-is */"./node_modules/core-util-is/lib/util.js"));util.inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");/**/util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};/***/},/***/"./node_modules/readable-stream/lib/_stream_readable.js":/*!**************************************************************!*\ - !*** ./node_modules/readable-stream/lib/_stream_readable.js ***! - \**************************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamLib_stream_readableJs(module,exports,__webpack_require__){"use strict";/* WEBPACK VAR INJECTION */(function(global,process){// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -/**/var pna=__webpack_require__(/*! process-nextick-args */"./node_modules/process-nextick-args/index.js");/**/module.exports=Readable;/**/var isArray=__webpack_require__(/*! isarray */"./node_modules/isarray/index.js");/**/ /**/var Duplex;/**/Readable.ReadableState=ReadableState;/**/var EE=__webpack_require__(/*! events */"./node_modules/events/events.js").EventEmitter;var EElistenerCount=function EElistenerCount(emitter,type){return emitter.listeners(type).length;};/**/ /**/var Stream=__webpack_require__(/*! ./internal/streams/stream */"./node_modules/readable-stream/lib/internal/streams/stream-browser.js");/**/ /**/var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk);}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array;}/**/ /**/var util=Object.create(__webpack_require__(/*! core-util-is */"./node_modules/core-util-is/lib/util.js"));util.inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");/**/ /**/var debugUtil=__webpack_require__(/*! util */1);var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog('stream');}else{debug=function debug(){};}/**/var BufferList=__webpack_require__(/*! ./internal/streams/BufferList */"./node_modules/readable-stream/lib/internal/streams/BufferList.js");var destroyImpl=__webpack_require__(/*! ./internal/streams/destroy */"./node_modules/readable-stream/lib/internal/streams/destroy.js");var StringDecoder;util.inherits(Readable,Stream);var kProxyEvents=['error','close','destroy','pause','resume'];function prependListener(emitter,event,fn){// Sadly this is not cacheable as some libraries bundle their own -// event emitter implementation with them. -if(typeof emitter.prependListener==='function')return emitter.prependListener(event,fn);// This is a hack to make sure that our error handler is attached before any -// userland ones. NEVER DO THIS. This is here only because this code needs -// to continue to work with older versions of Node.js that do not include -// the prependListener() method. The goal is to eventually remove this hack. -if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]];}function ReadableState(options,stream){Duplex=Duplex||__webpack_require__(/*! ./_stream_duplex */"./node_modules/readable-stream/lib/_stream_duplex.js");options=options||{};// Duplex streams are both readable and writable, but share -// the same options object. -// However, some cases require setting options to different -// values for the readable and the writable sides of the duplex stream. -// These options can be provided separately as readableXXX and writableXXX. -var isDuplex=stream instanceof Duplex;// object stream flag. Used to make read(n) ignore n and to -// make all the buffer merging and length checks go away -this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.readableObjectMode;// the point at which it stops calling _read() to fill the buffer -// Note: 0 is a valid value, means "don't call _read preemptively ever" -var hwm=options.highWaterMark;var readableHwm=options.readableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(readableHwm||readableHwm===0))this.highWaterMark=readableHwm;else this.highWaterMark=defaultHwm;// cast to ints. -this.highWaterMark=Math.floor(this.highWaterMark);// A linked list is used to store data chunks instead of an array because the -// linked list can remove elements from the beginning faster than -// array.shift() -this.buffer=new BufferList();this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;// a flag to be able to tell if the event 'readable'/'data' is emitted -// immediately, or on a later tick. We set this to true at first, because -// any actions that shouldn't happen until "later" should generally also -// not happen before the first read call. -this.sync=true;// whenever we return null, then we set a flag to say -// that we're awaiting a 'readable' event emission. -this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;// has it been destroyed -this.destroyed=false;// Crypto is kind of old and crusty. Historically, its default string -// encoding is 'binary' so we have to make this configurable. -// Everything else in the universe uses 'utf8', though. -this.defaultEncoding=options.defaultEncoding||'utf8';// the number of writers that are awaiting a drain event in .pipe()s -this.awaitDrain=0;// if true, a maybeReadMore has been scheduled -this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=__webpack_require__(/*! string_decoder/ */"./node_modules/string_decoder/lib/string_decoder.js").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding;}}function Readable(options){Duplex=Duplex||__webpack_require__(/*! ./_stream_duplex */"./node_modules/readable-stream/lib/_stream_duplex.js");if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);// legacy -this.readable=true;if(options){if(typeof options.read==='function')this._read=options.read;if(typeof options.destroy==='function')this._destroy=options.destroy;}Stream.call(this);}Object.defineProperty(Readable.prototype,'destroyed',{get:function get(){if(this._readableState===undefined){return false;}return this._readableState.destroyed;},set:function set(value){// we ignore the value if the stream -// has not been initialized yet -if(!this._readableState){return;}// backward compatibility, the user is explicitly -// managing destroyed -this._readableState.destroyed=value;}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){this.push(null);cb(err);};// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push=function(chunk,encoding){var state=this._readableState;var skipChunkCheck;if(!state.objectMode){if(typeof chunk==='string'){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=Buffer.from(chunk,encoding);encoding='';}skipChunkCheck=true;}}else{skipChunkCheck=true;}return readableAddChunk(this,chunk,encoding,false,skipChunkCheck);};// Unshift should *always* be something directly out of read() -Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,true,false);};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){var state=stream._readableState;if(chunk===null){state.reading=false;onEofChunk(stream,state);}else{var er;if(!skipChunkCheck)er=chunkInvalid(state,chunk);if(er){stream.emit('error',er);}else if(state.objectMode||chunk&&chunk.length>0){if(typeof chunk!=='string'&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk);}if(addToFront){if(state.endEmitted)stream.emit('error',new Error('stream.unshift() after end event'));else addChunk(stream,state,chunk,true);}else if(state.ended){stream.emit('error',new Error('stream.push() after EOF'));}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state);}else{addChunk(stream,state,chunk,false);}}}else if(!addToFront){state.reading=false;}}return needMoreData(state);}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit('data',chunk);stream.read(0);}else{// update the buffer info. -state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream);}maybeReadMore(stream,state);}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=='string'&&chunk!==undefined&&!state.objectMode){er=new TypeError('Invalid non-string/buffer chunk');}return er;}// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state){return!state.ended&&(state.needReadable||state.length 8MB -var MAX_HWM=0x800000;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM;}else{// Get the next highest power of 2 to prevent increasing hwm excessively in -// tiny amounts -n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++;}return n;}// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){// Only flow one buffer at a time -if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm. -if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough -if(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below. -Readable.prototype.read=function(n){debug('read',n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;// if we're doing read(0) to trigger a readable event, but we -// already have a bunch of data in the buffer, then just trigger -// the 'readable' event and move on. -if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug('read: emitReadable',state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null;}n=howMuchToRead(n,state);// if we've ended, and we're now clear, then finish it up. -if(n===0&&state.ended){if(state.length===0)endReadable(this);return null;}// All the actual chunk generation logic needs to be -// *below* the call to _read. The reason is that in certain -// synthetic stream cases, such as passthrough streams, _read -// may be a completely synchronous operation which may change -// the state of the read buffer, providing enough data when -// before there was *not* enough. -// -// So, the steps are: -// 1. Figure out what the state of things will be after we do -// a read from the buffer. -// -// 2. If that resulting state will trigger a _read, then call _read. -// Note that this may be asynchronous, or synchronous. Yes, it is -// deeply ugly to write APIs this way, but that still doesn't mean -// that the Readable class should behave improperly, as streams are -// designed to be sync/async agnostic. -// Take note if the _read call is sync or async (ie, if the read call -// has returned yet), so that we know whether or not it's safe to emit -// 'readable' etc. -// -// 3. Actually pull the requested chunks out of the buffer and return. -// if we need a readable event, then we need to do some reading. -var doRead=state.needReadable;debug('need readable',doRead);// if we currently have less than the highWaterMark, then also read some -if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0;}else{state.length-=n;}if(state.length===0){// If we have nothing in the buffer, then we want to know -// as soon as we *do* get something into the buffer. -if(!state.ended)state.needReadable=true;// If we tried to read() past the EOF, then emit end on the next tick. -if(nOrig!==n&&state.ended)endReadable(this);}if(ret!==null)this.emit('data',ret);return ret;};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length;}}state.ended=true;// emit 'readable' now to make sure it gets picked up. -emitReadable(stream);}// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;if(state.sync)pna.nextTick(emitReadable_,stream);else emitReadable_(stream);}}function emitReadable_(stream){debug('emit readable');stream.emit('readable');flow(stream);}// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;pna.nextTick(maybeReadMore_,stream,state);}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length Introduce a guard on increasing awaitDrain. -var increasedAwaitDrain=false;src.on('data',ondata);function ondata(chunk){debug('ondata');increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){// If the user unpiped during `dest.write()`, it is possible -// to get stuck in a permanently paused state if that write -// also returned false. -// => Check whether `dest` is still a piping destination. -if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug('false write response, pause',src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true;}src.pause();}}// if the dest has an error, then stop piping into it. -// however, don't suppress the throwing behavior for this. -function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones. -prependListener(dest,'error',onerror);// Both close and finish should trigger unpipe, but only once. -function onclose(){dest.removeListener('finish',onfinish);unpipe();}dest.once('close',onclose);function onfinish(){debug('onfinish');dest.removeListener('close',onclose);unpipe();}dest.once('finish',onfinish);function unpipe(){debug('unpipe');src.unpipe(dest);}// tell the dest that it's being piped to -dest.emit('pipe',src);// start the flow if it hasn't been started already. -if(!state.flowing){debug('pipe resume');src.resume();}return dest;};function pipeOnDrain(src){return function(){var state=src._readableState;debug('pipeOnDrain',state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,'data')){state.flowing=true;flow(src);}};}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};// if we're not piping anywhere, then do nothing. -if(state.pipesCount===0)return this;// just one destination. most common case. -if(state.pipesCount===1){// passed in one, but it's not the right one. -if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;// got a match. -state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit('unpipe',this,unpipeInfo);return this;}// slow case. multiple pipe destinations. -if(!dest){// remove all. -var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i=state.length){// read it all, truncate the list -if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear();}else{// read part of list -ret=fromListPartial(n,state.buffer,state.decoder);}return ret;}// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n,list,hasStrings){var ret;if(nstr.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list.head=p;p.data=buf.slice(nb);}break;}++c;}list.length-=c;return ret;}function endReadable(stream){var state=stream._readableState;// If we get here before consuming all the bytes, then that is a -// bug in node. Should never happen. -if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;pna.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){// Check that we didn't get one last unshift. -if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');}}function indexOf(xs,x){for(var i=0,l=xs.length;i*/var util=Object.create(__webpack_require__(/*! core-util-is */"./node_modules/core-util-is/lib/util.js"));util.inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");/**/util.inherits(Transform,Duplex);function afterTransform(er,data){var ts=this._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb){return this.emit('error',new Error('write callback called multiple times'));}ts.writechunk=null;ts.writecb=null;if(data!=null)// single equals check for both `null` and `undefined` -this.push(data);cb(er);var rs=this._readableState;rs.reading=false;if(rs.needReadable||rs.length*/var pna=__webpack_require__(/*! process-nextick-args */"./node_modules/process-nextick-args/index.js");/**/module.exports=Writable;/* */function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null;}// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state);};}/* */ /**/var asyncWrite=!process.browser&&['v0.10','v0.9.'].indexOf(process.version.slice(0,5))>-1?setImmediate:pna.nextTick;/**/ /**/var Duplex;/**/Writable.WritableState=WritableState;/**/var util=Object.create(__webpack_require__(/*! core-util-is */"./node_modules/core-util-is/lib/util.js"));util.inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");/**/ /**/var internalUtil={deprecate:__webpack_require__(/*! util-deprecate */"./node_modules/util-deprecate/browser.js")};/**/ /**/var Stream=__webpack_require__(/*! ./internal/streams/stream */"./node_modules/readable-stream/lib/internal/streams/stream-browser.js");/**/ /**/var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk);}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array;}/**/var destroyImpl=__webpack_require__(/*! ./internal/streams/destroy */"./node_modules/readable-stream/lib/internal/streams/destroy.js");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||__webpack_require__(/*! ./_stream_duplex */"./node_modules/readable-stream/lib/_stream_duplex.js");options=options||{};// Duplex streams are both readable and writable, but share -// the same options object. -// However, some cases require setting options to different -// values for the readable and the writable sides of the duplex stream. -// These options can be provided separately as readableXXX and writableXXX. -var isDuplex=stream instanceof Duplex;// object stream flag to indicate whether or not this stream -// contains buffers or objects. -this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.writableObjectMode;// the point at which write() starts returning false -// Note: 0 is a valid value, means that we always return false if -// the entire buffer is not flushed immediately on write() -var hwm=options.highWaterMark;var writableHwm=options.writableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(writableHwm||writableHwm===0))this.highWaterMark=writableHwm;else this.highWaterMark=defaultHwm;// cast to ints. -this.highWaterMark=Math.floor(this.highWaterMark);// if _final has been called -this.finalCalled=false;// drain event flag. -this.needDrain=false;// at the start of calling end() -this.ending=false;// when end() has been called, and returned -this.ended=false;// when 'finish' is emitted -this.finished=false;// has it been destroyed -this.destroyed=false;// should we decode strings into buffers before passing to _write? -// this is here so that some node-core streams can optimize string -// handling at a lower level. -var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;// Crypto is kind of old and crusty. Historically, its default string -// encoding is 'binary' so we have to make this configurable. -// Everything else in the universe uses 'utf8', though. -this.defaultEncoding=options.defaultEncoding||'utf8';// not an actual buffer we keep track of, but a measurement -// of how much we're waiting to get pushed to some underlying -// socket or file. -this.length=0;// a flag to see when we're in the middle of a write. -this.writing=false;// when true all writes will be buffered until .uncork() call -this.corked=0;// a flag to be able to tell if the onwrite cb is called immediately, -// or on a later tick. We set this to true at first, because any -// actions that shouldn't happen until "later" should generally also -// not happen before the first write call. -this.sync=true;// a flag to know if we're processing previously buffered items, which -// may call the _write() callback in the same tick, so that we don't -// end up in an overlapped onwrite situation. -this.bufferProcessing=false;// the callback that's passed to _write(chunk,cb) -this.onwrite=function(er){onwrite(stream,er);};// the callback that the user supplies to write(chunk,encoding,cb) -this.writecb=null;// the amount that is being written when _write is called. -this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;// number of pending user-supplied write callbacks -// this must be 0 before 'finish' can be emitted -this.pendingcb=0;// emit prefinish if the only thing we're waiting for is _write cbs -// This is relevant for synchronous Transform streams -this.prefinished=false;// True if the error was already emitted and should not be thrown again -this.errorEmitted=false;// count buffered requests -this.bufferedRequestCount=0;// allocate the first CorkedRequest, there is always -// one allocated and free to use, and we maintain at most two -this.corkedRequestsFree=new CorkedRequest(this);}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next;}return out;};(function(){try{Object.defineProperty(WritableState.prototype,'buffer',{get:internalUtil.deprecate(function(){return this.getBuffer();},'_writableState.buffer is deprecated. Use _writableState.getBuffer '+'instead.','DEP0003')});}catch(_){}})();// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance;if(typeof Symbol==='function'&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==='function'){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(object){if(realHasInstance.call(this,object))return true;if(this!==Writable)return false;return object&&object._writableState instanceof WritableState;}});}else{realHasInstance=function realHasInstance(object){return object instanceof this;};}function Writable(options){Duplex=Duplex||__webpack_require__(/*! ./_stream_duplex */"./node_modules/readable-stream/lib/_stream_duplex.js");// Writable ctor is applied to Duplexes, too. -// `realHasInstance` is necessary because using plain `instanceof` -// would return false, as no `_writableState` property is attached. -// Trying to use the custom `instanceof` for Writable here will also break the -// Node.js LazyTransform implementation, which has a non-trivial getter for -// `_writableState` that would lead to infinite recursion. -if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options);}this._writableState=new WritableState(options,this);// legacy. -this.writable=true;if(options){if(typeof options.write==='function')this._write=options.write;if(typeof options.writev==='function')this._writev=options.writev;if(typeof options.destroy==='function')this._destroy=options.destroy;if(typeof options.final==='function')this._final=options.final;}Stream.call(this);}// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe=function(){this.emit('error',new Error('Cannot pipe, not readable'));};function writeAfterEnd(stream,cb){var er=new Error('write after end');// TODO: defer error events consistently everywhere, not just the cb -stream.emit('error',er);pna.nextTick(cb,er);}// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError('May not write null values to stream');}else if(typeof chunk!=='string'&&chunk!==undefined&&!state.objectMode){er=new TypeError('Invalid non-string/buffer chunk');}if(er){stream.emit('error',er);pna.nextTick(cb,er);valid=false;}return valid;}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=!state.objectMode&&_isUint8Array(chunk);if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk);}if(typeof encoding==='function'){cb=encoding;encoding=null;}if(isBuf)encoding='buffer';else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=='function')cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb);}return ret;};Writable.prototype.cork=function(){var state=this._writableState;state.corked++;};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state);}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){// node::ParseEncoding() requires lower case. -if(typeof encoding==='string')encoding=encoding.toLowerCase();if(!(['hex','utf8','utf-8','ascii','binary','base64','ucs2','ucs-2','utf16le','utf-16le','raw'].indexOf((encoding+'').toLowerCase())>-1))throw new TypeError('Unknown encoding: '+encoding);this._writableState.defaultEncoding=encoding;return this;};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==='string'){chunk=Buffer.from(chunk,encoding);}return chunk;}Object.defineProperty(Writable.prototype,'writableHighWaterMark',{// making it explicit this property is not enumerable -// because otherwise some prototype manipulation in -// userland will fail -enumerable:false,get:function get(){return this._writableState.highWaterMark;}});// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding='buffer';chunk=newChunk;}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length*/asyncWrite(afterWrite,stream,state,finished,cb);/**/}else{afterWrite(stream,state,finished,cb);}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state);}// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit('drain');}}// if there's something in the buffer waiting, then process it -function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){// Fast case, write everything using _writev() -var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;var allBuffers=true;while(entry){buffer[count]=entry;if(!entry.isBuf)allBuffers=false;entry=entry.next;count+=1;}buffer.allBuffers=allBuffers;doWrite(stream,state,true,state.length,buffer,'',holder.finish);// doWrite is almost always async, defer these to save a bit of time -// as the hot path ends with doWrite -state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null;}else{state.corkedRequestsFree=new CorkedRequest(state);}state.bufferedRequestCount=0;}else{// Slow case, write chunks one-by-one -while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;state.bufferedRequestCount--;// if we didn't call the onwrite immediately, then -// it means that we need to wait until it does. -// also, that means that the chunk and cb are currently -// being processed, so move the buffer counter past them. -if(state.writing){break;}}if(entry===null)state.lastBufferedRequest=null;}state.bufferedRequest=entry;state.bufferProcessing=false;}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error('_write() is not implemented'));};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==='function'){cb=chunk;chunk=null;encoding=null;}else if(typeof encoding==='function'){cb=encoding;encoding=null;}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);// .end() fully uncorks -if(state.corked){state.corked=1;this.uncork();}// ignore unnecessary end() calls. -if(!state.ending&&!state.finished)endWritable(this,state,cb);};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing;}function callFinal(stream,state){stream._final(function(err){state.pendingcb--;if(err){stream.emit('error',err);}state.prefinished=true;stream.emit('prefinish');finishMaybe(stream,state);});}function prefinish(stream,state){if(!state.prefinished&&!state.finalCalled){if(typeof stream._final==='function'){state.pendingcb++;state.finalCalled=true;pna.nextTick(callFinal,stream,state);}else{state.prefinished=true;stream.emit('prefinish');}}}function finishMaybe(stream,state){var need=needFinish(state);if(need){prefinish(stream,state);if(state.pendingcb===0){state.finished=true;stream.emit('finish');}}return need;}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)pna.nextTick(cb);else stream.once('finish',cb);}state.ended=true;stream.writable=false;}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;corkReq.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next;}if(state.corkedRequestsFree){state.corkedRequestsFree.next=corkReq;}else{state.corkedRequestsFree=corkReq;}}Object.defineProperty(Writable.prototype,'destroyed',{get:function get(){if(this._writableState===undefined){return false;}return this._writableState.destroyed;},set:function set(value){// we ignore the value if the stream -// has not been initialized yet -if(!this._writableState){return;}// backward compatibility, the user is explicitly -// managing destroyed -this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){this.end();cb(err);};/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../../process/browser.js */"./node_modules/process/browser.js"),__webpack_require__(/*! ./../../timers-browserify/main.js */"./node_modules/timers-browserify/main.js").setImmediate,__webpack_require__(/*! ./../../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/readable-stream/lib/internal/streams/BufferList.js":/*!*************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***! - \*************************************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamLibInternalStreamsBufferListJs(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var util=__webpack_require__(/*! util */2);function copyBuffer(src,target,offset){src.copy(target,offset);}module.exports=function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}BufferList.prototype.push=function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0;};BufferList.prototype.join=function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next){ret+=s+p.data;}return ret;};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;};return BufferList;}();if(util&&util.inspect&&util.inspect.custom){module.exports.prototype[util.inspect.custom]=function(){var obj=util.inspect({length:this.length});return this.constructor.name+' '+obj;};}/***/},/***/"./node_modules/readable-stream/lib/internal/streams/destroy.js":/*!**********************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***! - \**********************************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamLibInternalStreamsDestroyJs(module,exports,__webpack_require__){"use strict";/**/var pna=__webpack_require__(/*! process-nextick-args */"./node_modules/process-nextick-args/index.js");/**/ // undocumented cb() API, needed for core, not for public API -function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){pna.nextTick(emitErrorNT,this,err);}return this;}// we set destroyed to true before firing error callbacks in order -// to make it re-entrance safe in case destroy() is called within callbacks -if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well -if(this._writableState){this._writableState.destroyed=true;}this._destroy(err||null,function(err){if(!cb&&err){pna.nextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true;}}else if(cb){cb(err);}});return this;}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false;}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false;}}function emitErrorNT(self,err){self.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy};/***/},/***/"./node_modules/readable-stream/lib/internal/streams/stream-browser.js":/*!*****************************************************************************!*\ - !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! - \*****************************************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamLibInternalStreamsStreamBrowserJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! events */"./node_modules/events/events.js").EventEmitter;/***/},/***/"./node_modules/readable-stream/passthrough.js":/*!*****************************************************!*\ - !*** ./node_modules/readable-stream/passthrough.js ***! - \*****************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamPassthroughJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! ./readable */"./node_modules/readable-stream/readable-browser.js").PassThrough;/***/},/***/"./node_modules/readable-stream/readable-browser.js":/*!**********************************************************!*\ - !*** ./node_modules/readable-stream/readable-browser.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamReadableBrowserJs(module,exports,__webpack_require__){exports=module.exports=__webpack_require__(/*! ./lib/_stream_readable.js */"./node_modules/readable-stream/lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=__webpack_require__(/*! ./lib/_stream_writable.js */"./node_modules/readable-stream/lib/_stream_writable.js");exports.Duplex=__webpack_require__(/*! ./lib/_stream_duplex.js */"./node_modules/readable-stream/lib/_stream_duplex.js");exports.Transform=__webpack_require__(/*! ./lib/_stream_transform.js */"./node_modules/readable-stream/lib/_stream_transform.js");exports.PassThrough=__webpack_require__(/*! ./lib/_stream_passthrough.js */"./node_modules/readable-stream/lib/_stream_passthrough.js");/***/},/***/"./node_modules/readable-stream/transform.js":/*!***************************************************!*\ - !*** ./node_modules/readable-stream/transform.js ***! - \***************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamTransformJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! ./readable */"./node_modules/readable-stream/readable-browser.js").Transform;/***/},/***/"./node_modules/readable-stream/writable-browser.js":/*!**********************************************************!*\ - !*** ./node_modules/readable-stream/writable-browser.js ***! - \**********************************************************/ /*! no static exports found */ /***/function node_modulesReadableStreamWritableBrowserJs(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! ./lib/_stream_writable.js */"./node_modules/readable-stream/lib/_stream_writable.js");/***/},/***/"./node_modules/regenerator-runtime/runtime.js":/*!*****************************************************!*\ - !*** ./node_modules/regenerator-runtime/runtime.js ***! - \*****************************************************/ /*! no static exports found */ /***/function node_modulesRegeneratorRuntimeRuntimeJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var runtime=function(exports){"use strict";var Op=Object.prototype;var hasOwn=Op.hasOwnProperty;var undefined;// More compressible than void 0. -var $Symbol=typeof Symbol==="function"?Symbol:{};var iteratorSymbol=$Symbol.iterator||"@@iterator";var asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator";var toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function wrap(innerFn,outerFn,self,tryLocsList){// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. -var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator;var generator=Object.create(protoGenerator.prototype);var context=new Context(tryLocsList||[]);// The ._invoke method unifies the implementations of the .next, -// .throw, and .return methods. -generator._invoke=makeInvokeMethod(innerFn,self,context);return generator;}exports.wrap=wrap;// Try/catch helper to minimize deoptimizations. Returns a completion -// record like context.tryEntries[i].completion. This interface could -// have been (and was previously) designed to take a closure to be -// invoked without arguments, but in all the cases we care about we -// already have an existing method we want to call, so there's no need -// to create a new function object. We can even get away with assuming -// the method takes exactly one argument, since that happens to be true -// in every case, so we don't have to touch the arguments object. The -// only additional allocation required is the completion record, which -// has a stable shape and so hopefully should be cheap to allocate. -function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)};}catch(err){return{type:"throw",arg:err};}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";// Returning this object from the innerFn has the same effect as -// breaking out of the dispatch switch statement. -var ContinueSentinel={};// Dummy constructor functions that we use as the .constructor and -// .constructor.prototype properties for functions that return Generator -// objects. For full spec compliance, you may wish to configure your -// minifier not to mangle the names of these two functions. -function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}// This is a polyfill for %IteratorPrototype% for environments that -// don't natively support it. -var IteratorPrototype={};IteratorPrototype[iteratorSymbol]=function(){return this;};var getProto=Object.getPrototypeOf;var NativeIteratorPrototype=getProto&&getProto(getProto(values([])));if(NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)){// This environment has a native %IteratorPrototype%; use it instead -// of the polyfill. -IteratorPrototype=NativeIteratorPrototype;}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunctionPrototype[toStringTagSymbol]=GeneratorFunction.displayName="GeneratorFunction";// Helper for defining the .next, .throw, and .return methods of the -// Iterator interface in terms of a single ._invoke method. -function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){prototype[method]=function(arg){return this._invoke(method,arg);};});}exports.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||// For the native GeneratorFunction constructor, the best we can -// do is to check its .name property. -(ctor.displayName||ctor.name)==="GeneratorFunction":false;};exports.mark=function(genFun){if(Object.setPrototypeOf){Object.setPrototypeOf(genFun,GeneratorFunctionPrototype);}else{genFun.__proto__=GeneratorFunctionPrototype;if(!(toStringTagSymbol in genFun)){genFun[toStringTagSymbol]="GeneratorFunction";}}genFun.prototype=Object.create(Gp);return genFun;};// Within the body of any async function, `await x` is transformed to -// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test -// `hasOwn.call(value, "__await")` to determine if the yielded value is -// meant to be awaited. -exports.awrap=function(arg){return{__await:arg};};function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if(record.type==="throw"){reject(record.arg);}else{var result=record.arg;var value=result.value;if(value&&_typeof(value)==="object"&&hasOwn.call(value,"__await")){return PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);});}return PromiseImpl.resolve(value).then(function(unwrapped){// When a yielded Promise is resolved, its final value becomes -// the .value of the Promise<{value,done}> result for the -// current iteration. -result.value=unwrapped;resolve(result);},function(error){// If a rejected Promise was yielded, throw the rejection back -// into the async generator function so it can be handled there. -return invoke("throw",error,resolve,reject);});}}var previousPromise;function enqueue(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=// If enqueue has been called before, then we want to wait until -// all previous Promises have been resolved before calling invoke, -// so that results are always delivered in the correct order. If -// enqueue has not been called before, then it is important to -// call invoke immediately, without waiting on a callback to fire, -// so that the async generator function has the opportunity to do -// any necessary setup in a predictable way. This predictability -// is why the Promise constructor synchronously invokes its -// executor callback, and why async functions synchronously -// execute code before the first await. Since we implement simple -// async functions in terms of async generators, it is especially -// important to get this right, even though it requires care. -previousPromise?previousPromise.then(callInvokeWithMethodAndArg,// Avoid propagating failures to Promises returned by later -// invocations of the iterator. -callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}// Define the unified helper method that is used to implement .next, -// .throw, and .return (see defineIteratorMethods). -this._invoke=enqueue;}defineIteratorMethods(AsyncIterator.prototype);AsyncIterator.prototype[asyncIteratorSymbol]=function(){return this;};exports.AsyncIterator=AsyncIterator;// Note that simple async functions are implemented on top of -// AsyncIterator objects; they just return a Promise for the value of -// the final result produced by the iterator. -exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){if(PromiseImpl===void 0)PromiseImpl=Promise;var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter// If outerFn is a generator, return the full iterator. -:iter.next().then(function(result){return result.done?result.value:iter.next();});};function makeInvokeMethod(innerFn,self,context){var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running");}if(state===GenStateCompleted){if(method==="throw"){throw arg;}// Be forgiving, per 25.3.3.3.3 of the spec: -// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume -return doneResult();}context.method=method;context.arg=arg;while(true){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if(context.method==="next"){// Setting context._sent for legacy support of Babel's -// function.sent implementation. -context.sent=context._sent=context.arg;}else if(context.method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw context.arg;}context.dispatchException(context.arg);}else if(context.method==="return"){context.abrupt("return",context.arg);}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){// If an exception is thrown from innerFn, we leave state === -// GenStateExecuting and loop back for another invocation. -state=context.done?GenStateCompleted:GenStateSuspendedYield;if(record.arg===ContinueSentinel){continue;}return{value:record.arg,done:context.done};}else if(record.type==="throw"){state=GenStateCompleted;// Dispatch the exception by looping back around to the -// context.dispatchException(context.arg) call above. -context.method="throw";context.arg=record.arg;}}};}// Call delegate.iterator[context.method](context.arg) and handle the -// result, either by returning a { value, done } result from the -// delegate iterator, or by modifying context.method and context.arg, -// setting context.delegate to null, and returning the ContinueSentinel. -function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(method===undefined){// A .throw or .return when the delegate iterator has no .throw -// method always terminates the yield* loop. -context.delegate=null;if(context.method==="throw"){// Note: ["return"] must be used for ES3 parsing compatibility. -if(delegate.iterator["return"]){// If the delegate iterator has a return method, give it a -// chance to clean up. -context.method="return";context.arg=undefined;maybeInvokeDelegate(delegate,context);if(context.method==="throw"){// If maybeInvokeDelegate(context) changed context.method from -// "return" to "throw", let that override the TypeError below. -return ContinueSentinel;}}context.method="throw";context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if(record.type==="throw"){context.method="throw";context.arg=record.arg;context.delegate=null;return ContinueSentinel;}var info=record.arg;if(!info){context.method="throw";context.arg=new TypeError("iterator result is not an object");context.delegate=null;return ContinueSentinel;}if(info.done){// Assign the result of the finished delegate to the temporary -// variable specified by delegate.resultName (see delegateYield). -context[delegate.resultName]=info.value;// Resume execution at the desired location (see delegateYield). -context.next=delegate.nextLoc;// If context.method was "throw" but the delegate handled the -// exception, let the outer generator proceed normally. If -// context.method was "next", forget context.arg since it has been -// "consumed" by the delegate iterator. If context.method was -// "return", allow the original .return call to continue in the -// outer generator. -if(context.method!=="return"){context.method="next";context.arg=undefined;}}else{// Re-yield the result returned by the delegate method. -return info;}// The delegate iterator is finished, so forget it and continue with -// the outer generator. -context.delegate=null;return ContinueSentinel;}// Define Generator.prototype.{next,throw,return} in terms of the -// unified ._invoke helper method. -defineIteratorMethods(Gp);Gp[toStringTagSymbol]="Generator";// A Generator should always return itself as the iterator object when the -// @@iterator function is called on it. Some browsers' implementations of the -// iterator prototype chain incorrectly implement this, causing the Generator -// object to not be returned from this call. This ensures that doesn't happen. -// See https://github.com/facebook/regenerator/issues/274 for more details. -Gp[iteratorSymbol]=function(){return this;};Gp.toString=function(){return"[object Generator]";};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1];}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3];}this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal";delete record.arg;entry.completion=record;}function Context(tryLocsList){// The root entry object (effectively a try statement without a catch -// or a finally block) gives us a place to store values thrown from -// locations where there is no enclosing try statement. -this.tryEntries=[{tryLoc:"root"}];tryLocsList.forEach(pushTryEntry,this);this.reset(true);}exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}keys.reverse();// Rather than returning an object with a next method, we keep -// things simple and return the next function itself. -return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next;}}// To avoid creating an additional object, we just hang the .value -// and .done properties off the next function object itself. This -// also ensures that the minifier will not anonymize the function. -next.done=true;return next;};};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable);}if(typeof iterable.next==="function"){return iterable;}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){// Exception thrown outside of any try block that could handle -// it, so set the completion value of the entire function to -// throw the exception. -return handle("end");}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel;}}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}// The context.catch method must only be called with a location -// argument that corresponds to a known catch block. -throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};if(this.method==="next"){// Deliberately forget the last sent value so that we don't -// accidentally pass it on to the delegate. -this.arg=undefined;}return ContinueSentinel;}};// Regardless of whether this script is executing as a CommonJS module -// or not, return the runtime object so that we can declare the variable -// regeneratorRuntime in the outer scope, which allows this module to be -// injected easily by `bin/regenerator --include-runtime script.js`. -return exports;}(// If this script is executing as a CommonJS module, use module.exports -// as the regeneratorRuntime namespace. Otherwise create a new empty -// object. Either way, the resulting object will be used to initialize -// the regeneratorRuntime variable at the top of this file. -(false?undefined:_typeof(module))==="object"?module.exports:{});try{regeneratorRuntime=runtime;}catch(accidentalStrictMode){// This module should not be running in strict mode, so the above -// assignment should always work unless something is misconfigured. Just -// in case runtime.js accidentally runs in strict mode, we can escape -// strict mode using a global Function call. This could conceivably fail -// if a Content Security Policy forbids using Function, but in that case -// the proper solution is to fix the accidental strict mode problem. If -// you've misconfigured your bundler to force strict mode and applied a -// CSP to forbid Function, and you're not willing to fix either of those -// problems, please detail your unique predicament in a GitHub issue. -Function("r","regeneratorRuntime = r")(runtime);}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./node_modules/ripemd160/index.js":/*!*****************************************!*\ - !*** ./node_modules/ripemd160/index.js ***! - \*****************************************/ /*! no static exports found */ /***/function node_modulesRipemd160IndexJs(module,exports,__webpack_require__){"use strict";var Buffer=__webpack_require__(/*! buffer */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer;var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var HashBase=__webpack_require__(/*! hash-base */"./node_modules/hash-base/index.js");var ARRAY16=new Array(16);var zl=[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];var zr=[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];var sl=[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];var sr=[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];var hl=[0x00000000,0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xa953fd4e];var hr=[0x50a28be6,0x5c4dd124,0x6d703ef3,0x7a6d76e9,0x00000000];function RIPEMD160(){HashBase.call(this,64);// state -this._a=0x67452301;this._b=0xefcdab89;this._c=0x98badcfe;this._d=0x10325476;this._e=0xc3d2e1f0;}inherits(RIPEMD160,HashBase);RIPEMD160.prototype._update=function(){var words=ARRAY16;for(var j=0;j<16;++j){words[j]=this._block.readInt32LE(j*4);}var al=this._a|0;var bl=this._b|0;var cl=this._c|0;var dl=this._d|0;var el=this._e|0;var ar=this._a|0;var br=this._b|0;var cr=this._c|0;var dr=this._d|0;var er=this._e|0;// computation -for(var i=0;i<80;i+=1){var tl;var tr;if(i<16){tl=fn1(al,bl,cl,dl,el,words[zl[i]],hl[0],sl[i]);tr=fn5(ar,br,cr,dr,er,words[zr[i]],hr[0],sr[i]);}else if(i<32){tl=fn2(al,bl,cl,dl,el,words[zl[i]],hl[1],sl[i]);tr=fn4(ar,br,cr,dr,er,words[zr[i]],hr[1],sr[i]);}else if(i<48){tl=fn3(al,bl,cl,dl,el,words[zl[i]],hl[2],sl[i]);tr=fn3(ar,br,cr,dr,er,words[zr[i]],hr[2],sr[i]);}else if(i<64){tl=fn4(al,bl,cl,dl,el,words[zl[i]],hl[3],sl[i]);tr=fn2(ar,br,cr,dr,er,words[zr[i]],hr[3],sr[i]);}else{// if (i<80) { -tl=fn5(al,bl,cl,dl,el,words[zl[i]],hl[4],sl[i]);tr=fn1(ar,br,cr,dr,er,words[zr[i]],hr[4],sr[i]);}al=el;el=dl;dl=rotl(cl,10);cl=bl;bl=tl;ar=er;er=dr;dr=rotl(cr,10);cr=br;br=tr;}// update state -var t=this._b+cl+dr|0;this._b=this._c+dl+er|0;this._c=this._d+el+ar|0;this._d=this._e+al+br|0;this._e=this._a+bl+cr|0;this._a=t;};RIPEMD160.prototype._digest=function(){// create padding and handle blocks -this._block[this._blockOffset++]=0x80;if(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();// produce result -var buffer=Buffer.alloc?Buffer.alloc(20):new Buffer(20);buffer.writeInt32LE(this._a,0);buffer.writeInt32LE(this._b,4);buffer.writeInt32LE(this._c,8);buffer.writeInt32LE(this._d,12);buffer.writeInt32LE(this._e,16);return buffer;};function rotl(x,n){return x<>>32-n;}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0;}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0;}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0;}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0;}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0;}module.exports=RIPEMD160;/***/},/***/"./node_modules/safe-buffer/index.js":/*!*******************************************!*\ - !*** ./node_modules/safe-buffer/index.js ***! - \*******************************************/ /*! no static exports found */ /***/function node_modulesSafeBufferIndexJs(module,exports,__webpack_require__){/* eslint-disable node/no-deprecated-api */var buffer=__webpack_require__(/*! buffer */"./node_modules/node-libs-browser/node_modules/buffer/index.js");var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers -function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer') -copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}// Copy static methods from Buffer -copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};/***/},/***/"./node_modules/setimmediate/setImmediate.js":/*!***************************************************!*\ - !*** ./node_modules/setimmediate/setImmediate.js ***! - \***************************************************/ /*! no static exports found */ /***/function node_modulesSetimmediateSetImmediateJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global,process){(function(global,undefined){"use strict";if(global.setImmediate){return;}var nextHandle=1;// Spec says greater than zero -var tasksByHandle={};var currentlyRunningATask=false;var doc=global.document;var registerImmediate;function setImmediate(callback){// Callback can either be a function or a string -if(typeof callback!=="function"){callback=new Function(""+callback);}// Copy function arguments -var args=new Array(arguments.length-1);for(var i=0;i element; its readystatechange event will be fired asynchronously once it is inserted -// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. -var script=doc.createElement("script");script.onreadystatechange=function(){runIfPresent(handle);script.onreadystatechange=null;html.removeChild(script);script=null;};html.appendChild(script);};}function installSetTimeoutImplementation(){registerImmediate=function registerImmediate(handle){setTimeout(runIfPresent,0,handle);};}// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. -var attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global;// Don't get fooled by e.g. browserify environments. -if({}.toString.call(global.process)==="[object process]"){// For Node.js before 0.9 -installNextTickImplementation();}else if(canUsePostMessage()){// For non-IE10 modern browsers -installPostMessageImplementation();}else if(global.MessageChannel){// For web workers, where supported -installMessageChannelImplementation();}else if(doc&&"onreadystatechange"in doc.createElement("script")){// For IE 6–8 -installReadyStateChangeImplementation();}else{// For older browsers -installSetTimeoutImplementation();}attachTo.setImmediate=setImmediate;attachTo.clearImmediate=clearImmediate;})(typeof self==="undefined"?typeof global==="undefined"?this:global:self);/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../process/browser.js */"./node_modules/process/browser.js"));/***/},/***/"./node_modules/sha.js/hash.js":/*!*************************************!*\ - !*** ./node_modules/sha.js/hash.js ***! - \*************************************/ /*! no static exports found */ /***/function node_modulesShaJsHashJs(module,exports,__webpack_require__){var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;// prototype class for hash functions -function Hash(blockSize,finalSize){this._block=Buffer.alloc(blockSize);this._finalSize=finalSize;this._blockSize=blockSize;this._len=0;}Hash.prototype.update=function(data,enc){if(typeof data==='string'){enc=enc||'utf8';data=Buffer.from(data,enc);}var block=this._block;var blockSize=this._blockSize;var length=data.length;var accum=this._len;for(var offset=0;offset=this._finalSize){this._update(this._block);this._block.fill(0);}var bits=this._len*8;// uint32 -if(bits<=0xffffffff){this._block.writeUInt32BE(bits,this._blockSize-4);// uint64 -}else{var lowBits=(bits&0xffffffff)>>>0;var highBits=(bits-lowBits)/0x100000000;this._block.writeUInt32BE(highBits,this._blockSize-8);this._block.writeUInt32BE(lowBits,this._blockSize-4);}this._update(this._block);var hash=this._hash();return enc?hash.toString(enc):hash;};Hash.prototype._update=function(){throw new Error('_update must be implemented by subclass');};module.exports=Hash;/***/},/***/"./node_modules/sha.js/index.js":/*!**************************************!*\ - !*** ./node_modules/sha.js/index.js ***! - \**************************************/ /*! no static exports found */ /***/function node_modulesShaJsIndexJs(module,exports,__webpack_require__){var exports=module.exports=function SHA(algorithm){algorithm=algorithm.toLowerCase();var Algorithm=exports[algorithm];if(!Algorithm)throw new Error(algorithm+' is not supported (we accept pull requests)');return new Algorithm();};exports.sha=__webpack_require__(/*! ./sha */"./node_modules/sha.js/sha.js");exports.sha1=__webpack_require__(/*! ./sha1 */"./node_modules/sha.js/sha1.js");exports.sha224=__webpack_require__(/*! ./sha224 */"./node_modules/sha.js/sha224.js");exports.sha256=__webpack_require__(/*! ./sha256 */"./node_modules/sha.js/sha256.js");exports.sha384=__webpack_require__(/*! ./sha384 */"./node_modules/sha.js/sha384.js");exports.sha512=__webpack_require__(/*! ./sha512 */"./node_modules/sha.js/sha512.js");/***/},/***/"./node_modules/sha.js/sha.js":/*!************************************!*\ - !*** ./node_modules/sha.js/sha.js ***! - \************************************/ /*! no static exports found */ /***/function node_modulesShaJsShaJs(module,exports,__webpack_require__){/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined - * in FIPS PUB 180-1 - * This source code is derived from sha1.js of the same repository. - * The difference between SHA-0 and SHA-1 is just a bitwise rotate left - * operation was added. - */var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var K=[0x5a827999,0x6ed9eba1,0x8f1bbcdc|0,0xca62c1d6|0];var W=new Array(80);function Sha(){this.init();this._w=W;Hash.call(this,64,56);}inherits(Sha,Hash);Sha.prototype.init=function(){this._a=0x67452301;this._b=0xefcdab89;this._c=0x98badcfe;this._d=0x10325476;this._e=0xc3d2e1f0;return this;};function rotl5(num){return num<<5|num>>>27;}function rotl30(num){return num<<30|num>>>2;}function ft(s,b,c,d){if(s===0)return b&c|~b&d;if(s===2)return b&c|b&d|c&d;return b^c^d;}Sha.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;for(var i=0;i<16;++i){W[i]=M.readInt32BE(i*4);}for(;i<80;++i){W[i]=W[i-3]^W[i-8]^W[i-14]^W[i-16];}for(var j=0;j<80;++j){var s=~~(j/20);var t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d;d=c;c=rotl30(b);b=a;a=t;}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0;};Sha.prototype._hash=function(){var H=Buffer.allocUnsafe(20);H.writeInt32BE(this._a|0,0);H.writeInt32BE(this._b|0,4);H.writeInt32BE(this._c|0,8);H.writeInt32BE(this._d|0,12);H.writeInt32BE(this._e|0,16);return H;};module.exports=Sha;/***/},/***/"./node_modules/sha.js/sha1.js":/*!*************************************!*\ - !*** ./node_modules/sha.js/sha1.js ***! - \*************************************/ /*! no static exports found */ /***/function node_modulesShaJsSha1Js(module,exports,__webpack_require__){/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS PUB 180-1 - * Version 2.1a Copyright Paul Johnston 2000 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. - */var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var K=[0x5a827999,0x6ed9eba1,0x8f1bbcdc|0,0xca62c1d6|0];var W=new Array(80);function Sha1(){this.init();this._w=W;Hash.call(this,64,56);}inherits(Sha1,Hash);Sha1.prototype.init=function(){this._a=0x67452301;this._b=0xefcdab89;this._c=0x98badcfe;this._d=0x10325476;this._e=0xc3d2e1f0;return this;};function rotl1(num){return num<<1|num>>>31;}function rotl5(num){return num<<5|num>>>27;}function rotl30(num){return num<<30|num>>>2;}function ft(s,b,c,d){if(s===0)return b&c|~b&d;if(s===2)return b&c|b&d|c&d;return b^c^d;}Sha1.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;for(var i=0;i<16;++i){W[i]=M.readInt32BE(i*4);}for(;i<80;++i){W[i]=rotl1(W[i-3]^W[i-8]^W[i-14]^W[i-16]);}for(var j=0;j<80;++j){var s=~~(j/20);var t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d;d=c;c=rotl30(b);b=a;a=t;}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0;};Sha1.prototype._hash=function(){var H=Buffer.allocUnsafe(20);H.writeInt32BE(this._a|0,0);H.writeInt32BE(this._b|0,4);H.writeInt32BE(this._c|0,8);H.writeInt32BE(this._d|0,12);H.writeInt32BE(this._e|0,16);return H;};module.exports=Sha1;/***/},/***/"./node_modules/sha.js/sha224.js":/*!***************************************!*\ - !*** ./node_modules/sha.js/sha224.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesShaJsSha224Js(module,exports,__webpack_require__){/** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * - */var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Sha256=__webpack_require__(/*! ./sha256 */"./node_modules/sha.js/sha256.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var W=new Array(64);function Sha224(){this.init();this._w=W;// new Array(64) -Hash.call(this,64,56);}inherits(Sha224,Sha256);Sha224.prototype.init=function(){this._a=0xc1059ed8;this._b=0x367cd507;this._c=0x3070dd17;this._d=0xf70e5939;this._e=0xffc00b31;this._f=0x68581511;this._g=0x64f98fa7;this._h=0xbefa4fa4;return this;};Sha224.prototype._hash=function(){var H=Buffer.allocUnsafe(28);H.writeInt32BE(this._a,0);H.writeInt32BE(this._b,4);H.writeInt32BE(this._c,8);H.writeInt32BE(this._d,12);H.writeInt32BE(this._e,16);H.writeInt32BE(this._f,20);H.writeInt32BE(this._g,24);return H;};module.exports=Sha224;/***/},/***/"./node_modules/sha.js/sha256.js":/*!***************************************!*\ - !*** ./node_modules/sha.js/sha256.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesShaJsSha256Js(module,exports,__webpack_require__){/** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * - */var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var K=[0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0x0FC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x06CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2];var W=new Array(64);function Sha256(){this.init();this._w=W;// new Array(64) -Hash.call(this,64,56);}inherits(Sha256,Hash);Sha256.prototype.init=function(){this._a=0x6a09e667;this._b=0xbb67ae85;this._c=0x3c6ef372;this._d=0xa54ff53a;this._e=0x510e527f;this._f=0x9b05688c;this._g=0x1f83d9ab;this._h=0x5be0cd19;return this;};function ch(x,y,z){return z^x&(y^z);}function maj(x,y,z){return x&y|z&(x|y);}function sigma0(x){return(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10);}function sigma1(x){return(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7);}function gamma0(x){return(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3;}function gamma1(x){return(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10;}Sha256.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;var f=this._f|0;var g=this._g|0;var h=this._h|0;for(var i=0;i<16;++i){W[i]=M.readInt32BE(i*4);}for(;i<64;++i){W[i]=gamma1(W[i-2])+W[i-7]+gamma0(W[i-15])+W[i-16]|0;}for(var j=0;j<64;++j){var T1=h+sigma1(e)+ch(e,f,g)+K[j]+W[j]|0;var T2=sigma0(a)+maj(a,b,c)|0;h=g;g=f;f=e;e=d+T1|0;d=c;c=b;b=a;a=T1+T2|0;}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0;this._f=f+this._f|0;this._g=g+this._g|0;this._h=h+this._h|0;};Sha256.prototype._hash=function(){var H=Buffer.allocUnsafe(32);H.writeInt32BE(this._a,0);H.writeInt32BE(this._b,4);H.writeInt32BE(this._c,8);H.writeInt32BE(this._d,12);H.writeInt32BE(this._e,16);H.writeInt32BE(this._f,20);H.writeInt32BE(this._g,24);H.writeInt32BE(this._h,28);return H;};module.exports=Sha256;/***/},/***/"./node_modules/sha.js/sha384.js":/*!***************************************!*\ - !*** ./node_modules/sha.js/sha384.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesShaJsSha384Js(module,exports,__webpack_require__){var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var SHA512=__webpack_require__(/*! ./sha512 */"./node_modules/sha.js/sha512.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var W=new Array(160);function Sha384(){this.init();this._w=W;Hash.call(this,128,112);}inherits(Sha384,SHA512);Sha384.prototype.init=function(){this._ah=0xcbbb9d5d;this._bh=0x629a292a;this._ch=0x9159015a;this._dh=0x152fecd8;this._eh=0x67332667;this._fh=0x8eb44a87;this._gh=0xdb0c2e0d;this._hh=0x47b5481d;this._al=0xc1059ed8;this._bl=0x367cd507;this._cl=0x3070dd17;this._dl=0xf70e5939;this._el=0xffc00b31;this._fl=0x68581511;this._gl=0x64f98fa7;this._hl=0xbefa4fa4;return this;};Sha384.prototype._hash=function(){var H=Buffer.allocUnsafe(48);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset);H.writeInt32BE(l,offset+4);}writeInt64BE(this._ah,this._al,0);writeInt64BE(this._bh,this._bl,8);writeInt64BE(this._ch,this._cl,16);writeInt64BE(this._dh,this._dl,24);writeInt64BE(this._eh,this._el,32);writeInt64BE(this._fh,this._fl,40);return H;};module.exports=Sha384;/***/},/***/"./node_modules/sha.js/sha512.js":/*!***************************************!*\ - !*** ./node_modules/sha.js/sha512.js ***! - \***************************************/ /*! no static exports found */ /***/function node_modulesShaJsSha512Js(module,exports,__webpack_require__){var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");var Hash=__webpack_require__(/*! ./hash */"./node_modules/sha.js/hash.js");var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;var K=[0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd,0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc,0x3956c25b,0xf348b538,0x59f111f1,0xb605d019,0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118,0xd807aa98,0xa3030242,0x12835b01,0x45706fbe,0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2,0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1,0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694,0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3,0x0fc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65,0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483,0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5,0x983e5152,0xee66dfab,0xa831c66d,0x2db43210,0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4,0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725,0x06ca6351,0xe003826f,0x14292967,0x0a0e6e70,0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926,0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df,0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8,0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b,0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001,0xc24b8b70,0xd0f89791,0xc76c51a3,0x0654be30,0xd192e819,0xd6ef5218,0xd6990624,0x5565a910,0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8,0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53,0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8,0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb,0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3,0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60,0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec,0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9,0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b,0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207,0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178,0x06f067aa,0x72176fba,0x0a637dc5,0xa2c898a6,0x113f9804,0xbef90dae,0x1b710b35,0x131c471b,0x28db77f5,0x23047d84,0x32caab7b,0x40c72493,0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c,0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a,0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817];var W=new Array(160);function Sha512(){this.init();this._w=W;Hash.call(this,128,112);}inherits(Sha512,Hash);Sha512.prototype.init=function(){this._ah=0x6a09e667;this._bh=0xbb67ae85;this._ch=0x3c6ef372;this._dh=0xa54ff53a;this._eh=0x510e527f;this._fh=0x9b05688c;this._gh=0x1f83d9ab;this._hh=0x5be0cd19;this._al=0xf3bcc908;this._bl=0x84caa73b;this._cl=0xfe94f82b;this._dl=0x5f1d36f1;this._el=0xade682d1;this._fl=0x2b3e6c1f;this._gl=0xfb41bd6b;this._hl=0x137e2179;return this;};function Ch(x,y,z){return z^x&(y^z);}function maj(x,y,z){return x&y|z&(x|y);}function sigma0(x,xl){return(x>>>28|xl<<4)^(xl>>>2|x<<30)^(xl>>>7|x<<25);}function sigma1(x,xl){return(x>>>14|xl<<18)^(x>>>18|xl<<14)^(xl>>>9|x<<23);}function Gamma0(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^x>>>7;}function Gamma0l(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^(x>>>7|xl<<25);}function Gamma1(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^x>>>6;}function Gamma1l(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^(x>>>6|xl<<26);}function getCarry(a,b){return a>>>0>>0?1:0;}Sha512.prototype._update=function(M){var W=this._w;var ah=this._ah|0;var bh=this._bh|0;var ch=this._ch|0;var dh=this._dh|0;var eh=this._eh|0;var fh=this._fh|0;var gh=this._gh|0;var hh=this._hh|0;var al=this._al|0;var bl=this._bl|0;var cl=this._cl|0;var dl=this._dl|0;var el=this._el|0;var fl=this._fl|0;var gl=this._gl|0;var hl=this._hl|0;for(var i=0;i<32;i+=2){W[i]=M.readInt32BE(i*4);W[i+1]=M.readInt32BE(i*4+4);}for(;i<160;i+=2){var xh=W[i-15*2];var xl=W[i-15*2+1];var gamma0=Gamma0(xh,xl);var gamma0l=Gamma0l(xl,xh);xh=W[i-2*2];xl=W[i-2*2+1];var gamma1=Gamma1(xh,xl);var gamma1l=Gamma1l(xl,xh);// W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] -var Wi7h=W[i-7*2];var Wi7l=W[i-7*2+1];var Wi16h=W[i-16*2];var Wi16l=W[i-16*2+1];var Wil=gamma0l+Wi7l|0;var Wih=gamma0+Wi7h+getCarry(Wil,gamma0l)|0;Wil=Wil+gamma1l|0;Wih=Wih+gamma1+getCarry(Wil,gamma1l)|0;Wil=Wil+Wi16l|0;Wih=Wih+Wi16h+getCarry(Wil,Wi16l)|0;W[i]=Wih;W[i+1]=Wil;}for(var j=0;j<160;j+=2){Wih=W[j];Wil=W[j+1];var majh=maj(ah,bh,ch);var majl=maj(al,bl,cl);var sigma0h=sigma0(ah,al);var sigma0l=sigma0(al,ah);var sigma1h=sigma1(eh,el);var sigma1l=sigma1(el,eh);// t1 = h + sigma1 + ch + K[j] + W[j] -var Kih=K[j];var Kil=K[j+1];var chh=Ch(eh,fh,gh);var chl=Ch(el,fl,gl);var t1l=hl+sigma1l|0;var t1h=hh+sigma1h+getCarry(t1l,hl)|0;t1l=t1l+chl|0;t1h=t1h+chh+getCarry(t1l,chl)|0;t1l=t1l+Kil|0;t1h=t1h+Kih+getCarry(t1l,Kil)|0;t1l=t1l+Wil|0;t1h=t1h+Wih+getCarry(t1l,Wil)|0;// t2 = sigma0 + maj -var t2l=sigma0l+majl|0;var t2h=sigma0h+majh+getCarry(t2l,sigma0l)|0;hh=gh;hl=gl;gh=fh;gl=fl;fh=eh;fl=el;el=dl+t1l|0;eh=dh+t1h+getCarry(el,dl)|0;dh=ch;dl=cl;ch=bh;cl=bl;bh=ah;bl=al;al=t1l+t2l|0;ah=t1h+t2h+getCarry(al,t1l)|0;}this._al=this._al+al|0;this._bl=this._bl+bl|0;this._cl=this._cl+cl|0;this._dl=this._dl+dl|0;this._el=this._el+el|0;this._fl=this._fl+fl|0;this._gl=this._gl+gl|0;this._hl=this._hl+hl|0;this._ah=this._ah+ah+getCarry(this._al,al)|0;this._bh=this._bh+bh+getCarry(this._bl,bl)|0;this._ch=this._ch+ch+getCarry(this._cl,cl)|0;this._dh=this._dh+dh+getCarry(this._dl,dl)|0;this._eh=this._eh+eh+getCarry(this._el,el)|0;this._fh=this._fh+fh+getCarry(this._fl,fl)|0;this._gh=this._gh+gh+getCarry(this._gl,gl)|0;this._hh=this._hh+hh+getCarry(this._hl,hl)|0;};Sha512.prototype._hash=function(){var H=Buffer.allocUnsafe(64);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset);H.writeInt32BE(l,offset+4);}writeInt64BE(this._ah,this._al,0);writeInt64BE(this._bh,this._bl,8);writeInt64BE(this._ch,this._cl,16);writeInt64BE(this._dh,this._dl,24);writeInt64BE(this._eh,this._el,32);writeInt64BE(this._fh,this._fl,40);writeInt64BE(this._gh,this._gl,48);writeInt64BE(this._hh,this._hl,56);return H;};module.exports=Sha512;/***/},/***/"./node_modules/stream-browserify/index.js":/*!*************************************************!*\ - !*** ./node_modules/stream-browserify/index.js ***! - \*************************************************/ /*! no static exports found */ /***/function node_modulesStreamBrowserifyIndexJs(module,exports,__webpack_require__){// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -module.exports=Stream;var EE=__webpack_require__(/*! events */"./node_modules/events/events.js").EventEmitter;var inherits=__webpack_require__(/*! inherits */"./node_modules/inherits/inherits_browser.js");inherits(Stream,EE);Stream.Readable=__webpack_require__(/*! readable-stream/readable.js */"./node_modules/readable-stream/readable-browser.js");Stream.Writable=__webpack_require__(/*! readable-stream/writable.js */"./node_modules/readable-stream/writable-browser.js");Stream.Duplex=__webpack_require__(/*! readable-stream/duplex.js */"./node_modules/readable-stream/duplex-browser.js");Stream.Transform=__webpack_require__(/*! readable-stream/transform.js */"./node_modules/readable-stream/transform.js");Stream.PassThrough=__webpack_require__(/*! readable-stream/passthrough.js */"./node_modules/readable-stream/passthrough.js");// Backwards-compat with node 0.4.x -Stream.Stream=Stream;// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. -function Stream(){EE.call(this);}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause();}}}source.on('data',ondata);function ondrain(){if(source.readable&&source.resume){source.resume();}}dest.on('drain',ondrain);// If the 'end' option is not supplied, dest.end() will be called when -// source gets the 'end' or 'close' events. Only dest.end() once. -if(!dest._isStdio&&(!options||options.end!==false)){source.on('end',onend);source.on('close',onclose);}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end();}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==='function')dest.destroy();}// don't leave dangling pipes when there are errors. -function onerror(er){cleanup();if(EE.listenerCount(this,'error')===0){throw er;// Unhandled stream error in pipe. -}}source.on('error',onerror);dest.on('error',onerror);// remove all the event listeners that were added. -function cleanup(){source.removeListener('data',ondata);dest.removeListener('drain',ondrain);source.removeListener('end',onend);source.removeListener('close',onclose);source.removeListener('error',onerror);dest.removeListener('error',onerror);source.removeListener('end',cleanup);source.removeListener('close',cleanup);dest.removeListener('close',cleanup);}source.on('end',cleanup);source.on('close',cleanup);dest.on('close',cleanup);dest.emit('pipe',source);// Allow for unix-like usage: A.pipe(B).pipe(C) -return dest;};/***/},/***/"./node_modules/string_decoder/lib/string_decoder.js":/*!***********************************************************!*\ - !*** ./node_modules/string_decoder/lib/string_decoder.js ***! - \***********************************************************/ /*! no static exports found */ /***/function node_modulesString_decoderLibString_decoderJs(module,exports,__webpack_require__){"use strict";// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -/**/var Buffer=__webpack_require__(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer;/**/var isEncoding=Buffer.isEncoding||function(encoding){encoding=''+encoding;switch(encoding&&encoding.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 true;default:return false;}};function _normalizeEncoding(enc){if(!enc)return'utf8';var retried;while(true){switch(enc){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 enc;default:if(retried)return;// undefined -enc=(''+enc).toLowerCase();retried=true;}}};// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=='string'&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error('Unknown encoding: '+enc);return nenc||enc;}// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case'utf16le':this.text=utf16Text;this.end=utf16End;nb=4;break;case'utf8':this.fillLast=utf8FillLast;nb=4;break;case'base64':this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return;}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb);}StringDecoder.prototype.write=function(buf){if(buf.length===0)return'';var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return'';i=this.lastNeed;this.lastNeed=0;}else{i=0;}if(i>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return"\uFFFD";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return"\uFFFD";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return"\uFFFD";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal);}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length;}// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+"\uFFFD";return r;}// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString('base64',i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1];}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];}return buf.toString('base64',i,buf.length-n);}function base64End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+this.lastChar.toString('base64',0,3-this.lastNeed);return r;}// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}/***/},/***/"./node_modules/timers-browserify/main.js":/*!************************************************!*\ - !*** ./node_modules/timers-browserify/main.js ***! - \************************************************/ /*! no static exports found */ /***/function node_modulesTimersBrowserifyMainJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global){var scope=typeof global!=="undefined"&&global||typeof self!=="undefined"&&self||window;var apply=Function.prototype.apply;// DOM APIs, for completeness -exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,scope,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,scope,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){if(timeout){timeout.close();}};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(scope,this._id);};// Does not start the time, just sets up the members needed. -exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// setimmediate attaches itself to the global object -__webpack_require__(/*! setimmediate */"./node_modules/setimmediate/setImmediate.js");// On some exotic environments, it's not clear which object `setimmediate` was -// able to install onto. Search each possibility in the same order as the -// `setimmediate` library. -exports.setImmediate=typeof self!=="undefined"&&self.setImmediate||typeof global!=="undefined"&&global.setImmediate||this&&this.setImmediate;exports.clearImmediate=typeof self!=="undefined"&&self.clearImmediate||typeof global!=="undefined"&&global.clearImmediate||this&&this.clearImmediate;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/typedarray-to-buffer/index.js":/*!****************************************************!*\ - !*** ./node_modules/typedarray-to-buffer/index.js ***! - \****************************************************/ /*! no static exports found */ /***/function node_modulesTypedarrayToBufferIndexJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(Buffer){/** - * Convert a typed array to a Buffer without a copy - * - * Author: Feross Aboukhadijeh - * License: MIT - * - * `npm install typedarray-to-buffer` - */var isTypedArray=__webpack_require__(/*! is-typedarray */"./node_modules/is-typedarray/index.js").strict;module.exports=function typedarrayToBuffer(arr){if(isTypedArray(arr)){// To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer -var buf=Buffer.from(arr.buffer);if(arr.byteLength!==arr.buffer.byteLength){// Respect the "view", i.e. byteOffset and byteLength, without doing a copy -buf=buf.slice(arr.byteOffset,arr.byteOffset+arr.byteLength);}return buf;}else{// Pass through all other types to `Buffer.from` -return Buffer.from(arr);}};/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node-libs-browser/node_modules/buffer/index.js */"./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer);/***/},/***/"./node_modules/util-deprecate/browser.js":/*!************************************************!*\ - !*** ./node_modules/util-deprecate/browser.js ***! - \************************************************/ /*! no static exports found */ /***/function node_modulesUtilDeprecateBrowserJs(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global){/** - * Module exports. - */module.exports=deprecate;/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */function deprecate(fn,msg){if(config('noDeprecation')){return fn;}var warned=false;function deprecated(){if(!warned){if(config('throwDeprecation')){throw new Error(msg);}else if(config('traceDeprecation')){console.trace(msg);}else{console.warn(msg);}warned=true;}return fn.apply(this,arguments);}return deprecated;}/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes -try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/vm-browserify/index.js":/*!*********************************************!*\ - !*** ./node_modules/vm-browserify/index.js ***! - \*********************************************/ /*! no static exports found */ /***/function node_modulesVmBrowserifyIndexJs(module,exports){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var indexOf=function indexOf(xs,item){if(xs.indexOf)return xs.indexOf(item);else for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{},environment=_ref.environment,platform=_ref.platform,namespace=_ref.namespace,deviceInterface=_ref.deviceInterface,swapClasses=_ref.swapClasses,skipClasses=_ref.skipClasses,crypto=_ref.crypto;_classCallCheck(this,SNApplication);if(!deviceInterface){throw'Device Interface must be supplied.';}if(!environment){throw'Environment must be supplied when creating an application.';}if(!platform){throw'Platform must be supplied when creating an application.';}this.environment=environment;this.platform=platform;this.namespace=namespace||'';this.deviceInterface=deviceInterface;this.crypto=crypto;this.swapClasses=swapClasses;this.skipClasses=skipClasses;this.eventHandlers=[];this.services=[];this.streamObservers=[];this.serviceObservers=[];this.managedSubscribers=[];this.constructServices();}/** - * The first thing consumers should call when starting their app. - * This function will load all services in their correct order. - * @access public - * @param {object} params - * @param {object} params.callbacks - * @param {async|function} params.callbacks.receiveChallenge - * Return an array of ChallengeResponse for each Challenge. - * @param {Array.} params.callbacks.receiveChallenge.challenges - * An array of challenges that need a ChallengeResponse. - */_createClass(SNApplication,[{key:"prepareForLaunch",value:function(){var _prepareForLaunch=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(_ref2){var _this=this;var callbacks,databaseResult;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:callbacks=_ref2.callbacks;if(callbacks.receiveChallenge){_context.next=3;break;}throw'Application.launch callbacks are not properly configured.';case 3:this.setLaunchCallbacks(callbacks);_context.next=6;return this.deviceInterface.openDatabase().catch(function(error){_this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].LocalDatabaseReadError,error);});case 6:databaseResult=_context.sent;this.createdNewDatabase=databaseResult&&databaseResult.isNewDatabase;_context.next=10;return this.migrationService.initialize();case 10:_context.next=12;return this.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].PreparingForLaunch_0);case 12:_context.next=14;return this.storageService.initializeFromDisk();case 14:_context.next=16;return this.keyManager.initialize();case 16:_context.next=18;return this.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].ReadyForLaunch_05);case 18:this.started=true;_context.next=21;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].Started);case 21:case"end":return _context.stop();}}},_callee,this);}));function prepareForLaunch(_x){return _prepareForLaunch.apply(this,arguments);}return prepareForLaunch;}()/** @access public */},{key:"setLaunchCallbacks",value:function setLaunchCallbacks(callbacks){this.launchCallbacks=callbacks;this.challengeService.setChallengeHandler(callbacks);}/** - * Runs migrations, handles device authentication, unlocks application, and - * issues a callback if a device activation requires user input - * (i.e local passcode or fingerprint). - * @access public - * @param {bool} params.awaitDatabaseLoad Option to await database load before marking the app - * as ready. Used as far as we know for .restart and unit tests. - */},{key:"launch",value:function(){var _launch=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(){var _this2=this;var _ref3,awaitDatabaseLoad,launchChallenge,response,databasePayloads,loadPromise,_args3=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_ref3=_args3.length>0&&_args3[0]!==undefined?_args3[0]:{},awaitDatabaseLoad=_ref3.awaitDatabaseLoad;this.launched=false;_context3.next=4;return this.challengeService.getLaunchChallenge();case 4:launchChallenge=_context3.sent;if(!launchChallenge){_context3.next=11;break;}_context3.next=8;return this.challengeService.promptForChallengeResponse(launchChallenge);case 8:response=_context3.sent;_context3.next=11;return this.handleLaunchChallengeResponse(response);case 11:_context3.next=13;return this.storageService.isStorageWrapped();case 13:if(!_context3.sent){_context3.next=16;break;}_context3.next=16;return this.storageService.decryptStorage();case 16:_context3.next=18;return this.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].StorageDecrypted_09);case 18:_context3.next=20;return this.apiService.loadHost();case 20:_context3.next=22;return this.sessionManager.initializeFromDisk();case 22:this.historyManager.initializeFromDisk();this.launched=true;_context3.next=26;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].Launched);case 26:_context3.next=28;return this.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].Launched_10);case 28:_context3.next=30;return this.syncService.getDatabasePayloads();case 30:databasePayloads=_context3.sent;_context3.next=33;return this.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].LoadingDatabase_11);case 33:if(!this.createdNewDatabase){_context3.next=36;break;}_context3.next=36;return this.syncService.onNewDatabaseCreated();case 36:/** - * We don't want to await this, as we want to begin allowing the app to function - * before local data has been loaded fully. We await only initial - * `getDatabasePayloads` to lock in on database state. - */loadPromise=this.syncService.loadDatabasePayloads(databasePayloads).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!_this2.dealloced){_context2.next=2;break;}throw'Application has been destroyed.';case 2:_context2.next=4;return _this2.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationStages"].LoadedDatabase_12);case 4:_this2.beginAutoSyncTimer();return _context2.abrupt("return",_this2.syncService.sync({mode:_Services__WEBPACK_IMPORTED_MODULE_7__["SyncModes"].DownloadFirst}));case 6:case"end":return _context2.stop();}}},_callee2);})));if(!awaitDatabaseLoad){_context3.next=40;break;}_context3.next=40;return loadPromise;case 40:case"end":return _context3.stop();}}},_callee3,this);}));function launch(){return _launch.apply(this,arguments);}return launch;}()},{key:"handleLaunchChallengeResponse",value:function(){var _handleLaunchChallengeResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(response){var wrappingKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(!response.challenge.types.includes(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].LocalPasscode)){_context4.next=8;break;}wrappingKey=response.artifacts.wrappingKey;if(wrappingKey){_context4.next=6;break;}_context4.next=5;return this.keyManager.computeWrappingKey({passcode:response.value});case 5:wrappingKey=_context4.sent;case 6:_context4.next=8;return this.keyManager.unwrapRootKey({wrappingKey:wrappingKey});case 8:case"end":return _context4.stop();}}},_callee4,this);}));function handleLaunchChallengeResponse(_x2){return _handleLaunchChallengeResponse.apply(this,arguments);}return handleLaunchChallengeResponse;}()/** - * @access private - */},{key:"beginAutoSyncTimer",value:function beginAutoSyncTimer(){var _this3=this;this.autoSyncInterval=this.deviceInterface.interval(function(){_this3.syncService.log('Syncing from autosync');_this3.sync();},DEFAULT_AUTO_SYNC_INTERVAL);}/** - * The migrations service is initialized with this function, so that it can retrieve - * raw challenge values as necessary. - * @access private - */},{key:"getMigrationChallengeResponder",value:function getMigrationChallengeResponder(){var _this4=this;return(/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(challenge,validate,orchestratorFill){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:return _context5.abrupt("return",_this4.challengeService.promptForChallengeResponse(challenge,validate,orchestratorFill));case 1:case"end":return _context5.stop();}}},_callee5);}));return function(_x3,_x4,_x5){return _ref5.apply(this,arguments);};}());}/** @access private */},{key:"handleStage",value:function(){var _handleStage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(stage){var _iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,service;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context6.prev=3;_iterator=this.services[Symbol.iterator]();case 5:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context6.next=12;break;}service=_step.value;_context6.next=9;return service.handleApplicationStage(stage);case 9:_iteratorNormalCompletion=true;_context6.next=5;break;case 12:_context6.next=18;break;case 14:_context6.prev=14;_context6.t0=_context6["catch"](3);_didIteratorError=true;_iteratorError=_context6.t0;case 18:_context6.prev=18;_context6.prev=19;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 21:_context6.prev=21;if(!_didIteratorError){_context6.next=24;break;}throw _iteratorError;case 24:return _context6.finish(21);case 25:return _context6.finish(18);case 26:case"end":return _context6.stop();}}},_callee6,this,[[3,14,18,26],[19,,21,25]]);}));function handleStage(_x6){return _handleStage.apply(this,arguments);}return handleStage;}()/** - * @access public - * @param {function} callback - * @param {ApplicationEvent} [singleEvent] Whether to only listen for a particular event. - */},{key:"addEventObserver",value:function addEventObserver(callback,singleEvent){var _this5=this;var observer={callback:callback,singleEvent:singleEvent};this.eventHandlers.push(observer);return function(){Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["removeFromArray"])(_this5.eventHandlers,observer);};}/** - * @access public - * @param {ApplicationEvent} singleEvent Event to listen for. - * @param {function} callback - */},{key:"addSingleEventObserver",value:function addSingleEventObserver(event,callback){return this.addEventObserver(function(firedEvent){if(firedEvent===event){callback();}},event);}/** @access private */},{key:"notifyEvent",value:function(){var _notifyEvent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(event,data){var _iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,observer;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context7.prev=3;_iterator2=this.eventHandlers.slice()[Symbol.iterator]();case 5:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context7.next=18;break;}observer=_step2.value;if(!(observer.singleEvent&&observer.singleEvent===event)){_context7.next=12;break;}_context7.next=10;return observer.callback(event,data||{});case 10:_context7.next=15;break;case 12:if(observer.singleEvent){_context7.next=15;break;}_context7.next=15;return observer.callback(event,data||{});case 15:_iteratorNormalCompletion2=true;_context7.next=5;break;case 18:_context7.next=24;break;case 20:_context7.prev=20;_context7.t0=_context7["catch"](3);_didIteratorError2=true;_iteratorError2=_context7.t0;case 24:_context7.prev=24;_context7.prev=25;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 27:_context7.prev=27;if(!_didIteratorError2){_context7.next=30;break;}throw _iteratorError2;case 30:return _context7.finish(27);case 31:return _context7.finish(24);case 32:case"end":return _context7.stop();}}},_callee7,this,[[3,20,24,32],[25,,27,31]]);}));function notifyEvent(_x7,_x8){return _notifyEvent.apply(this,arguments);}return notifyEvent;}()/** - * Whether the local database has completed loading local items. - * @access public - */},{key:"isDatabaseLoaded",value:function isDatabaseLoaded(){return this.syncService.isDatabaseLoaded();}/** @access public */},{key:"savePayload",value:function(){var _savePayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(_ref6){var payload,dirtied;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:payload=_ref6.payload;dirtied=Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_3__["CopyPayload"])({payload:payload,override:{dirty:true}});_context8.next=4;return this.modelManager.mapPayloadToLocalItem({payload:dirtied,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_4__["PayloadSources"].LocalChanged});case 4:_context8.next=6;return this.syncService.sync();case 6:case"end":return _context8.stop();}}},_callee8,this);}));function savePayload(_x9){return _savePayload.apply(this,arguments);}return savePayload;}()/** - * Finds an item by UUID. - * @access public - * @param uuid The uuid of the item to find. - */},{key:"findItem",value:function findItem(_ref7){var uuid=_ref7.uuid;return this.modelManager.findItem(uuid);}/** - * Finds an item by predicate. - * @access public - */},{key:"findItems",value:function findItems(_ref8){var predicate=_ref8.predicate;return this.modelManager.itemsMatchingPredicate(predicate);}/** @access public */},{key:"mergeItem",value:function(){var _mergeItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(_ref9){var item,source;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:item=_ref9.item,source=_ref9.source;return _context9.abrupt("return",this.modelManager.mapItem({item:item,source:source}));case 2:case"end":return _context9.stop();}}},_callee9,this);}));function mergeItem(_x10){return _mergeItem.apply(this,arguments);}return mergeItem;}()/** - * Creates a managed item. - * @access public - * @param needsSync Whether to mark the item as needing sync. `add` must also be true. - */},{key:"createManagedItem",value:function(){var _createManagedItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(_ref10){var contentType,content,needsSync,override,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:contentType=_ref10.contentType,content=_ref10.content,needsSync=_ref10.needsSync,override=_ref10.override;_context10.next=3;return this.modelManager.createItem({contentType:contentType,content:content,add:true,needsSync:needsSync,override:override});case 3:item=_context10.sent;return _context10.abrupt("return",item);case 5:case"end":return _context10.stop();}}},_callee10,this);}));function createManagedItem(_x11){return _createManagedItem.apply(this,arguments);}return createManagedItem;}()/** - * Creates an unmanaged item that can be added later. - * @access public - * @param needsSync Whether to mark the item as needing sync. `add` must also be true. - */},{key:"createTemplateItem",value:function(){var _createTemplateItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(_ref11){var contentType,content,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:contentType=_ref11.contentType,content=_ref11.content;_context11.next=3;return this.modelManager.createItem({contentType:contentType,content:content});case 3:item=_context11.sent;return _context11.abrupt("return",item);case 5:case"end":return _context11.stop();}}},_callee11,this);}));function createTemplateItem(_x12){return _createTemplateItem.apply(this,arguments);}return createTemplateItem;}()/** - * Creates an unmanaged item from a payload. - * @access public - */},{key:"createItemFromPayload",value:function createItemFromPayload(payload){return Object(_Models_generator__WEBPACK_IMPORTED_MODULE_5__["CreateItemFromPayload"])(payload);}/** - * Creates an unmanaged payload from any object, where the raw object - * represents the same data a payload would. - * @access public - */},{key:"createPayloadFromObject",value:function createPayloadFromObject(object){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"])({object:object});}/** @access public */},{key:"saveItem",value:function(){var _saveItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(_ref12){var item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:item=_ref12.item;_context12.next=3;return this.modelManager.setItemDirty(item,true);case 3:_context12.next=5;return this.syncService.sync();case 5:case"end":return _context12.stop();}}},_callee12,this);}));function saveItem(_x13){return _saveItem.apply(this,arguments);}return saveItem;}()/** - * @access public - * @param {Array.} params.items - */},{key:"saveItems",value:function(){var _saveItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(_ref13){var items;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:items=_ref13.items;_context13.next=3;return this.modelManager.setItemsDirty(items);case 3:_context13.next=5;return this.syncService.sync();case 5:case"end":return _context13.stop();}}},_callee13,this);}));function saveItems(_x14){return _saveItems.apply(this,arguments);}return saveItems;}()/** - * @access public - * @param {SNItem} params.item - * @param {bool} params.updateUserModifiedDate Whether to change the modified date the user - * sees of the item. - */},{key:"setItemNeedsSync",value:function(){var _setItemNeedsSync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(_ref14){var item,updateUserModifiedDate;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:item=_ref14.item,updateUserModifiedDate=_ref14.updateUserModifiedDate;return _context14.abrupt("return",this.modelManager.setItemDirty(item,true,updateUserModifiedDate));case 2:case"end":return _context14.stop();}}},_callee14,this);}));function setItemNeedsSync(_x15){return _setItemNeedsSync.apply(this,arguments);}return setItemNeedsSync;}()/** - * @access public - * @returns {Date|null} The date of last sync - */},{key:"getLastSyncDate",value:function getLastSyncDate(){return this.syncService.getLastSyncDate();}/** - * @access public - * @returns {SyncOpStatus} - */},{key:"getSyncStatus",value:function getSyncStatus(){return this.syncService.getStatus();}/** - * @access public - * @param updateUserModifiedDate - * Whether to change the modified date the user sees of the item. - */},{key:"setItemsNeedsSync",value:function(){var _setItemsNeedsSync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(_ref15){var items;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:items=_ref15.items;return _context15.abrupt("return",this.modelManager.setItemsDirty(items));case 2:case"end":return _context15.stop();}}},_callee15,this);}));function setItemsNeedsSync(_x16){return _setItemsNeedsSync.apply(this,arguments);}return setItemsNeedsSync;}()/** @access public */},{key:"deleteItem",value:function(){var _deleteItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee16(_ref16){var item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:item=_ref16.item;_context16.next=3;return this.modelManager.setItemToBeDeleted(item);case 3:return _context16.abrupt("return",this.sync());case 4:case"end":return _context16.stop();}}},_callee16,this);}));function deleteItem(_x17){return _deleteItem.apply(this,arguments);}return deleteItem;}()/** @access public */},{key:"deleteItemLocally",value:function(){var _deleteItemLocally=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee17(_ref17){var item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:item=_ref17.item;this.modelManager.removeItemLocally(item);case 2:case"end":return _context17.stop();}}},_callee17,this);}));function deleteItemLocally(_x18){return _deleteItemLocally.apply(this,arguments);}return deleteItemLocally;}()/** @access public */},{key:"emptyTrash",value:function(){var _emptyTrash=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee18(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:_context18.next=2;return this.modelManager.emptyTrash();case 2:return _context18.abrupt("return",this.sync());case 3:case"end":return _context18.stop();}}},_callee18,this);}));function emptyTrash(){return _emptyTrash.apply(this,arguments);}return emptyTrash;}()/** @access public */},{key:"getTrashedItems",value:function getTrashedItems(){return this.modelManager.trashedItems();}/** - * @access public - * @param {string|ContentType} contentType A string, array of strings, or '*' - */},{key:"getItems",value:function getItems(_ref18){var contentType=_ref18.contentType;return this.modelManager.getItems(contentType);}/** @access public */},{key:"getDisplayableItems",value:function getDisplayableItems(_ref19){var contentType=_ref19.contentType;return this.modelManager.validItemsForContentType(contentType);}/** @access public */},{key:"getNotesMatchingSmartTag",value:function getNotesMatchingSmartTag(_ref20){var smartTag=_ref20.smartTag;return this.modelManager.notesMatchingSmartTag(smartTag);}/** @access public */},{key:"findTag",value:function findTag(_ref21){var title=_ref21.title;return this.modelManager.findTagByTitle(title);}/** @access public */},{key:"findOrCreateTag",value:function(){var _findOrCreateTag=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee19(_ref22){var title;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:title=_ref22.title;return _context19.abrupt("return",this.modelManager.findOrCreateTagByTitle(title));case 2:case"end":return _context19.stop();}}},_callee19,this);}));function findOrCreateTag(_x19){return _findOrCreateTag.apply(this,arguments);}return findOrCreateTag;}()/** @access public */},{key:"getSmartTags",value:function getSmartTags(){return this.modelManager.getSmartTags();}/** @access public */},{key:"getNoteCount",value:function getNoteCount(){return this.modelManager.noteCount();}/** - * Begin streaming items to display in the UI. - * @access public - * @param contentType Can be string, '*', or array of types. - */},{key:"streamItems",value:function streamItems(_ref23){var _this6=this;var contentType=_ref23.contentType,stream=_ref23.stream;var observer=this.modelManager.addMappingObserver(contentType,function(allItems,validItems,deletedItems,source,sourceKey){var includedContentTypes=allItems.map(function(item){return item.content_type;});stream({items:allItems,contentTypes:includedContentTypes,source:source,sourceKey:sourceKey});});this.streamObservers.push(observer);return function(){observer();Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["removeFromArray"])(_this6.streamObservers,observer);};}/** - * Set the server's URL - * @access public - */},{key:"setHost",value:function(){var _setHost=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee20(host){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:return _context20.abrupt("return",this.apiService.setHost(host));case 1:case"end":return _context20.stop();}}},_callee20,this);}));function setHost(_x20){return _setHost.apply(this,arguments);}return setHost;}()/** @access public */},{key:"getHost",value:function(){var _getHost=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee21(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:return _context21.abrupt("return",this.apiService.getHost());case 1:case"end":return _context21.stop();}}},_callee21,this);}));function getHost(){return _getHost.apply(this,arguments);}return getHost;}()/** @access public */},{key:"getUser",value:function getUser(){if(!this.launched){throw'Attempting to access user before application unlocked';}return this.sessionManager.getUser();}/** @access public */},{key:"getUserVersion",value:function(){var _getUserVersion=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee22(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee22$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:return _context22.abrupt("return",this.protocolService.getUserVersion());case 1:case"end":return _context22.stop();}}},_callee22,this);}));function getUserVersion(){return _getUserVersion.apply(this,arguments);}return getUserVersion;}()/** - * Returns true if there is an upgrade available for the account or passcode - * @access public - */},{key:"protocolUpgradeAvailable",value:function(){var _protocolUpgradeAvailable=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee23(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee23$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:return _context23.abrupt("return",this.protocolService.upgradeAvailable());case 1:case"end":return _context23.stop();}}},_callee23,this);}));function protocolUpgradeAvailable(){return _protocolUpgradeAvailable.apply(this,arguments);}return protocolUpgradeAvailable;}()/** - * Returns true if there is an encryption source available - * @access public - * @returns {boolean} - */},{key:"isEncryptionAvailable",value:function(){var _isEncryptionAvailable=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee24(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee24$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:return _context24.abrupt("return",!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(this.getUser())||this.hasPasscode());case 1:case"end":return _context24.stop();}}},_callee24,this);}));function isEncryptionAvailable(){return _isEncryptionAvailable.apply(this,arguments);}return isEncryptionAvailable;}()/** - * @access public - * @returns {Array.} An array of errors, if any. - */},{key:"upgradeProtocolVersion",value:function(){var _upgradeProtocolVersion=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee25(){var hasPasscode,hasAccount,types,challenge,response,errors,passcode,value,_value,password,changeResponse;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee25$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:hasPasscode=this.hasPasscode();hasAccount=!this.noAccount();types=[];if(hasPasscode){types.push(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].LocalPasscode);}if(hasAccount){types.push(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].AccountPassword);}challenge=new _Lib__WEBPACK_IMPORTED_MODULE_6__["Challenge"](types,_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeReason"].ProtocolUpgrade);_context25.next=8;return this.challengeService.promptForChallengeResponse(challenge);case 8:response=_context25.sent;if(response){_context25.next=11;break;}return _context25.abrupt("return");case 11:errors=[];if(!hasPasscode){_context25.next=17;break;}/* Upgrade passcode version */value=response.getValueForType(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].LocalPasscode);passcode=value.value;_context25.next=17;return this.changePasscode(passcode);case 17:if(!hasAccount){_context25.next=24;break;}/* Upgrade account version */_value=response.getValueForType(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].AccountPassword);password=_value.value;_context25.next=22;return this.changePassword({currentPassword:password,newPassword:password,passcode:passcode});case 22:changeResponse=_context25.sent;if(changeResponse.error){errors.push(changeResponse.error);}case 24:return _context25.abrupt("return",errors);case 25:case"end":return _context25.stop();}}},_callee25,this);}));function upgradeProtocolVersion(){return _upgradeProtocolVersion.apply(this,arguments);}return upgradeProtocolVersion;}()/** @access public */},{key:"noAccount",value:function noAccount(){var user=this.getUser();return Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(user);}/** - * @access public - * @param {object} params.data - * @param {string} params.password - * @param {bool} [params.awaitSync = false] - * @returns {Object} result - * @returns {Array.} result.affectedItems Items that were either created - * or dirtied by this import - * @returns {int} result.errorCount The number of items - * that were not imported due to failure to decrypt. - */},{key:"importData",value:function(){var _importData=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee26(_ref24){var data,password,awaitSync,decryptedPayloads,validPayloads,affectedItems,promise;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee26$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:data=_ref24.data,password=_ref24.password,awaitSync=_ref24.awaitSync;_context26.next=3;return this.protocolService.payloadsByDecryptingBackupFile({data:data,password:password});case 3:decryptedPayloads=_context26.sent;validPayloads=decryptedPayloads.filter(function(payload){return!payload.errorDecrypting;});_context26.next=7;return this.modelManager.importPayloads(validPayloads);case 7:affectedItems=_context26.sent;promise=this.sync();if(!awaitSync){_context26.next=12;break;}_context26.next=12;return promise;case 12:return _context26.abrupt("return",{affectedItems:affectedItems,errorCount:decryptedPayloads.length-validPayloads.length});case 13:case"end":return _context26.stop();}}},_callee26,this);}));function importData(_x21){return _importData.apply(this,arguments);}return importData;}()/** - * Creates a JSON string representing the backup format of all items, or just subItems - * if supplied. - * @access public - */},{key:"createBackupFile",value:function(){var _createBackupFile=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee27(){var _ref25,subItems,intent,returnIfEmpty,_args27=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee27$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_ref25=_args27.length>0&&_args27[0]!==undefined?_args27[0]:{},subItems=_ref25.subItems,intent=_ref25.intent,returnIfEmpty=_ref25.returnIfEmpty;return _context27.abrupt("return",this.protocolService.createBackupFile({subItems:subItems,intent:intent,returnIfEmpty:returnIfEmpty}));case 2:case"end":return _context27.stop();}}},_callee27,this);}));function createBackupFile(){return _createBackupFile.apply(this,arguments);}return createBackupFile;}()/** @access public */},{key:"isEphemeralSession",value:function isEphemeralSession(){return this.storageService.isEphemeralSession();}/** @access private */},{key:"lockSyncing",value:function lockSyncing(){this.syncService.lockSyncing();}/** @access private */},{key:"unlockSyncing",value:function unlockSyncing(){this.syncService.unlockSyncing();}/** @access public */},{key:"sync",value:function(){var _sync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee28(options){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee28$(_context28){while(1){switch(_context28.prev=_context28.next){case 0:return _context28.abrupt("return",this.syncService.sync(options));case 1:case"end":return _context28.stop();}}},_callee28,this);}));function sync(_x22){return _sync.apply(this,arguments);}return sync;}()/** @access public */},{key:"resolveOutOfSync",value:function(){var _resolveOutOfSync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee29(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee29$(_context29){while(1){switch(_context29.prev=_context29.next){case 0:return _context29.abrupt("return",this.syncService.resolveOutOfSync());case 1:case"end":return _context29.stop();}}},_callee29,this);}));function resolveOutOfSync(){return _resolveOutOfSync.apply(this,arguments);}return resolveOutOfSync;}()/** @access public */},{key:"setValue",value:function(){var _setValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee30(key,value,mode){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee30$(_context30){while(1){switch(_context30.prev=_context30.next){case 0:return _context30.abrupt("return",this.storageService.setValue(key,value,mode));case 1:case"end":return _context30.stop();}}},_callee30,this);}));function setValue(_x23,_x24,_x25){return _setValue.apply(this,arguments);}return setValue;}()/** @access public */},{key:"getValue",value:function(){var _getValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee31(key,mode){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee31$(_context31){while(1){switch(_context31.prev=_context31.next){case 0:return _context31.abrupt("return",this.storageService.getValue(key,mode));case 1:case"end":return _context31.stop();}}},_callee31,this);}));function getValue(_x26,_x27){return _getValue.apply(this,arguments);}return getValue;}()/** @access public */},{key:"removeValue",value:function(){var _removeValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee32(key,mode){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee32$(_context32){while(1){switch(_context32.prev=_context32.next){case 0:return _context32.abrupt("return",this.storageService.removeValue(key,mode));case 1:case"end":return _context32.stop();}}},_callee32,this);}));function removeValue(_x28,_x29){return _removeValue.apply(this,arguments);}return removeValue;}()/** - * Deletes all payloads from storage. - * @access public - */},{key:"clearDatabase",value:function(){var _clearDatabase=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee33(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee33$(_context33){while(1){switch(_context33.prev=_context33.next){case 0:return _context33.abrupt("return",this.storageService.clearAllPayloads());case 1:case"end":return _context33.stop();}}},_callee33,this);}));function clearDatabase(){return _clearDatabase.apply(this,arguments);}return clearDatabase;}()/** - * Allows items keys to be rewritten to local db on local credential status change, - * such as if passcode is added, changed, or removed. - * This allows IndexedDB unencrypted logs to be deleted - * `deletePayloads` will remove data from backing store, - * but not from working memory See: - * https://github.com/standardnotes/desktop/issues/131 - * @access private - */},{key:"rewriteItemsKeys",value:function(){var _rewriteItemsKeys=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee34(){var itemsKeys,payloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee34$(_context34){while(1){switch(_context34.prev=_context34.next){case 0:itemsKeys=this.itemsKeyManager.allItemsKeys;payloads=itemsKeys.map(function(key){return key.payloadRepresentation();});_context34.next=4;return this.storageService.deletePayloads(payloads);case 4:_context34.next=6;return this.syncService.persistPayloads({decryptedPayloads:payloads});case 6:case"end":return _context34.stop();}}},_callee34,this);}));function rewriteItemsKeys(){return _rewriteItemsKeys.apply(this,arguments);}return rewriteItemsKeys;}()/** - * Destroys the application instance. - * @access public - */},{key:"deinit",value:function deinit(){clearInterval(this.autoSyncInterval);var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=this.serviceObservers[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var uninstallObserver=_step3.value;uninstallObserver();}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return!=null){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=this.managedSubscribers[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var uninstallSubscriber=_step4.value;uninstallSubscriber();}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return!=null){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=this.services[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var service=_step5.value;if(service.deinit){service.deinit();service.application=null;}}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return!=null){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}this.deviceInterface.deinit();this.deviceInterface=null;this.launchCallbacks=null;this.crypto=null;this.createdNewDatabase=null;this.services.length=0;this.serviceObservers.length=0;this.managedSubscribers.length=0;this.streamObservers.length=0;this.deviceInterface=null;this.clearServices();this.dealloced=true;this.started=false;}/** - * Returns the wrapping key for operations that require resaving the root key - * (changing the account password, signing in, registering, or upgrading protocol) - * Returns empty object if no passcode is configured. - * Otherwise returns {cancled: true} if the operation is canceled, or - * {wrappingKey} with the result. - * @param {string} [passcode] - If the consumer already has access to the passcode, - * they can pass it here so that the user is not prompted again. - * @access private - */},{key:"getWrappingKeyIfNecessary",value:function(){var _getWrappingKeyIfNecessary=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee35(passcode){var challenge,response,value,wrappingKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee35$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:if(this.hasPasscode()){_context35.next=2;break;}return _context35.abrupt("return",{});case 2:if(passcode){_context35.next=11;break;}challenge=new _Lib__WEBPACK_IMPORTED_MODULE_6__["Challenge"]([_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].LocalPasscode],_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeReason"].ResaveRootKey);_context35.next=6;return this.challengeService.promptForChallengeResponse(challenge);case 6:response=_context35.sent;if(response){_context35.next=9;break;}return _context35.abrupt("return",{canceled:true});case 9:value=response.getValueForType(_Lib__WEBPACK_IMPORTED_MODULE_6__["ChallengeType"].LocalPasscode);passcode=value.value;case 11:_context35.next=13;return this.keyManager.computeWrappingKey({passcode:passcode});case 13:wrappingKey=_context35.sent;return _context35.abrupt("return",{wrappingKey:wrappingKey});case 15:case"end":return _context35.stop();}}},_callee35,this);}));function getWrappingKeyIfNecessary(_x30){return _getWrappingKeyIfNecessary.apply(this,arguments);}return getWrappingKeyIfNecessary;}()/** - * @access public - * @param mergeLocal Whether to merge existing offline data into account. If false, - * any pre-existing data will be fully deleted upon success. - */},{key:"register",value:function(){var _register=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee36(_ref26){var email,password,ephemeral,mergeLocal,_ref27,wrappingKey,canceled,result;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee36$(_context36){while(1){switch(_context36.prev=_context36.next){case 0:email=_ref26.email,password=_ref26.password,ephemeral=_ref26.ephemeral,mergeLocal=_ref26.mergeLocal;_context36.next=3;return this.getWrappingKeyIfNecessary();case 3:_ref27=_context36.sent;wrappingKey=_ref27.wrappingKey;canceled=_ref27.canceled;if(!canceled){_context36.next=8;break;}return _context36.abrupt("return");case 8:this.lockSyncing();_context36.next=11;return this.sessionManager.register({email:email,password:password});case 11:result=_context36.sent;if(result.response.error){_context36.next=34;break;}_context36.next=15;return this.keyManager.setNewRootKey({key:result.rootKey,keyParams:result.keyParams,wrappingKey:wrappingKey});case 15:this.syncService.resetSyncState();_context36.next=18;return this.storageService.setPersistencePolicy(ephemeral?_Services__WEBPACK_IMPORTED_MODULE_7__["StoragePersistencePolicies"].Ephemeral:_Services__WEBPACK_IMPORTED_MODULE_7__["StoragePersistencePolicies"].Default);case 18:if(!mergeLocal){_context36.next=23;break;}_context36.next=21;return this.syncService.markAllItemsAsNeedingSync({alternateUuids:true});case 21:_context36.next=26;break;case 23:this.modelManager.removeAllItemsFromMemory();_context36.next=26;return this.clearDatabase();case 26:_context36.next=28;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].SignedIn);case 28:this.unlockSyncing();_context36.next=31;return this.syncService.sync({mode:_Services__WEBPACK_IMPORTED_MODULE_7__["SyncModes"].DownloadFirst,timingStrategy:_Services__WEBPACK_IMPORTED_MODULE_7__["TIMING_STRATEGY_FORCE_SPAWN_NEW"]});case 31:this.protocolService.decryptErroredItems();_context36.next=35;break;case 34:this.unlockSyncing();case 35:return _context36.abrupt("return",result.response);case 36:case"end":return _context36.stop();}}},_callee36,this);}));function register(_x31){return _register.apply(this,arguments);}return register;}()/** - * @access public - * @param {boolean} [params.awaitSync = false] - * @param {boolean} params.mergeLocal Whether to merge existing offline data into account. If false, - * any pre-existing data will be fully deleted upon success. - */},{key:"signIn",value:function(){var _signIn=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee37(_ref28){var email,password,strict,ephemeral,mfaKeyPath,mfaCode,_ref28$mergeLocal,mergeLocal,awaitSync,_ref29,wrappingKey,canceled,result,syncPromise;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee37$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:email=_ref28.email,password=_ref28.password,strict=_ref28.strict,ephemeral=_ref28.ephemeral,mfaKeyPath=_ref28.mfaKeyPath,mfaCode=_ref28.mfaCode,_ref28$mergeLocal=_ref28.mergeLocal,mergeLocal=_ref28$mergeLocal===void 0?true:_ref28$mergeLocal,awaitSync=_ref28.awaitSync;_context37.next=3;return this.getWrappingKeyIfNecessary();case 3:_ref29=_context37.sent;wrappingKey=_ref29.wrappingKey;canceled=_ref29.canceled;if(!canceled){_context37.next=8;break;}return _context37.abrupt("return");case 8:/** Prevent a timed sync from occuring while signing in. */this.lockSyncing();_context37.next=11;return this.sessionManager.signIn({email:email,password:password,strict:strict,mfaKeyPath:mfaKeyPath,mfaCode:mfaCode});case 11:result=_context37.sent;if(result.response.error){_context37.next=36;break;}_context37.next=15;return this.keyManager.setNewRootKey({key:result.rootKey,keyParams:result.keyParams,wrappingKey:wrappingKey});case 15:this.syncService.resetSyncState();_context37.next=18;return this.storageService.setPersistencePolicy(ephemeral?_Services__WEBPACK_IMPORTED_MODULE_7__["StoragePersistencePolicies"].Ephemeral:_Services__WEBPACK_IMPORTED_MODULE_7__["StoragePersistencePolicies"].Default);case 18:if(!mergeLocal){_context37.next=23;break;}_context37.next=21;return this.syncService.markAllItemsAsNeedingSync({alternateUuids:true});case 21:_context37.next=26;break;case 23:this.modelManager.removeAllItemsFromMemory();_context37.next=26;return this.clearDatabase();case 26:_context37.next=28;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].SignedIn);case 28:this.unlockSyncing();syncPromise=this.syncService.sync({mode:_Services__WEBPACK_IMPORTED_MODULE_7__["SyncModes"].DownloadFirst,checkIntegrity:true,timingStrategy:_Services__WEBPACK_IMPORTED_MODULE_7__["TIMING_STRATEGY_FORCE_SPAWN_NEW"]});if(!awaitSync){_context37.next=33;break;}_context37.next=33;return syncPromise;case 33:this.protocolService.decryptErroredItems();_context37.next=37;break;case 36:this.unlockSyncing();case 37:return _context37.abrupt("return",result.response);case 38:case"end":return _context37.stop();}}},_callee37,this);}));function signIn(_x32){return _signIn.apply(this,arguments);}return signIn;}()/** - * @access public - * @param {string} [passcode] - Changing the account password requires the local - * passcode if configured (to rewrap the account key with passcode). If the passcode - * is not passed in, the user will be prompted for the passcode. However if the consumer - * already has referene to the passcode, they can pass it in here so that the user - * is not prompted again. - */},{key:"changePassword",value:function(){var _changePassword=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee38(_ref30){var currentPassword,newPassword,passcode,_ref31,wrappingKey,canceled,currentKeyParams,result;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee38$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:currentPassword=_ref30.currentPassword,newPassword=_ref30.newPassword,passcode=_ref30.passcode;_context38.next=3;return this.getWrappingKeyIfNecessary(passcode);case 3:_ref31=_context38.sent;wrappingKey=_ref31.wrappingKey;canceled=_ref31.canceled;if(!canceled){_context38.next=8;break;}return _context38.abrupt("return");case 8:_context38.next=10;return this.keyManager.getRootKeyParams();case 10:currentKeyParams=_context38.sent;this.lockSyncing();_context38.next=14;return this.sessionManager.changePassword({currentPassword:currentPassword,currentKeyParams:currentKeyParams,newPassword:newPassword});case 14:result=_context38.sent;if(result.response.error){_context38.next=25;break;}_context38.next=18;return this.keyManager.setNewRootKey({key:result.rootKey,keyParams:result.keyParams,wrappingKey:wrappingKey});case 18:_context38.next=20;return this.itemsKeyManager.createNewDefaultItemsKey();case 20:this.unlockSyncing();_context38.next=23;return this.syncService.sync();case 23:_context38.next=26;break;case 25:this.unlockSyncing();case 26:return _context38.abrupt("return",result.response);case 27:case"end":return _context38.stop();}}},_callee38,this);}));function changePassword(_x33){return _changePassword.apply(this,arguments);}return changePassword;}()/** @access public */},{key:"signOut",value:function(){var _signOut=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee39(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee39$(_context39){while(1){switch(_context39.prev=_context39.next){case 0:_context39.next=2;return this.sessionManager.signOut();case 2:_context39.next=4;return this.keyManager.clearLocalKeyState();case 4:_context39.next=6;return this.storageService.clearAllData();case 6:_context39.next=8;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].SignedOut);case 8:this.deinit();case 9:case"end":return _context39.stop();}}},_callee39,this);}));function signOut(){return _signOut.apply(this,arguments);}return signOut;}()/** @access public */},{key:"validateAccountPassword",value:function(){var _validateAccountPassword=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee40(_ref32){var password,_ref33,valid;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee40$(_context40){while(1){switch(_context40.prev=_context40.next){case 0:password=_ref32.password;_context40.next=3;return this.keyManager.validateAccountPassword(password);case 3:_ref33=_context40.sent;valid=_ref33.valid;return _context40.abrupt("return",valid);case 6:case"end":return _context40.stop();}}},_callee40,this);}));function validateAccountPassword(_x34){return _validateAccountPassword.apply(this,arguments);}return validateAccountPassword;}()/** @access public */},{key:"isStarted",value:function isStarted(){return this.started;}/** @access public */},{key:"isLaunched",value:function isLaunched(){return this.launched;}/** @access public */},{key:"hasPasscode",value:function hasPasscode(){return this.keyManager.hasPasscode();}/** @access public */},{key:"isLocked",value:function(){var _isLocked=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee41(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee41$(_context41){while(1){switch(_context41.prev=_context41.next){case 0:if(this.started){_context41.next=2;break;}return _context41.abrupt("return",true);case 2:return _context41.abrupt("return",this.challengeService.isPasscodeLocked());case 3:case"end":return _context41.stop();}}},_callee41,this);}));function isLocked(){return _isLocked.apply(this,arguments);}return isLocked;}()/** @access public */},{key:"lock",value:function(){var _lock=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee42(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee42$(_context42){while(1){switch(_context42.prev=_context42.next){case 0:return _context42.abrupt("return",this.deinit());case 1:case"end":return _context42.stop();}}},_callee42,this);}));function lock(){return _lock.apply(this,arguments);}return lock;}()/** @access public */},{key:"setPasscode",value:function(){var _setPasscode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee43(passcode){var identifier,_ref34,key,keyParams;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee43$(_context43){while(1){switch(_context43.prev=_context43.next){case 0:_context43.next=2;return this.protocolService.crypto.generateUUID();case 2:identifier=_context43.sent;_context43.next=5;return this.protocolService.createRootKey({identifier:identifier,password:passcode});case 5:_ref34=_context43.sent;key=_ref34.key;keyParams=_ref34.keyParams;_context43.next=10;return this.keyManager.setNewRootKeyWrapper({wrappingKey:key,keyParams:keyParams});case 10:_context43.next=12;return this.rewriteItemsKeys();case 12:_context43.next=14;return this.syncService.sync();case 14:case"end":return _context43.stop();}}},_callee43,this);}));function setPasscode(_x35){return _setPasscode.apply(this,arguments);}return setPasscode;}()/** @access public */},{key:"removePasscode",value:function(){var _removePasscode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee44(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee44$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:_context44.next=2;return this.keyManager.removeRootKeyWrapper();case 2:_context44.next=4;return this.rewriteItemsKeys();case 4:case"end":return _context44.stop();}}},_callee44,this);}));function removePasscode(){return _removePasscode.apply(this,arguments);}return removePasscode;}()/** @access public */},{key:"changePasscode",value:function(){var _changePasscode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee45(passcode){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee45$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:_context45.next=2;return this.removePasscode();case 2:return _context45.abrupt("return",this.setPasscode(passcode));case 3:case"end":return _context45.stop();}}},_callee45,this);}));function changePasscode(_x36){return _changePasscode.apply(this,arguments);}return changePasscode;}()/** @access public */},{key:"setStorageEncryptionPolicy",value:function(){var _setStorageEncryptionPolicy=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee46(encryptionPolicy){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee46$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:_context46.next=2;return this.storageService.setEncryptionPolicy(encryptionPolicy);case 2:return _context46.abrupt("return",this.syncService.repersistAllItems());case 3:case"end":return _context46.stop();}}},_callee46,this);}));function setStorageEncryptionPolicy(_x37){return _setStorageEncryptionPolicy.apply(this,arguments);}return setStorageEncryptionPolicy;}()/** @access public */},{key:"generateUuid",value:function(){var _generateUuid=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee47(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee47$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:return _context47.abrupt("return",this.protocolService.crypto.generateUUID());case 1:case"end":return _context47.stop();}}},_callee47,this);}));function generateUuid(){return _generateUuid.apply(this,arguments);}return generateUuid;}()/** - * Dynamically change the device interface, i.e when Desktop wants to override - * default web interface. - * @access public - */},{key:"changeDeviceInterface",value:function(){var _changeDeviceInterface=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee48(deviceInterface){var _iteratorNormalCompletion6,_didIteratorError6,_iteratorError6,_iterator6,_step6,service;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee48$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:this.deviceInterface=deviceInterface;_iteratorNormalCompletion6=true;_didIteratorError6=false;_iteratorError6=undefined;_context48.prev=4;for(_iterator6=this.services[Symbol.iterator]();!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){service=_step6.value;if(service.deviceInterface){service.deviceInterface=deviceInterface;}}_context48.next=12;break;case 8:_context48.prev=8;_context48.t0=_context48["catch"](4);_didIteratorError6=true;_iteratorError6=_context48.t0;case 12:_context48.prev=12;_context48.prev=13;if(!_iteratorNormalCompletion6&&_iterator6.return!=null){_iterator6.return();}case 15:_context48.prev=15;if(!_didIteratorError6){_context48.next=18;break;}throw _iteratorError6;case 18:return _context48.finish(15);case 19:return _context48.finish(12);case 20:case"end":return _context48.stop();}}},_callee48,this,[[4,8,12,20],[13,,15,19]]);}));function changeDeviceInterface(_x38){return _changeDeviceInterface.apply(this,arguments);}return changeDeviceInterface;}()/** @access private */},{key:"constructServices",value:function constructServices(){this.createModelManager();this.createProtocolService(this.modelManager);this.createMigrationService();this.createAlertManager();this.createHttpManager();this.createStorageManager();this.createApiService();this.createSessionManager();this.createSyncManager();this.createItemsKeyManager();this.createKeyManager();this.protocolService.setKeyManager(this.keyManager);this.protocolService.setItemsKeyManager(this.itemsKeyManager);this.itemsKeyManager.setKeyManager(this.keyManager);this.createChallengeService();this.createSingletonManager();this.createComponentManager();this.createPrivilegesManager();this.createHistoryManager();this.createActionsManager();}/** @access private */},{key:"clearServices",value:function clearServices(){this.migrationService=null;this.alertService=null;this.httpService=null;this.modelManager=null;this.protocolService=null;this.storageService=null;this.apiService=null;this.sessionManager=null;this.syncService=null;this.keyManager=null;this.itemsKeyManager=null;this.challengeService=null;this.singletonManager=null;this.componentManager=null;this.privilegesService=null;this.actionsManager=null;this.historyManager=null;this.services=[];}},{key:"createMigrationService",value:function createMigrationService(){this.migrationService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNMigrationService"]))({application:this,challengeResponder:this.getMigrationChallengeResponder()});this.services.push(this.migrationService);}},{key:"createAlertManager",value:function createAlertManager(){if(this.shouldSkipClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNAlertService"])){return;}this.alertService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNAlertService"]))({deviceInterface:this.deviceInterface});this.services.push(this.alertService);}},{key:"createApiService",value:function createApiService(){this.apiService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNApiService"]))({storageService:this.storageService,httpService:this.httpService});this.services.push(this.apiService);}},{key:"createComponentManager",value:function createComponentManager(){if(this.shouldSkipClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNComponentManager"])){return;}this.componentManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNComponentManager"]))({modelManager:this.modelManager,syncService:this.syncService,alertService:this.alertService,timeout:this.deviceInterface.timeout,environment:this.environment,platform:this.platform});this.services.push(this.componentManager);}},{key:"createHttpManager",value:function createHttpManager(){this.httpService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNHttpService"]))();this.services.push(this.httpService);}},{key:"createKeyManager",value:function createKeyManager(){var _this7=this;this.keyManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNKeyManager"]))({modelManager:this.modelManager,storageService:this.storageService,protocolService:this.protocolService,itemsKeyManager:this.itemsKeyManager,deviceInterface:this.deviceInterface});this.keyManager.onStatusChange(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee49(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee49$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:_context49.next=2;return _this7.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].KeyStatusChanged);case 2:case"end":return _context49.stop();}}},_callee49);})));this.services.push(this.keyManager);}},{key:"createItemsKeyManager",value:function createItemsKeyManager(){this.itemsKeyManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["ItemsKeyManager"]))({modelManager:this.modelManager,syncService:this.syncService,protocolService:this.protocolService});this.services.push(this.itemsKeyManager);}},{key:"createModelManager",value:function createModelManager(){this.modelManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNModelManager"]))();this.services.push(this.modelManager);}},{key:"createSingletonManager",value:function createSingletonManager(){this.singletonManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNSingletonManager"]))({modelManager:this.modelManager,syncService:this.syncService});this.services.push(this.singletonManager);}},{key:"createStorageManager",value:function createStorageManager(){this.storageService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNStorageService"]))({protocolService:this.protocolService,namespace:this.namespace,deviceInterface:this.deviceInterface});this.services.push(this.storageService);}},{key:"createProtocolService",value:function createProtocolService(modelManager){this.protocolService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNProtocolService"]))({modelManager:modelManager,crypto:this.crypto});this.services.push(this.protocolService);}},{key:"createSessionManager",value:function createSessionManager(){this.sessionManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNSessionManager"]))({storageService:this.storageService,alertService:this.alertService,protocolService:this.protocolService,apiService:this.apiService,timeout:this.deviceInterface.timeout});this.services.push(this.sessionManager);}},{key:"createSyncManager",value:function createSyncManager(){var _this8=this;this.syncService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNSyncService"]))({modelManager:this.modelManager,storageService:this.storageService,sessionManager:this.sessionManager,protocolService:this.protocolService,apiService:this.apiService,interval:this.deviceInterface.interval});var uninstall=this.syncService.addEventObserver(/*#__PURE__*/function(){var _ref36=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee50(eventName){var appEvent;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee50$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:appEvent=Object(_Lib__WEBPACK_IMPORTED_MODULE_6__["applicationEventForSyncEvent"])(eventName);if(!appEvent){_context50.next=4;break;}_context50.next=4;return _this8.notifyEvent(appEvent);case 4:case"end":return _context50.stop();}}},_callee50);}));return function(_x39){return _ref36.apply(this,arguments);};}());this.serviceObservers.push(uninstall);this.services.push(this.syncService);}},{key:"createChallengeService",value:function createChallengeService(){this.challengeService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["ChallengeService"]))({storageService:this.storageService,protocolService:this.protocolService,keyManager:this.keyManager});this.services.push(this.challengeService);}},{key:"createPrivilegesManager",value:function createPrivilegesManager(){this.privilegesService=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNPrivilegesService"]))({storageService:this.storageService,keyManager:this.keyManager,modelManager:this.modelManager,syncService:this.syncService,sessionManager:this.sessionManager,singletonManager:this.singletonManager});this.services.push(this.privilegesService);}},{key:"createHistoryManager",value:function createHistoryManager(){this.historyManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNHistoryManager"]))({storageService:this.storageService,modelManager:this.modelManager,contentTypes:[_Models_content_types__WEBPACK_IMPORTED_MODULE_2__["ContentTypes"].Note],timeout:this.deviceInterface.timeout});this.services.push(this.historyManager);}},{key:"createActionsManager",value:function createActionsManager(){this.actionsManager=new(this.getClass(_Services__WEBPACK_IMPORTED_MODULE_7__["SNActionsService"]))({alertService:this.alertService,deviceInterface:this.deviceInterface,httpService:this.httpService,modelManager:this.modelManager,protocolService:this.protocolService,syncService:this.syncService});this.services.push(this.actionsManager);}},{key:"shouldSkipClass",value:function shouldSkipClass(classCandidate){return this.skipClasses&&this.skipClasses.includes(classCandidate);}},{key:"getClass",value:function getClass(base){var swapClass=this.swapClasses&&this.swapClasses.find(function(candidate){return candidate.swap===base;});if(swapClass){return swapClass.with;}else{return base;}}}]);return SNApplication;}();/***/},/***/"./lib/challenges.js":/*!***************************!*\ - !*** ./lib/challenges.js ***! - \***************************/ /*! exports provided: Challenge, ChallengeValue, ChallengeResponse, ChallengeType, ChallengeReason, challengeTypeToString */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Challenge",function(){return Challenge;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ChallengeValue",function(){return ChallengeValue;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ChallengeResponse",function(){return ChallengeResponse;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ChallengeType",function(){return ChallengeType;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ChallengeReason",function(){return ChallengeReason;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"challengeTypeToString",function(){return challengeTypeToString;});function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{},namespace=_ref.namespace,timeout=_ref.timeout,interval=_ref.interval;_classCallCheck(this,DeviceInterface);if(!timeout||!interval){throw"'timeout' and 'interval' are required to initialize device interface.";}this.namespace=namespace;this.timeout=timeout||setTimeout.bind(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["getGlobalScope"])());this.interval=interval||setInterval.bind(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["getGlobalScope"])());}/** @access public */_createClass(DeviceInterface,[{key:"deinit",value:function deinit(){/* Optional override */this.namespace=null;this.timeout=null;this.interval=null;}},{key:"getRawStorageValue",value:function(){var _getRawStorageValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(key){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:throw'Must override DeviceInterface.getRawStorageValue';case 1:case"end":return _context.stop();}}},_callee);}));function getRawStorageValue(_x){return _getRawStorageValue.apply(this,arguments);}return getRawStorageValue;}()},{key:"getJsonParsedStorageValue",value:function(){var _getJsonParsedStorageValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(key){var value;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.getRawStorageValue(key);case 2:value=_context2.sent;return _context2.abrupt("return",value?JSON.parse(value):value);case 4:case"end":return _context2.stop();}}},_callee2,this);}));function getJsonParsedStorageValue(_x2){return _getJsonParsedStorageValue.apply(this,arguments);}return getJsonParsedStorageValue;}()},{key:"getAllRawStorageKeyValues",value:function(){var _getAllRawStorageKeyValues=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:throw'Must override DeviceInterface.getAllRawStorageKeyValues';case 1:case"end":return _context3.stop();}}},_callee3);}));function getAllRawStorageKeyValues(){return _getAllRawStorageKeyValues.apply(this,arguments);}return getAllRawStorageKeyValues;}()},{key:"setRawStorageValue",value:function(){var _setRawStorageValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(key,value){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:throw'Must override DeviceInterface.setRawStorageValue';case 1:case"end":return _context4.stop();}}},_callee4);}));function setRawStorageValue(_x3,_x4){return _setRawStorageValue.apply(this,arguments);}return setRawStorageValue;}()},{key:"removeRawStorageValue",value:function(){var _removeRawStorageValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(key){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:throw'Must override DeviceInterface.removeRawStorageValue';case 1:case"end":return _context5.stop();}}},_callee5);}));function removeRawStorageValue(_x5){return _removeRawStorageValue.apply(this,arguments);}return removeRawStorageValue;}()},{key:"removeAllRawStorageValues",value:function(){var _removeAllRawStorageValues=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:throw'Must override DeviceInterface.removeAllRawStorageValues';case 1:case"end":return _context6.stop();}}},_callee6);}));function removeAllRawStorageValues(){return _removeAllRawStorageValues.apply(this,arguments);}return removeAllRawStorageValues;}()/** - * On web platforms, databased created may be new. - * New databases can be because of new sessions, or if the browser deleted it. - * In this case, callers should orchestrate with the server to redownload all items - * from scratch. - * @returns {object} { isNewDatabase } - True if the database was newly created - */},{key:"openDatabase",value:function(){var _openDatabase=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:throw'Must override DeviceInterface.openDatabase';case 1:case"end":return _context7.stop();}}},_callee7);}));function openDatabase(){return _openDatabase.apply(this,arguments);}return openDatabase;}()},{key:"getAllRawDatabasePayloads",value:function(){var _getAllRawDatabasePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:throw'Must override DeviceInterface.getAllRawDatabasePayloads';case 1:case"end":return _context8.stop();}}},_callee8);}));function getAllRawDatabasePayloads(){return _getAllRawDatabasePayloads.apply(this,arguments);}return getAllRawDatabasePayloads;}()},{key:"saveRawDatabasePayload",value:function(){var _saveRawDatabasePayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(payload){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:throw'Must override DeviceInterface.saveRawDatabasePayload';case 1:case"end":return _context9.stop();}}},_callee9);}));function saveRawDatabasePayload(_x6){return _saveRawDatabasePayload.apply(this,arguments);}return saveRawDatabasePayload;}()},{key:"saveRawDatabasePayloads",value:function(){var _saveRawDatabasePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(payloads){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:throw'Must override DeviceInterface.saveRawDatabasePayloads';case 1:case"end":return _context10.stop();}}},_callee10);}));function saveRawDatabasePayloads(_x7){return _saveRawDatabasePayloads.apply(this,arguments);}return saveRawDatabasePayloads;}()},{key:"removeRawDatabasePayloadWithId",value:function(){var _removeRawDatabasePayloadWithId=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(id){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:throw'Must override DeviceInterface.removeRawDatabasePayloadWithId';case 1:case"end":return _context11.stop();}}},_callee11);}));function removeRawDatabasePayloadWithId(_x8){return _removeRawDatabasePayloadWithId.apply(this,arguments);}return removeRawDatabasePayloadWithId;}()},{key:"removeAllRawDatabasePayloads",value:function(){var _removeAllRawDatabasePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:throw'Must override DeviceInterface.removeAllRawDatabasePayloads';case 1:case"end":return _context12.stop();}}},_callee12);}));function removeAllRawDatabasePayloads(){return _removeAllRawDatabasePayloads.apply(this,arguments);}return removeAllRawDatabasePayloads;}()},{key:"getKeychainValue",value:function(){var _getKeychainValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:throw'Must override DeviceInterface.getKeychainValue';case 1:case"end":return _context13.stop();}}},_callee13);}));function getKeychainValue(){return _getKeychainValue.apply(this,arguments);}return getKeychainValue;}()},{key:"setKeychainValue",value:function(){var _setKeychainValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(value){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:throw'Must override DeviceInterface.setKeychainValue';case 1:case"end":return _context14.stop();}}},_callee14);}));function setKeychainValue(_x9){return _setKeychainValue.apply(this,arguments);}return setKeychainValue;}()},{key:"clearKeychainValue",value:function(){var _clearKeychainValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:throw'Must override DeviceInterface.clearKeychainValue';case 1:case"end":return _context15.stop();}}},_callee15);}));function clearKeychainValue(){return _clearKeychainValue.apply(this,arguments);}return clearKeychainValue;}()}]);return DeviceInterface;}();/***/},/***/"./lib/events.js":/*!***********************!*\ - !*** ./lib/events.js ***! - \***********************/ /*! exports provided: SyncEvents, ApplicationEvents, applicationEventForSyncEvent */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ApplicationEvents",function(){return ApplicationEvents;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"applicationEventForSyncEvent",function(){return applicationEventForSyncEvent;});/* harmony import */var _Services_sync_events__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Services/sync/events */"./lib/services/sync/events.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncEvents",function(){return _Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"];});function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var ApplicationEvents={SignedIn:2,SignedOut:3,CompletedSync:5,FailedSync:6,HighLatencySync:7,EnteredOutOfSync:8,ExitedOutOfSync:9,/** - * The application has finished it `prepareForLaunch` state and is now ready for unlock - * Called when the application has initialized and is ready for launch, but before - * the application has been unlocked, if applicable. Use this to do pre-launch - * configuration, but do not attempt to access user data like notes or tags. - */Started:10,/** - * The applicaiton is fully unlocked and ready for i/o - * Called when the application has been fully decrypted and unlocked. Use this to - * to begin streaming data like notes and tags. - */Launched:11,LocalDataLoaded:12,/** - * When the root key or root key wrapper changes. Includes events like account state - * changes (registering, signing in, changing pw, logging out) and passcode state - * changes (adding, removing, changing). - */KeyStatusChanged:13,MajorDataChange:14,CompletedRestart:15,LocalDataIncrementalLoad:16,SyncStatusChanged:17,WillSync:18,InvalidSyncSession:19,LocalDatabaseReadError:20,LocalDatabaseWriteError:21};function applicationEventForSyncEvent(syncEvent){var _SyncEvents$FullSyncC;return(_SyncEvents$FullSyncC={},_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].FullSyncCompleted,ApplicationEvents.CompletedSync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].SyncError,ApplicationEvents.FailedSync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].SyncTakingTooLong,ApplicationEvents.HighLatencySync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].EnterOutOfSync,ApplicationEvents.EnteredOutOfSync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].ExitOutOfSync,ApplicationEvents.ExitedOutOfSync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].LocalDataLoaded,ApplicationEvents.LocalDataLoaded),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].MajorDataChange,ApplicationEvents.MajorDataChange),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].LocalDataIncrementalLoad,ApplicationEvents.LocalDataIncrementalLoad),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].StatusChanged,ApplicationEvents.SyncStatusChanged),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].SyncWillBegin,ApplicationEvents.WillSync),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].InvalidSession,ApplicationEvents.InvalidSyncSession),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].DatabaseReadError,ApplicationEvents.LocalDatabaseReadError),_defineProperty(_SyncEvents$FullSyncC,_Services_sync_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].DatabaseWriteError,ApplicationEvents.LocalDatabaseWriteError),_SyncEvents$FullSyncC)[syncEvent];}/***/},/***/"./lib/index.js":/*!**********************!*\ - !*** ./lib/index.js ***! - \**********************/ /*! exports provided: DEFAULT_APP_DOMAIN, ApplicationEvents, SyncEvents, applicationEventForSyncEvent, ApplicationStages, Environments, Platforms, isEnvironmentWebOrDesktop, isEnvironmentMobile, Challenge, ChallengeReason, challengeTypeToString, ChallengeResponse, ChallengeType, ChallengeValue, StorageKeys, RawStorageKeys, namespacedKey */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"DEFAULT_APP_DOMAIN",function(){return DEFAULT_APP_DOMAIN;});/* harmony import */var _Lib_events__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Lib/events */"./lib/events.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ApplicationEvents",function(){return _Lib_events__WEBPACK_IMPORTED_MODULE_0__["ApplicationEvents"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncEvents",function(){return _Lib_events__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"applicationEventForSyncEvent",function(){return _Lib_events__WEBPACK_IMPORTED_MODULE_0__["applicationEventForSyncEvent"];});/* harmony import */var _Lib_stages__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/stages */"./lib/stages.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ApplicationStages",function(){return _Lib_stages__WEBPACK_IMPORTED_MODULE_1__["ApplicationStages"];});/* harmony import */var _Lib_platforms__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib/platforms */"./lib/platforms.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Environments",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_2__["Environments"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Platforms",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_2__["Platforms"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isEnvironmentWebOrDesktop",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_2__["isEnvironmentWebOrDesktop"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isEnvironmentMobile",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_2__["isEnvironmentMobile"];});/* harmony import */var _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/challenges */"./lib/challenges.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Challenge",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["Challenge"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeReason",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["ChallengeReason"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"challengeTypeToString",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["challengeTypeToString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeResponse",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["ChallengeResponse"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeType",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["ChallengeType"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeValue",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_3__["ChallengeValue"];});/* harmony import */var _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Lib/storage_keys */"./lib/storage_keys.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StorageKeys",function(){return _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_4__["StorageKeys"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"RawStorageKeys",function(){return _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_4__["RawStorageKeys"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"namespacedKey",function(){return _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_4__["namespacedKey"];});var DEFAULT_APP_DOMAIN='org.standardnotes.sn';/***/},/***/"./lib/main.js":/*!*********************!*\ - !*** ./lib/main.js ***! - \*********************/ /*! exports provided: SNApplication, SNProtocolService, SNProtocolOperator001, SNProtocolOperator002, SNProtocolOperator003, SNProtocolOperator004, DeviceInterface, SNItem, SNItemsKey, SNPredicate, SNNote, SNTag, SNSmartTag, SNActionsExtension, Action, SNTheme, SNEncryptedStorage, SNComponent, SNEditor, SNComponentManager, ComponentActions, HistorySession, ItemHistory, ItemHistoryEntry, SNPrivileges, SNWebCrypto, SNModelManager, SNHttpService, ChallengeService, PureService, ApplicationService, SNStorageService, StoragePersistencePolicies, StorageEncryptionPolicies, StorageValueModes, ValueModesKeys, Challenge, ChallengeReason, ChallengeResponse, ChallengeType, challengeTypeToString, ChallengeValue, SNSyncService, SyncSources, SyncModes, TIMING_STRATEGY_RESOLVE_ON_NEXT, TIMING_STRATEGY_FORCE_SPAWN_NEW, SNSessionManager, SNMigrationService, SNAlertService, SNHistoryManager, SNPrivilegesService, SNSingletonManager, SNKeyManager, KEY_MODE_ROOT_KEY_NONE, KEY_MODE_ROOT_KEY_ONLY, KEY_MODE_ROOT_KEY_PLUS_WRAPPER, KEY_MODE_WRAPPER_ONLY, SNApiService, findInArray, isNullOrUndefined, deepMerge, extendArray, removeFromIndex, subtractFromArray, arrayByDifference, uniqCombineObjArrays, greaterOfTwoDates, getGlobalScope, removeFromArray, truncateHexString, jsonParseEmbeddedKeys, Uuid, EncryptionIntents, isLocalStorageIntent, isFileIntent, isDecryptedIntent, intentRequiresEncryption, ContentTypes, ApplicationEvents, Environments, Platforms, isEnvironmentWebOrDesktop, isEnvironmentMobile, platformFromString, SyncEvents, SNPureItemPayload, SNStorageItemPayload, PayloadCollection, CreateMaxPayloadFromAnyObject, CreateSourcedPayloadFromObject, PayloadSources, isPayloadSourceRetrieved, ProtocolVersions, PayloadFormats, StorageKeys, BaseMigration, ProtectedActions, PrivilegeCredentials, PRIVILEGE_SESSION_LENGTH_NONE, PRIVILEGE_SESSION_LENGTH_FIVE_MINUTES, PRIVILEGE_SESSION_LENGTH_ONE_HOUR, PRIVILEGE_SESSION_LENGTH_ONE_WEEK */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _Lib_application__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Lib/application */"./lib/application.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNApplication",function(){return _Lib_application__WEBPACK_IMPORTED_MODULE_0__["SNApplication"];});/* harmony import */var _Services_protocol_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Services/protocol_service */"./lib/services/protocol_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolService",function(){return _Services_protocol_service__WEBPACK_IMPORTED_MODULE_1__["SNProtocolService"];});/* harmony import */var _Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol/operator/001/operator_001 */"./lib/protocol/operator/001/operator_001.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator001",function(){return _Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_2__["SNProtocolOperator001"];});/* harmony import */var _Protocol_operator_002_operator_002__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Protocol/operator/002/operator_002 */"./lib/protocol/operator/002/operator_002.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator002",function(){return _Protocol_operator_002_operator_002__WEBPACK_IMPORTED_MODULE_3__["SNProtocolOperator002"];});/* harmony import */var _Protocol_operator_003_operator_003__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Protocol/operator/003/operator_003 */"./lib/protocol/operator/003/operator_003.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator003",function(){return _Protocol_operator_003_operator_003__WEBPACK_IMPORTED_MODULE_4__["SNProtocolOperator003"];});/* harmony import */var _Protocol_operator_004_operator_004__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Protocol/operator/004/operator_004 */"./lib/protocol/operator/004/operator_004.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator004",function(){return _Protocol_operator_004_operator_004__WEBPACK_IMPORTED_MODULE_5__["SNProtocolOperator004"];});/* harmony import */var _Lib_device_interface__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Lib/device_interface */"./lib/device_interface.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"DeviceInterface",function(){return _Lib_device_interface__WEBPACK_IMPORTED_MODULE_6__["DeviceInterface"];});/* harmony import */var _models__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! ./models */"./lib/models/index.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNItem",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNItem"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNItemsKey",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNItemsKey"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPredicate",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNPredicate"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNNote",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNNote"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNTag",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNTag"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSmartTag",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNSmartTag"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNActionsExtension",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNActionsExtension"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Action",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["Action"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNTheme",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNTheme"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNEncryptedStorage",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNEncryptedStorage"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNComponent",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNComponent"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNEditor",function(){return _models__WEBPACK_IMPORTED_MODULE_7__["SNEditor"];});/* harmony import */var _services_component_manager__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! ./services/component_manager */"./lib/services/component_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNComponentManager",function(){return _services_component_manager__WEBPACK_IMPORTED_MODULE_8__["SNComponentManager"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ComponentActions",function(){return _services_component_manager__WEBPACK_IMPORTED_MODULE_8__["ComponentActions"];});/* harmony import */var _Services_history_history_session__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(/*! @Services/history/history_session */"./lib/services/history/history_session.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"HistorySession",function(){return _Services_history_history_session__WEBPACK_IMPORTED_MODULE_9__["HistorySession"];});/* harmony import */var _Services_history_item_history__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(/*! @Services/history/item_history */"./lib/services/history/item_history.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ItemHistory",function(){return _Services_history_item_history__WEBPACK_IMPORTED_MODULE_10__["ItemHistory"];});/* harmony import */var _Services_history_item_history_entry__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(/*! @Services/history/item_history_entry */"./lib/services/history/item_history_entry.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ItemHistoryEntry",function(){return _Services_history_item_history_entry__WEBPACK_IMPORTED_MODULE_11__["ItemHistoryEntry"];});/* harmony import */var _models_app_privileges__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(/*! ./models/app/privileges */"./lib/models/app/privileges.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPrivileges",function(){return _models_app_privileges__WEBPACK_IMPORTED_MODULE_12__["SNPrivileges"];});/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(/*! sncrypto */"../sncrypto/dist/sncrypto.js");/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_13___default=/*#__PURE__*/__webpack_require__.n(sncrypto__WEBPACK_IMPORTED_MODULE_13__);/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNWebCrypto",function(){return sncrypto__WEBPACK_IMPORTED_MODULE_13__["SNWebCrypto"];});/* harmony import */var _services_model_manager__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(/*! ./services/model_manager */"./lib/services/model_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNModelManager",function(){return _services_model_manager__WEBPACK_IMPORTED_MODULE_14__["SNModelManager"];});/* harmony import */var _services_api_http_service__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(/*! ./services/api/http_service */"./lib/services/api/http_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNHttpService",function(){return _services_api_http_service__WEBPACK_IMPORTED_MODULE_15__["SNHttpService"];});/* harmony import */var _services_challenge_service__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(/*! ./services/challenge_service */"./lib/services/challenge_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeService",function(){return _services_challenge_service__WEBPACK_IMPORTED_MODULE_16__["ChallengeService"];});/* harmony import */var _Services_pure_service__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(/*! @Services/pure_service */"./lib/services/pure_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PureService",function(){return _Services_pure_service__WEBPACK_IMPORTED_MODULE_17__["PureService"];});/* harmony import */var _Services_application_service__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(/*! @Services/application_service */"./lib/services/application_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ApplicationService",function(){return _Services_application_service__WEBPACK_IMPORTED_MODULE_18__["ApplicationService"];});/* harmony import */var _services_storage_service__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(/*! ./services/storage_service */"./lib/services/storage_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNStorageService",function(){return _services_storage_service__WEBPACK_IMPORTED_MODULE_19__["SNStorageService"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StoragePersistencePolicies",function(){return _services_storage_service__WEBPACK_IMPORTED_MODULE_19__["StoragePersistencePolicies"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StorageEncryptionPolicies",function(){return _services_storage_service__WEBPACK_IMPORTED_MODULE_19__["StorageEncryptionPolicies"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StorageValueModes",function(){return _services_storage_service__WEBPACK_IMPORTED_MODULE_19__["StorageValueModes"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ValueModesKeys",function(){return _services_storage_service__WEBPACK_IMPORTED_MODULE_19__["ValueModesKeys"];});/* harmony import */var _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(/*! @Lib/challenges */"./lib/challenges.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Challenge",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["Challenge"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeReason",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["ChallengeReason"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeResponse",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["ChallengeResponse"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeType",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["ChallengeType"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"challengeTypeToString",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["challengeTypeToString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeValue",function(){return _Lib_challenges__WEBPACK_IMPORTED_MODULE_20__["ChallengeValue"];});/* harmony import */var _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(/*! ./services/sync/sync_service */"./lib/services/sync/sync_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSyncService",function(){return _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__["SNSyncService"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncSources",function(){return _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__["SyncSources"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncModes",function(){return _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__["SyncModes"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"TIMING_STRATEGY_RESOLVE_ON_NEXT",function(){return _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__["TIMING_STRATEGY_RESOLVE_ON_NEXT"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"TIMING_STRATEGY_FORCE_SPAWN_NEW",function(){return _services_sync_sync_service__WEBPACK_IMPORTED_MODULE_21__["TIMING_STRATEGY_FORCE_SPAWN_NEW"];});/* harmony import */var _services_api_session_manager__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(/*! ./services/api/session_manager */"./lib/services/api/session_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSessionManager",function(){return _services_api_session_manager__WEBPACK_IMPORTED_MODULE_22__["SNSessionManager"];});/* harmony import */var _services_migration_service__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(/*! ./services/migration_service */"./lib/services/migration_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNMigrationService",function(){return _services_migration_service__WEBPACK_IMPORTED_MODULE_23__["SNMigrationService"];});/* harmony import */var _services_alert_service__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(/*! ./services/alert_service */"./lib/services/alert_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNAlertService",function(){return _services_alert_service__WEBPACK_IMPORTED_MODULE_24__["SNAlertService"];});/* harmony import */var _services_history_history_manager__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(/*! ./services/history/history_manager */"./lib/services/history/history_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNHistoryManager",function(){return _services_history_history_manager__WEBPACK_IMPORTED_MODULE_25__["SNHistoryManager"];});/* harmony import */var _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(/*! ./services/privileges/privileges_service */"./lib/services/privileges/privileges_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPrivilegesService",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["SNPrivilegesService"];});/* harmony import */var _services_singleton_manager__WEBPACK_IMPORTED_MODULE_27__=__webpack_require__(/*! ./services/singleton_manager */"./lib/services/singleton_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSingletonManager",function(){return _services_singleton_manager__WEBPACK_IMPORTED_MODULE_27__["SNSingletonManager"];});/* harmony import */var _services_key_manager__WEBPACK_IMPORTED_MODULE_28__=__webpack_require__(/*! ./services/key_manager */"./lib/services/key_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNKeyManager",function(){return _services_key_manager__WEBPACK_IMPORTED_MODULE_28__["SNKeyManager"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_NONE",function(){return _services_key_manager__WEBPACK_IMPORTED_MODULE_28__["KEY_MODE_ROOT_KEY_NONE"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_ONLY",function(){return _services_key_manager__WEBPACK_IMPORTED_MODULE_28__["KEY_MODE_ROOT_KEY_ONLY"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_PLUS_WRAPPER",function(){return _services_key_manager__WEBPACK_IMPORTED_MODULE_28__["KEY_MODE_ROOT_KEY_PLUS_WRAPPER"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_WRAPPER_ONLY",function(){return _services_key_manager__WEBPACK_IMPORTED_MODULE_28__["KEY_MODE_WRAPPER_ONLY"];});/* harmony import */var _services_api_api_service__WEBPACK_IMPORTED_MODULE_29__=__webpack_require__(/*! ./services/api/api_service */"./lib/services/api/api_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNApiService",function(){return _services_api_api_service__WEBPACK_IMPORTED_MODULE_29__["SNApiService"];});/* harmony import */var _utils__WEBPACK_IMPORTED_MODULE_30__=__webpack_require__(/*! ./utils */"./lib/utils.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"findInArray",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["findInArray"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isNullOrUndefined",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["isNullOrUndefined"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"deepMerge",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["deepMerge"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"extendArray",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["extendArray"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"removeFromIndex",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["removeFromIndex"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"subtractFromArray",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["subtractFromArray"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"arrayByDifference",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["arrayByDifference"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"uniqCombineObjArrays",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["uniqCombineObjArrays"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"greaterOfTwoDates",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["greaterOfTwoDates"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"getGlobalScope",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["getGlobalScope"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"removeFromArray",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["removeFromArray"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"truncateHexString",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["truncateHexString"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"jsonParseEmbeddedKeys",function(){return _utils__WEBPACK_IMPORTED_MODULE_30__["jsonParseEmbeddedKeys"];});/* harmony import */var _Lib_uuid__WEBPACK_IMPORTED_MODULE_31__=__webpack_require__(/*! @Lib/uuid */"./lib/uuid.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Uuid",function(){return _Lib_uuid__WEBPACK_IMPORTED_MODULE_31__["Uuid"];});/* harmony import */var _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__=__webpack_require__(/*! @Protocol/intents */"./lib/protocol/intents.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"EncryptionIntents",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__["EncryptionIntents"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isLocalStorageIntent",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__["isLocalStorageIntent"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isFileIntent",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__["isFileIntent"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isDecryptedIntent",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__["isDecryptedIntent"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"intentRequiresEncryption",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_32__["intentRequiresEncryption"];});/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_33__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ContentTypes",function(){return _Models_content_types__WEBPACK_IMPORTED_MODULE_33__["ContentTypes"];});/* harmony import */var _Lib_events__WEBPACK_IMPORTED_MODULE_34__=__webpack_require__(/*! @Lib/events */"./lib/events.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ApplicationEvents",function(){return _Lib_events__WEBPACK_IMPORTED_MODULE_34__["ApplicationEvents"];});/* harmony import */var _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__=__webpack_require__(/*! @Lib/platforms */"./lib/platforms.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Environments",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__["Environments"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Platforms",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__["Platforms"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isEnvironmentWebOrDesktop",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__["isEnvironmentWebOrDesktop"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isEnvironmentMobile",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__["isEnvironmentMobile"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"platformFromString",function(){return _Lib_platforms__WEBPACK_IMPORTED_MODULE_35__["platformFromString"];});/* harmony import */var _Lib_services__WEBPACK_IMPORTED_MODULE_36__=__webpack_require__(/*! @Lib/services */"./lib/services/index.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncEvents",function(){return _Lib_services__WEBPACK_IMPORTED_MODULE_36__["SyncEvents"];});/* harmony import */var _Payloads_pure_item_payload__WEBPACK_IMPORTED_MODULE_37__=__webpack_require__(/*! @Payloads/pure_item_payload */"./lib/protocol/payloads/pure_item_payload.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPureItemPayload",function(){return _Payloads_pure_item_payload__WEBPACK_IMPORTED_MODULE_37__["SNPureItemPayload"];});/* harmony import */var _Payloads_storage_item_payload__WEBPACK_IMPORTED_MODULE_38__=__webpack_require__(/*! @Payloads/storage_item_payload */"./lib/protocol/payloads/storage_item_payload.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNStorageItemPayload",function(){return _Payloads_storage_item_payload__WEBPACK_IMPORTED_MODULE_38__["SNStorageItemPayload"];});/* harmony import */var _Payloads_collection__WEBPACK_IMPORTED_MODULE_39__=__webpack_require__(/*! @Payloads/collection */"./lib/protocol/payloads/collection.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PayloadCollection",function(){return _Payloads_collection__WEBPACK_IMPORTED_MODULE_39__["PayloadCollection"];});/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_40__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"CreateMaxPayloadFromAnyObject",function(){return _Payloads_generator__WEBPACK_IMPORTED_MODULE_40__["CreateMaxPayloadFromAnyObject"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"CreateSourcedPayloadFromObject",function(){return _Payloads_generator__WEBPACK_IMPORTED_MODULE_40__["CreateSourcedPayloadFromObject"];});/* harmony import */var _Lib_protocol_payloads_sources__WEBPACK_IMPORTED_MODULE_41__=__webpack_require__(/*! @Lib/protocol/payloads/sources */"./lib/protocol/payloads/sources.ts");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PayloadSources",function(){return _Lib_protocol_payloads_sources__WEBPACK_IMPORTED_MODULE_41__["PayloadSources"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isPayloadSourceRetrieved",function(){return _Lib_protocol_payloads_sources__WEBPACK_IMPORTED_MODULE_41__["isPayloadSourceRetrieved"];});/* harmony import */var _Lib_protocol_versions__WEBPACK_IMPORTED_MODULE_42__=__webpack_require__(/*! @Lib/protocol/versions */"./lib/protocol/versions.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ProtocolVersions",function(){return _Lib_protocol_versions__WEBPACK_IMPORTED_MODULE_42__["ProtocolVersions"];});/* harmony import */var _Payloads_formats__WEBPACK_IMPORTED_MODULE_43__=__webpack_require__(/*! @Payloads/formats */"./lib/protocol/payloads/formats.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PayloadFormats",function(){return _Payloads_formats__WEBPACK_IMPORTED_MODULE_43__["PayloadFormats"];});/* harmony import */var _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_44__=__webpack_require__(/*! @Lib/storage_keys */"./lib/storage_keys.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StorageKeys",function(){return _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_44__["StorageKeys"];});/* harmony import */var _Lib_migrations_2020_01_01_base__WEBPACK_IMPORTED_MODULE_45__=__webpack_require__(/*! @Lib/migrations/2020-01-01-base */"./lib/migrations/2020-01-01-base.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"BaseMigration",function(){return _Lib_migrations_2020_01_01_base__WEBPACK_IMPORTED_MODULE_45__["BaseMigration"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ProtectedActions",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["ProtectedActions"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PrivilegeCredentials",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["PrivilegeCredentials"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PRIVILEGE_SESSION_LENGTH_NONE",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["PRIVILEGE_SESSION_LENGTH_NONE"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PRIVILEGE_SESSION_LENGTH_FIVE_MINUTES",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["PRIVILEGE_SESSION_LENGTH_FIVE_MINUTES"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PRIVILEGE_SESSION_LENGTH_ONE_HOUR",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["PRIVILEGE_SESSION_LENGTH_ONE_HOUR"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"PRIVILEGE_SESSION_LENGTH_ONE_WEEK",function(){return _services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_26__["PRIVILEGE_SESSION_LENGTH_ONE_WEEK"];});/** Payloads */ /** Migrations */ /** Privileges */ /***/},/***/"./lib/migrations/2020-01-01-base.js":/*!*******************************************!*\ - !*** ./lib/migrations/2020-01-01-base.js ***! - \*******************************************/ /*! exports provided: BaseMigration */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"BaseMigration",function(){return BaseMigration;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_migrations_migration__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/migrations/migration */"./lib/migrations/migration.js");/* harmony import */var _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib/storage_keys */"./lib/storage_keys.js");/* harmony import */var _Lib_stages__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/stages */"./lib/stages.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i masterKey). - * @access private - */},{key:"migrateStorageStructureForMobile",value:function(){var _migrateStorageStructureForMobile=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(){var _nonwrapped,_this2=this;var wrappedAccountKey,rawAccountKeyParams,rawPasscodeParams,rawStructure,keychainValue,passcodeParams,getPasscodeKey,timing,passcodeKey,unwrappedAccountKey,accountKeyContent,defaultVersion,newAccountKey,newWrappedAccountKey,_passcodeKey,payload,wrapped,hasAccount,_defaultVersion,accountKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.next=2;return this.application.deviceInterface.getJsonParsedStorageValue(LegacyKeys.MobileWrappedRootKeyKey);case 2:wrappedAccountKey=_context10.sent;_context10.next=5;return this.application.deviceInterface.getJsonParsedStorageValue(LegacyKeys.AllAccountKeyParamsKey);case 5:rawAccountKeyParams=_context10.sent;_context10.next=8;return this.application.deviceInterface.getJsonParsedStorageValue(LegacyKeys.MobilePasscodeParamsKey);case 8:rawPasscodeParams=_context10.sent;rawStructure={nonwrapped:(_nonwrapped={},_defineProperty(_nonwrapped,_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].WrappedRootKey,wrappedAccountKey),_defineProperty(_nonwrapped,_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].RootKeyWrapperKeyParams,rawPasscodeParams),_defineProperty(_nonwrapped,_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].RootKeyParams,rawAccountKeyParams),_nonwrapped),unwrapped:{}};_context10.next=12;return this.application.deviceInterface.getKeychainValue();case 12:keychainValue=_context10.sent;if(!rawPasscodeParams){_context10.next=57;break;}passcodeParams=this.application.protocolService.createKeyParams(rawPasscodeParams);getPasscodeKey=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(){var pwHash,passcodeKey,challenge,orchestratorFill,response,value,passcode;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:/** Validate current passcode by comparing against keychain offline.pw value */pwHash=keychainValue.offline.pw;passcodeKey={serverPassword:null};challenge=new _Lib__WEBPACK_IMPORTED_MODULE_2__["Challenge"]([_Lib__WEBPACK_IMPORTED_MODULE_2__["ChallengeType"].LocalPasscode],_Lib__WEBPACK_IMPORTED_MODULE_2__["ChallengeReason"].Migration);orchestratorFill={};case 4:if(!(passcodeKey.serverPassword!==pwHash)){_context9.next=16;break;}_context9.next=7;return _this2.requestChallengeResponse(challenge,false,orchestratorFill);case 7:response=_context9.sent;value=response.getValueForType(_Lib__WEBPACK_IMPORTED_MODULE_2__["ChallengeType"].LocalPasscode);passcode=value.value;_context9.next=12;return _this2.application.protocolService.computeRootKey({password:passcode,keyParams:passcodeParams});case 12:passcodeKey=_context9.sent;orchestratorFill.orchestrator.setValidationStatus(challenge,value,passcodeKey.serverPassword===pwHash);_context9.next=4;break;case 16:return _context9.abrupt("return",passcodeKey);case 17:case"end":return _context9.stop();}}},_callee9);}));return function getPasscodeKey(){return _ref5.apply(this,arguments);};}();timing=keychainValue.offline.timing;rawStructure.unwrapped[_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].MobilePasscodeTiming]=timing;if(!wrappedAccountKey){_context10.next=36;break;}_context10.next=21;return getPasscodeKey();case 21:passcodeKey=_context10.sent;_context10.next=24;return this.application.protocolService.payloadByDecryptingPayload({payload:Object(_Payloads__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"])({object:wrappedAccountKey}),key:passcodeKey});case 24:unwrappedAccountKey=_context10.sent;accountKeyContent=unwrappedAccountKey.content.accountKeys;defaultVersion=!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isNullOrUndefined"])(accountKeyContent.ak)?_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V003:_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002;newAccountKey=Object(_Payloads__WEBPACK_IMPORTED_MODULE_3__["CopyPayload"])({payload:unwrappedAccountKey,override:{content:{masterKey:accountKeyContent.mk,serverPassword:accountKeyContent.pw,dataAuthenticationKey:accountKeyContent.ak,version:accountKeyContent.version||defaultVersion,accountKeys:null}}});_context10.next=30;return this.application.protocolService.payloadByEncryptingPayload({payload:newAccountKey,key:passcodeKey,intent:_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStoragePreferEncrypted});case 30:newWrappedAccountKey=_context10.sent;rawStructure.nonwrapped[_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].WrappedRootKey]=newWrappedAccountKey;_context10.next=34;return this.application.deviceInterface.clearKeychainValue();case 34:_context10.next=55;break;case 36:if(wrappedAccountKey){_context10.next=55;break;}_context10.next=39;return getPasscodeKey();case 39:_passcodeKey=_context10.sent;_context10.t0=_Payloads__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"];_context10.next=43;return _Lib_uuid__WEBPACK_IMPORTED_MODULE_9__["Uuid"].GenerateUuid();case 43:_context10.t1=_context10.sent;_context10.t2=rawStructure.unwrapped;_context10.t3=_Models__WEBPACK_IMPORTED_MODULE_7__["ContentTypes"].EncryptedStorage;_context10.t4={uuid:_context10.t1,content:_context10.t2,content_type:_context10.t3};_context10.t5={object:_context10.t4};payload=(0,_context10.t0)(_context10.t5);_context10.next=51;return this.application.protocolService.payloadByEncryptingPayload({payload:payload,key:_passcodeKey,intent:_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStoragePreferEncrypted});case 51:wrapped=_context10.sent;rawStructure.wrapped=wrapped;_context10.next=55;return this.application.deviceInterface.clearKeychainValue();case 55:_context10.next=65;break;case 57:/** No passcode, potentially account. Migrate keychain property keys. */hasAccount=keychainValue&&keychainValue.mk;if(!hasAccount){_context10.next=65;break;}_defaultVersion=!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isNullOrUndefined"])(keychainValue.ak)?_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V003:_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002;_context10.next=62;return _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNRootKey"].Create({content:{masterKey:keychainValue.mk,serverPassword:keychainValue.pw,dataAuthenticationKey:keychainValue.ak,version:keychainValue.version||_defaultVersion}});case 62:accountKey=_context10.sent;_context10.next=65;return this.application.deviceInterface.setKeychainValue(accountKey.getPersistableValue());case 65:_context10.next=67;return this.allPlatformHelperSetStorageStructure(rawStructure);case 67:case"end":return _context10.stop();}}},_callee10,this);}));function migrateStorageStructureForMobile(){return _migrateStorageStructureForMobile.apply(this,arguments);}return migrateStorageStructureForMobile;}()/** - * All platforms - * Migrate all previously independently stored storage keys into new - * managed approach. Also deletes any legacy values from raw storage. - * @access private - */},{key:"migrateArbitraryRawStorageToManagedStorageAllPlatforms",value:function(){var _migrateArbitraryRawStorageToManagedStorageAllPlatforms=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(){var allKeyValues,legacyKeys,tryJsonParse,namespace,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,keyValuePair,key,value,isNameSpacedKey,newValue;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:_context11.next=2;return this.application.deviceInterface.getAllRawStorageKeyValues();case 2:allKeyValues=_context11.sent;legacyKeys=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["objectToValueArray"])(LegacyKeys);tryJsonParse=function tryJsonParse(value){try{return JSON.parse(value);}catch(e){return value;}};namespace=this.application.namespace;_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context11.prev=9;_iterator=allKeyValues[Symbol.iterator]();case 11:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context11.next=25;break;}keyValuePair=_step.value;key=keyValuePair.key;value=keyValuePair.value;isNameSpacedKey=namespace&&namespace.length>0&&key.startsWith(namespace);if(!(legacyKeys.includes(key)||isNameSpacedKey)){_context11.next=18;break;}return _context11.abrupt("continue",22);case 18:if(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isNullOrUndefined"])(value)){_context11.next=22;break;}/** - * Raw values should always have been json stringified. - * New values should always be objects/parsed. - */newValue=tryJsonParse(value);_context11.next=22;return this.application.storageService.setValue(key,newValue);case 22:_iteratorNormalCompletion=true;_context11.next=11;break;case 25:_context11.next=31;break;case 27:_context11.prev=27;_context11.t0=_context11["catch"](9);_didIteratorError=true;_iteratorError=_context11.t0;case 31:_context11.prev=31;_context11.prev=32;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 34:_context11.prev=34;if(!_didIteratorError){_context11.next=37;break;}throw _iteratorError;case 37:return _context11.finish(34);case 38:return _context11.finish(31);case 39:case"end":return _context11.stop();}}},_callee11,this,[[9,27,31,39],[32,,34,38]]);}));function migrateArbitraryRawStorageToManagedStorageAllPlatforms(){return _migrateArbitraryRawStorageToManagedStorageAllPlatforms.apply(this,arguments);}return migrateArbitraryRawStorageToManagedStorageAllPlatforms;}()/** - * All platforms - * Deletes all StorageKeys and LegacyKeys from root raw storage. - * @access private - */},{key:"deleteLegacyStorageValues",value:function(){var _deleteLegacyStorageValues=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(){var miscKeys,managedKeys,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,key;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:miscKeys=['mk','ak','jwt','ephemeral','cachedThemes'];managedKeys=[].concat(_toConsumableArray(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["objectToValueArray"])(_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"])),_toConsumableArray(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["objectToValueArray"])(LegacyKeys)),miscKeys);_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context12.prev=5;_iterator2=managedKeys[Symbol.iterator]();case 7:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context12.next=14;break;}key=_step2.value;_context12.next=11;return this.application.deviceInterface.removeRawStorageValue(key);case 11:_iteratorNormalCompletion2=true;_context12.next=7;break;case 14:_context12.next=20;break;case 16:_context12.prev=16;_context12.t0=_context12["catch"](5);_didIteratorError2=true;_iteratorError2=_context12.t0;case 20:_context12.prev=20;_context12.prev=21;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 23:_context12.prev=23;if(!_didIteratorError2){_context12.next=26;break;}throw _iteratorError2;case 26:return _context12.finish(23);case 27:return _context12.finish(20);case 28:case"end":return _context12.stop();}}},_callee12,this,[[5,16,20,28],[21,,23,27]]);}));function deleteLegacyStorageValues(){return _deleteLegacyStorageValues.apply(this,arguments);}return deleteLegacyStorageValues;}()/** - * All platforms - * Migrate previously stored session string token into object - * @access private - */},{key:"migrateSessionStorage",value:function(){var _migrateSessionStorage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(){var LEGACY_SESSION_TOKEN_KEY,currentToken,session;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:LEGACY_SESSION_TOKEN_KEY='jwt';_context13.next=3;return this.application.storageService.getValue(LEGACY_SESSION_TOKEN_KEY);case 3:currentToken=_context13.sent;if(currentToken){_context13.next=6;break;}return _context13.abrupt("return");case 6:session=new _Services_api_session__WEBPACK_IMPORTED_MODULE_11__["Session"](currentToken);_context13.next=9;return this.application.storageService.setValue(_Lib__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].Session,session);case 9:case"end":return _context13.stop();}}},_callee13,this);}));function migrateSessionStorage(){return _migrateSessionStorage.apply(this,arguments);}return migrateSessionStorage;}()/** - * All platforms - * Create new default SNItemsKey from root key. - * Otherwise, when data is loaded, we won't be able to decrypt it - * without existence of an item key. This will mean that if this migration - * is run on two different platforms for the same user, they will create - * two new items keys. Which one they use to decrypt past items and encrypt - * future items doesn't really matter. - * @access private - */},{key:"createDefaultItemsKeyForAllPlatforms",value:function(){var _createDefaultItemsKeyForAllPlatforms=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(){var rootKey,rootKeyParams,itemsKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.next=2;return this.application.keyManager.getRootKey();case 2:rootKey=_context14.sent;if(!rootKey){_context14.next=14;break;}_context14.next=6;return this.application.keyManager.getRootKeyParams();case 6:rootKeyParams=_context14.sent;itemsKey=_Models__WEBPACK_IMPORTED_MODULE_7__["SNItemsKey"].FromRaw({itemsKey:rootKey.masterKey,dataAuthenticationKey:rootKey.dataAuthenticationKey,version:rootKeyParams.version});_context14.next=10;return itemsKey.initUUID();case 10:_context14.next=12;return this.application.modelManager.mapItem({item:itemsKey,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_4__["PayloadSources"].LocalChanged});case 12:_context14.next=14;return this.application.modelManager.setItemDirty(itemsKey);case 14:case"end":return _context14.stop();}}},_callee14,this);}));function createDefaultItemsKeyForAllPlatforms(){return _createDefaultItemsKeyForAllPlatforms.apply(this,arguments);}return createDefaultItemsKeyForAllPlatforms;}()}],[{key:"timestamp",value:function timestamp(){return new Date('2020-01-15').getTime();}}]);return Migration20200115;}(_Lib_migrations_migration__WEBPACK_IMPORTED_MODULE_1__["Migration"]);/***/},/***/"./lib/migrations/index.js":/*!*********************************!*\ - !*** ./lib/migrations/index.js ***! - \*********************************/ /*! exports provided: Migration20200115 */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _2020_01_15__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ./2020-01-15 */"./lib/migrations/2020-01-15.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Migration20200115",function(){return _2020_01_15__WEBPACK_IMPORTED_MODULE_0__["Migration20200115"];});/***/},/***/"./lib/migrations/migration.js":/*!*************************************!*\ - !*** ./lib/migrations/migration.js ***! - \*************************************/ /*! exports provided: Migration */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Migration",function(){return Migration;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;ib.title;}).map(function(tag,i){return'#'+tag.title;}).join(' ');}}]);return SNTag;}(_Models_core_item__WEBPACK_IMPORTED_MODULE_2__["SNItem"]);/***/},/***/"./lib/models/app/theme.js":/*!*********************************!*\ - !*** ./lib/models/app/theme.js ***! - \*********************************/ /*! exports provided: SNTheme */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNTheme",function(){return SNTheme;});/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony import */var _Models_app_component__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Models/app/component */"./lib/models/app/component.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{},override=_ref.override;return Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:this,override:override});}/** - * If creating from external payload, it may not include values for .references and .appData - * Here we want to initialize these values with default values. - */},{key:"populateDefaultContentValues",value:function populateDefaultContentValues(){if(this.errorDecrypting||this.deleted){return;}if(!this.content.references){this.content.references=[];}if(!this.content.appData){this.content.appData=_defineProperty({},_Lib__WEBPACK_IMPORTED_MODULE_5__["DEFAULT_APP_DOMAIN"],{});}}/** - * Consumers who create items without a syncronous UUID generation function - * must manually call this function when creating an item. The consumer must - * have previously called Uuid.SetGenerators. - */},{key:"initUUID",value:function(){var _initUUID=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(this.uuid){_context.next=4;break;}_context.next=3;return SNItem.GenerateUuid();case 3:this.uuid=_context.sent;case 4:case"end":return _context.stop();}}},_callee,this);}));function initUUID(){return _initUUID.apply(this,arguments);}return initUUID;}()},{key:"updateFromPayload",value:function updateFromPayload(payload){if(!payload){return;}var fieldsToCopy=[_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFields"].Content];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=payload.fields()[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var field=_step.value;if(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["hasGetter"])(this,field)){continue;}var value=payload[field];if(fieldsToCopy.includes(field)){var copy=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["Copy"])(value||null);this[field]=copy;}else{this[field]=value;}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}if(this.content){this.mapContentToLocalProperties(this.content);}else if(payload.deleted===true){this.handleDeletedContent();}if(this.dirtiedDate&&typeof this.dirtiedDate==='string'){this.dirtiedDate=new Date(this.dirtiedDate);}if(this.lastSyncBegan&&typeof this.lastSyncBegan==='string'){this.lastSyncBegan=new Date(this.lastSyncBegan);}if(this.lastSyncEnd&&typeof this.lastSyncEnd==='string'){this.lastSyncEnd=new Date(this.lastSyncEnd);}if(this.created_at){this.created_at=new Date(this.created_at);}else{this.created_at=new Date();}if(this.updated_at){this.updated_at=new Date(this.updated_at);}else{this.updated_at=new Date(0);}// Epoch -/** Allows the getter to be re-invoked */this._client_updated_at=null;this.populateDefaultContentValues();}},{key:"mapContentToLocalProperties",value:function mapContentToLocalProperties(content){}/** Optional override */ /** - * Merges any fields we get from `this.structureParams` into our .content object. - * Subclasses can override `structureParams`, and add their own custom content - * and properties to the object returned from `structureParams`. - * These are properties that this superclass will not be aware of, - * like `title` or `text`. When we call `collapseContent`, we want to update - * our own inherit 'content' field with the values returned from structureParams, - * so that our content field is up to date. Each subclass will call - * `super.structureParams` and merge it with its own custom result object. - * Since our own `structureParams` gets a real-time copy of our content, - * it should be safe to merge the aggregate value back into our own content field. - */},{key:"collapseContent",value:function collapseContent(){var contentCopy=this.structureParams();Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["deepMerge"])(this.content,contentCopy);return contentCopy;}},{key:"structureParams",value:function structureParams(){return this.getContentCopy()||{};}/** Allows consumers to check if object is an SNItem subclass and not a generic JS object */},{key:"handleDeletedContent",/* Allows the item to handle the case where the item is deleted and the content is null */value:function handleDeletedContent(){/** Subclasses can override */}},{key:"setDirty",value:function setDirty(_ref2){var dirty=_ref2.dirty,updateClientDate=_ref2.updateClientDate,authorized=_ref2.authorized;if(!authorized){throw'Do not call setDirty directly. Use modelManager.setItemDirty';}this.dirty=dirty;this.dirtiedDate=new Date();if(dirty&&updateClientDate){// Set the client modified date to now if marking the item as dirty -this.client_updated_at=new Date();}else if(!this.hasRawClientUpdatedAtValue()){// if we don't have an explcit raw value, we initialize client_updated_at. -this.client_updated_at=new Date(this.updated_at);}this.collapseContent();}/** - * Loops through all memory-based referenced items and checks to see - * if they're in our content.references. If not, we remove them from - * our memory state. - */},{key:"updateLocalRelationships",value:function updateLocalRelationships(){var references=this.content.references;var uuids=references.map(function(ref){return ref.uuid;});var existingUuids=Object.keys(this._referencedItems);for(var _i=0,_existingUuids=existingUuids;_i<_existingUuids.length;_i++){var uuid=_existingUuids[_i];var ref=this._referencedItems[uuid];if(!uuids.includes(ref.uuid)){delete this._referencedItems[uuid];ref.setIsNoLongerReferencedBy(this);}}}},{key:"addItemAsRelationship",value:function addItemAsRelationship(item){item.setIsBeingReferencedBy(this);if(!this._referencedItems[item.uuid]){this._referencedItems[item.uuid]=item;}if(this.hasRelationshipWithItem(item)){return;}var references=this.content.references||[];references.push({uuid:item.uuid,content_type:item.content_type});this.content.references=references;}},{key:"removeItemAsRelationship",value:function removeItemAsRelationship(item){item.setIsNoLongerReferencedBy(this);this.removeReferenceWithUuid(item.uuid);delete this._referencedItems[item.uuid];}/** - * When another object has a relationship with us, we push that object - * into memory here. We use this so that when `this` is deleted, we're able - * to update the references of those other objects. - */},{key:"setIsBeingReferencedBy",value:function setIsBeingReferencedBy(item){if(!this._referencingItems[item.uuid]){this._referencingItems[item.uuid]=item;}}},{key:"setIsNoLongerReferencedBy",value:function setIsNoLongerReferencedBy(item){delete this._referencingItems[item.uuid];}},{key:"removeReferenceWithUuid",value:function removeReferenceWithUuid(uuid){var references=this.content.references||[];references=references.filter(function(r){return r.uuid!==uuid;});this.content.references=references;delete this._referencedItems[uuid];}},{key:"hasRelationshipWithItem",value:function hasRelationshipWithItem(item){var target=this.content.references.find(function(r){return r.uuid===item.uuid;});return!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(target);}},{key:"isBeingRemovedLocally",value:function isBeingRemovedLocally(){for(var _i2=0,_Object$keys=Object.keys(this._referencedItems);_i2<_Object$keys.length;_i2++){var uuid=_Object$keys[_i2];var item=this._referencedItems[uuid];item.setIsNoLongerReferencedBy(this);}}/** The number of items this item currently references */},{key:"resetLocalReferencePointers",value:function resetLocalReferencePointers(){this._referencingItems={};this._referencedItems={};}},{key:"didCompleteMapping",value:function didCompleteMapping(source){}/** Optional override */ /* App Data */},{key:"setDomainDataItem",value:function setDomainDataItem(key,value,domain){if(!domain){console.error('DEFAULT_APP_DOMAIN needs to be set.');return;}if(this.errorDecrypting){return;}if(!this.content.appData){this.content.appData={};}var data=this.content.appData[domain];if(!data){data={};}data[key]=value;this.content.appData[domain]=data;}},{key:"getDomainDataItem",value:function getDomainDataItem(key,domain){if(!domain){console.error('DEFAULT_APP_DOMAIN needs to be set.');return;}if(this.errorDecrypting){return;}if(!this.content.appData){this.content.appData={};}var data=this.content.appData[domain];if(data){return data[key];}else{return null;}}},{key:"setAppDataItem",value:function setAppDataItem(key,value){this.setDomainDataItem(key,value,_Lib__WEBPACK_IMPORTED_MODULE_5__["DEFAULT_APP_DOMAIN"]);}},{key:"getAppDataItem",value:function getAppDataItem(key){return this.getDomainDataItem(key,_Lib__WEBPACK_IMPORTED_MODULE_5__["DEFAULT_APP_DOMAIN"]);}},{key:"hasRawClientUpdatedAtValue",value:function hasRawClientUpdatedAtValue(){return this.getAppDataItem('client_updated_at')!=null;}// eslint-disable-next-line camelcase -},{key:"contentKeysToIgnoreWhenCheckingEquality",/** - * During sync conflicts, when determing whether to create a duplicate for an item, - * we can omit keys that have no meaningful weight and can be ignored. For example, - * if one component has active = true and another component has active = false, - * it would be needless to duplicate them, so instead we ignore that value. - */value:function contentKeysToIgnoreWhenCheckingEquality(){return['conflict_of'];}/** Same as `contentKeysToIgnoreWhenCheckingEquality`, but keys inside appData[Item.AppDomain] */},{key:"appDatacontentKeysToIgnoreWhenCheckingEquality",value:function appDatacontentKeysToIgnoreWhenCheckingEquality(){return['client_updated_at'];}},{key:"getContentCopy",value:function getContentCopy(){var contentCopy=JSON.parse(JSON.stringify(this.content));return contentCopy;}/** Whether the item has never been synced to a server */},{key:"strategyWhenConflictingWithItem",/** - * Subclasses can override this method and provide their own opinion on whether - * they want to be duplicated. For example, if this.content.x = 12 and - * item.content.x = 13, this function can be overriden to always return - * ConflictStrategies.KeepLeft to say 'don't create a duplicate at all, the - * change is not important.' - * - * In the default implementation, we create a duplicate if content differs. - * However, if they only differ by references, we KEEP_LEFT_MERGE_REFS. - */value:function strategyWhenConflictingWithItem(_ref3){var item=_ref3.item;if(this.errorDecrypting){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepLeftDuplicateRight;}if(this.isSingleton){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepLeft;}if(this.deleted||item.deleted){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepRight;}var contentDiffers=Object(_Models_core_functions__WEBPACK_IMPORTED_MODULE_3__["ItemContentsDiffer"])(this,item);if(!contentDiffers){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepRight;}var differsExclRefs=Object(_Models_core_functions__WEBPACK_IMPORTED_MODULE_3__["ItemContentsDiffer"])(this,item,['references']);if(differsExclRefs){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepLeftDuplicateRight;}else{/** Is only references change */return _Payloads__WEBPACK_IMPORTED_MODULE_4__["ConflictStrategies"].KeepLeftMergeRefs;}}},{key:"isItemContentEqualWith",value:function isItemContentEqualWith(otherItem){return Object(_Models_core_functions__WEBPACK_IMPORTED_MODULE_3__["ItemContentsEqual"])({leftContent:this.content,rightContent:otherItem.content,keysToIgnore:this.contentKeysToIgnoreWhenCheckingEquality(),appDataKeysToIgnore:this.appDatacontentKeysToIgnoreWhenCheckingEquality()});}},{key:"satisfiesPredicate",value:function satisfiesPredicate(predicate){return _Models_core_predicate__WEBPACK_IMPORTED_MODULE_2__["SNPredicate"].ItemSatisfiesPredicate(this,predicate);}/** Dates */},{key:"createdAtString",value:function createdAtString(){return this.dateToLocalizedString(this.created_at);}},{key:"updatedAtString",value:function updatedAtString(){return this.dateToLocalizedString(this.client_updated_at);}},{key:"updatedAtTimestamp",value:function updatedAtTimestamp(){return this.updated_at.getTime();}},{key:"dateToLocalizedString",value:function dateToLocalizedString(date){if(typeof Intl!=='undefined'&&Intl.DateTimeFormat){if(!SNItem.sharedDateFormatter){var locale=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language;SNItem.sharedDateFormatter=new Intl.DateTimeFormat(locale,{year:'numeric',month:'short',day:'2-digit',weekday:'long',hour:'2-digit',minute:'2-digit'});}return SNItem.sharedDateFormatter.format(date);}else{// IE < 11, Safari <= 9.0. -// In English, this generates the string most similar to -// the toLocaleDateString() result above. -return date.toDateString()+' '+date.toLocaleTimeString();}}},{key:"isItem",get:function get(){return true;}},{key:"referencedItemsCount",get:function get(){return Object.keys(this._referencedItems).length;}/** The number of items that currently reference this item */},{key:"referencingItemsCount",get:function get(){return Object.keys(this._referencingItems).length;}},{key:"allReferencingItems",get:function get(){var _this=this;return Object.keys(this._referencingItems).map(function(uuid){return _this._referencingItems[uuid];});}},{key:"pinned",get:function get(){return this.getAppDataItem('pinned');}},{key:"archived",get:function get(){return this.getAppDataItem('archived');}},{key:"locked",get:function get(){return this.getAppDataItem('locked');}},{key:"client_updated_at",get:function get(){if(!this._client_updated_at){var saved=this.getAppDataItem('client_updated_at');if(saved){this._client_updated_at=new Date(saved);}else{this._client_updated_at=new Date(this.updated_at);}}return this._client_updated_at;}// eslint-disable-next-line camelcase -,set:function set(date){this._client_updated_at=date;this.setAppDataItem('client_updated_at',date);}},{key:"neverSynced",get:function get(){return!this.updated_at||this.updated_at.getTime()===0;}/** - * Subclasses can override this getter to return true if they want only - * one of this item to exist, depending on custom criteria. - */},{key:"isSingleton",get:function get(){return false;}/** The predicate by which singleton items should be unique */},{key:"singletonPredicate",get:function get(){throw'Must override SNItem.singletonPredicate';}},{key:"singletonStrategy",get:function get(){return SingletonStrategies.KeepEarliest;}}]);return SNItem;}();/***/},/***/"./lib/models/core/predicate.js":/*!**************************************!*\ - !*** ./lib/models/core/predicate.js ***! - \**************************************/ /*! exports provided: SNPredicate */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNPredicate",function(){return SNPredicate;});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i'){return valueAtKeyPath>predicateValue;}else if(predicate.operator==='<='){return valueAtKeyPath<=predicateValue;}else if(predicate.operator==='>='){return valueAtKeyPath>=predicateValue;}else if(predicate.operator==='startsWith'){return valueAtKeyPath.startsWith(predicateValue);}else if(predicate.operator==='in'){return predicateValue.indexOf(valueAtKeyPath)!==-1;}else if(predicate.operator==='includes'){return this.resolveIncludesPredicate(valueAtKeyPath,predicateValue);}else if(predicate.operator==='matches'){var regex=new RegExp(predicateValue);return regex.test(valueAtKeyPath);}return false;}},{key:"resolveIncludesPredicate",value:function resolveIncludesPredicate(valueAtKeyPath,predicateValue){// includes can be a string or a predicate (in array form) -if(typeof predicateValue==='string'){// if string, simply check if the valueAtKeyPath includes the predicate value -return valueAtKeyPath.includes(predicateValue);}else{// is a predicate array or predicate object -var innerPredicate;if(Array.isArray(predicateValue)){innerPredicate=SNPredicate.FromArray(predicateValue);}else{innerPredicate=predicateValue;}var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=valueAtKeyPath[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var obj=_step3.value;if(this.ObjectSatisfiesPredicate(obj,innerPredicate)){return true;}}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return!=null){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}return false;}}},{key:"ItemSatisfiesPredicate",value:function ItemSatisfiesPredicate(item,predicate){if(Array.isArray(predicate)){predicate=SNPredicate.FromArray(predicate);}return this.ObjectSatisfiesPredicate(item,predicate);}},{key:"ItemSatisfiesPredicates",value:function ItemSatisfiesPredicates(item,predicates){var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=predicates[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var predicate=_step4.value;if(!this.ItemSatisfiesPredicate(item,predicate)){return false;}}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return!=null){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}return true;}},{key:"DateFromString",value:function DateFromString(string){// x.days.ago, x.hours.ago -var comps=string.split('.');var unit=comps[1];var date=new Date();var offset=parseInt(comps[0]);if(unit==='days'){date.setDate(date.getDate()-offset);}else if(unit==='hours'){date.setHours(date.getHours()-offset);}return date;}},{key:"IsRecursiveOperator",value:function IsRecursiveOperator(operator){return['and','or'].includes(operator);}}]);return SNPredicate;}();/***/},/***/"./lib/models/generator.js":/*!*********************************!*\ - !*** ./lib/models/generator.js ***! - \*********************************/ /*! exports provided: CreateItemFromPayload */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"CreateItemFromPayload",function(){return CreateItemFromPayload;});/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");var _ContentTypeClassMapp;function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var ContentTypeClassMapping=(_ContentTypeClassMapp={},_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Note,_Models__WEBPACK_IMPORTED_MODULE_0__["SNNote"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Tag,_Models__WEBPACK_IMPORTED_MODULE_0__["SNTag"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].ItemsKey,_Models__WEBPACK_IMPORTED_MODULE_0__["SNItemsKey"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].SmartTag,_Models__WEBPACK_IMPORTED_MODULE_0__["SNSmartTag"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].ActionsExtension,_Models__WEBPACK_IMPORTED_MODULE_0__["SNActionsExtension"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Editor,_Models__WEBPACK_IMPORTED_MODULE_0__["SNEditor"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Theme,_Models__WEBPACK_IMPORTED_MODULE_0__["SNTheme"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Component,_Models__WEBPACK_IMPORTED_MODULE_0__["SNComponent"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].Privileges,_Models__WEBPACK_IMPORTED_MODULE_0__["SNPrivileges"]),_defineProperty(_ContentTypeClassMapp,_Models_content_types__WEBPACK_IMPORTED_MODULE_1__["ContentTypes"].UserPrefs,_Models__WEBPACK_IMPORTED_MODULE_0__["SNUserPrefs"]),_ContentTypeClassMapp);function CreateItemFromPayload(payload){if(!payload.isPayload){throw'Attempting to create item from non-payload object.';}var itemClass=ContentTypeClassMapping[payload.content_type]||_Models__WEBPACK_IMPORTED_MODULE_0__["SNItem"];// eslint-disable-next-line new-cap -return new itemClass(payload);}/***/},/***/"./lib/models/index.js":/*!*****************************!*\ - !*** ./lib/models/index.js ***! - \*****************************/ /*! exports provided: SNItem, SingletonStrategies, SNItemsKey, SNPredicate, SNComponent, SNEditor, SNActionsExtension, Action, SNNote, SNTag, SNUserPrefs, SNPrivileges, SNSmartTag, SNTheme, SNEncryptedStorage, ContentTypes, displayStringForContentType, CreateItemFromPayload */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _Models_core_item__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Models/core/item */"./lib/models/core/item.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNItem",function(){return _Models_core_item__WEBPACK_IMPORTED_MODULE_0__["SNItem"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SingletonStrategies",function(){return _Models_core_item__WEBPACK_IMPORTED_MODULE_0__["SingletonStrategies"];});/* harmony import */var _Models_app_items_key__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Models/app/items_key */"./lib/models/app/items_key.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNItemsKey",function(){return _Models_app_items_key__WEBPACK_IMPORTED_MODULE_1__["SNItemsKey"];});/* harmony import */var _Models_core_predicate__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Models/core/predicate */"./lib/models/core/predicate.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPredicate",function(){return _Models_core_predicate__WEBPACK_IMPORTED_MODULE_2__["SNPredicate"];});/* harmony import */var _Models_app_component__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Models/app/component */"./lib/models/app/component.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNComponent",function(){return _Models_app_component__WEBPACK_IMPORTED_MODULE_3__["SNComponent"];});/* harmony import */var _Models_app_editor__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Models/app/editor */"./lib/models/app/editor.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNEditor",function(){return _Models_app_editor__WEBPACK_IMPORTED_MODULE_4__["SNEditor"];});/* harmony import */var _Models_app_extension__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Models/app/extension */"./lib/models/app/extension.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNActionsExtension",function(){return _Models_app_extension__WEBPACK_IMPORTED_MODULE_5__["SNActionsExtension"];});/* harmony import */var _Models_app_action__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Models/app/action */"./lib/models/app/action.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"Action",function(){return _Models_app_action__WEBPACK_IMPORTED_MODULE_6__["Action"];});/* harmony import */var _Models_app_note__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Models/app/note */"./lib/models/app/note.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNNote",function(){return _Models_app_note__WEBPACK_IMPORTED_MODULE_7__["SNNote"];});/* harmony import */var _Models_app_tag__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! @Models/app/tag */"./lib/models/app/tag.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNTag",function(){return _Models_app_tag__WEBPACK_IMPORTED_MODULE_8__["SNTag"];});/* harmony import */var _Models_app_userPrefs__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(/*! @Models/app/userPrefs */"./lib/models/app/userPrefs.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNUserPrefs",function(){return _Models_app_userPrefs__WEBPACK_IMPORTED_MODULE_9__["SNUserPrefs"];});/* harmony import */var _Models_app_privileges__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(/*! @Models/app/privileges */"./lib/models/app/privileges.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPrivileges",function(){return _Models_app_privileges__WEBPACK_IMPORTED_MODULE_10__["SNPrivileges"];});/* harmony import */var _Models_app_smartTag__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(/*! @Models/app/smartTag */"./lib/models/app/smartTag.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSmartTag",function(){return _Models_app_smartTag__WEBPACK_IMPORTED_MODULE_11__["SNSmartTag"];});/* harmony import */var _Models_app_theme__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(/*! @Models/app/theme */"./lib/models/app/theme.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNTheme",function(){return _Models_app_theme__WEBPACK_IMPORTED_MODULE_12__["SNTheme"];});/* harmony import */var _Models_core_encryptedStorage__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(/*! @Models/core/encryptedStorage */"./lib/models/core/encryptedStorage.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNEncryptedStorage",function(){return _Models_core_encryptedStorage__WEBPACK_IMPORTED_MODULE_13__["SNEncryptedStorage"];});/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ContentTypes",function(){return _Models_content_types__WEBPACK_IMPORTED_MODULE_14__["ContentTypes"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"displayStringForContentType",function(){return _Models_content_types__WEBPACK_IMPORTED_MODULE_14__["displayStringForContentType"];});/* harmony import */var _Models_generator__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(/*! @Models/generator */"./lib/models/generator.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"CreateItemFromPayload",function(){return _Models_generator__WEBPACK_IMPORTED_MODULE_15__["CreateItemFromPayload"];});/***/},/***/"./lib/platforms.js":/*!**************************!*\ - !*** ./lib/platforms.js ***! - \**************************/ /*! exports provided: Environments, Platforms, platformFromString, platformToString, environmentToString, isEnvironmentWebOrDesktop, isEnvironmentMobile */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Environments",function(){return Environments;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Platforms",function(){return Platforms;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"platformFromString",function(){return platformFromString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"platformToString",function(){return platformToString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"environmentToString",function(){return environmentToString;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isEnvironmentWebOrDesktop",function(){return isEnvironmentWebOrDesktop;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isEnvironmentMobile",function(){return isEnvironmentMobile;});function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var Environments={Web:1,Desktop:2,Mobile:3};var Platforms={Ios:1,Android:2,MacWeb:3,MacDesktop:4,WindowsWeb:5,WindowsDesktop:6,LinuxWeb:7,LinuxDesktop:8};function platformFromString(string){var map={'mac-web':Platforms.MacWeb,'mac-desktop':Platforms.MacDesktop,'linux-web':Platforms.LinuxWeb,'linux-desktop':Platforms.LinuxDesktop,'windows-web':Platforms.WindowsWeb,'windows-desktop':Platforms.WindowsDesktop,'ios':Platforms.Ios,'android':Platforms.Android};return map[string];}function platformToString(platform){var _map;var map=(_map={},_defineProperty(_map,Platforms.MacWeb,'mac-web'),_defineProperty(_map,Platforms.MacDesktop,'mac-desktop'),_defineProperty(_map,Platforms.LinuxWeb,'linux-web'),_defineProperty(_map,Platforms.LinuxDesktop,'linux-desktop'),_defineProperty(_map,Platforms.WindowsWeb,'windows-web'),_defineProperty(_map,Platforms.WindowsDesktop,'windows-desktop'),_defineProperty(_map,Platforms.Ios,'ios'),_defineProperty(_map,Platforms.Android,'android'),_map);return map[platform];}function environmentToString(environment){var _map2;var map=(_map2={},_defineProperty(_map2,Environments.Web,'web'),_defineProperty(_map2,Environments.Desktop,'desktop'),_defineProperty(_map2,Environments.Mobile,'mobile'),_map2);return map[environment];}function isEnvironmentWebOrDesktop(environment){return environment===Environments.Web||environment===Environments.Desktop;}function isEnvironmentMobile(environment){return environment===Environments.Mobile;}/***/},/***/"./lib/protocol/index.js":/*!*******************************!*\ - !*** ./lib/protocol/index.js ***! - \*******************************/ /*! exports provided: ProtocolVersions, compareVersions, EncryptionIntents, isDecryptedIntent, intentRequiresEncryption, SNRootKey, CreateKeyParams, SNProtocolOperator001, SNProtocolOperator002, SNProtocolOperator003, SNProtocolOperator004 */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ProtocolVersions",function(){return _Protocol_versions__WEBPACK_IMPORTED_MODULE_0__["ProtocolVersions"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"compareVersions",function(){return _Protocol_versions__WEBPACK_IMPORTED_MODULE_0__["compareVersions"];});/* harmony import */var _Protocol_intents__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Protocol/intents */"./lib/protocol/intents.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"EncryptionIntents",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_1__["EncryptionIntents"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"isDecryptedIntent",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_1__["isDecryptedIntent"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"intentRequiresEncryption",function(){return _Protocol_intents__WEBPACK_IMPORTED_MODULE_1__["intentRequiresEncryption"];});/* harmony import */var _Protocol_root_key__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol/root_key */"./lib/protocol/root_key.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNRootKey",function(){return _Protocol_root_key__WEBPACK_IMPORTED_MODULE_2__["SNRootKey"];});/* harmony import */var _Protocol_key_params__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Protocol/key_params */"./lib/protocol/key_params.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"CreateKeyParams",function(){return _Protocol_key_params__WEBPACK_IMPORTED_MODULE_3__["CreateKeyParams"];});/* harmony import */var _Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Protocol/operator/001/operator_001 */"./lib/protocol/operator/001/operator_001.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator001",function(){return _Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_4__["SNProtocolOperator001"];});/* harmony import */var _Protocol_operator_002_operator_002__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Protocol/operator/002/operator_002 */"./lib/protocol/operator/002/operator_002.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator002",function(){return _Protocol_operator_002_operator_002__WEBPACK_IMPORTED_MODULE_5__["SNProtocolOperator002"];});/* harmony import */var _Protocol_operator_003_operator_003__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Protocol/operator/003/operator_003 */"./lib/protocol/operator/003/operator_003.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator003",function(){return _Protocol_operator_003_operator_003__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator003"];});/* harmony import */var _Protocol_operator_004_operator_004__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Protocol/operator/004/operator_004 */"./lib/protocol/operator/004/operator_004.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator004",function(){return _Protocol_operator_004_operator_004__WEBPACK_IMPORTED_MODULE_7__["SNProtocolOperator004"];});/***/},/***/"./lib/protocol/intents.js":/*!*********************************!*\ - !*** ./lib/protocol/intents.js ***! - \*********************************/ /*! exports provided: EncryptionIntents, isLocalStorageIntent, isFileIntent, isDecryptedIntent, intentRequiresEncryption */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"EncryptionIntents",function(){return EncryptionIntents;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isLocalStorageIntent",function(){return isLocalStorageIntent;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isFileIntent",function(){return isFileIntent;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"isDecryptedIntent",function(){return isDecryptedIntent;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"intentRequiresEncryption",function(){return intentRequiresEncryption;});var EncryptionIntents={Sync:0,/** Permissible only for server extensions */SyncDecrypted:1,LocalStorageEncrypted:2,LocalStorageDecrypted:3,/** Store encrypted if possible, but decrypted if not */LocalStoragePreferEncrypted:4,FileEncrypted:5,FileDecrypted:6,FilePreferEncrypted:7};function isLocalStorageIntent(intent){return intent===EncryptionIntents.LocalStorageEncrypted||intent===EncryptionIntents.LocalStorageDecrypted||intent===EncryptionIntents.LocalStoragePreferEncrypted;}function isFileIntent(intent){return intent===EncryptionIntents.FileEncrypted||intent===EncryptionIntents.FileDecrypted||intent===EncryptionIntents.FilePreferEncrypted;}function isDecryptedIntent(intent){return intent===EncryptionIntents.SyncDecrypted||intent===EncryptionIntents.LocalStorageDecrypted||intent===EncryptionIntents.FileDecrypted;}/** - * @returns {boolean} True if the intent requires encryption. - */function intentRequiresEncryption(intent){return intent===EncryptionIntents.Sync||intent===EncryptionIntents.LocalStorageEncrypted||intent===EncryptionIntents.FileEncrypted;}/***/},/***/"./lib/protocol/key_params.js":/*!************************************!*\ - !*** ./lib/protocol/key_params.js ***! - \************************************/ /*! exports provided: CreateKeyParams, SNRootKeyParams */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"CreateKeyParams",function(){return CreateKeyParams;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNRootKeyParams",function(){return SNRootKeyParams;});/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i= 003, do not send kdfIterations, as this value is always deduced - * locally depending on the version. - * Versions <= 002 had dynamic kdfIterations, so these values must be transfered. - */if(Object(_Protocol_versions__WEBPACK_IMPORTED_MODULE_1__["compareVersions"])(this.version,_Protocol_versions__WEBPACK_IMPORTED_MODULE_1__["ProtocolVersions"].V003)>=0){return Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_0__["omitByCopy"])(this.content,['pw_cost']);}else{return this.content;}}},{key:"isKeyParamsObject",get:function get(){return true;}},{key:"kdfIterations",get:function get(){return this.content.pw_cost;}},{key:"seed",get:function get(){return this.content.pw_nonce;}},{key:"identifier",get:function get(){return this.content.identifier||this.content.email;}},{key:"salt",get:function get(){return this.content.pw_salt;}},{key:"version",get:function get(){return this.content.version;}}]);return SNRootKeyParams;}();/***/},/***/"./lib/protocol/operator/001/operator_001.js":/*!***************************************************!*\ - !*** ./lib/protocol/operator/001/operator_001.js ***! - \***************************************************/ /*! exports provided: SNProtocolOperator001 */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator001",function(){return SNProtocolOperator001;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Protocol_operator_operator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Protocol/operator/operator */"./lib/protocol/operator/operator.js");/* harmony import */var _Protocol_key_params__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol/key_params */"./lib/protocol/key_params.js");/* harmony import */var _Payloads_fields__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Payloads/fields */"./lib/protocol/payloads/fields.js");/* harmony import */var _Payloads_formats__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Payloads/formats */"./lib/protocol/payloads/formats.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");/* harmony import */var _Protocol_root_key__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Protocol/root_key */"./lib/protocol/root_key.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&_args8[0]!==undefined?_args8[0]:{},password=_ref5.password,pwSalt=_ref5.pwSalt,pwCost=_ref5.pwCost;_context8.next=3;return this.crypto.pbkdf2(password,pwSalt,pwCost,PBKDF2_OUTPUT_KEY_LENGTH);case 3:derivedKey=_context8.sent;_context8.next=6;return this.splitKey({key:derivedKey,numParts:2});case 6:partitions=_context8.sent;_context8.next=9;return _Protocol_root_key__WEBPACK_IMPORTED_MODULE_7__["SNRootKey"].Create({content:{serverPassword:partitions[0],masterKey:partitions[1],version:this.constructor.versionString()}});case 9:key=_context8.sent;return _context8.abrupt("return",key);case 11:case"end":return _context8.stop();}}},_callee8,this);}));function deriveKey(){return _deriveKey.apply(this,arguments);}return deriveKey;}()}],[{key:"pwCost",value:function pwCost(){return PBKDF2_MIN_ITERATIONS;}},{key:"versionString",value:function versionString(){return _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V001;}}]);return SNProtocolOperator001;}(_Protocol_operator_operator__WEBPACK_IMPORTED_MODULE_1__["SNProtocolOperator"]);/***/},/***/"./lib/protocol/operator/002/operator_002.js":/*!***************************************************!*\ - !*** ./lib/protocol/operator/002/operator_002.js ***! - \***************************************************/ /*! exports provided: SNProtocolOperator002 */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator002",function(){return SNProtocolOperator002;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Protocol_key_params__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Protocol/key_params */"./lib/protocol/key_params.js");/* harmony import */var _Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol/operator/001/operator_001 */"./lib/protocol/operator/001/operator_001.js");/* harmony import */var _Payloads_fields__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Payloads/fields */"./lib/protocol/payloads/fields.js");/* harmony import */var _Payloads_formats__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Payloads/formats */"./lib/protocol/payloads/formats.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");/* harmony import */var _Protocol_root_key__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Protocol/root_key */"./lib/protocol/root_key.js");/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! sncrypto */"../sncrypto/dist/sncrypto.js");/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_8___default=/*#__PURE__*/__webpack_require__.n(sncrypto__WEBPACK_IMPORTED_MODULE_8__);function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&_args10[0]!==undefined?_args10[0]:{},password=_ref6.password,pwSalt=_ref6.pwSalt,pwCost=_ref6.pwCost;if(!(!pwCost||!pwSalt||!password)){_context10.next=3;break;}throw'Attempting to 003.deriveKey with invalid parameters';case 3:_context10.next=5;return this.crypto.pbkdf2(password,pwSalt,pwCost,PBKDF2_OUTPUT_KEY_LENGTH);case 5:derivedKey=_context10.sent;_context10.next=8;return this.splitKey({key:derivedKey,numParts:3});case 8:partitions=_context10.sent;_context10.next=11;return _Protocol_root_key__WEBPACK_IMPORTED_MODULE_7__["SNRootKey"].Create({content:{serverPassword:partitions[0],masterKey:partitions[1],dataAuthenticationKey:partitions[2],version:this.constructor.versionString()}});case 11:key=_context10.sent;return _context10.abrupt("return",key);case 13:case"end":return _context10.stop();}}},_callee10,this);}));function deriveKey(){return _deriveKey.apply(this,arguments);}return deriveKey;}()},{key:"encryptionComponentsFromString",value:function encryptionComponentsFromString(string,encryptionKey,authKey){var components=string.split(':');return{encryptionVersion:components[0],authHash:components[1],uuid:components[2],iv:components[3],contentCiphertext:components[4],ciphertextToAuth:[components[0],components[2],components[3],components[4]].join(':'),encryptionKey:encryptionKey,authKey:authKey};}}],[{key:"pwCost",value:function pwCost(){return PBKDF2_MIN_ITERATIONS;}},{key:"versionString",value:function versionString(){return _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002;}}]);return SNProtocolOperator002;}(_Protocol_operator_001_operator_001__WEBPACK_IMPORTED_MODULE_2__["SNProtocolOperator001"]);/***/},/***/"./lib/protocol/operator/003/operator_003.js":/*!***************************************************!*\ - !*** ./lib/protocol/operator/003/operator_003.js ***! - \***************************************************/ /*! exports provided: SNProtocolOperator003 */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator003",function(){return SNProtocolOperator003;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Protocol_key_params__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Protocol/key_params */"./lib/protocol/key_params.js");/* harmony import */var _Protocol_operator_002_operator_002__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol/operator/002/operator_002 */"./lib/protocol/operator/002/operator_002.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&_args10[0]!==undefined?_args10[0]:{},password=_ref9.password,salt=_ref9.salt,iterations=_ref9.iterations;if(!(!iterations||!salt||!password)){_context10.next=3;break;}throw'Attempting to 004.deriveKey with invalid parameters';case 3:_context10.next=5;return this.crypto.argon2(password,salt,iterations,ARGON2_MEMLIMIT,ARGON2_OUTPUT_KEY_BYTES);case 5:derivedKey=_context10.sent;_context10.next=8;return this.splitKey({key:derivedKey,numParts:2});case 8:partitions=_context10.sent;masterKey=partitions[0];serverPassword=partitions[1];return _context10.abrupt("return",_Protocol_root_key__WEBPACK_IMPORTED_MODULE_7__["SNRootKey"].Create({content:{masterKey:masterKey,serverPassword:serverPassword,version:this.constructor.versionString()}}));case 12:case"end":return _context10.stop();}}},_callee10,this);}));function deriveKey(){return _deriveKey.apply(this,arguments);}return deriveKey;}()}],[{key:"versionString",value:function versionString(){return _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V004;}},{key:"kdfIterations",value:function kdfIterations(){return ARGON2_ITERATIONS;}}]);return SNProtocolOperator004;}(_Protocol_operator_003_operator_003__WEBPACK_IMPORTED_MODULE_2__["SNProtocolOperator003"]);/***/},/***/"./lib/protocol/operator/operator.js":/*!*******************************************!*\ - !*** ./lib/protocol/operator/operator.js ***! - \*******************************************/ /*! exports provided: SNProtocolOperator */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNProtocolOperator",function(){return SNProtocolOperator;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Models_app_items_key__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Models/app/items_key */"./lib/models/app/items_key.js");/* harmony import */var _Payloads_formats__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Payloads/formats */"./lib/protocol/payloads/formats.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! sncrypto */"../sncrypto/dist/sncrypto.js");/* harmony import */var sncrypto__WEBPACK_IMPORTED_MODULE_5___default=/*#__PURE__*/__webpack_require__.n(sncrypto__WEBPACK_IMPORTED_MODULE_5__);function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{},_ref$payloads=_ref.payloads,payloads=_ref$payloads===void 0?[]:_ref$payloads,source=_ref.source;_classCallCheck(this,PayloadCollection);this.source=source;this.payloadMap={};this.allPayloads=payloads;var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=payloads[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var payload=_step.value;this.payloadMap[payload.uuid]=payload;}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}Object.freeze(this);}/** @access public */_createClass(PayloadCollection,[{key:"getAllPayloads",value:function getAllPayloads(){return this.allPayloads;}},{key:"findPayload",value:function findPayload(id){return this.payloadMap[id];}},{key:"concat",value:function concat(inCollection){var result=inCollection.allPayloads.slice();var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=this.allPayloads[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var ours=_step2.value;/** If the payload exists in incoming collection, don't add our version */if(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_0__["findInArray"])(inCollection.allPayloads,'uuid',ours.uuid)){continue;}result.push(ours);}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}return new PayloadCollection({payloads:result,source:this.source});}},{key:"payloadsThatReferencePayload",value:function payloadsThatReferencePayload(payload){var results=[];for(var _i=0,_Object$keys=Object.keys(this.payloadMap);_i<_Object$keys.length;_i++){var uuid=_Object$keys[_i];var candidate=this.findPayload(uuid);if(candidate.errorDecrypting){continue;}var references=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_0__["findInArray"])(candidate.content.references,'uuid',payload.uuid);if(references){results.push(candidate);}}return results;}}]);return PayloadCollection;}();/***/},/***/"./lib/protocol/payloads/collection_set.ts":/*!*************************************************!*\ - !*** ./lib/protocol/payloads/collection_set.ts ***! - \*************************************************/ /*! exports provided: PayloadCollectionSet */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"PayloadCollectionSet",function(){return PayloadCollectionSet;});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i b - */function compareVersions(a,b){var aNum=Number(a);var bNum=Number(b);return aNum-bNum;}/***/},/***/"./lib/services/actions_service.js":/*!*****************************************!*\ - !*** ./lib/services/actions_service.js ***! - \*****************************************/ /*! exports provided: SNActionsService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNActionsService",function(){return SNActionsService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Protocol__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol */"./lib/protocol/index.js");/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0;});}/** - * Loads an extension in the context of a certain item. - * The server then has the chance to respond with actions that are - * relevant just to this item. The response extension is not saved, - * just displayed as a one-time thing. - */},{key:"loadExtensionInContextOfItem",value:function(){var _loadExtensionInContextOfItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(extension,item){var params;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:params={content_type:item.content_type,item_uuid:item.uuid};return _context.abrupt("return",this.httpService.getAbsolute({url:extension.url,params:params}).then(function(response){if(response.description){extension.description=response.description;}if(response.supported_types){extension.supported_types=response.supported_types;}if(response.actions){extension.actions=response.actions.map(function(action){return new _Models__WEBPACK_IMPORTED_MODULE_4__["Action"](action);});}else{extension.actions=[];}return extension;}).catch(function(response){console.error('Error loading extension',response);return null;}));case 2:case"end":return _context.stop();}}},_callee,this);}));function loadExtensionInContextOfItem(_x,_x2){return _loadExtensionInContextOfItem.apply(this,arguments);}return loadExtensionInContextOfItem;}()},{key:"runAction",value:function(){var _runAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(_ref2){var action,item,passwordRequestHandler,result;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:action=_ref2.action,item=_ref2.item,passwordRequestHandler=_ref2.passwordRequestHandler;action.running=true;_context2.t0=action.verb;_context2.next=_context2.t0==='get'?5:_context2.t0==='render'?9:_context2.t0==='show'?13:_context2.t0==='post'?17:21;break;case 5:_context2.next=7;return this.handleGetAction({action:action,passwordRequestHandler:passwordRequestHandler});case 7:result=_context2.sent;return _context2.abrupt("break",22);case 9:_context2.next=11;return this.handleRenderAction({action:action,passwordRequestHandler:passwordRequestHandler});case 11:result=_context2.sent;return _context2.abrupt("break",22);case 13:_context2.next=15;return this.handleShowAction(action);case 15:result=_context2.sent;return _context2.abrupt("break",22);case 17:_context2.next=19;return this.handlePostAction(action,item);case 19:result=_context2.sent;return _context2.abrupt("break",22);case 21:return _context2.abrupt("break",22);case 22:action.lastExecuted=new Date();action.running=false;return _context2.abrupt("return",result);case 25:case"end":return _context2.stop();}}},_callee2,this);}));function runAction(_x3){return _runAction.apply(this,arguments);}return runAction;}()},{key:"handleGetAction",value:function(){var _handleGetAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(_ref3){var _this2=this;var action,passwordRequestHandler;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:action=_ref3.action,passwordRequestHandler=_ref3.passwordRequestHandler;return _context3.abrupt("return",new Promise(function(resolve,reject){_this2.alertService.confirm({text:"Are you sure you want to replace the current note contents with this action's results?",onConfirm:function onConfirm(){_this2.runConfirmedGetAction({action:action,passwordRequestHandler:passwordRequestHandler}).then(resolve);}});}));case 2:case"end":return _context3.stop();}}},_callee3);}));function handleGetAction(_x4){return _handleGetAction.apply(this,arguments);}return handleGetAction;}()},{key:"runConfirmedGetAction",value:function(){var _runConfirmedGetAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(_ref4){var _this3=this;var action,passwordRequestHandler,response,payload,items,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,mappedItem;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:action=_ref4.action,passwordRequestHandler=_ref4.passwordRequestHandler;_context4.next=3;return this.httpService.getAbsolute({url:action.url}).catch(function(response){var error=response&&response.error||{message:'An issue occurred while processing this action. Please try again.'};_this3.alertService.alert({text:error.message});action.error=true;return{error:error};});case 3:response=_context4.sent;if(!response.error){_context4.next=6;break;}return _context4.abrupt("return",response);case 6:action.error=false;_context4.next=9;return this.payloadByDecryptingResponse({response:response,passwordRequestHandler:passwordRequestHandler});case 9:payload=_context4.sent;_context4.next=12;return this.modelManager.mapPayload({payload:payload,source:_Payloads__WEBPACK_IMPORTED_MODULE_1__["PayloadSources"].RemoteActionRetrieved});case 12:items=_context4.sent;_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context4.prev=16;for(_iterator=items[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){mappedItem=_step.value;this.modelManager.setItemDirty(mappedItem,true);}_context4.next=24;break;case 20:_context4.prev=20;_context4.t0=_context4["catch"](16);_didIteratorError=true;_iteratorError=_context4.t0;case 24:_context4.prev=24;_context4.prev=25;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 27:_context4.prev=27;if(!_didIteratorError){_context4.next=30;break;}throw _iteratorError;case 30:return _context4.finish(27);case 31:return _context4.finish(24);case 32:this.syncService.sync();return _context4.abrupt("return",{response:response,item:response.item});case 34:case"end":return _context4.stop();}}},_callee4,this,[[16,20,24,32],[25,,27,31]]);}));function runConfirmedGetAction(_x5){return _runConfirmedGetAction.apply(this,arguments);}return runConfirmedGetAction;}()},{key:"handleRenderAction",value:function(){var _handleRenderAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(_ref5){var _this4=this;var action,passwordRequestHandler;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:action=_ref5.action,passwordRequestHandler=_ref5.passwordRequestHandler;return _context6.abrupt("return",this.httpService.getAbsolute({url:action.url}).then(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(response){var payload,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:action.error=false;_context5.next=3;return _this4.payloadByDecryptingResponse({response:response,passwordRequestHandler:passwordRequestHandler});case 3:payload=_context5.sent;if(!payload){_context5.next=7;break;}item=_this4.modelManager.createItem({contentType:payload.contentType,content:payload.content});return _context5.abrupt("return",{response:response,item:item});case 7:case"end":return _context5.stop();}}},_callee5);}));return function(_x7){return _ref6.apply(this,arguments);};}()).catch(function(response){var error=response&&response.error||{message:'An issue occurred while processing this action. Please try again.'};_this4.alertService.alert({text:error.message});action.error=true;return{error:error};}));case 2:case"end":return _context6.stop();}}},_callee6,this);}));function handleRenderAction(_x6){return _handleRenderAction.apply(this,arguments);}return handleRenderAction;}()},{key:"payloadByDecryptingResponse",value:function(){var _payloadByDecryptingResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(_ref7){var response,key,passwordRequestHandler,payload,decryptedPayload,triedPasswords,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,passwordCandidate,_key,nestedResponse,password;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:response=_ref7.response,key=_ref7.key,passwordRequestHandler=_ref7.passwordRequestHandler;payload=Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_5__["CreateMaxPayloadFromAnyObject"])({object:response.item});_context7.next=4;return this.protocolService.payloadByDecryptingPayload({payload:payload,key:key});case 4:decryptedPayload=_context7.sent;if(decryptedPayload.errorDecrypting){_context7.next=7;break;}return _context7.abrupt("return",decryptedPayload);case 7:if(response.auth_params){_context7.next=10;break;}/** - * In some cases revisions were missing auth params. - * Instruct the user to email us to get this remedied. - */this.alertService.alert({text:"We were unable to decrypt this revision using your current keys, \n and this revision is missing metadata that would allow us to try different \n keys to decrypt it. This can likely be fixed with some manual intervention. \n Please email hello@standardnotes.org for assistance."});return _context7.abrupt("return",null);case 10:/* Try previous passwords */triedPasswords=[];_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context7.prev=14;_iterator2=this.previousPasswords[Symbol.iterator]();case 16:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context7.next=34;break;}passwordCandidate=_step2.value;if(!triedPasswords.includes(passwordCandidate)){_context7.next=20;break;}return _context7.abrupt("continue",31);case 20:triedPasswords.push(passwordCandidate);_context7.next=23;return this.protocolService.computeRootKey({password:passwordCandidate,keyParams:response.auth_params});case 23:_key=_context7.sent;if(_key){_context7.next=26;break;}return _context7.abrupt("continue",31);case 26:_context7.next=28;return this.payloadByDecryptingResponse({response:response,key:_key,passwordRequestHandler:passwordRequestHandler});case 28:nestedResponse=_context7.sent;if(!nestedResponse){_context7.next=31;break;}return _context7.abrupt("return",nestedResponse);case 31:_iteratorNormalCompletion2=true;_context7.next=16;break;case 34:_context7.next=40;break;case 36:_context7.prev=36;_context7.t0=_context7["catch"](14);_didIteratorError2=true;_iteratorError2=_context7.t0;case 40:_context7.prev=40;_context7.prev=41;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 43:_context7.prev=43;if(!_didIteratorError2){_context7.next=46;break;}throw _iteratorError2;case 46:return _context7.finish(43);case 47:return _context7.finish(40);case 48:_context7.next=50;return passwordRequestHandler();case 50:password=_context7.sent;this.previousPasswords.push(password);return _context7.abrupt("return",this.payloadByDecryptingResponse({response:response,key:key,passwordRequestHandler:passwordRequestHandler}));case 53:case"end":return _context7.stop();}}},_callee7,this,[[14,36,40,48],[41,,43,47]]);}));function payloadByDecryptingResponse(_x8){return _payloadByDecryptingResponse.apply(this,arguments);}return payloadByDecryptingResponse;}()},{key:"handlePostAction",value:function(){var _handlePostAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(action,item){var _this5=this;var decrypted,itemParams,params;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:decrypted=action.access_type==='decrypted';_context8.next=3;return this.outgoingPayloadForItem({item:item,decrypted:decrypted});case 3:itemParams=_context8.sent;params={items:[itemParams]};return _context8.abrupt("return",this.httpService.postAbsolute({url:action.url,params:params}).then(function(response){action.error=false;return{response:response};}).catch(function(response){action.error=true;console.error('Action error response:',response);_this5.alertService.alert({text:'An issue occurred while processing this action. Please try again.'});return{response:response};}));case 6:case"end":return _context8.stop();}}},_callee8,this);}));function handlePostAction(_x9,_x10){return _handlePostAction.apply(this,arguments);}return handlePostAction;}()},{key:"handleShowAction",value:function(){var _handleShowAction=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(action){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:this.deviceInterface.openUrl(action.url);return _context9.abrupt("return",{response:null});case 2:case"end":return _context9.stop();}}},_callee9,this);}));function handleShowAction(_x11){return _handleShowAction.apply(this,arguments);}return handleShowAction;}()},{key:"outgoingPayloadForItem",value:function(){var _outgoingPayloadForItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(_ref8){var item,_ref8$decrypted,decrypted,intent;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:item=_ref8.item,_ref8$decrypted=_ref8.decrypted,decrypted=_ref8$decrypted===void 0?false:_ref8$decrypted;intent=decrypted?_Protocol__WEBPACK_IMPORTED_MODULE_2__["EncryptionIntents"].FileDecrypted:_Protocol__WEBPACK_IMPORTED_MODULE_2__["EncryptionIntents"].FileEncrypted;return _context10.abrupt("return",this.protocolService.payloadByEncryptingPayload({payload:item.payloadRepresentation(),intent:intent}));case 3:case"end":return _context10.stop();}}},_callee10,this);}));function outgoingPayloadForItem(_x12){return _outgoingPayloadForItem.apply(this,arguments);}return outgoingPayloadForItem;}()}]);return SNActionsService;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_3__["PureService"]);/***/},/***/"./lib/services/alert_service.js":/*!***************************************!*\ - !*** ./lib/services/alert_service.js ***! - \***************************************/ /*! exports provided: SNAlertService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNAlertService",function(){return SNAlertService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0){url=this.urlForUrlAndParams(url,params);}request.open(verb,url,true);request.setRequestHeader('Content-type','application/json');if(authentication){request.setRequestHeader('Authorization','Bearer '+authentication);}return request;}},{key:"runRequest",value:function(){var _runRequest=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(_ref6){var _this=this;var request,verb,params;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:request=_ref6.request,verb=_ref6.verb,params=_ref6.params;return _context5.abrupt("return",new Promise(function(resolve,reject){request.onreadystatechange=function(){_this.stateChangeHandlerForRequest(request,resolve,reject);};if(verb===HTTP_VERB_POST||verb===HTTP_VERB_PATCH){request.send(JSON.stringify(params));}else{request.send();}}));case 2:case"end":return _context5.stop();}}},_callee5);}));function runRequest(_x5){return _runRequest.apply(this,arguments);}return runRequest;}()},{key:"stateChangeHandlerForRequest",value:function stateChangeHandlerForRequest(request,resolve,reject){if(request.readyState!==REQUEST_READY_STATE_COMPLETED){return;}var response=request.responseText;if(response){try{response=JSON.parse(response);// eslint-disable-next-line no-empty -}catch(e){}}if(!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isObject"])(response)){response={};}var httpStatus=request.status;if(httpStatus>=HTTP_STATUS_MIN_SUCCESS&&httpStatus<=HTTP_STATUS_MAX_SUCCESS){response.status=httpStatus;resolve(response);}else{console.error('Request error:',response);if(Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isString"])(response)){response={error:{message:response}};}if(!response.error){response.error={status:httpStatus};}response.status=httpStatus;reject(response);}}},{key:"urlForUrlAndParams",value:function urlForUrlAndParams(url,params){var keyValueString=Object.keys(params).map(function(key){return key+'='+encodeURIComponent(params[key]);}).join('&');if(url.includes('?')){return url+'&'+keyValueString;}else{return url+'?'+keyValueString;}}}]);return SNHttpService;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/api/keys.js":/*!**********************************!*\ - !*** ./lib/services/api/keys.js ***! - \**********************************/ /*! exports provided: ApiEndpointParams */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ApiEndpointParams",function(){return ApiEndpointParams;});var ApiEndpointParams={LastSyncToken:'sync_token',PaginationToken:'cursor_token',IntegrityCheck:'compute_integrity',IntegrityResult:'integrity_hash',SyncDlLimit:'limit',SyncPayloads:'items',ApiVersion:'api'};/***/},/***/"./lib/services/api/messages.js":/*!**************************************!*\ - !*** ./lib/services/api/messages.js ***! - \**************************************/ /*! exports provided: API_MESSAGE_GENERIC_INVALID_LOGIN, API_MESSAGE_GENERIC_REGISTRATION_FAIL, API_MESSAGE_GENERIC_CHANGE_PW_FAIL, API_MESSAGE_GENERIC_SYNC_FAIL, API_MESSAGE_REGISTRATION_IN_PROGRESS, API_MESSAGE_LOGIN_IN_PROGRESS, API_MESSAGE_CHANGE_PW_IN_PROGRESS, API_MESSAGE_FALLBACK_LOGIN_FAIL, UNSUPPORTED_PROTOCOL_VERSION, EXPIRED_PROTOCOL_VERSION, OUTDATED_PROTOCOL_VERSION, UNSUPPORTED_KEY_DERIVATION, INVALID_PASSWORD_COST, OUTDATED_PROTOCOL_ALERT_TITLE, OUTDATED_PROTOCOL_ALERT_IGNORE, InsufficientPasswordMessage, StrictSignInFailed */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_GENERIC_INVALID_LOGIN",function(){return API_MESSAGE_GENERIC_INVALID_LOGIN;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_GENERIC_REGISTRATION_FAIL",function(){return API_MESSAGE_GENERIC_REGISTRATION_FAIL;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_GENERIC_CHANGE_PW_FAIL",function(){return API_MESSAGE_GENERIC_CHANGE_PW_FAIL;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_GENERIC_SYNC_FAIL",function(){return API_MESSAGE_GENERIC_SYNC_FAIL;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_REGISTRATION_IN_PROGRESS",function(){return API_MESSAGE_REGISTRATION_IN_PROGRESS;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_LOGIN_IN_PROGRESS",function(){return API_MESSAGE_LOGIN_IN_PROGRESS;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_CHANGE_PW_IN_PROGRESS",function(){return API_MESSAGE_CHANGE_PW_IN_PROGRESS;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"API_MESSAGE_FALLBACK_LOGIN_FAIL",function(){return API_MESSAGE_FALLBACK_LOGIN_FAIL;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"UNSUPPORTED_PROTOCOL_VERSION",function(){return UNSUPPORTED_PROTOCOL_VERSION;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"EXPIRED_PROTOCOL_VERSION",function(){return EXPIRED_PROTOCOL_VERSION;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"OUTDATED_PROTOCOL_VERSION",function(){return OUTDATED_PROTOCOL_VERSION;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"UNSUPPORTED_KEY_DERIVATION",function(){return UNSUPPORTED_KEY_DERIVATION;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"INVALID_PASSWORD_COST",function(){return INVALID_PASSWORD_COST;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"OUTDATED_PROTOCOL_ALERT_TITLE",function(){return OUTDATED_PROTOCOL_ALERT_TITLE;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"OUTDATED_PROTOCOL_ALERT_IGNORE",function(){return OUTDATED_PROTOCOL_ALERT_IGNORE;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"InsufficientPasswordMessage",function(){return InsufficientPasswordMessage;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"StrictSignInFailed",function(){return StrictSignInFailed;});var API_MESSAGE_GENERIC_INVALID_LOGIN='A server error occurred while trying to sign in. Please try again.';var API_MESSAGE_GENERIC_REGISTRATION_FAIL='A server error occurred while trying to register. Please try again.';var API_MESSAGE_GENERIC_CHANGE_PW_FAIL="Something went wrong while changing your password.\n Your password was not changed. Please try again.";var API_MESSAGE_GENERIC_SYNC_FAIL='Could not connect to server.';var API_MESSAGE_REGISTRATION_IN_PROGRESS='An existing registration request is already in progress.';var API_MESSAGE_LOGIN_IN_PROGRESS='An existing sign in request is already in progress.';var API_MESSAGE_CHANGE_PW_IN_PROGRESS='An existing change password request is already in progress.';var API_MESSAGE_FALLBACK_LOGIN_FAIL='Invalid email or password.';var UNSUPPORTED_PROTOCOL_VERSION="This version of the application does not support your\n newer account type. Please upgrade to the latest version\n of Standard Notes to sign in.";var EXPIRED_PROTOCOL_VERSION="The protocol version associated with your account is\n outdated and no longer supported by this application.\n Please visit standardnotes.org/help/security for more\n information.";var OUTDATED_PROTOCOL_VERSION="The encryption version for your account is outdated and\n requires upgrade. You may proceed with login, but are\n advised to perform a security update using the web or\n desktop application. Please visit\n standardnotes.org/help/security for more information.";var UNSUPPORTED_KEY_DERIVATION="Your account was created on a platform with higher security\n capabilities than this browser supports. If we attempted\n to generate your login keys here, it would take hours. Please\n use a browser with more up to date security capabilities,\n like Google Chrome or Firefox, to log in.";var INVALID_PASSWORD_COST="Unable to login due to insecure password parameters.\n Please visit standardnotes.org/help/security for\n more information.";var OUTDATED_PROTOCOL_ALERT_TITLE='Update Recommended';var OUTDATED_PROTOCOL_ALERT_IGNORE='Sign In';function InsufficientPasswordMessage(minimum){return"\n Your password must be at least ".concat(minimum," characters in length.\n For your security, please choose a longer password or,\n ideally, a passphrase, and try again.\n ");}function StrictSignInFailed(current,latest){return"\n Strict Sign In has refused the server's sign-in parameters.\n The latest account version is ".concat(latest,", but the server is reporting a \n version of ").concat(current," for your account. If you'd like to proceed\n with sign in anyway, please disable Strict Sign In and try again.\n ");}/***/},/***/"./lib/services/api/session.js":/*!*************************************!*\ - !*** ./lib/services/api/session.js ***! - \*************************************/ /*! exports provided: Session */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Session",function(){return Session;});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i} values - */},{key:"submitValues",value:function submitValues(values){this.submitValuesFn(values);}/** - * Called by client to submit manual valid status for value - * @access public - * @param {ChallengeValue} value - * @param {boolean} valid - * @param {object} [artifacts] - */},{key:"setValidationStatus",value:function setValidationStatus(value,valid,artifacts){this.setValidationStatusFn(value,valid,artifacts);}/** - * Cancels this challenge if permissible - * @access public - */},{key:"cancel",value:function cancel(){this.cancelFn();}}]);return ChallengeOrchestrator;}();/** The client gives this object to the orchestrator */var ChallengeClient=/*#__PURE__*/function(){/** - * Signatures for these functions match exactly the signatures - * of the instance methods in this class. - */function ChallengeClient(){var _ref3=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},onValidValue=_ref3.onValidValue,onInvalidValue=_ref3.onInvalidValue,onComplete=_ref3.onComplete,onCancel=_ref3.onCancel;_classCallCheck(this,ChallengeClient);this.onValidValueFn=onValidValue;this.onInvalidValueFn=onInvalidValue;this.onCompleteFn=onComplete;this.onCancelFn=onCancel;}/** - * Called by the orchestrator to let the client know of a valid value - * @access public - * @param {ChallengeValue} value - */_createClass(ChallengeClient,[{key:"onValidValue",value:function onValidValue(value){this.onValidValueFn&&this.onValidValueFn(value);}/** - * Called by the orchestrator to let the client know of an invalid value - * @access public - * @param {ChallengeValue} value - */},{key:"onInvalidValue",value:function onInvalidValue(value){this.onInvalidValueFn&&this.onInvalidValueFn(value);}/** - * Called by the orchestrator to let the client know the challenge has completed - * successfully. - * @access public - */},{key:"onComplete",value:function onComplete(){this.onCompleteFn&&this.onCompleteFn();}/** - * Called by the orchestrator to let the client know the challenge was canceled - * @access public - */},{key:"onCancel",value:function onCancel(){this.onCancelFn&&this.onCancelFn();}}]);return ChallengeClient;}();var ChallengeOperation=/*#__PURE__*/function(){function ChallengeOperation(challenge,validate){_classCallCheck(this,ChallengeOperation);this.challenge=challenge;this.validate=validate;this.validValues=[];this.invalidValues=[];this.artifacts={};/** Create default client in case client does not set callbacks */this.client=new ChallengeClient();}/** - * @access public - * Sets the promise resolve function to be called - * when this challenge completes or cancels - * @param {function} resolve - */_createClass(ChallengeOperation,[{key:"setResolver",value:function setResolver(resolve){this.resolve=resolve;}/** - * @access public - * Mark this challenge as complete, triggering the resolve function, - * as well as notifying the client - */},{key:"complete",value:function complete(response){if(!response){response=new _Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeResponse"](this.challenge,this.validValues,this.artifacts);}this.resolve(response);this.getClient().onComplete();}/** - * @access public - * Mark this challenge as canceled, triggering the resolve function with a null response, - * as well as notifying the client. - */},{key:"cancel",value:function cancel(){this.resolve(null);this.getClient().onCancel();}/** - * @access public - * @returns {boolean} Returns true if the challenge has received all valid responses - */},{key:"isFinished",value:function isFinished(){return this.validValues.length===this.challenge.types.length;}/** - * @access public - * Called by challenge orchestrator to set up the orchestrator object. - * This object will be used by the client to communicate with us. - */},{key:"setOrchestratorFunctions",value:function setOrchestratorFunctions(_ref4){var setClientFunctions=_ref4.setClientFunctions,setValidationStatus=_ref4.setValidationStatus,submitValues=_ref4.submitValues,cancel=_ref4.cancel;this.orchestrator=new ChallengeOrchestrator({setClientFunctions:setClientFunctions,setValidationStatus:setValidationStatus,submitValues:submitValues,cancel:cancel});}/** @access private */},{key:"getClient",value:function getClient(){return this.client;}/** @access public */},{key:"getOrchestrator",value:function getOrchestrator(){return this.orchestrator;}/** - * @access public - * @param {ChallengeClient} client - */},{key:"setClient",value:function setClient(client){this.client=client;}/** - * Sets the values validation status, as well as handles subsequent actions, - * such as completing the operation if all valid values are supplied, as well as - * notifying the client of this new value's validation status. - * @access public - * @param {ChallengeValue} value - * @param {boolean} valid - * @param {object} artifacts - */},{key:"setValueStatus",value:function setValueStatus(value,valid,artifacts){var valuesArray=valid?this.validValues:this.invalidValues;var matching=valuesArray.find(function(v){return v.type===value.type;});if(matching){Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_4__["removeFromArray"])(valuesArray,matching);}valuesArray.push(value);if(valid){this.validValues=valuesArray;}else{this.invalidValues=valuesArray;}Object.assign(this.artifacts,artifacts);if(this.isFinished()){this.complete();}else{if(valid){this.getClient().onValidValue(value);}else{this.getClient().onInvalidValue(value);}}}}]);return ChallengeOperation;}();var ChallengeService=/*#__PURE__*/function(_PureService){_inherits(ChallengeService,_PureService);function ChallengeService(_ref5){var _this;var storageService=_ref5.storageService,keyManager=_ref5.keyManager,protocolService=_ref5.protocolService;_classCallCheck(this,ChallengeService);_this=_possibleConstructorReturn(this,_getPrototypeOf(ChallengeService).call(this));_this.storageService=storageService;_this.keyManager=keyManager;_this.protocolService=protocolService;_this.challengeOperations={};return _this;}/** @override */_createClass(ChallengeService,[{key:"deinit",value:function deinit(){this.storageService=null;this.keyManager=null;this.protocolService=null;this.challengeHandler=null;_get(_getPrototypeOf(ChallengeService.prototype),"deinit",this).call(this);}/** @access public */},{key:"setChallengeHandler",value:function setChallengeHandler(handler){this.challengeHandler=handler;}/** - * @access public - * @param {Challenge} challenge - * @param {boolean} validate - * @param {object} orchestratorFill - An empty object which will be populated with - * a .orchestrator property. The caller uses this funtion to communicate with us - * via a selective API. - */},{key:"promptForChallengeResponse",value:function(){var _promptForChallengeResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(challenge){var _this2=this;var validate,orchestratorFill,operation,isNew,_args=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:validate=_args.length>1&&_args[1]!==undefined?_args[1]:true;orchestratorFill=_args.length>2?_args[2]:undefined;operation=this.getChallengeOperation(challenge);isNew=!operation;if(!operation){operation=this.createChallengeOperation(challenge,validate);}if(orchestratorFill){orchestratorFill.orchestrator=operation.getOrchestrator();}return _context.abrupt("return",new Promise(function(resolve){operation.setResolver(resolve);if(isNew){_this2.challengeHandler.receiveChallenge(challenge,operation.getOrchestrator());}}));case 7:case"end":return _context.stop();}}},_callee,this);}));function promptForChallengeResponse(_x){return _promptForChallengeResponse.apply(this,arguments);}return promptForChallengeResponse;}()/** - * @access public - * @returns {object} {valid, artifacts} - */},{key:"validateChallengeValue",value:function(){var _validateChallengeValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(value){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!(value.type===_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeType"].LocalPasscode)){_context2.next=4;break;}return _context2.abrupt("return",this.keyManager.validatePasscode(value.value));case 4:if(!(value.type===_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeType"].AccountPassword)){_context2.next=8;break;}return _context2.abrupt("return",this.keyManager.validateAccountPassword(value.value));case 8:if(!(value.type===_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeType"].Biometric)){_context2.next=10;break;}return _context2.abrupt("return",{valid:value.value===true});case 10:throw"Cannot validate challenge type ".concat(value.type);case 11:case"end":return _context2.stop();}}},_callee2,this);}));function validateChallengeValue(_x2){return _validateChallengeValue.apply(this,arguments);}return validateChallengeValue;}()/** - * @access public - * @returns {Challenge} - */},{key:"getLaunchChallenge",value:function(){var _getLaunchChallenge=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(){var types,hasPasscode,biometricPrefs,biometricEnabled;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:types=[];_context3.next=3;return this.keyManager.hasPasscode();case 3:hasPasscode=_context3.sent;if(hasPasscode){types.push(_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeType"].LocalPasscode);}_context3.next=7;return this.storageService.getValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].BiometricPrefs,_Services_storage_service__WEBPACK_IMPORTED_MODULE_3__["StorageValueModes"].Nonwrapped);case 7:biometricPrefs=_context3.sent;biometricEnabled=biometricPrefs&&biometricPrefs.enabled;if(biometricEnabled){types.push(_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeType"].Biometric);}if(!(types.length>0)){_context3.next=14;break;}return _context3.abrupt("return",new _Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["Challenge"](types,_Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeReason"].ApplicationUnlock));case 14:return _context3.abrupt("return",null);case 15:case"end":return _context3.stop();}}},_callee3,this);}));function getLaunchChallenge(){return _getLaunchChallenge.apply(this,arguments);}return getLaunchChallenge;}()/** - * @access public - * @returns {boolean} - */},{key:"isPasscodeLocked",value:function isPasscodeLocked(){return this.keyManager.rootKeyNeedsUnwrapping();}/** @access public */},{key:"enableBiometrics",value:function(){var _enableBiometrics=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return this.storageService.setValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_2__["StorageKeys"].BiometricPrefs,{enabled:true},_Services_storage_service__WEBPACK_IMPORTED_MODULE_3__["StorageValueModes"].Nonwrapped);case 2:case"end":return _context4.stop();}}},_callee4,this);}));function enableBiometrics(){return _enableBiometrics.apply(this,arguments);}return enableBiometrics;}()/** @access private */},{key:"createChallengeOperation",value:function createChallengeOperation(challenge,validate){var _this3=this;var operation=new ChallengeOperation(challenge,validate);operation.setOrchestratorFunctions({setClientFunctions:function setClientFunctions(_ref6){var onValidValue=_ref6.onValidValue,onInvalidValue=_ref6.onInvalidValue,onComplete=_ref6.onComplete,onCancel=_ref6.onCancel;var client=new ChallengeClient({onValidValue:onValidValue,onInvalidValue:onInvalidValue,onComplete:onComplete,onCancel:onCancel});operation.setClient(client);},submitValues:function submitValues(values){_this3.submitValuesForChallenge(challenge,values);},setValidationStatus:function setValidationStatus(value,valid,artifacts){_this3.setValidationStatusForChallenge(challenge,value,valid,artifacts);},cancel:function cancel(){_this3.cancelChallenge(challenge);}});this.setChallengeOperation(operation);return operation;}/** @access private */},{key:"getChallengeOperation",value:function getChallengeOperation(challenge){return this.challengeOperations[challenge.id];}/** @access private */},{key:"setChallengeOperation",value:function setChallengeOperation(operation){this.challengeOperations[operation.challenge.id]=operation;}/** @access private */},{key:"deleteChallengeOperation",value:function deleteChallengeOperation(operation){delete this.challengeOperations[operation.challenge.id];}/** @access private */},{key:"cancelChallenge",value:function cancelChallenge(challenge){var operation=this.challengeOperations[challenge.id];operation.cancel();this.deleteChallengeOperation(operation);}/** @access private */},{key:"submitValuesForChallenge",value:function(){var _submitValuesForChallenge=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(challenge,values){var operation,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,value,_ref7,valid,artifacts,response;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:operation=this.getChallengeOperation(challenge);if(!operation.validate){_context5.next=34;break;}_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context5.prev=5;_iterator=values[Symbol.iterator]();case 7:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context5.next=18;break;}value=_step.value;_context5.next=11;return this.validateChallengeValue(value);case 11:_ref7=_context5.sent;valid=_ref7.valid;artifacts=_ref7.artifacts;this.setValidationStatusForChallenge(challenge,value,valid,artifacts);case 15:_iteratorNormalCompletion=true;_context5.next=7;break;case 18:_context5.next=24;break;case 20:_context5.prev=20;_context5.t0=_context5["catch"](5);_didIteratorError=true;_iteratorError=_context5.t0;case 24:_context5.prev=24;_context5.prev=25;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 27:_context5.prev=27;if(!_didIteratorError){_context5.next=30;break;}throw _iteratorError;case 30:return _context5.finish(27);case 31:return _context5.finish(24);case 32:_context5.next=36;break;case 34:response=new _Lib_challenges__WEBPACK_IMPORTED_MODULE_5__["ChallengeResponse"](challenge,values,null);operation.complete(response);case 36:case"end":return _context5.stop();}}},_callee5,this,[[5,20,24,32],[25,,27,31]]);}));function submitValuesForChallenge(_x3,_x4){return _submitValuesForChallenge.apply(this,arguments);}return submitValuesForChallenge;}()/** @access private */},{key:"setValidationStatusForChallenge",value:function setValidationStatusForChallenge(challenge,value,valid,artifacts){var operation=this.getChallengeOperation(challenge);operation.setValueStatus(value,valid,artifacts);if(operation.isFinished()){this.deleteChallengeOperation(operation);}}}]);return ChallengeService;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/component_manager.js":/*!*******************************************!*\ - !*** ./lib/services/component_manager.js ***! - \*******************************************/ /*! exports provided: ComponentActions, SNComponentManager */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ComponentActions",function(){return ComponentActions;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNComponentManager",function(){return SNComponentManager;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var lodash_find__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! lodash/find */"./node_modules/lodash/find.js");/* harmony import */var lodash_find__WEBPACK_IMPORTED_MODULE_1___default=/*#__PURE__*/__webpack_require__.n(lodash_find__WEBPACK_IMPORTED_MODULE_1__);/* harmony import */var lodash_uniq__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! lodash/uniq */"./node_modules/lodash/uniq.js");/* harmony import */var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default=/*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);/* harmony import */var lodash_remove__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! lodash/remove */"./node_modules/lodash/remove.js");/* harmony import */var lodash_remove__WEBPACK_IMPORTED_MODULE_3___default=/*#__PURE__*/__webpack_require__.n(lodash_remove__WEBPACK_IMPORTED_MODULE_3__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Models_app_component__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Models/app/component */"./lib/models/app/component.js");/* harmony import */var _Lib_uuid__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! @Lib/uuid */"./lib/uuid.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Lib_platforms__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(/*! @Lib/platforms */"./lib/platforms.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&source!==_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].RemoteSaved){/* Ensure any component in our data is installed by the system */if(_this2.isDesktop){_this2.desktopManager.syncComponentsInstallation(syncedComponents);}}_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context.prev=5;_iterator2=syncedComponents[Symbol.iterator]();case 7:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context.next=21;break;}component=_step2.value;activeComponent=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(_this2.activeComponents,{uuid:component.uuid});if(!(component.active&&!component.deleted&&!activeComponent)){_context.next=15;break;}_context.next=13;return _this2.activateComponent(component);case 13:_context.next=18;break;case 15:if(!(!component.active&&activeComponent)){_context.next=18;break;}_context.next=18;return _this2.deactivateComponent(component);case 18:_iteratorNormalCompletion2=true;_context.next=7;break;case 21:_context.next=27;break;case 23:_context.prev=23;_context.t0=_context["catch"](5);_didIteratorError2=true;_iteratorError2=_context.t0;case 27:_context.prev=27;_context.prev=28;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 30:_context.prev=30;if(!_didIteratorError2){_context.next=33;break;}throw _iteratorError2;case 33:return _context.finish(30);case 34:return _context.finish(27);case 35:/* LocalChanged is not interesting to send to observers. For local changes, - we wait until the item is set to dirty before notifying observers, where the mapping - source would be PayloadSources.LocalDirtied */if(source!==_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].LocalChanged){_this2.notifyStreamObservers(allItems,source,sourceKey);}case 36:case"end":return _context.stop();}}},_callee,null,[[5,23,27,35],[28,,30,34]]);}));return function(_x,_x2,_x3,_x4,_x5){return _ref2.apply(this,arguments);};}());}},{key:"notifyStreamObservers",value:function notifyStreamObservers(allItems,source,sourceKey){var _this3=this;var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{var _loop2=function _loop2(){var observer=_step3.value;if(sourceKey&&sourceKey===observer.component.uuid){/* Don't notify source of change, as it is the originator, doesn't need duplicate event. */return"continue";}var relevantItems=allItems.filter(function(item){return observer.contentTypes.indexOf(item.content_type)!==-1;});if(relevantItems.length===0){return"continue";}var requiredPermissions=[{name:ComponentActions.StreamItems,content_types:observer.contentTypes.sort()}];_this3.runWithPermissions(observer.component,requiredPermissions,function(){_this3.sendItemsInReply(observer.component,relevantItems,observer.originalMessage);});};for(var _iterator3=this.streamObservers[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var _ret2=_loop2();if(_ret2==="continue")continue;}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return!=null){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}var requiredContextPermissions=[{name:ComponentActions.StreamContextItem}];var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{var _loop3=function _loop3(){var observer=_step4.value;if(sourceKey&&sourceKey===observer.component.uuid){/* Don't notify source of change, as it is the originator, doesn't need duplicate event. */return"continue";}var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=_this3.handlers[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var handler=_step5.value;if(!handler.areas.includes(observer.component.area)&&!handler.areas.includes('*')){continue;}if(handler.contextRequestHandler){var itemInContext=handler.contextRequestHandler(observer.component);if(itemInContext){var _ret4=function(){var matchingItem=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(allItems,{uuid:itemInContext.uuid});if(matchingItem){if(matchingItem.deleted){return"continue";}_this3.runWithPermissions(observer.component,requiredContextPermissions,function(){_this3.sendContextItemInReply(observer.component,matchingItem,observer.originalMessage,source);});}}();if(_ret4==="continue")continue;}}}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return!=null){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}};for(var _iterator4=this.contextStreamObservers[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var _ret3=_loop3();if(_ret3==="continue")continue;}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return!=null){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}}},{key:"isNativeExtension",value:function isNativeExtension(component){var nativeUrls=[window._extensions_manager_location,window._batch_manager_location];var hostedUrl=component.content.hosted_url;var localUrl=component.content.local_url&&component.content.local_url.replace(DESKTOP_URL_PREFIX,'');return nativeUrls.includes(hostedUrl)||nativeUrls.includes(localUrl);}},{key:"configureForNonMobileUsage",value:function configureForNonMobileUsage(){window.addEventListener?window.addEventListener('focus',this.detectFocusChange,true):window.attachEvent('onfocusout',this.detectFocusChange);window.addEventListener?window.addEventListener('blur',this.detectFocusChange,true):window.attachEvent('onblur',this.detectFocusChange);/* On mobile, events listeners are handled by a respective component */window.addEventListener('message',this.onWindowMessage);}},{key:"configureForDesktop",value:function configureForDesktop(){var _this4=this;this.desktopManager.registerUpdateObserver(function(component){/* Reload theme if active */if(component.active&&component.isTheme()){_this4.postActiveThemesToAllComponents();}});}},{key:"postActiveThemesToAllComponents",value:function postActiveThemesToAllComponents(){var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=this.components[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var component=_step6.value;/* Skip over components that are themes themselves, - or components that are not active, or components that don't have a window */if(component.isTheme()||!component.active||!component.window){continue;}this.postActiveThemesToComponent(component);}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally{try{if(!_iteratorNormalCompletion6&&_iterator6.return!=null){_iterator6.return();}}finally{if(_didIteratorError6){throw _iteratorError6;}}}}},{key:"getActiveThemes",value:function getActiveThemes(){return this.componentsForArea(_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Themes).filter(function(theme){return theme.active;});}},{key:"urlsForActiveThemes",value:function urlsForActiveThemes(){var _this5=this;var themes=this.getActiveThemes();return themes.map(function(theme){return _this5.urlForComponent(theme);});}},{key:"postActiveThemesToComponent",value:function postActiveThemesToComponent(component){var urls=this.urlsForActiveThemes();var data={themes:urls};this.sendMessageToComponent(component,{action:ComponentActions.ActivateThemes,data:data});}},{key:"contextItemDidChangeInArea",value:function contextItemDidChangeInArea(area){var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=this.handlers[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var handler=_step7.value;if(handler.areas.includes(area)===false&&!handler.areas.includes('*')){continue;}var observers=this.contextStreamObservers.filter(function(observer){return observer.component.area===area;});var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=observers[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var observer=_step8.value;if(handler.contextRequestHandler){var itemInContext=handler.contextRequestHandler(observer.component);if(itemInContext){this.sendContextItemInReply(observer.component,itemInContext,observer.originalMessage);}}}}catch(err){_didIteratorError8=true;_iteratorError8=err;}finally{try{if(!_iteratorNormalCompletion8&&_iterator8.return!=null){_iterator8.return();}}finally{if(_didIteratorError8){throw _iteratorError8;}}}}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally{try{if(!_iteratorNormalCompletion7&&_iterator7.return!=null){_iterator7.return();}}finally{if(_didIteratorError7){throw _iteratorError7;}}}}},{key:"setComponentHidden",value:function setComponentHidden(component,hidden){/* A hidden component will not receive messages. However, when a component is unhidden, - * we need to send it any items it may have registered streaming for. */if(hidden){component.hidden=true;}else if(component.hidden){component.hidden=false;var contextObserver=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(this.contextStreamObservers,{identifier:component.uuid});if(contextObserver){this.handleStreamContextItemMessage(component,contextObserver.originalMessage);}var streamObserver=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(this.streamObservers,{identifier:component.uuid});if(streamObserver){this.handleStreamItemsMessage(component,streamObserver.originalMessage);}}}},{key:"jsonForItem",value:function jsonForItem(item,component,source){var params={uuid:item.uuid,content_type:item.content_type,created_at:item.created_at,updated_at:item.updated_at,deleted:item.deleted};params.content=item.collapseContent();params.clientData=item.getDomainDataItem(component.getClientDataKey(),SNComponentManager.ClientDataDomain)||{};/** isMetadataUpdate implies that the extension should make reference of updated - * metadata, but not update content values as they may be stale relative to what the - * extension currently has. Changes are always metadata updates if the mapping source - * is PayloadSources.RemoteSaved || source === PayloadSources.LocalSaved. */if(source&&(source===_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].RemoteSaved||source===_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].LocalSaved)){params.isMetadataUpdate=true;}this.removePrivatePropertiesFromResponseItems([params],component);return params;}},{key:"sendItemsInReply",value:function sendItemsInReply(component,items,message,source){var _this6=this;this.log('Web|componentManager|sendItemsInReply',component,items,message);var response={items:{}};var mapped=items.map(function(item){return _this6.jsonForItem(item,component,source);});response.items=mapped;this.replyToMessage(component,message,response);}},{key:"sendContextItemInReply",value:function sendContextItemInReply(component,item,originalMessage,source){this.log('Web|componentManager|sendContextItemInReply',component,item,originalMessage);var response={item:this.jsonForItem(item,component,source)};this.replyToMessage(component,originalMessage,response);}},{key:"replyToMessage",value:function replyToMessage(component,originalMessage,replyData){var reply={action:ComponentActions.Reply,original:originalMessage,data:replyData};this.sendMessageToComponent(component,reply);}},{key:"sendMessageToComponent",value:function sendMessageToComponent(component,message){var permissibleActionsWhileHidden=[ComponentActions.ComponentRegistered,ComponentActions.ActivateThemes];if(component.hidden&&!permissibleActionsWhileHidden.includes(message.action)){this.log('Component disabled for current item, ignoring messages.',component.name);return;}this.log('Web|sendMessageToComponent',component,message);var origin=this.urlForComponent(component);if(!origin.startsWith('http')&&!origin.startsWith('file')){/* Native extension running in web, prefix current host */origin=window.location.href+origin;}if(!component.window){this.alertService.alert({text:"Standard Notes is trying to communicate with ".concat(component.name,", \n but an error is occurring. Please restart this extension and try again.")});}/* Mobile messaging requires json */if(this.isMobile){message=JSON.stringify(message);}component.window.postMessage(message,origin);}},{key:"componentsForArea",value:function componentsForArea(area){return this.components.filter(function(component){return component.area===area;});}},{key:"urlForComponent",value:function urlForComponent(component){/* offlineOnly is available only on desktop, and not on web or mobile. */if(component.offlineOnly&&!this.isDesktop){return null;}if(component.offlineOnly||this.isDesktop&&component.local_url){return component.local_url&&component.local_url.replace(DESKTOP_URL_PREFIX,this.desktopManager.getExtServerHost());}else{var url=component.hosted_url||component.legacy_url;if(this.isMobile){var localReplacement=this.platform===_Lib_platforms__WEBPACK_IMPORTED_MODULE_10__["Platforms"].Ios?LOCAL_HOST:ANDROID_LOCAL_HOST;url=url.replace(LOCAL_HOST,localReplacement).replace(CUSTOM_LOCAL_HOST,localReplacement);}return url;}}},{key:"componentForUrl",value:function componentForUrl(url){return this.components.filter(function(component){return component.hosted_url===url||component.legacy_url===url;})[0];}},{key:"componentForSessionKey",value:function componentForSessionKey(key){var component=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(this.components,{sessionKey:key});if(!component){var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=this.handlers[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var handler=_step9.value;if(handler.componentForSessionKeyHandler){component=handler.componentForSessionKeyHandler(key);if(component){break;}}}}catch(err){_didIteratorError9=true;_iteratorError9=err;}finally{try{if(!_iteratorNormalCompletion9&&_iterator9.return!=null){_iterator9.return();}}finally{if(_didIteratorError9){throw _iteratorError9;}}}}return component;}},{key:"handleMessage",value:function handleMessage(component,message){var _this7=this;if(!component){this.log('Component not defined for message, returning',message);this.alertService.alert({text:'An extension is trying to communicate with Standard Notes,'+'but there is an error establishing a bridge. Please restart the app and try again.'});return;}var readwriteActions=[ComponentActions.SaveItems,ComponentActions.AssociateItem,ComponentActions.DeassociateItem,ComponentActions.CreateItem,ComponentActions.CreateItems,ComponentActions.DeleteItems,ComponentActions.SetComponentData];if(component.readonly&&readwriteActions.includes(message.action)){this.alertService.alert({text:"The extension ".concat(component.name," is trying to save, but it is in a locked state and cannot accept changes.")});return;}if(message.action===ComponentActions.StreamItems){this.handleStreamItemsMessage(component,message);}else if(message.action===ComponentActions.StreamContextItem){this.handleStreamContextItemMessage(component,message);}else if(message.action===ComponentActions.SetComponentData){this.handleSetComponentDataMessage(component,message);}else if(message.action===ComponentActions.DeleteItems){this.handleDeleteItemsMessage(component,message);}else if(message.action===ComponentActions.CreateItems||message.action===ComponentActions.CreateItem){this.handleCreateItemsMessage(component,message);}else if(message.action===ComponentActions.SaveItems){this.handleSaveItemsMessage(component,message);}else if(message.action===ComponentActions.ToggleActivateComponent){var componentToToggle=this.modelManager.findItem(message.data.uuid);this.handleToggleComponentMessage(component,componentToToggle,message);}else if(message.action===ComponentActions.RequestPermissions){this.handleRequestPermissionsMessage(component,message);}else if(message.action===ComponentActions.InstallLocalComponent){this.handleInstallLocalComponentMessage(component,message);}else if(message.action===ComponentActions.DuplicateItem){this.handleDuplicateItemMessage(component,message);}var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{var _loop4=function _loop4(){var handler=_step10.value;if(handler.actionHandler&&(handler.areas.includes(component.area)||handler.areas.includes('*'))){_this7.timeout(function(){handler.actionHandler(component,message.action,message.data);});}};for(var _iterator10=this.handlers[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){_loop4();}}catch(err){_didIteratorError10=true;_iteratorError10=err;}finally{try{if(!_iteratorNormalCompletion10&&_iterator10.return!=null){_iterator10.return();}}finally{if(_didIteratorError10){throw _iteratorError10;}}}}},{key:"removePrivatePropertiesFromResponseItems",value:function removePrivatePropertiesFromResponseItems(responseItems,component){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(component){/* System extensions can bypass this step */if(this.isNativeExtension(component)){return;}}/* Don't allow component to overwrite these properties. */var privateContentProperties=['autoupdateDisabled','permissions','active'];if(options){if(options.includeUrls){privateContentProperties=privateContentProperties.concat(['url','hosted_url','local_url']);}}var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=responseItems[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var responseItem=_step11.value;/* Do not pass in actual items here, otherwise that would be destructive. - Instead, generic JS/JSON objects should be passed. */if(responseItem.isItem){console.error('Attempting to pass object. Use JSON.');continue;}var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=privateContentProperties[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var prop=_step12.value;delete responseItem.content[prop];}}catch(err){_didIteratorError12=true;_iteratorError12=err;}finally{try{if(!_iteratorNormalCompletion12&&_iterator12.return!=null){_iterator12.return();}}finally{if(_didIteratorError12){throw _iteratorError12;}}}}}catch(err){_didIteratorError11=true;_iteratorError11=err;}finally{try{if(!_iteratorNormalCompletion11&&_iterator11.return!=null){_iterator11.return();}}finally{if(_didIteratorError11){throw _iteratorError11;}}}}},{key:"handleStreamItemsMessage",value:function handleStreamItemsMessage(component,message){var _this8=this;var requiredPermissions=[{name:ComponentActions.StreamItems,content_types:message.data.content_types.sort()}];this.runWithPermissions(component,requiredPermissions,function(){if(!lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(_this8.streamObservers,{identifier:component.uuid})){/* For pushing laster as changes come in */_this8.streamObservers.push({identifier:component.uuid,component:component,originalMessage:message,contentTypes:message.data.content_types});}/* Push immediately now */var items=[];var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=message.data.content_types[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var contentType=_step13.value;items=items.concat(_this8.modelManager.validItemsForContentType(contentType));}}catch(err){_didIteratorError13=true;_iteratorError13=err;}finally{try{if(!_iteratorNormalCompletion13&&_iterator13.return!=null){_iterator13.return();}}finally{if(_didIteratorError13){throw _iteratorError13;}}}_this8.sendItemsInReply(component,items,message);});}},{key:"handleStreamContextItemMessage",value:function handleStreamContextItemMessage(component,message){var _this9=this;var requiredPermissions=[{name:ComponentActions.StreamContextItem}];this.runWithPermissions(component,requiredPermissions,function(){if(!lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(_this9.contextStreamObservers,{identifier:component.uuid})){_this9.contextStreamObservers.push({identifier:component.uuid,component:component,originalMessage:message});}var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=_this9.handlersForArea(component.area)[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var handler=_step14.value;if(handler.contextRequestHandler){var itemInContext=handler.contextRequestHandler(component);if(itemInContext){_this9.sendContextItemInReply(component,itemInContext,message);}}}}catch(err){_didIteratorError14=true;_iteratorError14=err;}finally{try{if(!_iteratorNormalCompletion14&&_iterator14.return!=null){_iterator14.return();}}finally{if(_didIteratorError14){throw _iteratorError14;}}}});}},{key:"isItemIdWithinComponentContextJurisdiction",value:function isItemIdWithinComponentContextJurisdiction(uuid,component){var itemIdsInJurisdiction=this.itemIdsInContextJurisdictionForComponent(component);return itemIdsInJurisdiction.includes(uuid);}/* Returns items that given component has context permissions for */},{key:"itemIdsInContextJurisdictionForComponent",value:function itemIdsInContextJurisdictionForComponent(component){var itemIds=[];var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=this.handlersForArea(component.area)[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var handler=_step15.value;if(handler.contextRequestHandler){var itemInContext=handler.contextRequestHandler(component);if(itemInContext){itemIds.push(itemInContext.uuid);}}}}catch(err){_didIteratorError15=true;_iteratorError15=err;}finally{try{if(!_iteratorNormalCompletion15&&_iterator15.return!=null){_iterator15.return();}}finally{if(_didIteratorError15){throw _iteratorError15;}}}return itemIds;}},{key:"handlersForArea",value:function handlersForArea(area){return this.handlers.filter(function(candidate){return candidate.areas.includes(area);});}},{key:"handleSaveItemsMessage",value:function(){var _handleSaveItemsMessage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(component,message){var _this10=this;var responseItems,requiredPermissions,itemIdsInContextJurisdiction,pendingResponseItems,_iteratorNormalCompletion16,_didIteratorError16,_iteratorError16,_iterator16,_step16,responseItem,requiredContentTypes;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:responseItems=message.data.items;requiredPermissions=[];itemIdsInContextJurisdiction=this.itemIdsInContextJurisdictionForComponent(component);/* Pending as in needed to be accounted for in permissions. */pendingResponseItems=responseItems.slice();_iteratorNormalCompletion16=true;_didIteratorError16=false;_iteratorError16=undefined;_context3.prev=7;_iterator16=responseItems.slice()[Symbol.iterator]();case 9:if(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done){_context3.next=18;break;}responseItem=_step16.value;if(!itemIdsInContextJurisdiction.includes(responseItem.uuid)){_context3.next=15;break;}requiredPermissions.push({name:ComponentActions.StreamContextItem});Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(pendingResponseItems,responseItem);/* We break because there can only be one context item */return _context3.abrupt("break",18);case 15:_iteratorNormalCompletion16=true;_context3.next=9;break;case 18:_context3.next=24;break;case 20:_context3.prev=20;_context3.t0=_context3["catch"](7);_didIteratorError16=true;_iteratorError16=_context3.t0;case 24:_context3.prev=24;_context3.prev=25;if(!_iteratorNormalCompletion16&&_iterator16.return!=null){_iterator16.return();}case 27:_context3.prev=27;if(!_didIteratorError16){_context3.next=30;break;}throw _iteratorError16;case 30:return _context3.finish(27);case 31:return _context3.finish(24);case 32:/* Check to see if additional privileges are required */if(pendingResponseItems.length>0){requiredContentTypes=lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(pendingResponseItems.map(function(i){return i.content_type;})).sort();requiredPermissions.push({name:ComponentActions.StreamItems,content_types:requiredContentTypes});}this.runWithPermissions(component,requiredPermissions,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(){var ids,items,lockedCount,_iteratorNormalCompletion17,_didIteratorError17,_iteratorError17,_iterator17,_step17,item,itemNoun,auxVerb,payloads,localItems,_iteratorNormalCompletion18,_didIteratorError18,_iteratorError18,_iterator18,_step18,responseItem,_item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_this10.removePrivatePropertiesFromResponseItems(responseItems,component,{includeUrls:true,incoming:true});/* Filter locked items */ids=responseItems.map(function(i){return i.uuid;});items=_this10.modelManager.findItems(ids);lockedCount=0;_iteratorNormalCompletion17=true;_didIteratorError17=false;_iteratorError17=undefined;_context2.prev=7;for(_iterator17=items[Symbol.iterator]();!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){item=_step17.value;if(item.locked){lodash_remove__WEBPACK_IMPORTED_MODULE_3___default()(responseItems,{uuid:item.uuid});lockedCount++;}}_context2.next=15;break;case 11:_context2.prev=11;_context2.t0=_context2["catch"](7);_didIteratorError17=true;_iteratorError17=_context2.t0;case 15:_context2.prev=15;_context2.prev=16;if(!_iteratorNormalCompletion17&&_iterator17.return!=null){_iterator17.return();}case 18:_context2.prev=18;if(!_didIteratorError17){_context2.next=21;break;}throw _iteratorError17;case 21:return _context2.finish(18);case 22:return _context2.finish(15);case 23:if(lockedCount>0){itemNoun=lockedCount===1?'item':'items';auxVerb=lockedCount===1?'is':'are';_this10.alertService.alert({title:'Items Locked',text:"".concat(lockedCount," ").concat(itemNoun," you are attempting to save ").concat(auxVerb," locked and cannot be edited.")});}payloads=responseItems.map(function(responseItem){return Object(_Payloads__WEBPACK_IMPORTED_MODULE_5__["CreateSourcedPayloadFromObject"])({object:responseItem,source:_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].ComponentRetrieved});});_context2.next=27;return _this10.modelManager.mapPayloadsToLocalItems({payloads:payloads,source:_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].ComponentRetrieved,sourceKey:component.uuid});case 27:localItems=_context2.sent;_iteratorNormalCompletion18=true;_didIteratorError18=false;_iteratorError18=undefined;_context2.prev=31;_iterator18=responseItems[Symbol.iterator]();case 33:if(_iteratorNormalCompletion18=(_step18=_iterator18.next()).done){_context2.next=46;break;}responseItem=_step18.value;_item=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(localItems,{uuid:responseItem.uuid});if(_item){_context2.next=39;break;}// An item this extension is trying to save was possibly removed locally, notify user -_this10.alertService.alert({text:"The extension ".concat(component.name," is trying to save an item with type ")+"".concat(responseItem.content_type,", but that item does not exist. Please restart this extension and try again.")});return _context2.abrupt("continue",43);case 39:if(_item.locked){_context2.next=43;break;}if(responseItem.clientData){_item.setDomainDataItem(component.getClientDataKey(),responseItem.clientData,SNComponentManager.ClientDataDomain);}_context2.next=43;return _this10.modelManager.setItemDirty(_item,true,true,_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].ComponentRetrieved,component.uuid);case 43:_iteratorNormalCompletion18=true;_context2.next=33;break;case 46:_context2.next=52;break;case 48:_context2.prev=48;_context2.t1=_context2["catch"](31);_didIteratorError18=true;_iteratorError18=_context2.t1;case 52:_context2.prev=52;_context2.prev=53;if(!_iteratorNormalCompletion18&&_iterator18.return!=null){_iterator18.return();}case 55:_context2.prev=55;if(!_didIteratorError18){_context2.next=58;break;}throw _iteratorError18;case 58:return _context2.finish(55);case 59:return _context2.finish(52);case 60:_this10.syncService.sync().then(function(){/* Allow handlers to be notified when a save begins and ends, to update the UI */var saveMessage=Object.assign({},message);saveMessage.action='save-success';_this10.replyToMessage(component,message,{});_this10.handleMessage(component,saveMessage);}).catch(function(){var saveMessage=Object.assign({},message);saveMessage.action='save-error';_this10.replyToMessage(component,message,{error:'save-error'});_this10.handleMessage(component,saveMessage);});case 61:case"end":return _context2.stop();}}},_callee2,null,[[7,11,15,23],[16,,18,22],[31,48,52,60],[53,,55,59]]);})));case 34:case"end":return _context3.stop();}}},_callee3,this,[[7,20,24,32],[25,,27,31]]);}));function handleSaveItemsMessage(_x6,_x7){return _handleSaveItemsMessage.apply(this,arguments);}return handleSaveItemsMessage;}()},{key:"handleDuplicateItemMessage",value:function handleDuplicateItemMessage(component,message){var _this11=this;var itemParams=message.data.item;var item=this.modelManager.findItem(itemParams.uuid);var requiredPermissions=[{name:ComponentActions.StreamItems,content_types:[item.content_type]}];this.runWithPermissions(component,requiredPermissions,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(){var duplicate;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return _this11.modelManager.duplicateItem({item:item});case 2:duplicate=_context4.sent;_this11.syncService.sync();_this11.replyToMessage(component,message,{item:_this11.jsonForItem(duplicate,component)});case 5:case"end":return _context4.stop();}}},_callee4);})));}},{key:"handleCreateItemsMessage",value:function handleCreateItemsMessage(component,message){var _this12=this;var responseItems=message.data.item?[message.data.item]:message.data.items;var uniqueContentTypes=lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(responseItems.map(function(item){return item.content_type;}));var requiredPermissions=[{name:ComponentActions.StreamItems,content_types:uniqueContentTypes}];this.runWithPermissions(component,requiredPermissions,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(){var processedItems,_iteratorNormalCompletion19,_didIteratorError19,_iteratorError19,_iterator19,_step19,responseItem,payload,item,reply;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_this12.removePrivatePropertiesFromResponseItems(responseItems,component,{incoming:true});processedItems=[];_iteratorNormalCompletion19=true;_didIteratorError19=false;_iteratorError19=undefined;_context5.prev=5;_iterator19=responseItems[Symbol.iterator]();case 7:if(_iteratorNormalCompletion19=(_step19=_iterator19.next()).done){_context5.next=21;break;}responseItem=_step19.value;payload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_5__["CreateSourcedPayloadFromObject"])({object:responseItem,source:_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].RemoteRetrieved});item=Object(_Models__WEBPACK_IMPORTED_MODULE_6__["CreateItemFromPayload"])(payload);if(responseItem.clientData){item.setDomainDataItem(component.getClientDataKey(),responseItem.clientData,SNComponentManager.ClientDataDomain);}_this12.modelManager.addItem(item);_context5.next=15;return _this12.modelManager.resolveReferencesForItem(item,true);case 15:_context5.next=17;return _this12.modelManager.setItemDirty(item,true);case 17:processedItems.push(item);case 18:_iteratorNormalCompletion19=true;_context5.next=7;break;case 21:_context5.next=27;break;case 23:_context5.prev=23;_context5.t0=_context5["catch"](5);_didIteratorError19=true;_iteratorError19=_context5.t0;case 27:_context5.prev=27;_context5.prev=28;if(!_iteratorNormalCompletion19&&_iterator19.return!=null){_iterator19.return();}case 30:_context5.prev=30;if(!_didIteratorError19){_context5.next=33;break;}throw _iteratorError19;case 33:return _context5.finish(30);case 34:return _context5.finish(27);case 35:_this12.syncService.sync();reply=message.action===ComponentActions.CreateItem?{item:_this12.jsonForItem(processedItems[0],component)}:{items:processedItems.map(function(item){return _this12.jsonForItem(item,component);})};_this12.replyToMessage(component,message,reply);case 38:case"end":return _context5.stop();}}},_callee5,null,[[5,23,27,35],[28,,30,34]]);})));}},{key:"handleDeleteItemsMessage",value:function handleDeleteItemsMessage(component,message){var _this13=this;var requiredContentTypes=lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(message.data.items.map(function(i){return i.content_type;})).sort();var requiredPermissions=[{name:ComponentActions.StreamItems,content_types:requiredContentTypes}];this.runWithPermissions(component,requiredPermissions,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(){var itemsData,noun,reply,didConfirm,_iteratorNormalCompletion20,_didIteratorError20,_iteratorError20,_iterator20,_step20,itemData,model;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:itemsData=message.data.items;noun=itemsData.length===1?'item':'items';reply=null;didConfirm=true;_context6.next=6;return _this13.alertService.confirm({text:"Are you sure you want to delete ".concat(itemsData.length," ").concat(noun,"?")}).catch(function(){didConfirm=false;});case 6:if(!didConfirm){_context6.next=45;break;}/* Filter for any components and deactivate before deleting */_iteratorNormalCompletion20=true;_didIteratorError20=false;_iteratorError20=undefined;_context6.prev=10;_iterator20=itemsData[Symbol.iterator]();case 12:if(_iteratorNormalCompletion20=(_step20=_iterator20.next()).done){_context6.next=27;break;}itemData=_step20.value;model=_this13.modelManager.findItem(itemData.uuid);if(model){_context6.next=18;break;}_this13.alertService.alert({text:'The item you are trying to delete cannot be found.'});return _context6.abrupt("continue",24);case 18:if(![_Models__WEBPACK_IMPORTED_MODULE_6__["ContentTypes"].Component,_Models__WEBPACK_IMPORTED_MODULE_6__["ContentTypes"].Theme].includes(model.content_type)){_context6.next=21;break;}_context6.next=21;return _this13.deactivateComponent(model,true);case 21:_context6.next=23;return _this13.modelManager.setItemToBeDeleted(model);case 23:/* Currently extensions are not notified of association until a full server sync completes. - We manually notify observers. */_this13.modelManager.notifyMappingObservers([model],_Payloads__WEBPACK_IMPORTED_MODULE_5__["PayloadSources"].RemoteSaved);case 24:_iteratorNormalCompletion20=true;_context6.next=12;break;case 27:_context6.next=33;break;case 29:_context6.prev=29;_context6.t0=_context6["catch"](10);_didIteratorError20=true;_iteratorError20=_context6.t0;case 33:_context6.prev=33;_context6.prev=34;if(!_iteratorNormalCompletion20&&_iterator20.return!=null){_iterator20.return();}case 36:_context6.prev=36;if(!_didIteratorError20){_context6.next=39;break;}throw _iteratorError20;case 39:return _context6.finish(36);case 40:return _context6.finish(33);case 41:_this13.syncService.sync();reply={deleted:true};_context6.next=46;break;case 45:/* Rejected by user */reply={deleted:false};case 46:_this13.replyToMessage(component,message,reply);case 47:case"end":return _context6.stop();}}},_callee6,null,[[10,29,33,41],[34,,36,40]]);})));}},{key:"handleRequestPermissionsMessage",value:function handleRequestPermissionsMessage(component,message){var _this14=this;this.runWithPermissions(component,message.data.permissions,function(){_this14.replyToMessage(component,message,{approved:true});});}},{key:"handleSetComponentDataMessage",value:function handleSetComponentDataMessage(component,message){var _this15=this;/* A component setting its own data does not require special permissions */this.runWithPermissions(component,[],/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:component.componentData=message.data.componentData;_context7.next=3;return _this15.modelManager.setItemDirty(component,true);case 3:_this15.syncService.sync();case 4:case"end":return _context7.stop();}}},_callee7);})));}},{key:"handleToggleComponentMessage",value:function handleToggleComponentMessage(sourceComponent,targetComponent,message){this.toggleComponent(targetComponent);}},{key:"toggleComponent",value:function(){var _toggleComponent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(component){var _this16=this;var activeThemes;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:if(!(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Modal)){_context9.next=4;break;}this.openModalComponent(component);_context9.next=18;break;case 4:if(!component.active){_context9.next=9;break;}_context9.next=7;return this.deactivateComponent(component);case 7:_context9.next=18;break;case 9:if(!(component.content_type===_Models__WEBPACK_IMPORTED_MODULE_6__["ContentTypes"].Theme)){_context9.next=16;break;}/* Deactive currently active theme if new theme is not layerable */activeThemes=this.getActiveThemes();/* Activate current before deactivating others, so as not to flicker */_context9.next=13;return this.activateComponent(component);case 13:if(!component.isLayerable()){setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(){var _iteratorNormalCompletion21,_didIteratorError21,_iteratorError21,_iterator21,_step21,theme;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_iteratorNormalCompletion21=true;_didIteratorError21=false;_iteratorError21=undefined;_context8.prev=3;_iterator21=activeThemes[Symbol.iterator]();case 5:if(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done){_context8.next=13;break;}theme=_step21.value;if(!(theme&&!theme.isLayerable())){_context8.next=10;break;}_context8.next=10;return _this16.deactivateComponent(theme);case 10:_iteratorNormalCompletion21=true;_context8.next=5;break;case 13:_context8.next=19;break;case 15:_context8.prev=15;_context8.t0=_context8["catch"](3);_didIteratorError21=true;_iteratorError21=_context8.t0;case 19:_context8.prev=19;_context8.prev=20;if(!_iteratorNormalCompletion21&&_iterator21.return!=null){_iterator21.return();}case 22:_context8.prev=22;if(!_didIteratorError21){_context8.next=25;break;}throw _iteratorError21;case 25:return _context8.finish(22);case 26:return _context8.finish(19);case 27:case"end":return _context8.stop();}}},_callee8,null,[[3,15,19,27],[20,,22,26]]);})),10);}_context9.next=18;break;case 16:_context9.next=18;return this.activateComponent(component);case 18:case"end":return _context9.stop();}}},_callee9,this);}));function toggleComponent(_x8){return _toggleComponent.apply(this,arguments);}return toggleComponent;}()},{key:"handleInstallLocalComponentMessage",value:function handleInstallLocalComponentMessage(sourceComponent,message){/* Only native extensions have this permission */if(!this.isNativeExtension(sourceComponent)){return;}var targetComponent=this.modelManager.findItem(message.data.uuid);this.desktopManager.installComponent(targetComponent);}},{key:"runWithPermissions",value:function runWithPermissions(component,requiredPermissions,runFunction){if(!component.permissions){component.permissions=[];}/* Make copy as not to mutate input values */requiredPermissions=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["Copy"])(requiredPermissions);var acquiredPermissions=component.permissions;var _iteratorNormalCompletion22=true;var _didIteratorError22=false;var _iteratorError22=undefined;try{var _loop5=function _loop5(){var required=_step22.value;/* Remove anything we already have */var respectiveAcquired=acquiredPermissions.find(function(candidate){return candidate.name===required.name;});if(!respectiveAcquired){return"continue";}/* We now match on name, lets substract from required.content_types anything we have in acquired. */var requiredContentTypes=required.content_types;if(!requiredContentTypes){/* If this permission does not require any content types (i.e stream-context-item) - then we can remove this from required since we match by name (respectiveAcquired.name === required.name) */Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(requiredPermissions,required);return"continue";}var _iteratorNormalCompletion23=true;var _didIteratorError23=false;var _iteratorError23=undefined;try{for(var _iterator23=respectiveAcquired.content_types[Symbol.iterator](),_step23;!(_iteratorNormalCompletion23=(_step23=_iterator23.next()).done);_iteratorNormalCompletion23=true){var acquiredContentType=_step23.value;Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(requiredContentTypes,acquiredContentType);}}catch(err){_didIteratorError23=true;_iteratorError23=err;}finally{try{if(!_iteratorNormalCompletion23&&_iterator23.return!=null){_iterator23.return();}}finally{if(_didIteratorError23){throw _iteratorError23;}}}if(requiredContentTypes.length===0){/* We've removed all acquired and end up with zero, means we already have all these permissions */Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(requiredPermissions,required);}};for(var _iterator22=requiredPermissions.slice()[Symbol.iterator](),_step22;!(_iteratorNormalCompletion22=(_step22=_iterator22.next()).done);_iteratorNormalCompletion22=true){var _ret5=_loop5();if(_ret5==="continue")continue;}}catch(err){_didIteratorError22=true;_iteratorError22=err;}finally{try{if(!_iteratorNormalCompletion22&&_iterator22.return!=null){_iterator22.return();}}finally{if(_didIteratorError22){throw _iteratorError22;}}}if(requiredPermissions.length>0){this.promptForPermissions(component,requiredPermissions,function(approved){if(approved){runFunction();}});}else{runFunction();}}},{key:"promptForPermissions",value:function promptForPermissions(component,permissions,callback){var _this17=this;var params={};params.component=component;params.permissions=permissions;params.permissionsString=this.permissionsStringForPermissions(permissions,component);params.actionBlock=callback;params.callback=/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(approved){var _iteratorNormalCompletion24,_didIteratorError24,_iteratorError24,_loop6,_iterator24,_step24;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:if(!approved){_context10.next=24;break;}_iteratorNormalCompletion24=true;_didIteratorError24=false;_iteratorError24=undefined;_context10.prev=4;_loop6=function _loop6(){var permission=_step24.value;var matchingPermission=component.permissions.find(function(candidate){return candidate.name===permission.name;});if(!matchingPermission){component.permissions.push(permission);}else{/* Permission already exists, but content_types may have been expanded */var contentTypes=matchingPermission.content_types||[];matchingPermission.content_types=lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(contentTypes.concat(permission.content_types));}};for(_iterator24=permissions[Symbol.iterator]();!(_iteratorNormalCompletion24=(_step24=_iterator24.next()).done);_iteratorNormalCompletion24=true){_loop6();}_context10.next=13;break;case 9:_context10.prev=9;_context10.t0=_context10["catch"](4);_didIteratorError24=true;_iteratorError24=_context10.t0;case 13:_context10.prev=13;_context10.prev=14;if(!_iteratorNormalCompletion24&&_iterator24.return!=null){_iterator24.return();}case 16:_context10.prev=16;if(!_didIteratorError24){_context10.next=19;break;}throw _iteratorError24;case 19:return _context10.finish(16);case 20:return _context10.finish(13);case 21:_context10.next=23;return _this17.modelManager.setItemDirty(component,true);case 23:_this17.syncService.sync();case 24:_this17.permissionDialogs=_this17.permissionDialogs.filter(function(pendingDialog){/* Remove self */if(pendingDialog===params){pendingDialog.actionBlock&&pendingDialog.actionBlock(approved);return false;}var containsObjectSubset=function containsObjectSubset(source,target){return!target.some(function(val){return!source.find(function(candidate){return JSON.stringify(candidate)===JSON.stringify(val);});});};if(pendingDialog.component===component){/* remove pending dialogs that are encapsulated by already approved permissions, and run its function */if(pendingDialog.permissions===permissions||containsObjectSubset(permissions,pendingDialog.permissions)){/* If approved, run the action block. Otherwise, if canceled, cancel any - pending ones as well, since the user was explicit in their intentions */if(approved){pendingDialog.actionBlock&&pendingDialog.actionBlock(approved);}return false;}}return true;});if(_this17.permissionDialogs.length>0){_this17.presentPermissionsDialog(_this17.permissionDialogs[0]);}case 26:case"end":return _context10.stop();}}},_callee10,null,[[4,9,13,21],[14,,16,20]]);}));return function(_x9){return _ref9.apply(this,arguments);};}();/** - * Since these calls are asyncronous, multiple dialogs may be requested at the same time. - * We only want to present one and trigger all callbacks based on one modal result - */var existingDialog=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(this.permissionDialogs,{component:component});this.permissionDialogs.push(params);if(!existingDialog){this.presentPermissionsDialog(params);}else{this.log('Existing dialog, not presenting.');}}},{key:"presentPermissionsDialog",value:function presentPermissionsDialog(dialog){throw'Must override SNComponentManager.presentPermissionsDialog';}},{key:"openModalComponent",value:function openModalComponent(component){throw'Must override SNComponentManager.presentPermissionsDialog';}/** @access public */},{key:"registerHandler",value:function registerHandler(handler){var _this18=this;this.handlers.push(handler);return function(){var matching=lodash_find__WEBPACK_IMPORTED_MODULE_1___default()(_this18.handlers,{identifier:handler.identifier});if(!matching){_this18.log('Attempting to deregister non-existing handler');return;}Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(_this18.handlers,matching);};}/** Called by other views when the iframe is ready */},{key:"registerComponentWindow",value:function(){var _registerComponentWindow=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(component,componentWindow){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(component.window===componentWindow){this.log('Web|componentManager','attempting to re-register same component window.');}this.log('Web|componentManager|registerComponentWindow',component);component.window=componentWindow;_context11.next=5;return _Lib_uuid__WEBPACK_IMPORTED_MODULE_8__["Uuid"].GenerateUuid();case 5:component.sessionKey=_context11.sent;this.sendMessageToComponent(component,{action:ComponentActions.ComponentRegistered,sessionKey:component.sessionKey,componentData:component.componentData,data:{uuid:component.uuid,environment:Object(_Lib_platforms__WEBPACK_IMPORTED_MODULE_10__["environmentToString"])(this.environment),platform:Object(_Lib_platforms__WEBPACK_IMPORTED_MODULE_10__["platformToString"])(this.platform),activeThemeUrls:this.urlsForActiveThemes()}});this.postActiveThemesToComponent(component);if(this.desktopManager){this.desktopManager.notifyComponentActivation(component);}case 9:case"end":return _context11.stop();}}},_callee11,this);}));function registerComponentWindow(_x10,_x11){return _registerComponentWindow.apply(this,arguments);}return registerComponentWindow;}()},{key:"activateComponent",value:function(){var _activateComponent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(component){var dontSync,didChange,_iteratorNormalCompletion25,_didIteratorError25,_iteratorError25,_iterator25,_step25,handler,_args12=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:dontSync=_args12.length>1&&_args12[1]!==undefined?_args12[1]:false;didChange=component.active!==true;component.active=true;if(!this.activeComponents.includes(component)){this.activeComponents.push(component);}_iteratorNormalCompletion25=true;_didIteratorError25=false;_iteratorError25=undefined;_context12.prev=7;for(_iterator25=this.handlers[Symbol.iterator]();!(_iteratorNormalCompletion25=(_step25=_iterator25.next()).done);_iteratorNormalCompletion25=true){handler=_step25.value;if(handler.areas.includes(component.area)||handler.areas.includes('*')){handler.activationHandler&&handler.activationHandler(component);}}_context12.next=15;break;case 11:_context12.prev=11;_context12.t0=_context12["catch"](7);_didIteratorError25=true;_iteratorError25=_context12.t0;case 15:_context12.prev=15;_context12.prev=16;if(!_iteratorNormalCompletion25&&_iterator25.return!=null){_iterator25.return();}case 18:_context12.prev=18;if(!_didIteratorError25){_context12.next=21;break;}throw _iteratorError25;case 21:return _context12.finish(18);case 22:return _context12.finish(15);case 23:if(!(didChange&&!dontSync)){_context12.next=27;break;}_context12.next=26;return this.modelManager.setItemDirty(component,true);case 26:this.syncService.sync();case 27:if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Themes){this.postActiveThemesToAllComponents();}case 28:case"end":return _context12.stop();}}},_callee12,this,[[7,11,15,23],[16,,18,22]]);}));function activateComponent(_x12){return _activateComponent.apply(this,arguments);}return activateComponent;}()},{key:"deactivateComponent",value:function(){var _deactivateComponent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(component){var dontSync,didChange,_iteratorNormalCompletion26,_didIteratorError26,_iteratorError26,_iterator26,_step26,handler,_args13=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:dontSync=_args13.length>1&&_args13[1]!==undefined?_args13[1]:false;didChange=component.active!==false;component.active=false;component.sessionKey=null;Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(this.activeComponents,component);_iteratorNormalCompletion26=true;_didIteratorError26=false;_iteratorError26=undefined;_context13.prev=8;for(_iterator26=this.handlers[Symbol.iterator]();!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){handler=_step26.value;if(handler.areas.includes(component.area)||handler.areas.includes('*')){handler.activationHandler&&handler.activationHandler(component);}}_context13.next=16;break;case 12:_context13.prev=12;_context13.t0=_context13["catch"](8);_didIteratorError26=true;_iteratorError26=_context13.t0;case 16:_context13.prev=16;_context13.prev=17;if(!_iteratorNormalCompletion26&&_iterator26.return!=null){_iterator26.return();}case 19:_context13.prev=19;if(!_didIteratorError26){_context13.next=22;break;}throw _iteratorError26;case 22:return _context13.finish(19);case 23:return _context13.finish(16);case 24:if(!(didChange&&!dontSync)){_context13.next=28;break;}_context13.next=27;return this.modelManager.setItemDirty(component,true);case 27:this.syncService.sync();case 28:this.streamObservers=this.streamObservers.filter(function(o){return o.component!==component;});this.contextStreamObservers=this.contextStreamObservers.filter(function(o){return o.component!==component;});if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Themes){this.postActiveThemesToAllComponents();}case 31:case"end":return _context13.stop();}}},_callee13,this,[[8,12,16,24],[17,,19,23]]);}));function deactivateComponent(_x13){return _deactivateComponent.apply(this,arguments);}return deactivateComponent;}()},{key:"reloadComponent",value:function(){var _reloadComponent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(component){var _this19=this;var _iteratorNormalCompletion27,_didIteratorError27,_iteratorError27,_iterator27,_step27,handler;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:/* Do soft deactivate */component.active=false;_iteratorNormalCompletion27=true;_didIteratorError27=false;_iteratorError27=undefined;_context14.prev=4;for(_iterator27=this.handlers[Symbol.iterator]();!(_iteratorNormalCompletion27=(_step27=_iterator27.next()).done);_iteratorNormalCompletion27=true){handler=_step27.value;if(handler.areas.includes(component.area)||handler.areas.includes('*')){handler.activationHandler&&handler.activationHandler(component);}}_context14.next=12;break;case 8:_context14.prev=8;_context14.t0=_context14["catch"](4);_didIteratorError27=true;_iteratorError27=_context14.t0;case 12:_context14.prev=12;_context14.prev=13;if(!_iteratorNormalCompletion27&&_iterator27.return!=null){_iterator27.return();}case 15:_context14.prev=15;if(!_didIteratorError27){_context14.next=18;break;}throw _iteratorError27;case 18:return _context14.finish(15);case 19:return _context14.finish(12);case 20:this.streamObservers=this.streamObservers.filter(function(o){return o.component!==component;});this.contextStreamObservers=this.contextStreamObservers.filter(function(o){return o.component!==component;});if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Themes){this.postActiveThemesToAllComponents();}/* Do soft activate */return _context14.abrupt("return",new Promise(function(resolve,reject){_this19.timeout(function(){component.active=true;var _iteratorNormalCompletion28=true;var _didIteratorError28=false;var _iteratorError28=undefined;try{for(var _iterator28=_this19.handlers[Symbol.iterator](),_step28;!(_iteratorNormalCompletion28=(_step28=_iterator28.next()).done);_iteratorNormalCompletion28=true){var handler=_step28.value;if(handler.areas.includes(component.area)||handler.areas.includes('*')){handler.activationHandler&&handler.activationHandler(component);resolve();}}}catch(err){_didIteratorError28=true;_iteratorError28=err;}finally{try{if(!_iteratorNormalCompletion28&&_iterator28.return!=null){_iterator28.return();}}finally{if(_didIteratorError28){throw _iteratorError28;}}}if(!_this19.activeComponents.includes(component)){_this19.activeComponents.push(component);}if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Themes){_this19.postActiveThemesToAllComponents();}/* Resolve again in case first resolve in for loop isn't reached. - Should be no effect if resolved twice, only first will be used. */resolve();});}));case 24:case"end":return _context14.stop();}}},_callee14,this,[[4,8,12,20],[13,,15,19]]);}));function reloadComponent(_x14){return _reloadComponent.apply(this,arguments);}return reloadComponent;}()},{key:"deleteComponent",value:function(){var _deleteComponent=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(component){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.next=2;return this.modelManager.setItemToBeDeleted(component);case 2:this.syncService.sync();case 3:case"end":return _context15.stop();}}},_callee15,this);}));function deleteComponent(_x15){return _deleteComponent.apply(this,arguments);}return deleteComponent;}()},{key:"isComponentActive",value:function isComponentActive(component){return component.active;}},{key:"iframeForComponent",value:function iframeForComponent(component){for(var _i=0,_Array$from=Array.from(document.getElementsByTagName('iframe'));_i<_Array$from.length;_i++){var frame=_Array$from[_i];var componentId=frame.dataset.componentId;if(componentId===component.uuid){return frame;}}}},{key:"focusChangedForComponent",value:function focusChangedForComponent(component){var focused=document.activeElement===this.iframeForComponent(component);var _iteratorNormalCompletion29=true;var _didIteratorError29=false;var _iteratorError29=undefined;try{for(var _iterator29=this.handlers[Symbol.iterator](),_step29;!(_iteratorNormalCompletion29=(_step29=_iterator29.next()).done);_iteratorNormalCompletion29=true){var handler=_step29.value;/* Notify all handlers, and not just ones that match this component type */handler.focusHandler&&handler.focusHandler(component,focused);}}catch(err){_didIteratorError29=true;_iteratorError29=err;}finally{try{if(!_iteratorNormalCompletion29&&_iterator29.return!=null){_iterator29.return();}}finally{if(_didIteratorError29){throw _iteratorError29;}}}}},{key:"handleSetSizeEvent",value:function handleSetSizeEvent(component,data){var setSize=function setSize(element,size){var widthString=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["isString"])(size.width)?size.width:"".concat(data.width,"px");var heightString=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_9__["isString"])(size.height)?size.height:"".concat(data.height,"px");if(element){element.setAttribute('style',"width:".concat(widthString,"; height:").concat(heightString,";"));}};if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Rooms||component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Modal){var selector=component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Rooms?'inner':'outer';var content=document.getElementById("component-content-".concat(selector,"-").concat(component.uuid));if(content){setSize(content,data);}}else{var iframe=this.iframeForComponent(component);if(!iframe){return;}setSize(iframe,data);/** - * On Firefox, resizing a component iframe does not seem to have an effect with - * editor-stack extensions. Sizing the parent does the trick, however, we can't do - * this globally, otherwise, areas like the note-tags will not be able to expand - * outside of the bounds (to display autocomplete, for example). - */if(component.area===_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].EditorStack){var parent=iframe.parentElement;if(parent){setSize(parent,data);}}}}},{key:"editorForNote",value:function editorForNote(note){var editors=this.componentsForArea(_Models_app_component__WEBPACK_IMPORTED_MODULE_7__["ComponentAreas"].Editor);var _iteratorNormalCompletion30=true;var _didIteratorError30=false;var _iteratorError30=undefined;try{for(var _iterator30=editors[Symbol.iterator](),_step30;!(_iteratorNormalCompletion30=(_step30=_iterator30.next()).done);_iteratorNormalCompletion30=true){var editor=_step30.value;if(editor.isExplicitlyEnabledForItem(note)){return editor;}}/* No editor found for note. Use default editor, if note does not prefer system editor */}catch(err){_didIteratorError30=true;_iteratorError30=err;}finally{try{if(!_iteratorNormalCompletion30&&_iterator30.return!=null){_iterator30.return();}}finally{if(_didIteratorError30){throw _iteratorError30;}}}if(this.isMobile){if(!note.content.mobilePrefersPlainEditor){return this.getDefaultEditor();}}else{if(!note.getAppDataItem('prefersPlainEditor')){return editors.filter(function(e){return e.isDefaultEditor();})[0];}}}},{key:"permissionsStringForPermissions",value:function permissionsStringForPermissions(permissions,component){var finalString='';var permissionsCount=permissions.length;var addSeparator=function addSeparator(index,length){if(index>0){if(index===length-1){if(length===2){return' and ';}else{return', and ';}}else{return', ';}}return'';};permissions.forEach(function(permission,index){if(permission.name===ComponentActions.StreamItems){var types=permission.content_types.map(function(type){var desc=Object(_Models__WEBPACK_IMPORTED_MODULE_6__["displayStringForContentType"])(type);if(desc){return desc+'s';}else{return'items of type '+type;}});var typesString='';for(var i=0;i=2&&indexthis.itemRevisionThreshold){itemHistory.optimize();}}}]);return HistorySession;}();/***/},/***/"./lib/services/history/item_history.js":/*!**********************************************!*\ - !*** ./lib/services/history/item_history.js ***! - \**********************************************/ /*! exports provided: ItemHistory */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ItemHistory",function(){return ItemHistory;});/* harmony import */var _functions__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! ./functions */"./lib/services/history/functions.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,ItemHistory);if(!this.entries){this.entries=[];}/** Deserialize the entries into entry objects. */if(params.entries){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=params.entries[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var entryParams=_step.value;var entry=this.createEntryForItem(entryParams.item);entry.setPreviousEntry(this.getLastEntry());this.entries.push(entry);}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}}}_createClass(ItemHistory,[{key:"createEntryForItem",value:function createEntryForItem(item){return Object(_functions__WEBPACK_IMPORTED_MODULE_0__["CreateHistoryEntryForItem"])(item);}},{key:"getLastEntry",value:function getLastEntry(){return this.entries[this.entries.length-1];}},{key:"addHistoryEntryForItem",value:function addHistoryEntryForItem(item){var prospectiveEntry=this.createEntryForItem(item);var previousEntry=this.getLastEntry();prospectiveEntry.setPreviousEntry(previousEntry);if(prospectiveEntry.isSameAsEntry(previousEntry)){return;}this.entries.push(prospectiveEntry);return prospectiveEntry;}},{key:"clear",value:function clear(){this.entries.length=0;}},{key:"optimize",value:function optimize(){var _this=this;var keepEntries=[];var isEntrySignificant=function isEntrySignificant(entry){return entry.deltaSize()>LARGE_ENTRY_DELTA_THRESHOLD;};var processEntry=function processEntry(entry,index,keep){/** - * Entries may be processed retrospectively, meaning it can be - * decided to be deleted, then an upcoming processing can change that. - */if(keep){keepEntries.push(entry);}else{/** Remove if in keep */var _index=keepEntries.indexOf(entry);if(_index!==-1){keepEntries.splice(_index,1);}}if(keep&&isEntrySignificant(entry)&&entry.operationVector()===-1){/** This is a large negative change. Hang on to the previous entry. */var previousEntry=_this.entries[index-1];if(previousEntry){keepEntries.push(previousEntry);}}};this.entries.forEach(function(entry,index){if(index===0||index===_this.entries.length-1){/** Keep the first and last */processEntry(entry,index,true);}else{var significant=isEntrySignificant(entry);processEntry(entry,index,significant);}});this.entries=this.entries.filter(function(entry,index){return keepEntries.indexOf(entry)!==-1;});}}]);return ItemHistory;}();/***/},/***/"./lib/services/history/item_history_entry.js":/*!****************************************************!*\ - !*** ./lib/services/history/item_history_entry.js ***! - \****************************************************/ /*! exports provided: ItemHistoryEntry */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ItemHistoryEntry",function(){return ItemHistoryEntry;});/* harmony import */var _Models_core_item__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Models/core/item */"./lib/models/core/item.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0){return"".concat(this.textCharDiffLength," characters added");}else{return'Title or metadata changed';}}}]);return NoteHistoryEntry;}(_Services_history_item_history_entry__WEBPACK_IMPORTED_MODULE_0__["ItemHistoryEntry"]);/***/},/***/"./lib/services/index.js":/*!*******************************!*\ - !*** ./lib/services/index.js ***! - \*******************************/ /*! exports provided: SNAlertService, SNSessionManager, SNApiService, SNComponentManager, SNHttpService, SNModelManager, SNSingletonManager, SNActionsService, SNMigrationService, SNProtocolService, SNHistoryManager, SNPrivilegesService, SNKeyManager, KEY_MODE_ROOT_KEY_NONE, ItemsKeyManager, SyncEvents, SNSyncService, SyncModes, TIMING_STRATEGY_FORCE_SPAWN_NEW, ChallengeService, SNStorageService, StorageEncryptionPolicies, StoragePersistencePolicies */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony import */var _Services_alert_service__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @Services/alert_service */"./lib/services/alert_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNAlertService",function(){return _Services_alert_service__WEBPACK_IMPORTED_MODULE_0__["SNAlertService"];});/* harmony import */var _Services_api_session_manager__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Services/api/session_manager */"./lib/services/api/session_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSessionManager",function(){return _Services_api_session_manager__WEBPACK_IMPORTED_MODULE_1__["SNSessionManager"];});/* harmony import */var _Services_api_api_service__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Services/api/api_service */"./lib/services/api/api_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNApiService",function(){return _Services_api_api_service__WEBPACK_IMPORTED_MODULE_2__["SNApiService"];});/* harmony import */var _Services_component_manager__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Services/component_manager */"./lib/services/component_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNComponentManager",function(){return _Services_component_manager__WEBPACK_IMPORTED_MODULE_3__["SNComponentManager"];});/* harmony import */var _Services_api_http_service__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Services/api/http_service */"./lib/services/api/http_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNHttpService",function(){return _Services_api_http_service__WEBPACK_IMPORTED_MODULE_4__["SNHttpService"];});/* harmony import */var _Services_model_manager__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Services/model_manager */"./lib/services/model_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNModelManager",function(){return _Services_model_manager__WEBPACK_IMPORTED_MODULE_5__["SNModelManager"];});/* harmony import */var _Services_singleton_manager__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Services/singleton_manager */"./lib/services/singleton_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSingletonManager",function(){return _Services_singleton_manager__WEBPACK_IMPORTED_MODULE_6__["SNSingletonManager"];});/* harmony import */var _Services_actions_service__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Services/actions_service */"./lib/services/actions_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNActionsService",function(){return _Services_actions_service__WEBPACK_IMPORTED_MODULE_7__["SNActionsService"];});/* harmony import */var _Lib_services_migration_service__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! @Lib/services/migration_service */"./lib/services/migration_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNMigrationService",function(){return _Lib_services_migration_service__WEBPACK_IMPORTED_MODULE_8__["SNMigrationService"];});/* harmony import */var _Services_protocol_service__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(/*! @Services/protocol_service */"./lib/services/protocol_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNProtocolService",function(){return _Services_protocol_service__WEBPACK_IMPORTED_MODULE_9__["SNProtocolService"];});/* harmony import */var _Services_history_history_manager__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(/*! @Services/history/history_manager */"./lib/services/history/history_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNHistoryManager",function(){return _Services_history_history_manager__WEBPACK_IMPORTED_MODULE_10__["SNHistoryManager"];});/* harmony import */var _Services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(/*! @Services/privileges/privileges_service */"./lib/services/privileges/privileges_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNPrivilegesService",function(){return _Services_privileges_privileges_service__WEBPACK_IMPORTED_MODULE_11__["SNPrivilegesService"];});/* harmony import */var _Services_key_manager__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(/*! @Services/key_manager */"./lib/services/key_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNKeyManager",function(){return _Services_key_manager__WEBPACK_IMPORTED_MODULE_12__["SNKeyManager"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_NONE",function(){return _Services_key_manager__WEBPACK_IMPORTED_MODULE_12__["KEY_MODE_ROOT_KEY_NONE"];});/* harmony import */var _Services_items_key_manager__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(/*! @Services/items_key_manager */"./lib/services/items_key_manager.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ItemsKeyManager",function(){return _Services_items_key_manager__WEBPACK_IMPORTED_MODULE_13__["ItemsKeyManager"];});/* harmony import */var _Services_sync_events__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(/*! @Services/sync/events */"./lib/services/sync/events.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncEvents",function(){return _Services_sync_events__WEBPACK_IMPORTED_MODULE_14__["SyncEvents"];});/* harmony import */var _Services_sync_sync_service__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(/*! @Services/sync/sync_service */"./lib/services/sync/sync_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNSyncService",function(){return _Services_sync_sync_service__WEBPACK_IMPORTED_MODULE_15__["SNSyncService"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SyncModes",function(){return _Services_sync_sync_service__WEBPACK_IMPORTED_MODULE_15__["SyncModes"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"TIMING_STRATEGY_FORCE_SPAWN_NEW",function(){return _Services_sync_sync_service__WEBPACK_IMPORTED_MODULE_15__["TIMING_STRATEGY_FORCE_SPAWN_NEW"];});/* harmony import */var _Services_challenge_service__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(/*! @Services/challenge_service */"./lib/services/challenge_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"ChallengeService",function(){return _Services_challenge_service__WEBPACK_IMPORTED_MODULE_16__["ChallengeService"];});/* harmony import */var _Services_storage_service__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(/*! @Services/storage_service */"./lib/services/storage_service.js");/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"SNStorageService",function(){return _Services_storage_service__WEBPACK_IMPORTED_MODULE_17__["SNStorageService"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StorageEncryptionPolicies",function(){return _Services_storage_service__WEBPACK_IMPORTED_MODULE_17__["StorageEncryptionPolicies"];});/* harmony reexport (safe) */__webpack_require__.d(__webpack_exports__,"StoragePersistencePolicies",function(){return _Services_storage_service__WEBPACK_IMPORTED_MODULE_17__["StoragePersistencePolicies"];});/***/},/***/"./lib/services/items_key_manager.js":/*!*******************************************!*\ - !*** ./lib/services/items_key_manager.js ***! - \*******************************************/ /*! exports provided: ItemsKeyManager */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ItemsKeyManager",function(){return ItemsKeyManager;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Lib_events__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib/events */"./lib/events.js");/* harmony import */var _Services_key_manager__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Services/key_manager */"./lib/services/key_manager.js");/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Protocol_versions__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Protocol/versions */"./lib/protocol/versions.js");/* harmony import */var _Payloads_sources__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Payloads/sources */"./lib/protocol/payloads/sources.ts");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0)){_context4.next=17;break;}_context4.next=17;return this.modelManager.setItemsToBeDeleted(toDelete);case 17:if(!(allItemsKeys.length===0)){_context4.next=20;break;}_context4.next=20;return this.createNewDefaultItemsKey();case 20:case"end":return _context4.stop();}}},_callee4,this);}));function handleDownloadFirstSyncCompletion(){return _handleDownloadFirstSyncCompletion.apply(this,arguments);}return handleDownloadFirstSyncCompletion;}()/** @access private */},{key:"handleFullSyncCompletion",value:function(){var _handleFullSyncCompletion=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(){var currentItemsKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:/** Always create a new items key after full sync, if no items key is found */currentItemsKey=this.getDefaultItemsKey();if(currentItemsKey){_context5.next=6;break;}_context5.next=4;return this.createNewDefaultItemsKey();case 4:if(!(this.keyManager.keyMode===_Services_key_manager__WEBPACK_IMPORTED_MODULE_3__["KEY_MODE_WRAPPER_ONLY"])){_context5.next=6;break;}return _context5.abrupt("return",this.syncService.repersistAllItems());case 6:case"end":return _context5.stop();}}},_callee5,this);}));function handleFullSyncCompletion(){return _handleFullSyncCompletion.apply(this,arguments);}return handleFullSyncCompletion;}()/** - * @access public - * @returns All SN|ItemsKey objects synced to the account. - */},{key:"itemsKeyForPayload",/** - * @access public - * @returns {SNItemsKey} The items key used to encrypt the payload - */value:function itemsKeyForPayload(payload){return this.allItemsKeys.find(function(key){return key.uuid===payload.items_key_id;});}/** - * @access public - * @returns {SNItemsKey} The SNItemsKey object to use to encrypt new or updated items. - */},{key:"getDefaultItemsKey",value:function getDefaultItemsKey(){if(this.allItemsKeys.length===1){return this.allItemsKeys[0];}return this.allItemsKeys.find(function(key){return key.isDefault;});}/** - * When the root key changes (non-null only), we must re-encrypt all items - * keys with this new root key (by simply re-syncing). - * @access public - */},{key:"reencryptItemsKeys",value:function(){var _reencryptItemsKeys=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(){var itemsKeys;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:itemsKeys=this.allItemsKeys;if(!(itemsKeys.length>0)){_context6.next=4;break;}_context6.next=4;return this.modelManager.setItemsDirty(itemsKeys);case 4:case"end":return _context6.stop();}}},_callee6,this);}));function reencryptItemsKeys(){return _reencryptItemsKeys.apply(this,arguments);}return reencryptItemsKeys;}()/** - * When migrating from non-SNItemsKey architecture, many items will not have a - * relationship with any key object. For those items, we can be sure that only 1 key - * object will correspond to that protocol version. - * @access public - * @returns {SNItemsKey|null} The SNItemsKey object to decrypt items encrypted - * with previous protocol version. - */},{key:"defaultItemsKeyForItemVersion",value:function(){var _defaultItemsKeyForItemVersion=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(version){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:return _context7.abrupt("return",this.allItemsKeys.find(function(key){return key.version===version;}));case 1:case"end":return _context7.stop();}}},_callee7,this);}));function defaultItemsKeyForItemVersion(_x2){return _defaultItemsKeyForItemVersion.apply(this,arguments);}return defaultItemsKeyForItemVersion;}()/** - * Creates a new random SNItemsKey to use for item encryption, and adds it to model management. - * Consumer must call sync. If the protocol version <= 003, only one items key should be created, - * and its .itemsKey value should be equal to the root key masterKey value. - * @access public - * @returns {Promise} - */},{key:"createNewDefaultItemsKey",value:function(){var _createNewDefaultItemsKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(){var rootKey,operatorVersion,itemsKey,currentDefault,payload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.next=2;return this.keyManager.getRootKey();case 2:rootKey=_context8.sent;operatorVersion=rootKey?rootKey.version:this.protocolService.getLatestVersion();if(!(Object(_Protocol_versions__WEBPACK_IMPORTED_MODULE_6__["compareVersions"])(operatorVersion,LAST_NONROOT_ITEMS_KEY_VERSION)<=0)){_context8.next=10;break;}/** Create root key based items key */itemsKey=_Models__WEBPACK_IMPORTED_MODULE_4__["SNItemsKey"].FromRaw({itemsKey:rootKey.masterKey,dataAuthenticationKey:rootKey.dataAuthenticationKey,version:operatorVersion});_context8.next=8;return itemsKey.initUUID();case 8:_context8.next=13;break;case 10:_context8.next=12;return this.protocolService.operatorForVersion(operatorVersion).createItemsKey();case 12:itemsKey=_context8.sent;case 13:currentDefault=this.getDefaultItemsKey();if(!currentDefault){_context8.next=18;break;}currentDefault.content.isDefault=false;_context8.next=18;return this.modelManager.setItemDirty(currentDefault);case 18:itemsKey.content.isDefault=true;payload=itemsKey.payloadRepresentation({override:{dirty:true}});_context8.next=22;return this.modelManager.mapPayloadToLocalItem({payload:payload,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_7__["PayloadSources"].LocalChanged});case 22:case"end":return _context8.stop();}}},_callee8,this);}));function createNewDefaultItemsKey(){return _createNewDefaultItemsKey.apply(this,arguments);}return createNewDefaultItemsKey;}()},{key:"allItemsKeys",get:function get(){return this.modelManager.itemsKeys;}}]);return ItemsKeyManager;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/key_manager.js":/*!*************************************!*\ - !*** ./lib/services/key_manager.js ***! - \*************************************/ /*! exports provided: KEY_MODE_ROOT_KEY_NONE, KEY_MODE_ROOT_KEY_ONLY, KEY_MODE_ROOT_KEY_PLUS_WRAPPER, KEY_MODE_WRAPPER_ONLY, SNKeyManager */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_NONE",function(){return KEY_MODE_ROOT_KEY_NONE;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_ONLY",function(){return KEY_MODE_ROOT_KEY_ONLY;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_ROOT_KEY_PLUS_WRAPPER",function(){return KEY_MODE_ROOT_KEY_PLUS_WRAPPER;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"KEY_MODE_WRAPPER_ONLY",function(){return KEY_MODE_WRAPPER_ONLY;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNKeyManager",function(){return SNKeyManager;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony import */var _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Lib/storage_keys */"./lib/storage_keys.js");/* harmony import */var _Protocol__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Protocol */"./lib/protocol/index.js");/* harmony import */var _Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Lib/services/storage_service */"./lib/services/storage_service.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i} True if a root key wrapper (passcode) is configured. - */},{key:"hasRootKeyWrapper",value:function(){var _hasRootKeyWrapper=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(){var wrapper;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.next=2;return this.getRootKeyWrapperKeyParams();case 2:wrapper=_context5.sent;return _context5.abrupt("return",!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isNullOrUndefined"])(wrapper));case 4:case"end":return _context5.stop();}}},_callee5,this);}));function hasRootKeyWrapper(){return _hasRootKeyWrapper.apply(this,arguments);}return hasRootKeyWrapper;}()/** - * @access public - * A non-async alternative to `hasRootKeyWrapper` which uses pre-loaded state - * to determine if a passcode is configured. - * @returns {boolean} - */},{key:"hasPasscode",value:function hasPasscode(){return this.keyMode===KEY_MODE_WRAPPER_ONLY||this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER;}/** - * @access public - * @returns {Promise} True if the root key has not yet been unwrapped (passcode locked). - */},{key:"rootKeyNeedsUnwrapping",value:function(){var _rootKeyNeedsUnwrapping=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return this.hasRootKeyWrapper();case 2:_context6.t0=_context6.sent;if(!_context6.t0){_context6.next=5;break;}_context6.t0=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isNullOrUndefined"])(this.rootKey);case 5:return _context6.abrupt("return",_context6.t0);case 6:case"end":return _context6.stop();}}},_callee6,this);}));function rootKeyNeedsUnwrapping(){return _rootKeyNeedsUnwrapping.apply(this,arguments);}return rootKeyNeedsUnwrapping;}()/** - * @access public - * @returns {Promise} Key params object containing root key wrapper key params - */},{key:"getRootKeyWrapperKeyParams",value:function(){var _getRootKeyWrapperKeyParams=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(){var rawKeyParams;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return this.storageService.getValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyWrapperKeyParams,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 2:rawKeyParams=_context7.sent;if(rawKeyParams){_context7.next=5;break;}return _context7.abrupt("return",null);case 5:return _context7.abrupt("return",this.protocolService.createKeyParams(rawKeyParams));case 6:case"end":return _context7.stop();}}},_callee7,this);}));function getRootKeyWrapperKeyParams(){return _getRootKeyWrapperKeyParams.apply(this,arguments);}return getRootKeyWrapperKeyParams;}()/** - * @access private - * @returns {Promise} Object containing persisted wrapped (encrypted) root key - */},{key:"getWrappedRootKey",value:function(){var _getWrappedRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:return _context8.abrupt("return",this.storageService.getValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].WrappedRootKey,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped));case 1:case"end":return _context8.stop();}}},_callee8,this);}));function getWrappedRootKey(){return _getWrappedRootKey.apply(this,arguments);}return getWrappedRootKey;}()/** - * Returns rootKeyParams by reading from storage. - * @access public - * @returns {Promise} - */},{key:"getRootKeyParams",value:function(){var _getRootKeyParams=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY)){_context9.next=4;break;}return _context9.abrupt("return",this.getRootKeyWrapperKeyParams());case 4:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY||this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context9.next=8;break;}return _context9.abrupt("return",this.getAccountKeyParams());case 8:throw"Unhandled key mode for getRootKeyParams ".concat(this.keyMode);case 9:case"end":return _context9.stop();}}},_callee9,this);}));function getRootKeyParams(){return _getRootKeyParams.apply(this,arguments);}return getRootKeyParams;}()/** - * @access public - * @returns {SNRootKeyParams} getRootKeyParams may return different params based on different - * keyMode. This function however strictly returns only account params. - */},{key:"getAccountKeyParams",value:function(){var _getAccountKeyParams=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(){var rawKeyParams;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.next=2;return this.storageService.getValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyParams,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 2:rawKeyParams=_context10.sent;if(rawKeyParams){_context10.next=5;break;}return _context10.abrupt("return",null);case 5:return _context10.abrupt("return",this.protocolService.createKeyParams(rawKeyParams));case 6:case"end":return _context10.stop();}}},_callee10,this);}));function getAccountKeyParams(){return _getAccountKeyParams.apply(this,arguments);}return getAccountKeyParams;}()/** - * We know a wrappingKey is correct if it correctly decrypts - * wrapped root key. - * @access public - * @returns {Promise} - */},{key:"validateWrappingKey",value:function(){var _validateWrappingKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(wrappingKey){var wrappedRootKey,wrappedKeyPayload,decrypted;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:_context11.next=2;return this.getWrappedRootKey();case 2:wrappedRootKey=_context11.sent;if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY)){_context11.next=7;break;}return _context11.abrupt("return",this.storageService.canDecryptWithKey(wrappingKey));case 7:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY||this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context11.next=15;break;}/** - * In these modes, storage is encrypted with account keys, and - * account keys are encrypted with wrappingKey. Here we validate - * by attempting to decrypt account keys. - */wrappedKeyPayload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"])({object:wrappedRootKey});_context11.next=11;return this.protocolService.payloadByDecryptingPayload({payload:wrappedKeyPayload,key:wrappingKey});case 11:decrypted=_context11.sent;return _context11.abrupt("return",!decrypted.errorDecrypting);case 15:throw'Unhandled case in validateWrappingKey';case 16:case"end":return _context11.stop();}}},_callee11,this);}));function validateWrappingKey(_x){return _validateWrappingKey.apply(this,arguments);}return validateWrappingKey;}()/** - * Computes the root key wrapping key given a passcode. - * Wrapping key params are read from disk. - * @access public - * @returns {SNRootKey} - */},{key:"computeWrappingKey",value:function(){var _computeWrappingKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(_ref2){var passcode,keyParams,key;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:passcode=_ref2.passcode;_context12.next=3;return this.getRootKeyWrapperKeyParams();case 3:keyParams=_context12.sent;_context12.next=6;return this.protocolService.computeRootKey({password:passcode,keyParams:keyParams});case 6:key=_context12.sent;return _context12.abrupt("return",key);case 8:case"end":return _context12.stop();}}},_callee12,this);}));function computeWrappingKey(_x2){return _computeWrappingKey.apply(this,arguments);}return computeWrappingKey;}()/** - * @access public - * Unwraps the persisted root key value using the supplied wrappingKey. - * Application interfaces must check to see if the root key requires unwrapping on load. - * If so, they must generate the unwrapping key by getting our saved wrapping key keyParams. - * After unwrapping, the root key is automatically loaded. - * @returns {void} - */},{key:"unwrapRootKey",value:function(){var _unwrapRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(_ref3){var wrappingKey,wrappedKey,payload,decrypted;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:wrappingKey=_ref3.wrappingKey;if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY)){_context13.next=4;break;}this.rootKey=wrappingKey;return _context13.abrupt("return");case 4:if(!(this.keyMode!==KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context13.next=6;break;}throw'Invalid key mode condition for unwrapping.';case 6:_context13.next=8;return this.getWrappedRootKey();case 8:wrappedKey=_context13.sent;payload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"])({object:wrappedKey});_context13.next=12;return this.protocolService.payloadByDecryptingPayload({payload:payload,key:wrappingKey});case 12:decrypted=_context13.sent;if(!decrypted.errorDecrypting){_context13.next=17;break;}throw Error('Unable to decrypt root key with provided wrapping key.');case 17:_context13.next=19;return _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNRootKey"].Create({uuid:decrypted.uuid,content:decrypted.content});case 19:this.rootKey=_context13.sent;_context13.next=22;return this.notifyObserversOfChange();case 22:case"end":return _context13.stop();}}},_callee13,this);}));function unwrapRootKey(_x3){return _unwrapRootKey.apply(this,arguments);}return unwrapRootKey;}()/** - * @access public - * Encrypts rootKey and saves it in storage instead of keychain, and then - * clears keychain. This is because we don't want to store large encrypted - * payloads in the keychain. If the root key is not wrapped, it is stored - * in plain form in the user's secure keychain. - */},{key:"setNewRootKeyWrapper",value:function(){var _setNewRootKeyWrapper=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(_ref4){var wrappingKey,keyParams;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:wrappingKey=_ref4.wrappingKey,keyParams=_ref4.keyParams;if(!(this.keyMode===KEY_MODE_ROOT_KEY_NONE)){_context14.next=5;break;}this.keyMode=KEY_MODE_WRAPPER_ONLY;_context14.next=10;break;case 5:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY)){_context14.next=9;break;}this.keyMode=KEY_MODE_ROOT_KEY_PLUS_WRAPPER;_context14.next=10;break;case 9:throw'Attempting to set wrapper on already wrapped key.';case 10:_context14.next=12;return this.deviceInterface.clearKeychainValue();case 12:if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY||this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context14.next=27;break;}if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY)){_context14.next=19;break;}this.rootKey=wrappingKey;_context14.next=17;return this.itemsKeyManager.reencryptItemsKeys();case 17:_context14.next=21;break;case 19:_context14.next=21;return this.wrapAndPersistRootKey({wrappingKey:wrappingKey});case 21:_context14.next=23;return this.storageService.setValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyWrapperKeyParams,keyParams.getPortableValue(),_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 23:_context14.next=25;return this.notifyObserversOfChange();case 25:_context14.next=28;break;case 27:throw'Invalid keyMode on setNewRootKeyWrapper';case 28:case"end":return _context14.stop();}}},_callee14,this);}));function setNewRootKeyWrapper(_x4){return _setNewRootKeyWrapper.apply(this,arguments);}return setNewRootKeyWrapper;}()/** - * Wraps the current in-memory root key value using the wrappingKey, - * then persists the wrapped value to disk. - * @access private - */},{key:"wrapAndPersistRootKey",value:function(){var _wrapAndPersistRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(_ref5){var wrappingKey,payload,wrappedKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:wrappingKey=_ref5.wrappingKey;payload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_3__["CreateMaxPayloadFromAnyObject"])({object:this.rootKey,override:{content:this.rootKey.getPersistableValue()}});_context15.next=4;return this.protocolService.payloadByEncryptingPayload({payload:payload,key:wrappingKey,intent:_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStorageEncrypted});case 4:wrappedKey=_context15.sent;_context15.next=7;return this.storageService.setValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].WrappedRootKey,wrappedKey,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 7:case"end":return _context15.stop();}}},_callee15,this);}));function wrapAndPersistRootKey(_x5){return _wrapAndPersistRootKey.apply(this,arguments);}return wrapAndPersistRootKey;}()/** - * @access public - * Removes root key wrapper from local storage and stores root key bare in secure keychain. - */},{key:"removeRootKeyWrapper",value:function(){var _removeRootKeyWrapper=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee16(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!(this.keyMode!==KEY_MODE_WRAPPER_ONLY&&this.keyMode!==KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context16.next=2;break;}throw'Attempting to remove root key wrapper on unwrapped key.';case 2:if(this.keyMode===KEY_MODE_WRAPPER_ONLY){this.keyMode=KEY_MODE_ROOT_KEY_NONE;this.rootKey=null;}else if(this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER){this.keyMode=KEY_MODE_ROOT_KEY_ONLY;}_context16.next=5;return this.storageService.removeValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].WrappedRootKey,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 5:_context16.next=7;return this.storageService.removeValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyWrapperKeyParams,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 7:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY)){_context16.next=10;break;}_context16.next=10;return this.saveRootKeyToKeychain();case 10:_context16.next=12;return this.notifyObserversOfChange();case 12:case"end":return _context16.stop();}}},_callee16,this);}));function removeRootKeyWrapper(){return _removeRootKeyWrapper.apply(this,arguments);}return removeRootKeyWrapper;}()/** - * @access public - * The root key is distinct from regular keys and are only saved locally in the keychain, - * in non-item form. Applications set root key on sign in, register, or password change. - * @param {SNRootKey} key A SNRootKey object. - * @param {SNRootKeyParams} keyParams - * @param {SNRootKey} [wrappingKey] If a passcode is configured, the wrapping key - * must be supplied, so that the new root key can be wrapped with the wrapping key. - */},{key:"setNewRootKey",value:function(){var _setNewRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee17(_ref6){var key,keyParams,wrappingKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:key=_ref6.key,keyParams=_ref6.keyParams,wrappingKey=_ref6.wrappingKey;if(key.isRootKey){_context17.next=3;break;}throw"Root key must be a ".concat(_Models_content_types__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].RootKey," object.");case 3:if(keyParams){_context17.next=5;break;}throw'keyParams must be supplied if setting root key.';case 5:if(!(this.rootKey===key)){_context17.next=7;break;}throw'Attempting to set root key as same current value.';case 7:if(!(this.keyMode===KEY_MODE_WRAPPER_ONLY)){_context17.next=11;break;}this.keyMode=KEY_MODE_ROOT_KEY_PLUS_WRAPPER;_context17.next=19;break;case 11:if(!(this.keyMode===KEY_MODE_ROOT_KEY_NONE)){_context17.next=15;break;}this.keyMode=KEY_MODE_ROOT_KEY_ONLY;_context17.next=19;break;case 15:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY||this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context17.next=18;break;}_context17.next=19;break;case 18:throw"Unhandled key mode for setNewRootKey ".concat(this.keyMode);case 19:this.rootKey=key;_context17.next=22;return this.storageService.setValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyParams,keyParams.getPortableValue(),_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 22:if(!(this.keyMode===KEY_MODE_ROOT_KEY_ONLY)){_context17.next=27;break;}_context17.next=25;return this.saveRootKeyToKeychain();case 25:_context17.next=32;break;case 27:if(!(this.keyMode===KEY_MODE_ROOT_KEY_PLUS_WRAPPER)){_context17.next=32;break;}if(wrappingKey){_context17.next=30;break;}throw Error('wrappingKey must be supplied');case 30:_context17.next=32;return this.wrapAndPersistRootKey({wrappingKey:wrappingKey});case 32:_context17.next=34;return this.notifyObserversOfChange(_Models_content_types__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].RootKey);case 34:_context17.next=36;return this.itemsKeyManager.reencryptItemsKeys();case 36:case"end":return _context17.stop();}}},_callee17,this);}));function setNewRootKey(_x6){return _setNewRootKey.apply(this,arguments);}return setNewRootKey;}()/** - * Returns the in-memory root key value. - * @access public - * @returns {SNRootKey} SNRootKey object - */},{key:"getRootKey",value:function(){var _getRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee18(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:return _context18.abrupt("return",this.rootKey);case 1:case"end":return _context18.stop();}}},_callee18,this);}));function getRootKey(){return _getRootKey.apply(this,arguments);}return getRootKey;}()/** - * @access public - * Deletes root key and wrapper from keychain. Used when signing out of application. - */},{key:"clearLocalKeyState",value:function(){var _clearLocalKeyState=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee19(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:_context19.next=2;return this.deviceInterface.clearKeychainValue();case 2:_context19.next=4;return this.storageService.removeValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].WrappedRootKey,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 4:_context19.next=6;return this.storageService.removeValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyWrapperKeyParams,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 6:_context19.next=8;return this.storageService.removeValue(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["StorageKeys"].RootKeyParams,_Lib_services_storage_service__WEBPACK_IMPORTED_MODULE_7__["StorageValueModes"].Nonwrapped);case 8:this.keyMode=KEY_MODE_ROOT_KEY_NONE;this.rootKey=null;_context19.next=12;return this.notifyObserversOfChange();case 12:case"end":return _context19.stop();}}},_callee19,this);}));function clearLocalKeyState(){return _clearLocalKeyState.apply(this,arguments);}return clearLocalKeyState;}()/** - * @param {string} password The password string to generate a root key from. - * @returns {object} { valid, artifacts : { wrappingKey : object } } - */},{key:"validateAccountPassword",value:function(){var _validateAccountPassword=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee20(password){var keyParams,key,valid;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.next=2;return this.getRootKeyParams();case 2:keyParams=_context20.sent;_context20.next=5;return this.protocolService.computeRootKey({password:password,keyParams:keyParams});case 5:key=_context20.sent;valid=key.compare(this.rootKey);if(!valid){_context20.next=11;break;}return _context20.abrupt("return",{valid:valid,artifacts:{rootKey:key}});case 11:return _context20.abrupt("return",{valid:false});case 12:case"end":return _context20.stop();}}},_callee20,this);}));function validateAccountPassword(_x7){return _validateAccountPassword.apply(this,arguments);}return validateAccountPassword;}()/** - * @param {string} passcode The passcode string to generate a root key from. - * @returns {object} { valid, artifacts : { wrappingKey : object } } - */},{key:"validatePasscode",value:function(){var _validatePasscode=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee21(passcode){var keyParams,key,valid;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:_context21.next=2;return this.getRootKeyWrapperKeyParams();case 2:keyParams=_context21.sent;_context21.next=5;return this.protocolService.computeRootKey({password:passcode,keyParams:keyParams});case 5:key=_context21.sent;_context21.next=8;return this.validateWrappingKey(key);case 8:valid=_context21.sent;if(!valid){_context21.next=13;break;}return _context21.abrupt("return",{valid:valid,artifacts:{wrappingKey:key}});case 13:return _context21.abrupt("return",{valid:false});case 14:case"end":return _context21.stop();}}},_callee21,this);}));function validatePasscode(_x8){return _validatePasscode.apply(this,arguments);}return validatePasscode;}()/** - * Only two types of items should be encrypted with a root key: - * - An SNItemsKey object - * - An encrypted storage object (local) - * @access public - * @returns {boolean} - */},{key:"contentTypeUsesRootKeyEncryption",value:function contentTypeUsesRootKeyEncryption(contentType){return contentType===_Models_content_types__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].ItemsKey||contentType===_Models_content_types__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].EncryptedStorage;}/** - * Determines which key to use for encryption of the payload - * @access public - * @returns {SNRootKey|SNItemsKey} - * The key object to use for encrypting the payload. - */},{key:"keyToUseForEncryptionOfPayload",value:function(){var _keyToUseForEncryptionOfPayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee22(_ref7){var payload,intent,rootKey;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee22$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:payload=_ref7.payload,intent=_ref7.intent;if(!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_2__["isNullOrUndefined"])(intent)){_context22.next=3;break;}throw'Intent must be supplied when looking up key for encryption of item.';case 3:if(!this.contentTypeUsesRootKeyEncryption(payload.content_type)){_context22.next=16;break;}_context22.next=6;return this.getRootKey();case 6:rootKey=_context22.sent;if(rootKey){_context22.next=13;break;}if(!Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["intentRequiresEncryption"])(intent)){_context22.next=12;break;}throw'Root key encryption is required but no root key is available.';case 12:return _context22.abrupt("return",null);case 13:return _context22.abrupt("return",rootKey);case 16:return _context22.abrupt("return",this.itemsKeyManager.getDefaultItemsKey());case 17:case"end":return _context22.stop();}}},_callee22,this);}));function keyToUseForEncryptionOfPayload(_x9){return _keyToUseForEncryptionOfPayload.apply(this,arguments);}return keyToUseForEncryptionOfPayload;}()/** - * Payloads could have been previously encrypted with any arbitrary SNItemsKey object. - * If the payload is an items key object, it is always encrypted with the root key, - * and so return that. Otherwise, we check to see if the payload has an - * items_key_id and return that key. If it doesn't, this means the payload was - * encrypted with legacy behavior. We return then the key object corresponding - * to the version of this payload. - * @returns {SNRootKey|SNItemsKey} The key object to use for decrypting this payload. - */},{key:"keyToUseForDecryptionOfPayload",value:function(){var _keyToUseForDecryptionOfPayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee23(_ref8){var payload,itemsKey,payloadVersion;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee23$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:payload=_ref8.payload;if(!this.contentTypeUsesRootKeyEncryption(payload.content_type)){_context23.next=3;break;}return _context23.abrupt("return",this.getRootKey());case 3:if(!payload.items_key_id){_context23.next=6;break;}itemsKey=this.itemsKeyManager.itemsKeyForPayload(payload);return _context23.abrupt("return",itemsKey);case 6:payloadVersion=payload.version;if(!(payloadVersion===this.protocolService.getLatestVersion())){_context23.next=9;break;}throw'No associated key found for item encrypted with latest protocol version.';case 9:return _context23.abrupt("return",this.itemsKeyManager.defaultItemsKeyForItemVersion(payloadVersion));case 10:case"end":return _context23.stop();}}},_callee23,this);}));function keyToUseForDecryptionOfPayload(_x10){return _keyToUseForDecryptionOfPayload.apply(this,arguments);}return keyToUseForDecryptionOfPayload;}()}]);return SNKeyManager;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/migration_service.js":/*!*******************************************!*\ - !*** ./lib/services/migration_service.js ***! - \*******************************************/ /*! exports provided: SNMigrationService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNMigrationService",function(){return SNMigrationService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_migrations__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/migrations */"./lib/migrations/index.js");/* harmony import */var _Lib__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib */"./lib/index.js");/* harmony import */var _Lib_migrations_2020_01_01_base__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/migrations/2020-01-01-base */"./lib/migrations/2020-01-01-base.js");/* harmony import */var _Services_pure_service__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Lib/storage_keys */"./lib/storage_keys.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0){lastMigration=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_6__["lastElement"])(this.activeMigrations);lastMigration.onDone(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this2.saveLastMigrationTimestamp(lastMigration.constructor.timestamp());case 2:case"end":return _context.stop();}}},_callee);})));}case 6:case"end":return _context2.stop();}}},_callee2,this);}));function initialize(){return _initialize.apply(this,arguments);}return initialize;}()/** - * @access public - * Application instances will call this function directly when they arrive - * at a certain migratory state. - */},{key:"handleApplicationStage",value:function(){var _handleApplicationStage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(stage){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return _get(_getPrototypeOf(SNMigrationService.prototype),"handleApplicationStage",this).call(this,stage);case 2:if(stage===_Lib__WEBPACK_IMPORTED_MODULE_2__["ApplicationStages"].ReadyForLaunch_05){this.addLoginObserver();this.addSyncObserver();}_context3.next=5;return this.handleStage(stage);case 5:case"end":return _context3.stop();}}},_callee3,this);}));function handleApplicationStage(_x){return _handleApplicationStage.apply(this,arguments);}return handleApplicationStage;}()},{key:"runBaseMigration",value:function(){var _runBaseMigration=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(){var baseMigration;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:baseMigration=new _Lib_migrations_2020_01_01_base__WEBPACK_IMPORTED_MODULE_3__["BaseMigration"]({application:this.application});_context4.next=3;return baseMigration.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_2__["ApplicationStages"].PreparingForLaunch_0);case 3:case"end":return _context4.stop();}}},_callee4,this);}));function runBaseMigration(){return _runBaseMigration.apply(this,arguments);}return runBaseMigration;}()/** @access private */},{key:"getRequiredMigrations",value:function(){var _getRequiredMigrations=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(){var lastMigrationTimestamp,activeMigrations,migrationClasses,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,migrationClass,migrationTimestamp;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.next=2;return this.getLastMigrationTimestamp();case 2:lastMigrationTimestamp=_context5.sent;activeMigrations=[];migrationClasses=Object.keys(_Lib_migrations__WEBPACK_IMPORTED_MODULE_1__).map(function(key){return _Lib_migrations__WEBPACK_IMPORTED_MODULE_1__[key];}).sort(function(a,b){var aTimestamp=a.timestamp();var bTimestamp=b.timestamp();if(aTimestampbTimestamp){return 1;}else{return 0;}});_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context5.prev=8;for(_iterator=migrationClasses[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){migrationClass=_step.value;migrationTimestamp=migrationClass.timestamp();if(migrationTimestamp>lastMigrationTimestamp){// eslint-disable-next-line new-cap -activeMigrations.push(new migrationClass({application:this.application,challengeResponder:this.challengeResponder}));}}_context5.next=16;break;case 12:_context5.prev=12;_context5.t0=_context5["catch"](8);_didIteratorError=true;_iteratorError=_context5.t0;case 16:_context5.prev=16;_context5.prev=17;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 19:_context5.prev=19;if(!_didIteratorError){_context5.next=22;break;}throw _iteratorError;case 22:return _context5.finish(19);case 23:return _context5.finish(16);case 24:return _context5.abrupt("return",activeMigrations);case 25:case"end":return _context5.stop();}}},_callee5,this,[[8,12,16,24],[17,,19,23]]);}));function getRequiredMigrations(){return _getRequiredMigrations.apply(this,arguments);}return getRequiredMigrations;}()/** @access private */},{key:"getTimeStampKey",value:function getTimeStampKey(){return Object(_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["namespacedKey"])(this.application.namespace,_Lib_storage_keys__WEBPACK_IMPORTED_MODULE_5__["RawStorageKeys"].LastMigrationTimestamp);}/** @access private */},{key:"getLastMigrationTimestamp",value:function(){var _getLastMigrationTimestamp=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(){var timestamp;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.next=2;return this.application.deviceInterface.getRawStorageValue(this.getTimeStampKey());case 2:timestamp=_context6.sent;if(!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_6__["isNullOrUndefined"])(timestamp)){_context6.next=5;break;}throw'Timestamp should not be null. Be sure to run base migration first.';case 5:return _context6.abrupt("return",JSON.parse(timestamp));case 6:case"end":return _context6.stop();}}},_callee6,this);}));function getLastMigrationTimestamp(){return _getLastMigrationTimestamp.apply(this,arguments);}return getLastMigrationTimestamp;}()/** @access private */},{key:"saveLastMigrationTimestamp",value:function(){var _saveLastMigrationTimestamp=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(timestamp){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return this.application.deviceInterface.setRawStorageValue(this.getTimeStampKey(),JSON.stringify(timestamp));case 2:case"end":return _context7.stop();}}},_callee7,this);}));function saveLastMigrationTimestamp(_x2){return _saveLastMigrationTimestamp.apply(this,arguments);}return saveLastMigrationTimestamp;}()/** @access private */},{key:"addLoginObserver",value:function addLoginObserver(){var _this3=this;this.removeAppObserver=this.application.addEventObserver(/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(event,data){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:if(!(event===_Lib__WEBPACK_IMPORTED_MODULE_2__["ApplicationEvents"].SignedIn)){_context8.next=3;break;}_context8.next=3;return _this3.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_2__["ApplicationStages"].SignedIn_30);case 3:case"end":return _context8.stop();}}},_callee8);}));return function(_x3,_x4){return _ref3.apply(this,arguments);};}());}/** @access private */},{key:"addSyncObserver",value:function addSyncObserver(){var _this4=this;this.removeSyncObserver=this.application.syncService.addEventObserver(/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(event,data){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:if(!(event===_Lib__WEBPACK_IMPORTED_MODULE_2__["SyncEvents"].FullSyncCompleted)){_context9.next=3;break;}_context9.next=3;return _this4.handleStage(_Lib__WEBPACK_IMPORTED_MODULE_2__["ApplicationStages"].FullSyncCompleted_13);case 3:case"end":return _context9.stop();}}},_callee9);}));return function(_x5,_x6){return _ref4.apply(this,arguments);};}());}/** @access private */},{key:"handleStage",value:function(){var _handleStage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(stage){var _iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,migration;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context10.prev=3;_iterator2=this.activeMigrations[Symbol.iterator]();case 5:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context10.next=12;break;}migration=_step2.value;_context10.next=9;return migration.handleStage(stage);case 9:_iteratorNormalCompletion2=true;_context10.next=5;break;case 12:_context10.next=18;break;case 14:_context10.prev=14;_context10.t0=_context10["catch"](3);_didIteratorError2=true;_iteratorError2=_context10.t0;case 18:_context10.prev=18;_context10.prev=19;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 21:_context10.prev=21;if(!_didIteratorError2){_context10.next=24;break;}throw _iteratorError2;case 24:return _context10.finish(21);case 25:return _context10.finish(18);case 26:case"end":return _context10.stop();}}},_callee10,this,[[3,14,18,26],[19,,21,25]]);}));function handleStage(_x7){return _handleStage.apply(this,arguments);}return handleStage;}()}]);return SNMigrationService;}(_Services_pure_service__WEBPACK_IMPORTED_MODULE_4__["PureService"]);/***/},/***/"./lib/services/model_manager.js":/*!***************************************!*\ - !*** ./lib/services/model_manager.js ***! - \***************************************/ /*! exports provided: SNModelManager */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNModelManager",function(){return SNModelManager;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var lodash_remove__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! lodash/remove */"./node_modules/lodash/remove.js");/* harmony import */var lodash_remove__WEBPACK_IMPORTED_MODULE_1___default=/*#__PURE__*/__webpack_require__.n(lodash_remove__WEBPACK_IMPORTED_MODULE_1__);/* harmony import */var lodash_pull__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! lodash/pull */"./node_modules/lodash/pull.js");/* harmony import */var lodash_pull__WEBPACK_IMPORTED_MODULE_2___default=/*#__PURE__*/__webpack_require__.n(lodash_pull__WEBPACK_IMPORTED_MODULE_2__);/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Lib_uuid__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Lib/uuid */"./lib/uuid.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return;}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0)){_context9.next=97;break;}_context9.next=97;return this.notifyCreationObservers(newItems,source,sourceKey);case 97:_context9.next=99;return this.notifyMappingObservers(itemsToNotifyObserversOf,source,sourceKey);case 99:return _context9.abrupt("return",allItems);case 100:case"end":return _context9.stop();}}},_callee9,this,[[11,45,49,57],[50,,52,56],[72,76,80,88],[81,,83,87]]);}));function mapPayloadsToLocalItems(_x9){return _mapPayloadsToLocalItems.apply(this,arguments);}return mapPayloadsToLocalItems;}()/** - * Inserts an item to be managed by model manager state, but does not map the item. - * Access to this function should be restricted to use by consumers that explicitely - * know what this function is used for. - * @access public - */},{key:"insertItem",value:function insertItem(_ref10){var item=_ref10.item;this.insertItems({items:[item]});}/** - * Similiar to `insertItem` but for many items. - * @access public - */},{key:"insertItems",value:function insertItems(_ref11){var items=_ref11.items,globalOnly=_ref11.globalOnly;var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=items[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var item=_step5.value;if(this.itemsHash[item.uuid]){continue;}this.itemsHash[item.uuid]=item;this.items.push(item);/** - * In some cases, you just want to add the item to this.items, and not to - * the individual arrays This applies when you want to keep an item - * syncable, but not display it via the individual arrays - */if(globalOnly){continue;}if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].ItemsKey){this.itemsKeys.unshift(item);}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Tag){this.tags.unshift(item);}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Note){this.notes.unshift(item);}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Component){this.components.unshift(item);}}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return!=null){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}}/** - * Adds items to model management. - * @deprecated Use `insertItem` instead. - * @param globalOnly Whether the item should only be added to main .items - * array, and not individual item arrays like .notes, - * .tags, .components, etc. - */},{key:"addItem",value:function(){var _addItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(item){var globalOnly,_args10=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:globalOnly=_args10.length>1&&_args10[1]!==undefined?_args10[1]:false;return _context10.abrupt("return",this.addItems([item],globalOnly));case 2:case"end":return _context10.stop();}}},_callee10,this);}));function addItem(_x10){return _addItem.apply(this,arguments);}return addItem;}()/** - * @deprecated Use `insertItems` instead. - */},{key:"addItems",value:function(){var _addItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(items){var globalOnly,payloads,_args11=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:globalOnly=_args11.length>1&&_args11[1]!==undefined?_args11[1]:false;console.warn('ModelManager.addItems is depracated. Use mapPayloadsToLocalItems instead.');payloads=items.map(function(item){return Object(_Payloads__WEBPACK_IMPORTED_MODULE_6__["CreateMaxPayloadFromAnyObject"])({object:item});});_context11.next=5;return this.mapPayloadsToLocalItems({payloads:payloads,source:_Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadSources"].LocalChanged});case 5:case"end":return _context11.stop();}}},_callee11,this);}));function addItems(_x11){return _addItems.apply(this,arguments);}return addItems;}()/** @access private */},{key:"resolveRelationshipWhenItemAvailable",value:function resolveRelationshipWhenItemAvailable(_ref12){var interestedItem=_ref12.interestedItem,missingItemId=_ref12.missingItemId;var interestedItems=this.resolveQueue[missingItemId]||[];interestedItems.push(interestedItem);this.resolveQueue[missingItemId]=interestedItems;}/** @access private */},{key:"popItemsInterestedInMissingItem",value:function popItemsInterestedInMissingItem(_ref13){var item=_ref13.item;var interestedItems=this.resolveQueue[item.uuid];delete this.resolveQueue[item.uuid];return interestedItems||[];}/** @access private */},{key:"resolveReferencesForItem",value:function(){var _resolveReferencesForItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(item){var markReferencesDirty,content,references,referencesIds,includeBlanks,items,_iteratorNormalCompletion6,_didIteratorError6,_iteratorError6,_iterator6,_step6,_step6$value,index,referencedItem,referenceId,_args12=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:markReferencesDirty=_args12.length>1&&_args12[1]!==undefined?_args12[1]:false;if(!item.errorDecrypting){_context12.next=3;break;}return _context12.abrupt("return");case 3:content=item.content;/** - * If another client removes an item's references, this client won't pick - * up the removal unless we remove everything not present in the current - * list of references - */item.updateLocalRelationships();if(!(!content.references||item.deleted)){_context12.next=7;break;}return _context12.abrupt("return");case 7:/** Make copy, references will be modified in array */references=content.references.slice();referencesIds=references.map(function(ref){return ref.uuid;});includeBlanks=true;items=this.findItems(referencesIds,includeBlanks);_iteratorNormalCompletion6=true;_didIteratorError6=false;_iteratorError6=undefined;_context12.prev=14;_iterator6=items.entries()[Symbol.iterator]();case 16:if(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done){_context12.next=30;break;}_step6$value=_slicedToArray(_step6.value,2),index=_step6$value[0],referencedItem=_step6$value[1];if(!referencedItem){_context12.next=25;break;}item.addItemAsRelationship(referencedItem);if(!markReferencesDirty){_context12.next=23;break;}_context12.next=23;return this.setItemDirty(referencedItem,true);case 23:_context12.next=27;break;case 25:referenceId=referencesIds[index];this.resolveRelationshipWhenItemAvailable({interestedItem:item,missingItemId:referenceId});case 27:_iteratorNormalCompletion6=true;_context12.next=16;break;case 30:_context12.next=36;break;case 32:_context12.prev=32;_context12.t0=_context12["catch"](14);_didIteratorError6=true;_iteratorError6=_context12.t0;case 36:_context12.prev=36;_context12.prev=37;if(!_iteratorNormalCompletion6&&_iterator6.return!=null){_iterator6.return();}case 39:_context12.prev=39;if(!_didIteratorError6){_context12.next=42;break;}throw _iteratorError6;case 42:return _context12.finish(39);case 43:return _context12.finish(36);case 44:case"end":return _context12.stop();}}},_callee12,this,[[14,32,36,44],[37,,39,43]]);}));function resolveReferencesForItem(_x12){return _resolveReferencesForItem.apply(this,arguments);}return resolveReferencesForItem;}()/** - * Notifies observers when an item has been created - * @access public - * @param {object} observer - * @param {function} observer.callback - * @param {Array.} observer.callback.items - * @param {PayloadSource} observer.callback.source - * @param {string} observer.callback.sourceKey - * @returns {function} A function to remove the observer - */},{key:"addCreationObserver",value:function addCreationObserver(observer){var _this2=this;this.creationObservers.push(observer);return function(){lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(_this2.creationObservers,observer);};}/** @access private */},{key:"notifyCreationObservers",value:function(){var _notifyCreationObservers=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(items,source,sourceKey){var _iteratorNormalCompletion7,_didIteratorError7,_iteratorError7,_iterator7,_step7,observer;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_iteratorNormalCompletion7=true;_didIteratorError7=false;_iteratorError7=undefined;_context13.prev=3;_iterator7=this.creationObservers[Symbol.iterator]();case 5:if(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done){_context13.next=12;break;}observer=_step7.value;_context13.next=9;return observer.callback({items:items,source:source,sourceKey:sourceKey});case 9:_iteratorNormalCompletion7=true;_context13.next=5;break;case 12:_context13.next=18;break;case 14:_context13.prev=14;_context13.t0=_context13["catch"](3);_didIteratorError7=true;_iteratorError7=_context13.t0;case 18:_context13.prev=18;_context13.prev=19;if(!_iteratorNormalCompletion7&&_iterator7.return!=null){_iterator7.return();}case 21:_context13.prev=21;if(!_didIteratorError7){_context13.next=24;break;}throw _iteratorError7;case 24:return _context13.finish(21);case 25:return _context13.finish(18);case 26:case"end":return _context13.stop();}}},_callee13,this,[[3,14,18,26],[19,,21,25]]);}));function notifyCreationObservers(_x13,_x14,_x15){return _notifyCreationObservers.apply(this,arguments);}return notifyCreationObservers;}()/** - * Notifies observers when an item has been mapped. - * @param {Array.} types - An array of content types to listen for - * @param {function} callback - * @param {Array.} callback.items - * @param {PayloadSource} callback.source - * @param {string} callback.sourceKey - * @param {number} priority - The lower the priority, the earlier the function is called - * wrt to other observers - * @returns {function} A function to remove the observer - */},{key:"addMappingObserver",value:function addMappingObserver(types,callback){var _this3=this;var priority=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;if(!Array.isArray(types)){types=[types];}var observer={types:types,priority:priority,callback:callback};this.mappingObservers.push(observer);return function(){lodash_pull__WEBPACK_IMPORTED_MODULE_2___default()(_this3.mappingObservers,observer);};}/** - * @access public - * This function is mostly for internal use, but can be used externally by consumers who - * explicitely understand what they are doing (want to propagate model state without mapping) - */},{key:"notifyMappingObservers",value:function(){var _notifyMappingObservers=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(items,source,sourceKey){var observers,_iteratorNormalCompletion8,_didIteratorError8,_iteratorError8,_loop,_iterator8,_step8;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:observers=this.mappingObservers.sort(function(a,b){return a.priority0)){_context14.next=26;break;}_context14.next=26;return observer.callback(allRelevantItems,validItems,deletedItems,source,sourceKey);case 26:case"end":return _context14.stop();}}},_loop,null,[[7,11,15,23],[16,,18,22]]);});_iterator8=observers[Symbol.iterator]();case 7:if(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done){_context15.next=12;break;}return _context15.delegateYield(_loop(),"t0",9);case 9:_iteratorNormalCompletion8=true;_context15.next=7;break;case 12:_context15.next=18;break;case 14:_context15.prev=14;_context15.t1=_context15["catch"](4);_didIteratorError8=true;_iteratorError8=_context15.t1;case 18:_context15.prev=18;_context15.prev=19;if(!_iteratorNormalCompletion8&&_iterator8.return!=null){_iterator8.return();}case 21:_context15.prev=21;if(!_didIteratorError8){_context15.next=24;break;}throw _iteratorError8;case 24:return _context15.finish(21);case 25:return _context15.finish(18);case 26:case"end":return _context15.stop();}}},_callee14,this,[[4,14,18,26],[19,,21,25]]);}));function notifyMappingObservers(_x16,_x17,_x18){return _notifyMappingObservers.apply(this,arguments);}return notifyMappingObservers;}()/** - * Sets the item as needing sync. The item is then run through the mapping function, - * and propagated to mapping observers. - * @access public - * @param {object} item - * @param {boolean} dirty - * @param {boolean} updateClientDate - Whether to update the item's "user modified date" - * @param {PayloadSource} source - * @param {string} sourceKey - */},{key:"setItemDirty",value:function(){var _setItemDirty=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(item){var dirty,updateClientDate,source,sourceKey,_args16=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:dirty=_args16.length>1&&_args16[1]!==undefined?_args16[1]:true;updateClientDate=_args16.length>2?_args16[2]:undefined;source=_args16.length>3?_args16[3]:undefined;sourceKey=_args16.length>4?_args16[4]:undefined;return _context16.abrupt("return",this.setItemsDirty([item],dirty,updateClientDate,source,sourceKey));case 5:case"end":return _context16.stop();}}},_callee15,this);}));function setItemDirty(_x19){return _setItemDirty.apply(this,arguments);}return setItemDirty;}()/** - * @access public - * Similar to `setItemDirty`, but acts on an array of items as the first param. - */},{key:"setItemsDirty",value:function(){var _setItemsDirty=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee16(items){var dirty,updateClientDate,source,sourceKey,_iteratorNormalCompletion10,_didIteratorError10,_iteratorError10,_iterator10,_step10,item,_args17=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee16$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:dirty=_args17.length>1&&_args17[1]!==undefined?_args17[1]:true;updateClientDate=_args17.length>2?_args17[2]:undefined;source=_args17.length>3?_args17[3]:undefined;sourceKey=_args17.length>4?_args17[4]:undefined;_iteratorNormalCompletion10=true;_didIteratorError10=false;_iteratorError10=undefined;_context17.prev=7;_iterator10=items[Symbol.iterator]();case 9:if(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done){_context17.next=17;break;}item=_step10.value;if(item.isItem){_context17.next=13;break;}throw'Attempting to dirty non-item object.';case 13:item.setDirty({dirty:dirty,updateClientDate:updateClientDate,authorized:true});case 14:_iteratorNormalCompletion10=true;_context17.next=9;break;case 17:_context17.next=23;break;case 19:_context17.prev=19;_context17.t0=_context17["catch"](7);_didIteratorError10=true;_iteratorError10=_context17.t0;case 23:_context17.prev=23;_context17.prev=24;if(!_iteratorNormalCompletion10&&_iterator10.return!=null){_iterator10.return();}case 26:_context17.prev=26;if(!_didIteratorError10){_context17.next=29;break;}throw _iteratorError10;case 29:return _context17.finish(26);case 30:return _context17.finish(23);case 31:return _context17.abrupt("return",this.mapItems({items:items,source:source||_Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadSources"].LocalDirtied,sourceKey:sourceKey}));case 32:case"end":return _context17.stop();}}},_callee16,this,[[7,19,23,31],[24,,26,30]]);}));function setItemsDirty(_x20){return _setItemsDirty.apply(this,arguments);}return setItemsDirty;}()/** - * Duplicates an item and maps it, thus propagating the item to observers. - * @access public - * @param {object} params - * @param {Item} params.item - * @param {boolean} params.isConflict - Whether to mark the duplicate as a conflict - * of the original. - */},{key:"duplicateItem",value:function(){var _duplicateItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee17(_ref14){var item,isConflict,payload,payloads,results,copy;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee17$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:item=_ref14.item,isConflict=_ref14.isConflict;if(item.isItem){_context18.next=3;break;}throw'Attempting to duplicate non-item object.';case 3:payload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_6__["CreateMaxPayloadFromAnyObject"])({object:item});_context18.next=6;return Object(_Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadsByDuplicating"])({payload:payload,baseCollection:this.getMasterCollection(),isConflict:isConflict});case 6:payloads=_context18.sent;_context18.next=9;return this.mapPayloadsToLocalItems({payloads:payloads,source:_Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadSources"].LocalChanged});case 9:results=_context18.sent;copy=results.find(function(p){return p.uuid===payloads[0].uuid;});return _context18.abrupt("return",copy);case 12:case"end":return _context18.stop();}}},_callee17,this);}));function duplicateItem(_x21){return _duplicateItem.apply(this,arguments);}return duplicateItem;}()/** - * Creates an item and conditionally maps it and marks it as dirty. - * @access public - * @param {object} params - * @param {string} params.contentType - * @param {object} params.content - * @param {boolean} params.add - Whether to insert the item to model manager state. - * @param {boolean} params.needsSync - Whether to mark the item as needing sync - * @returns {Item} The created item - */},{key:"createItem",value:function(){var _createItem=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee18(_ref15){var contentType,content,add,needsSync,override,payload,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee18$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:contentType=_ref15.contentType,content=_ref15.content,add=_ref15.add,needsSync=_ref15.needsSync,override=_ref15.override;if(contentType){_context19.next=3;break;}throw'Attempting to create item with no contentType';case 3:_context19.t0=_Payloads__WEBPACK_IMPORTED_MODULE_6__["CreateMaxPayloadFromAnyObject"];_context19.next=6;return _Lib_uuid__WEBPACK_IMPORTED_MODULE_7__["Uuid"].GenerateUuid();case 6:_context19.t1=_context19.sent;_context19.t2=contentType;_context19.t3=content||{};_context19.t4={uuid:_context19.t1,content_type:_context19.t2,content:_context19.t3};_context19.t5=override;_context19.t6={object:_context19.t4,override:_context19.t5};payload=(0,_context19.t0)(_context19.t6);item=Object(_Models__WEBPACK_IMPORTED_MODULE_4__["CreateItemFromPayload"])(payload);if(!add){_context19.next=21;break;}this.insertItem({item:item});if(!needsSync){_context19.next=19;break;}_context19.next=19;return this.setItemDirty(item);case 19:_context19.next=21;return this.notifyCreationObservers([item]);case 21:return _context19.abrupt("return",item);case 22:case"end":return _context19.stop();}}},_callee18,this);}));function createItem(_x22){return _createItem.apply(this,arguments);}return createItem;}()/** - * Returns an array of items that need to be synced. - * @returns {Array.} - */},{key:"getDirtyItems",value:function getDirtyItems(){return this.items.filter(function(item){/* An item that has an error decrypting can be synced only if it is being deleted. - Otherwise, we don't want to send corrupt content up to the server. */return item.dirty&&!item.dummy&&(!item.errorDecrypting||item.deleted);});}/** - * Marks the item as deleted and needing sync. - * Removes the item from respective content arrays (this.notes, this.tags, etc.) - * @access public - * @param {Item} item - */},{key:"setItemToBeDeleted",value:function(){var _setItemToBeDeleted=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee19(item){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee19$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:item.deleted=true;if(item.dummy){_context20.next=4;break;}_context20.next=4;return this.setItemDirty(item,true);case 4:_context20.next=6;return this.handleReferencesForItemDeletion(item);case 6:this.removeItemFromRespectiveArray(item);case 7:case"end":return _context20.stop();}}},_callee19,this);}));function setItemToBeDeleted(_x23){return _setItemToBeDeleted.apply(this,arguments);}return setItemToBeDeleted;}()/** - * Like `setItemToBeDeleted`, but acts on an array of items. - * @access public - * @param {Array.} items - */},{key:"setItemsToBeDeleted",value:function(){var _setItemsToBeDeleted=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee20(items){var _iteratorNormalCompletion11,_didIteratorError11,_iteratorError11,_iterator11,_step11,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee20$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:_iteratorNormalCompletion11=true;_didIteratorError11=false;_iteratorError11=undefined;_context21.prev=3;_iterator11=items[Symbol.iterator]();case 5:if(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done){_context21.next=12;break;}item=_step11.value;_context21.next=9;return this.setItemToBeDeleted(item);case 9:_iteratorNormalCompletion11=true;_context21.next=5;break;case 12:_context21.next=18;break;case 14:_context21.prev=14;_context21.t0=_context21["catch"](3);_didIteratorError11=true;_iteratorError11=_context21.t0;case 18:_context21.prev=18;_context21.prev=19;if(!_iteratorNormalCompletion11&&_iterator11.return!=null){_iterator11.return();}case 21:_context21.prev=21;if(!_didIteratorError11){_context21.next=24;break;}throw _iteratorError11;case 24:return _context21.finish(21);case 25:return _context21.finish(18);case 26:case"end":return _context21.stop();}}},_callee20,this,[[3,14,18,26],[19,,21,25]]);}));function setItemsToBeDeleted(_x24){return _setItemsToBeDeleted.apply(this,arguments);}return setItemsToBeDeleted;}()/** - * @access private - * @param {Item} item - */},{key:"handleReferencesForItemDeletion",value:function(){var _handleReferencesForItemDeletion=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee21(item){var _iteratorNormalCompletion12,_didIteratorError12,_iteratorError12,_iterator12,_step12,reference,relationship,referencingItems,_iteratorNormalCompletion13,_didIteratorError13,_iteratorError13,_iterator13,_step13,referencingItem;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee21$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:if(item.errorDecrypting){_context22.next=32;break;}_iteratorNormalCompletion12=true;_didIteratorError12=false;_iteratorError12=undefined;_context22.prev=4;_iterator12=item.content.references[Symbol.iterator]();case 6:if(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done){_context22.next=18;break;}reference=_step12.value;relationship=this.findItem(reference.uuid);if(!relationship){_context22.next=15;break;}item.removeItemAsRelationship(relationship);if(!relationship.hasRelationshipWithItem(item)){_context22.next=15;break;}relationship.removeItemAsRelationship(item);_context22.next=15;return this.setItemDirty(relationship,true);case 15:_iteratorNormalCompletion12=true;_context22.next=6;break;case 18:_context22.next=24;break;case 20:_context22.prev=20;_context22.t0=_context22["catch"](4);_didIteratorError12=true;_iteratorError12=_context22.t0;case 24:_context22.prev=24;_context22.prev=25;if(!_iteratorNormalCompletion12&&_iterator12.return!=null){_iterator12.return();}case 27:_context22.prev=27;if(!_didIteratorError12){_context22.next=30;break;}throw _iteratorError12;case 30:return _context22.finish(27);case 31:return _context22.finish(24);case 32:/* Handle indirect relationships */referencingItems=item.allReferencingItems;_iteratorNormalCompletion13=true;_didIteratorError13=false;_iteratorError13=undefined;_context22.prev=36;_iterator13=referencingItems[Symbol.iterator]();case 38:if(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done){_context22.next=46;break;}referencingItem=_step13.value;referencingItem.removeItemAsRelationship(item);_context22.next=43;return this.setItemDirty(referencingItem,true);case 43:_iteratorNormalCompletion13=true;_context22.next=38;break;case 46:_context22.next=52;break;case 48:_context22.prev=48;_context22.t1=_context22["catch"](36);_didIteratorError13=true;_iteratorError13=_context22.t1;case 52:_context22.prev=52;_context22.prev=53;if(!_iteratorNormalCompletion13&&_iterator13.return!=null){_iterator13.return();}case 55:_context22.prev=55;if(!_didIteratorError13){_context22.next=58;break;}throw _iteratorError13;case 58:return _context22.finish(55);case 59:return _context22.finish(52);case 60:item.resetLocalReferencePointers();case 61:case"end":return _context22.stop();}}},_callee21,this,[[4,20,24,32],[25,,27,31],[36,48,52,60],[53,,55,59]]);}));function handleReferencesForItemDeletion(_x25){return _handleReferencesForItemDeletion.apply(this,arguments);}return handleReferencesForItemDeletion;}()/** - * Removes an item directly from local state, without setting it as deleted or - * as needing sync. This is typically called after a deleted item has been fully synced. - * @access public - * @param {Item} item - */},{key:"removeItemLocally",value:function(){var _removeItemLocally=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee22(item){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee22$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.items,{uuid:item.uuid});delete this.itemsHash[item.uuid];this.removeItemFromRespectiveArray(item);item.isBeingRemovedLocally();case 4:case"end":return _context23.stop();}}},_callee22,this);}));function removeItemLocally(_x26){return _removeItemLocally.apply(this,arguments);}return removeItemLocally;}()/** @access private */},{key:"removeItemFromRespectiveArray",value:function removeItemFromRespectiveArray(item){if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Tag){lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.tags,{uuid:item.uuid});}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Note){lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.notes,{uuid:item.uuid});}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Component){lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.components,{uuid:item.uuid});}else if(item.content_type===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].ItemsKey){lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.itemsKeys,{uuid:item.uuid});}}/** - * Returns a detached array of all items - * @access public - */},{key:"getItems",/** - * Returns all items of a certain type - * @access public - * @param {string|Array.} contentType - A string or array of strings representing - * content types. Use '*' for all content types. - */value:function getItems(contentType){if(Array.isArray(contentType)){return this.allItems.filter(function(item){return!item.dummy&&(contentType.includes(item.content_type)||contentType.includes('*'));});}var managed=this.managedItemsForContentType(contentType);return managed||this.getItems([contentType]);}/** @access private */},{key:"managedItemsForContentType",value:function managedItemsForContentType(contentType){if(contentType===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Note){return this.notes.slice();}else if(contentType===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Component){return this.components.slice();}else if(contentType===_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Tag){return this.tags.slice();}return null;}/** - * Returns all items that have not been able to decrypt. - * @access public - */},{key:"invalidItems",value:function invalidItems(){return this.allItems.filter(function(item){return item.errorDecrypting;});}/** - * Returns all items which are properly decrypted - * @param {string} contentType - */},{key:"validItemsForContentType",value:function validItemsForContentType(contentType){var managed=this.managedItemsForContentType(contentType);var items=managed||this.allItems;return items.filter(function(item){return!item.errorDecrypting&&(Array.isArray(contentType)?contentType.includes(item.content_type):item.content_type===contentType);});}/** - * Returns an item for a given id - * @access public - * @param {string} itemId - */},{key:"findItem",value:function findItem(itemId){return this.itemsHash[itemId];}/** - * Returns all items matching given ids - * @access public - * @param {Array.} ids - * @param {boolean} includeBlanks - Whether to include a null array element where a - * result could not be found. If true, ids.length and results.length will always be the same. - */},{key:"findItems",value:function findItems(ids){var includeBlanks=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var results=[];var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=ids[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var id=_step14.value;var item=this.itemsHash[id];if(item||includeBlanks){results.push(item);}}}catch(err){_didIteratorError14=true;_iteratorError14=err;}finally{try{if(!_iteratorNormalCompletion14&&_iterator14.return!=null){_iterator14.return();}}finally{if(_didIteratorError14){throw _iteratorError14;}}}return results;}/** - * Returns all items matching a given predicate - * @access public - * @param {SNPredicate} predicate - */},{key:"itemsMatchingPredicate",value:function itemsMatchingPredicate(predicate){return this.itemsMatchingPredicates([predicate]);}/** - * Returns all items matching an array of predicates - * @access public - * @param {Array.} predicates - */},{key:"itemsMatchingPredicates",value:function itemsMatchingPredicates(predicates){return this.filterItemsWithPredicates(this.allItems,predicates);}/** - * Performs actual predicate filtering for public methods above. - * Does not return deleted items. - * @access private - */},{key:"filterItemsWithPredicates",value:function filterItemsWithPredicates(items,predicates){var results=items.filter(function(item){if(item.deleted){return false;}var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=predicates[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var predicate=_step15.value;if(!item.satisfiesPredicate(predicate)){return false;}}}catch(err){_didIteratorError15=true;_iteratorError15=err;}finally{try{if(!_iteratorNormalCompletion15&&_iterator15.return!=null){_iterator15.return();}}finally{if(_didIteratorError15){throw _iteratorError15;}}}return true;});return results;}/** - * Imports an array of payloads from an external source (such as a backup file) - * and marks the items as dirty. - * @access public - * @param {Array.} payloads - * @returns {Array.} Resulting items - */},{key:"importPayloads",value:function(){var _importPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee23(payloads){var delta,collection,items,_iteratorNormalCompletion16,_didIteratorError16,_iteratorError16,_iterator16,_step16,item;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee23$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:delta=new _Payloads__WEBPACK_IMPORTED_MODULE_6__["DeltaFileImport"]({baseCollection:this.getMasterCollection(),applyCollection:new _Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadCollection"]({payloads:payloads,source:_Payloads__WEBPACK_IMPORTED_MODULE_6__["PayloadSources"].FileImport})});_context24.next=3;return delta.resultingCollection();case 3:collection=_context24.sent;_context24.next=6;return this.mapCollectionToLocalItems({collection:collection});case 6:items=_context24.sent;_iteratorNormalCompletion16=true;_didIteratorError16=false;_iteratorError16=undefined;_context24.prev=10;_iterator16=items[Symbol.iterator]();case 12:if(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done){_context24.next=20;break;}item=_step16.value;_context24.next=16;return this.setItemDirty(item,true,false);case 16:item.deleted=false;case 17:_iteratorNormalCompletion16=true;_context24.next=12;break;case 20:_context24.next=26;break;case 22:_context24.prev=22;_context24.t0=_context24["catch"](10);_didIteratorError16=true;_iteratorError16=_context24.t0;case 26:_context24.prev=26;_context24.prev=27;if(!_iteratorNormalCompletion16&&_iterator16.return!=null){_iterator16.return();}case 29:_context24.prev=29;if(!_didIteratorError16){_context24.next=32;break;}throw _iteratorError16;case 32:return _context24.finish(29);case 33:return _context24.finish(26);case 34:return _context24.abrupt("return",items);case 35:case"end":return _context24.stop();}}},_callee23,this,[[10,22,26,34],[27,,29,33]]);}));function importPayloads(_x27){return _importPayloads.apply(this,arguments);}return importPayloads;}()/** - * The number of notes currently managed - * @access public - */},{key:"noteCount",value:function noteCount(){return this.notes.filter(function(n){return!n.dummy;}).length;}/** - * Immediately removes all items from mapping state and notifies observers - * Used primarily when signing into an account and wanting to discard any current - * local data. - * @access public - */},{key:"removeAllItemsFromMemory",value:function removeAllItemsFromMemory(){var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=this.items[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var item=_step17.value;item.deleted=true;}}catch(err){_didIteratorError17=true;_iteratorError17=err;}finally{try{if(!_iteratorNormalCompletion17&&_iterator17.return!=null){_iterator17.return();}}finally{if(_didIteratorError17){throw _iteratorError17;}}}this.notifyMappingObservers(this.items);this.resetState();}/** - * Finds the first tag matching a given title - * @access public - * @param {string} title - * @returns {Tag|null} - */},{key:"findTagByTitle",value:function findTagByTitle(title){return Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_3__["findInArray"])(this.tags,'title',title);}/** - * Finds or creates a tag with a given title - * @access public - * @param {string} title - * @returns {Promise} - */},{key:"findOrCreateTagByTitle",value:function(){var _findOrCreateTagByTitle=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee24(title){var tag;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee24$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:tag=this.findTagByTitle(title);if(tag){_context25.next=5;break;}_context25.next=4;return this.createItem({contentType:'Tag',content:{title:title},add:true,needsSync:true});case 4:tag=_context25.sent;case 5:return _context25.abrupt("return",tag);case 6:case"end":return _context25.stop();}}},_callee24,this);}));function findOrCreateTagByTitle(_x28){return _findOrCreateTagByTitle.apply(this,arguments);}return findOrCreateTagByTitle;}()/** - * Returns all notes matching the smart tag - * @access public - * @param {SmartTag} smartTag - */},{key:"notesMatchingSmartTag",value:function notesMatchingSmartTag(smartTag){var contentTypePredicate=new _Models__WEBPACK_IMPORTED_MODULE_4__["SNPredicate"]('content_type','=','Note');var predicates=[contentTypePredicate,smartTag.content.predicate];if(!smartTag.content.isTrashTag){var notTrashedPredicate=new _Models__WEBPACK_IMPORTED_MODULE_4__["SNPredicate"]('content.trashed','=',false);predicates.push(notTrashedPredicate);}var results=this.itemsMatchingPredicates(predicates);return results;}/** - * Returns the smart tag corresponding to the "Trash" tag. - * @access public - */},{key:"trashSmartTag",value:function trashSmartTag(){return this.systemSmartTags.find(function(tag){return tag.content.isTrashTag;});}/** - * Returns all items currently in the trash - * @access public - */},{key:"trashedItems",value:function trashedItems(){return this.notesMatchingSmartTag(this.trashSmartTag());}/** - * Permanently deletes any items currently in the trash. Consumer must manually call sync. - * @access public - */},{key:"emptyTrash",value:function(){var _emptyTrash=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee25(){var notes;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee25$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:notes=this.trashedItems();return _context26.abrupt("return",this.setItemsToBeDeleted(notes));case 2:case"end":return _context26.stop();}}},_callee25,this);}));function emptyTrash(){return _emptyTrash.apply(this,arguments);}return emptyTrash;}()/** - * Returns all smart tags, sorted by title. - * @access public - */},{key:"getSmartTags",value:function getSmartTags(){var userTags=this.validItemsForContentType(_Models__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].SmartTag).sort(function(a,b){return a.content.title=0){/* keyParams.version >= 004 */return true;}else{return!!Object(sncrypto__WEBPACK_IMPORTED_MODULE_2__["isWebCryptoAvailable"])();}}/** - * @access public - * @returns {Array.} The versions that this library supports. - */},{key:"supportedVersions",value:function supportedVersions(){return[_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V001,_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002,_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V003,_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V004];}/** - * Determines whether the input version is greater than the latest supported library version. - * @access public - * @param {string} version - */},{key:"isVersionNewerThanLibraryVersion",value:function isVersionNewerThanLibraryVersion(version){var libraryVersion=this.getLatestVersion();return Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["compareVersions"])(version,libraryVersion)===1;}/** - * Determines whether the input version is expired - * @access public - * @param {string} version - */},{key:"isProtocolVersionOutdated",value:function isProtocolVersionOutdated(version){var expirationDates={};expirationDates[_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V001]=Date.parse('2018-01-01');expirationDates[_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002]=Date.parse('2020-01-01');var date=expirationDates[version];if(!date){/* No expiration date, is active version */return false;}var expired=new Date()>date;return expired;}/** - * Versions 001 and 002 of the protocol supported dynamic costs, as reported by the server. - * This function returns the client-enforced minimum cost, to prevent the server from - * overwhelmingly under-reporting the cost. - * @access public - * @param {string} version - * @returns {number} - */},{key:"costMinimumForVersion",value:function costMinimumForVersion(version){if(Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["compareVersions"])(version,_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V003)>=0){throw'Cost minimums only apply to versions <= 002';}if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V001){return _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator001"].pwCost();}else if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002){return _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator002"].pwCost();}else{throw"Invalid version for cost minimum: ".concat(version);}}/** - * @access private - * @returns {SNProtocolOperator} - */},{key:"createOperatorForLatestVersion",value:function createOperatorForLatestVersion(){return this.createOperatorForVersion(this.getLatestVersion());}/** - * @access private - * @returns {SNProtocolOperator} - */},{key:"createOperatorForVersion",value:function createOperatorForVersion(version){if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V001){return new _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator001"](this.crypto);}else if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002){return new _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator002"](this.crypto);}else if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V003){return new _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator003"](this.crypto);}else if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V004){return new _Protocol__WEBPACK_IMPORTED_MODULE_6__["SNProtocolOperator004"](this.crypto);}else if(version===_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V000Base64Decrypted){return this.createOperatorForLatestVersion();}else{throw"Unable to find operator for version ".concat(version);}}/** - * @access private - * @returns {SNProtocolOperator} - */},{key:"operatorForVersion",value:function operatorForVersion(version){var operatorKey=version;var operator=this.operators[operatorKey];if(!operator){operator=this.createOperatorForVersion(version);this.operators[operatorKey]=operator;}return operator;}/** - * Returns the operator corresponding to the latest protocol version - * @access private - * @returns {SNProtocolOperator} - */},{key:"defaultOperator",value:function defaultOperator(){return this.operatorForVersion(this.getLatestVersion());}/** - * Computes a root key given a password and key params. - * Delegates computation to respective protocol operator. - * @access public - * @returns {SNRootKey} - */},{key:"computeRootKey",value:function(){var _computeRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(_ref3){var password,keyParams,version,operator;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:password=_ref3.password,keyParams=_ref3.keyParams;version=keyParams.version;operator=this.operatorForVersion(version);return _context6.abrupt("return",operator.computeRootKey({password:password,keyParams:keyParams}));case 4:case"end":return _context6.stop();}}},_callee6,this);}));function computeRootKey(_x){return _computeRootKey.apply(this,arguments);}return computeRootKey;}()/** - * Creates a root key using the latest protocol version - * @access public - * @returns {SNRootKey} - */},{key:"createRootKey",value:function(){var _createRootKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(_ref4){var identifier,password,operator;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:identifier=_ref4.identifier,password=_ref4.password;operator=this.defaultOperator();return _context7.abrupt("return",operator.createRootKey({identifier:identifier,password:password}));case 3:case"end":return _context7.stop();}}},_callee7,this);}));function createRootKey(_x2){return _createRootKey.apply(this,arguments);}return createRootKey;}()/** - * Given a key and intent, returns the proper PayloadFormat, - * or throws an exception if unsupported configuration of parameters. - * @access private - * @returns {PayloadFormat} - */},{key:"payloadContentFormatForIntent",value:function payloadContentFormatForIntent(_ref5){var key=_ref5.key,intent=_ref5.intent;if(!key){/** Decrypted */if(intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStorageDecrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStoragePreferEncrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FileDecrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FilePreferEncrypted){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].DecryptedBareObject;}else if(intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].SyncDecrypted){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].DecryptedBase64String;}else{throw'Unhandled decrypted case in protocolService.payloadContentFormatForIntent.';}}else{/** Encrypted */if(intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].Sync||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FileEncrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FilePreferEncrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStorageEncrypted||intent===_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].LocalStoragePreferEncrypted){return _Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].EncryptedString;}else{throw'Unhandled encrypted case in protocolService.payloadContentFormatForIntent.';}}}/** - * Generates parameters for a payload that are typically encrypted, and used for syncing - * or saving locally. Parameters are non-typed objects that can later by converted to objects. - * If the input payload is not properly decrypted in the first place, it will be returned - * as-is. - * @access public - * @param {Payload} payload - The payload to encrypt - * @param {SNRootKey|SNItemsKey} [key] - Optional. The key to use to encrypt the payload. - * Will be looked up if not supplied. - * @param {EncryptionIntents} intent - The target of the encryption - * @returns {Payload} The encrypted payload - */},{key:"payloadByEncryptingPayload",value:function(){var _payloadByEncryptingPayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(_ref6){var payload,key,intent,version,format,operator,encryptionParameters;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:payload=_ref6.payload,key=_ref6.key,intent=_ref6.intent;if(!payload.errorDecrypting){_context8.next=3;break;}return _context8.abrupt("return",payload);case 3:if(!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isNullOrUndefined"])(intent)){_context8.next=5;break;}throw'Attempting to encrypt payload with null intent';case 5:if(!(!key&&!Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["isDecryptedIntent"])(intent))){_context8.next=9;break;}_context8.next=8;return this.keyManager.keyToUseForEncryptionOfPayload({payload:payload,intent:intent});case 8:key=_context8.sent;case 9:if(!(!key&&Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["intentRequiresEncryption"])(intent))){_context8.next=11;break;}throw'Attempting to generate encrypted payload with no key.';case 11:if(!(payload.getFormat()!==_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].DecryptedBareObject)){_context8.next=13;break;}throw'Attempting to encrypt already encrypted payload.';case 13:if(payload.isPayload){_context8.next=15;break;}throw'Attempting to encrypt non-payload.';case 15:if(payload.content){_context8.next=17;break;}throw'Attempting to encrypt payload with no content.';case 17:if(payload.uuid){_context8.next=19;break;}throw'Attempting to encrypt payload with no uuid.';case 19:version=key?key.version:this.getLatestVersion();format=this.payloadContentFormatForIntent({key:key,intent:intent});operator=this.operatorForVersion(version);_context8.next=24;return operator.generateEncryptionParameters({payload:payload,key:key,format:format});case 24:encryptionParameters=_context8.sent;if(encryptionParameters){_context8.next=27;break;}throw'Unable to generate encryption parameters';case 27:return _context8.abrupt("return",Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateIntentPayloadFromObject"])({object:payload,override:encryptionParameters,intent:intent}));case 28:case"end":return _context8.stop();}}},_callee8,this);}));function payloadByEncryptingPayload(_x3){return _payloadByEncryptingPayload.apply(this,arguments);}return payloadByEncryptingPayload;}()/** - * Similar to `payloadByEncryptingPayload`, but operates on an array of payloads. - * `intent` can also be a function of the current iteration payload. - * @access public - * @param {Array.} payloads - * @param {EncryptionIntent|function} intent - * @returns {Array.} - */},{key:"payloadsByEncryptingPayloads",value:function(){var _payloadsByEncryptingPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(_ref7){var payloads,intent,results,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,payload,useIntent,encryptedPayload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:payloads=_ref7.payloads,intent=_ref7.intent;results=[];_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context9.prev=5;_iterator=payloads[Symbol.iterator]();case 7:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context9.next=17;break;}payload=_step.value;useIntent=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isFunction"])(intent)?intent(payload):intent;_context9.next=12;return this.payloadByEncryptingPayload({payload:payload,intent:useIntent});case 12:encryptedPayload=_context9.sent;results.push(encryptedPayload);case 14:_iteratorNormalCompletion=true;_context9.next=7;break;case 17:_context9.next=23;break;case 19:_context9.prev=19;_context9.t0=_context9["catch"](5);_didIteratorError=true;_iteratorError=_context9.t0;case 23:_context9.prev=23;_context9.prev=24;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 26:_context9.prev=26;if(!_didIteratorError){_context9.next=29;break;}throw _iteratorError;case 29:return _context9.finish(26);case 30:return _context9.finish(23);case 31:return _context9.abrupt("return",results);case 32:case"end":return _context9.stop();}}},_callee9,this,[[5,19,23,31],[24,,26,30]]);}));function payloadsByEncryptingPayloads(_x4){return _payloadsByEncryptingPayloads.apply(this,arguments);}return payloadsByEncryptingPayloads;}()/** - * Generates a new payload by decrypting the input payload. - * If the input payload is already decrypted, it will be returned as-is. - * @access public - * @param {Payload} payload - The payload to decrypt. - * @param {SNRootKey|SNItemsKey} [key] - Optional. The key to use to decrypt the payload. - * If none is supplied, it will be automatically looked up. - * @returns {Payload} - */},{key:"payloadByDecryptingPayload",value:function(){var _payloadByDecryptingPayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(_ref8){var payload,key,format,version,operator,encryptionParameters,decryptedParameters;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:payload=_ref8.payload,key=_ref8.key;if(payload.content){_context10.next=3;break;}throw'Attempting to decrypt payload that has no content.';case 3:if(payload.isPayload){_context10.next=5;break;}throw'Attempting to decrypt non-payload.';case 5:format=payload.getFormat();if(!(format===_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].DecryptedBareObject)){_context10.next=8;break;}return _context10.abrupt("return",payload);case 8:if(!(!key&&format===_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFormats"].EncryptedString)){_context10.next=14;break;}_context10.next=11;return this.keyManager.keyToUseForDecryptionOfPayload({payload:payload});case 11:key=_context10.sent;if(key){_context10.next=14;break;}return _context10.abrupt("return",Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:payload,override:{waitingForKey:true,errorDecrypting:true}}));case 14:version=payload.version;operator=this.operatorForVersion(version);encryptionParameters=Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateEncryptionParameters"])(payload);_context10.next=19;return operator.generateDecryptedParameters({encryptedParameters:encryptionParameters,key:key});case 19:decryptedParameters=_context10.sent;return _context10.abrupt("return",Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:payload,override:decryptedParameters}));case 21:case"end":return _context10.stop();}}},_callee10,this);}));function payloadByDecryptingPayload(_x5){return _payloadByDecryptingPayload.apply(this,arguments);}return payloadByDecryptingPayload;}()/** - * Similar to `payloadByDecryptingPayload`, but operates on an array of payloads. - * @access public - * @param {Array.} payloads - * @param {SNRootKey|SNItemsKey} [key] - Optional - * @returns {Array.} - */},{key:"payloadsByDecryptingPayloads",value:function(){var _payloadsByDecryptingPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(_ref9){var payloads,key,decryptedPayloads,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,encryptedPayload,isDecryptable,decryptedPayload,_override;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:payloads=_ref9.payloads,key=_ref9.key;decryptedPayloads=[];_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context11.prev=5;_iterator2=payloads[Symbol.iterator]();case 7:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context11.next=35;break;}encryptedPayload=_step2.value;if(encryptedPayload){_context11.next=12;break;}/** Keep in-counts similar to out-counts */decryptedPayloads.push(encryptedPayload);return _context11.abrupt("continue",32);case 12:if(encryptedPayload.isPayload){_context11.next=14;break;}throw'Attempting to decrypt non-payload object in payloadsByDecryptingPayloads.';case 14:if(!(encryptedPayload.deleted===true&&Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isNullOrUndefined"])(encryptedPayload.content))){_context11.next=17;break;}decryptedPayloads.push(encryptedPayload);return _context11.abrupt("continue",32);case 17:isDecryptable=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_5__["isString"])(encryptedPayload.content);if(isDecryptable){_context11.next=21;break;}decryptedPayloads.push(encryptedPayload);return _context11.abrupt("continue",32);case 21:_context11.prev=21;_context11.next=24;return this.payloadByDecryptingPayload({payload:encryptedPayload,key:key});case 24:decryptedPayload=_context11.sent;decryptedPayloads.push(decryptedPayload);_context11.next=32;break;case 28:_context11.prev=28;_context11.t0=_context11["catch"](21);decryptedPayloads.push(Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:encryptedPayload,override:(_override={},_defineProperty(_override,_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFields"].ErrorDecrypting,true),_defineProperty(_override,_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadFields"].ErrorDecryptingChanged,!encryptedPayload.errorDecrypting),_override)}));console.error('Error decrypting payload',encryptedPayload,_context11.t0);case 32:_iteratorNormalCompletion2=true;_context11.next=7;break;case 35:_context11.next=41;break;case 37:_context11.prev=37;_context11.t1=_context11["catch"](5);_didIteratorError2=true;_iteratorError2=_context11.t1;case 41:_context11.prev=41;_context11.prev=42;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 44:_context11.prev=44;if(!_didIteratorError2){_context11.next=47;break;}throw _iteratorError2;case 47:return _context11.finish(44);case 48:return _context11.finish(41);case 49:return _context11.abrupt("return",decryptedPayloads);case 50:case"end":return _context11.stop();}}},_callee11,this,[[5,37,41,49],[21,28],[42,,44,48]]);}));function payloadsByDecryptingPayloads(_x6){return _payloadsByDecryptingPayloads.apply(this,arguments);}return payloadsByDecryptingPayloads;}()/** - * If an item was attempting to decrypt, but failed, either because the keys - * for that item had not downloaded yet, or any other reason, it will be deferred - * item.errorDecrypting = true and possibly item.waitingForKey = true. - * Here we find such items, and attempt to decrypt them again. - * @access public - * @returns {void} - */},{key:"decryptErroredItems",value:function(){var _decryptErroredItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(){var items,payloads,decrypted;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:items=this.modelManager.allItems.filter(function(item){return item.waitingForKey||item.errorDecrypting;});if(!(items.length===0)){_context12.next=3;break;}return _context12.abrupt("return");case 3:payloads=items.map(function(item){return item.payloadRepresentation();});_context12.next=6;return this.payloadsByDecryptingPayloads({payloads:payloads});case 6:decrypted=_context12.sent;_context12.next=9;return this.modelManager.mapPayloadsToLocalItems({payloads:decrypted,source:_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadSources"].LocalChanged});case 9:case"end":return _context12.stop();}}},_callee12,this);}));function decryptErroredItems(){return _decryptErroredItems.apply(this,arguments);}return decryptErroredItems;}()/** - * Decrypts a backup file using user-inputted password - * @access public - * @param {object} data - * @param {object} data.keyParams|data.auth_params - * @param {Array.} data.items - * @param {string} password - The raw user password associated with this backup file - * @returns {Array.} - */},{key:"payloadsByDecryptingBackupFile",value:function(){var _payloadsByDecryptingBackupFile=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(_ref10){var data,password,keyParams,rawItems,encryptedPayloads,decryptedPayloads,key;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:data=_ref10.data,password=_ref10.password;keyParams=data.keyParams||data.auth_params;rawItems=data.items;encryptedPayloads=rawItems.map(function(rawItem){return Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateSourcedPayloadFromObject"])({object:rawItem,source:_Payloads__WEBPACK_IMPORTED_MODULE_4__["PayloadSources"].FileImport});});if(!keyParams){_context13.next=13;break;}_context13.next=7;return this.computeRootKey({password:password,keyParams:keyParams});case 7:key=_context13.sent;_context13.next=10;return this.payloadsByDecryptingPayloads({payloads:encryptedPayloads,key:key});case 10:decryptedPayloads=_context13.sent;_context13.next=14;break;case 13:decryptedPayloads=encryptedPayloads;case 14:return _context13.abrupt("return",decryptedPayloads);case 15:case"end":return _context13.stop();}}},_callee13,this);}));function payloadsByDecryptingBackupFile(_x7){return _payloadsByDecryptingBackupFile.apply(this,arguments);}return payloadsByDecryptingBackupFile;}()/** - * Creates a key params object from a raw object - * @access public - * @param {object} keyParams - The raw key params object to create a KeyParams object from - * @returns {SNRootKeyParams} - */},{key:"createKeyParams",value:function createKeyParams(keyParams){if(keyParams.isKeyParamsObject){throw'Attempting to create key params from non-raw value.';}/* 002 doesn't have version automatically, newer versions do. */if(!keyParams.version){keyParams.version=_Protocol__WEBPACK_IMPORTED_MODULE_6__["ProtocolVersions"].V002;}return Object(_Protocol__WEBPACK_IMPORTED_MODULE_6__["CreateKeyParams"])(keyParams);}/** - * Creates a JSON string representing the backup format of all items, or just subitems - * if supplied. - * @access public - * @param {Array} [subItems] An optional array of items to create backup of. - * If not supplied, all items are backed up. - * @param {EncryptionIntent} [intent = FilePreferEncrypted] - * @param {bool} returnIfEmpty Returns null if there are no items to make backup of. - * @returns {string} JSON stringified representation of data, including keyParams. - */},{key:"createBackupFile",value:function(){var _createBackupFile=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(){var _ref11,subItems,intent,returnIfEmpty,items,payloads,encryptedPayloads,data,keyParams,prettyPrint,_args14=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_ref11=_args14.length>0&&_args14[0]!==undefined?_args14[0]:{},subItems=_ref11.subItems,intent=_ref11.intent,returnIfEmpty=_ref11.returnIfEmpty;items=subItems||this.modelManager.allItems;if(!(returnIfEmpty&&items.length===0)){_context14.next=4;break;}return _context14.abrupt("return",null);case 4:if(!intent){intent=_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FilePreferEncrypted;}payloads=items.map(function(item){return Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:item});});_context14.next=8;return this.payloadsByEncryptingPayloads({payloads:payloads,intent:intent});case 8:encryptedPayloads=_context14.sent;data={items:encryptedPayloads};_context14.next=12;return this.keyManager.getRootKeyParams();case 12:keyParams=_context14.sent;if(keyParams&&intent!==_Protocol__WEBPACK_IMPORTED_MODULE_6__["EncryptionIntents"].FileDecrypted){data.keyParams=keyParams.getPortableValue();}prettyPrint=2;return _context14.abrupt("return",JSON.stringify(data,null,prettyPrint));case 16:case"end":return _context14.stop();}}},_callee14,this);}));function createBackupFile(){return _createBackupFile.apply(this,arguments);}return createBackupFile;}()}]);return SNProtocolService;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/pure_service.js":/*!**************************************!*\ - !*** ./lib/services/pure_service.js ***! - \**************************************/ /*! exports provided: PureService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"PureService",function(){return PureService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}if(args){var _console;(_console=console).log.apply(_console,[string,message].concat(args));}else{console.log(string,message);}}}}]);return PureService;}();/***/},/***/"./lib/services/singleton_manager.js":/*!*******************************************!*\ - !*** ./lib/services/singleton_manager.js ***! - \*******************************************/ /*! exports provided: SNSingletonManager */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNSingletonManager",function(){return SNSingletonManager;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Models__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Models */"./lib/models/index.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Lib_uuid__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Lib/uuid */"./lib/uuid.js");/* harmony import */var _Services_sync_events__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Services/sync/events */"./lib/services/sync/events.js");/* harmony import */var _Payloads_sources__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Payloads/sources */"./lib/protocol/payloads/sources.ts");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0){return selfMatches;}return matchesForRegisteredPredicate(item);};handled=[];_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context2.prev=7;_iterator2=items[Symbol.iterator]();case 9:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context2.next=22;break;}item=_step2.value;if(!handled.includes(item)){_context2.next=13;break;}return _context2.abrupt("continue",19);case 13:matchingItems=matches(item);Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_3__["extendArray"])(handled,matchingItems||[]);if(!(!matchingItems||matchingItems.length<=1)){_context2.next=17;break;}return _context2.abrupt("continue",19);case 17:_context2.next=19;return this.handleStrategy({items:matchingItems,strategy:item.singletonStrategy});case 19:_iteratorNormalCompletion2=true;_context2.next=9;break;case 22:_context2.next=28;break;case 24:_context2.prev=24;_context2.t0=_context2["catch"](7);_didIteratorError2=true;_iteratorError2=_context2.t0;case 28:_context2.prev=28;_context2.prev=29;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 31:_context2.prev=31;if(!_didIteratorError2){_context2.next=34;break;}throw _iteratorError2;case 34:return _context2.finish(31);case 35:return _context2.finish(28);case 36:/** - * Only sync if event source is FullSyncCompleted. - * If it is on DownloadFirstSyncCompleted, we don't need to sync, - * as a sync request will automatically be made as part of the second phase - * of a download-first request. - */if(handled.length>0&&eventSource===_Services_sync_events__WEBPACK_IMPORTED_MODULE_6__["SyncEvents"].FullSyncCompleted){/** - * Do not await. We want any local-side changes to - * be awaited but the actual sync shouldn't be since it's non-essential - * Perform after timeout so that we can yield to event notifier that triggered us - */setTimeout(function(){_this3.syncService.sync();});}case 37:case"end":return _context2.stop();}}},_callee2,this,[[7,24,28,36],[29,,31,35]]);}));function resolveSingletonsForItems(_x2,_x3){return _resolveSingletonsForItems.apply(this,arguments);}return resolveSingletonsForItems;}()/** @access private */},{key:"handleStrategy",value:function(){var _handleStrategy=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(_ref4){var items,strategy,earliestFirst,deleteItems;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:items=_ref4.items,strategy=_ref4.strategy;if(!(strategy!==_Models__WEBPACK_IMPORTED_MODULE_2__["SingletonStrategies"].KeepEarliest)){_context3.next=3;break;}throw'Unhandled singleton strategy';case 3:earliestFirst=items.sort(function(a,b){/** -1: a comes first, 1: b comes first */if(a.errorDecrypting){return 1;}if(b.errorDecrypting){return-1;}return a.created_at0)){_context4.next=4;break;}return _context4.abrupt("return",items[0]);case 4:if(this.syncService.getLastSyncDate()){_context4.next=7;break;}_context4.next=7;return this.syncService.sync();case 7:/** Check again */refreshedItems=this.validItemsMatchingPredicate(predicate);if(!(refreshedItems.length>0)){_context4.next=10;break;}return _context4.abrupt("return",refreshedItems[0]);case 10:/** Delete any items that are errored */errorDecrypting=this.modelManager.itemsMatchingPredicate(predicate).filter(function(item){return item.errorDecrypting;});_context4.next=13;return this.modelManager.setItemsToBeDeleted(errorDecrypting);case 13:_context4.t0=_Payloads_generator__WEBPACK_IMPORTED_MODULE_4__["CopyPayload"];_context4.t1=createPayload;_context4.next=17;return _Lib_uuid__WEBPACK_IMPORTED_MODULE_5__["Uuid"].GenerateUuid();case 17:_context4.t2=_context4.sent;_context4.t3={uuid:_context4.t2,dirty:true};_context4.t4={payload:_context4.t1,override:_context4.t3};dirtyPayload=(0,_context4.t0)(_context4.t4);_context4.next=23;return this.modelManager.mapPayloadToLocalItem({payload:dirtyPayload,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_7__["PayloadSources"].LocalChanged});case 23:item=_context4.sent;_context4.next=26;return this.syncService.sync();case 26:return _context4.abrupt("return",item);case 27:case"end":return _context4.stop();}}},_callee4,this);}));function findOrCreateSingleton(_x5){return _findOrCreateSingleton.apply(this,arguments);}return findOrCreateSingleton;}()}]);return SNSingletonManager;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/storage_service.js":/*!*****************************************!*\ - !*** ./lib/services/storage_service.js ***! - \*****************************************/ /*! exports provided: StoragePersistencePolicies, StorageEncryptionPolicies, StorageValueModes, ValueModesKeys, SNStorageService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"StoragePersistencePolicies",function(){return StoragePersistencePolicies;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"StorageEncryptionPolicies",function(){return StorageEncryptionPolicies;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"StorageValueModes",function(){return StorageValueModes;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"ValueModesKeys",function(){return ValueModesKeys;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNStorageService",function(){return SNStorageService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Protocol__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Protocol */"./lib/protocol/index.js");/* harmony import */var _Lib__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Lib */"./lib/index.js");/* harmony import */var _Payloads__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Payloads */"./lib/protocol/payloads/index.js");/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Lib_uuid__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Lib/uuid */"./lib/uuid.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0;}/** @access public */},{key:"canDecryptWithKey",value:function(){var _canDecryptWithKey=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(key){var wrappedValue,decryptedPayload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:wrappedValue=this.values[ValueModesKeys.Wrapped];_context6.next=3;return this.decryptWrappedValue({wrappedValue:wrappedValue,key:key,throws:false});case 3:decryptedPayload=_context6.sent;return _context6.abrupt("return",!decryptedPayload.errorDecrypting);case 5:case"end":return _context6.stop();}}},_callee6,this);}));function canDecryptWithKey(_x5){return _canDecryptWithKey.apply(this,arguments);}return canDecryptWithKey;}()/** @access private */},{key:"decryptWrappedValue",value:function(){var _decryptWrappedValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(_ref2){var wrappedValue,key,payload,decryptedPayload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:wrappedValue=_ref2.wrappedValue,key=_ref2.key;if(wrappedValue.content_type){_context7.next=3;break;}throw'Attempting to decrypt nonexistent wrapped value';case 3:payload=Object(_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"])({object:wrappedValue,override:{content_type:_Models_content_types__WEBPACK_IMPORTED_MODULE_5__["ContentTypes"].EncryptedStorage}});_context7.next=6;return this.protocolService.payloadByDecryptingPayload({payload:payload,key:key});case 6:decryptedPayload=_context7.sent;return _context7.abrupt("return",decryptedPayload);case 8:case"end":return _context7.stop();}}},_callee7,this);}));function decryptWrappedValue(_x6){return _decryptWrappedValue.apply(this,arguments);}return decryptWrappedValue;}()/** @access public */},{key:"decryptStorage",value:function(){var _decryptStorage=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(){var wrappedValue,decryptedPayload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:wrappedValue=this.values[ValueModesKeys.Wrapped];_context8.next=3;return this.decryptWrappedValue({wrappedValue:wrappedValue});case 3:decryptedPayload=_context8.sent;if(!decryptedPayload.errorDecrypting){_context8.next=6;break;}throw'Unable to decrypt storage.';case 6:this.values[ValueModesKeys.Unwrapped]=Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_6__["Copy"])(decryptedPayload.content);delete this.values[ValueModesKeys.Wrapped];case 8:case"end":return _context8.stop();}}},_callee8,this);}));function decryptStorage(){return _decryptStorage.apply(this,arguments);}return decryptStorage;}()/** - * Generates a payload that can be persisted to disk, - * either as a plain object, or an encrypted item. - */},{key:"generatePersistenceValue",value:function(){var _generatePersistenceValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(){var rawContent,valuesToWrap,payload,encryptedPayload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:rawContent=Object.assign({},this.values);valuesToWrap=rawContent[ValueModesKeys.Unwrapped];_context9.t0=_Payloads__WEBPACK_IMPORTED_MODULE_4__["CreateMaxPayloadFromAnyObject"];_context9.next=5;return _Lib_uuid__WEBPACK_IMPORTED_MODULE_7__["Uuid"].GenerateUuid();case 5:_context9.t1=_context9.sent;_context9.t2=valuesToWrap;_context9.t3=_Models_content_types__WEBPACK_IMPORTED_MODULE_5__["ContentTypes"].EncryptedStorage;_context9.t4={uuid:_context9.t1,content:_context9.t2,content_type:_context9.t3};_context9.t5={object:_context9.t4};payload=(0,_context9.t0)(_context9.t5);_context9.next=13;return this.protocolService.payloadByEncryptingPayload({payload:payload,intent:_Protocol__WEBPACK_IMPORTED_MODULE_2__["EncryptionIntents"].LocalStoragePreferEncrypted});case 13:encryptedPayload=_context9.sent;rawContent[ValueModesKeys.Wrapped]=encryptedPayload;rawContent[ValueModesKeys.Unwrapped]=null;return _context9.abrupt("return",rawContent);case 17:case"end":return _context9.stop();}}},_callee9,this);}));function generatePersistenceValue(){return _generatePersistenceValue.apply(this,arguments);}return generatePersistenceValue;}()},{key:"repersistToDisk",value:function(){var _repersistToDisk=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(){var value;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:if(this.storagePersistable){_context10.next=2;break;}return _context10.abrupt("return");case 2:if(!(this.persistencePolicy===StoragePersistencePolicies.Ephemeral)){_context10.next=4;break;}return _context10.abrupt("return");case 4:_context10.next=6;return this.generatePersistenceValue();case 6:value=_context10.sent;/** Save the persisted value so we have access to it in memory (for unit tests afawk) */this.values[ValueModesKeys.Wrapped]=value[ValueModesKeys.Wrapped];return _context10.abrupt("return",this.persistAsValueToDisk(value));case 9:case"end":return _context10.stop();}}},_callee10,this);}));function repersistToDisk(){return _repersistToDisk.apply(this,arguments);}return repersistToDisk;}()},{key:"setValue",value:function(){var _setValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(key,value){var mode,_args11=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:mode=_args11.length>2&&_args11[2]!==undefined?_args11[2]:StorageValueModes.Default;if(this.values){_context11.next=3;break;}throw"Attempting to set storage key ".concat(key," before loading local storage.");case 3:this.values[this.domainKeyForMode(mode)][key]=value;return _context11.abrupt("return",this.repersistToDisk());case 5:case"end":return _context11.stop();}}},_callee11,this);}));function setValue(_x7,_x8){return _setValue.apply(this,arguments);}return setValue;}()},{key:"getValue",value:function(){var _getValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(key){var mode,_args12=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:mode=_args12.length>1&&_args12[1]!==undefined?_args12[1]:StorageValueModes.Default;if(this.values){_context12.next=3;break;}throw"Attempting to get storage key ".concat(key," before loading local storage.");case 3:if(this.values[this.domainKeyForMode(mode)]){_context12.next=5;break;}throw"Storage domain mode not available ".concat(mode," for key ").concat(key);case 5:return _context12.abrupt("return",this.values[this.domainKeyForMode(mode)][key]);case 6:case"end":return _context12.stop();}}},_callee12,this);}));function getValue(_x9){return _getValue.apply(this,arguments);}return getValue;}()},{key:"removeValue",value:function(){var _removeValue=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(key){var mode,_args13=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:mode=_args13.length>1&&_args13[1]!==undefined?_args13[1]:StorageValueModes.Default;if(this.values){_context13.next=3;break;}throw"Attempting to remove storage key ".concat(key," before loading local storage.");case 3:delete this.values[this.domainKeyForMode(mode)][key];return _context13.abrupt("return",this.repersistToDisk());case 5:case"end":return _context13.stop();}}},_callee13,this);}));function removeValue(_x10){return _removeValue.apply(this,arguments);}return removeValue;}()/** - * Default persistence key. Platforms can override as needed. - */},{key:"getPersistenceKey",value:function getPersistenceKey(){return Object(_Lib__WEBPACK_IMPORTED_MODULE_3__["namespacedKey"])(this.namespace,_Lib__WEBPACK_IMPORTED_MODULE_3__["RawStorageKeys"].StorageObject);}},{key:"defaultValuesObject",value:function defaultValuesObject(){var _ref3=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},wrapped=_ref3.wrapped,unwrapped=_ref3.unwrapped,nonwrapped=_ref3.nonwrapped;return this.constructor.defaultValuesObject({wrapped:wrapped,unwrapped:unwrapped,nonwrapped:nonwrapped});}},{key:"domainKeyForMode",/** @access private */value:function domainKeyForMode(mode){return this.constructor.domainKeyForMode(mode);}/** - * Clears simple values from storage only. Does not affect payloads. - */},{key:"clearValues",value:function(){var _clearValues=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:this.setInitialValues();_context14.next=3;return this.repersistToDisk();case 3:case"end":return _context14.stop();}}},_callee14,this);}));function clearValues(){return _clearValues.apply(this,arguments);}return clearValues;}()/** Payload Storage */},{key:"getAllRawPayloads",value:function(){var _getAllRawPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:return _context15.abrupt("return",this.deviceInterface.getAllRawDatabasePayloads());case 1:case"end":return _context15.stop();}}},_callee15,this);}));function getAllRawPayloads(){return _getAllRawPayloads.apply(this,arguments);}return getAllRawPayloads;}()},{key:"savePayload",value:function(){var _savePayload=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee16(payload){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:return _context16.abrupt("return",this.savePayloads([payload]));case 1:case"end":return _context16.stop();}}},_callee16,this);}));function savePayload(_x11){return _savePayload.apply(this,arguments);}return savePayload;}()},{key:"savePayloads",value:function(){var _savePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee17(decryptedPayloads){var deleted,nondeleted,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,payload,encrypted;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:if(!(this.persistencePolicy===StoragePersistencePolicies.Ephemeral)){_context17.next=2;break;}return _context17.abrupt("return");case 2:deleted=[];nondeleted=[];_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context17.prev=7;_iterator=decryptedPayloads[Symbol.iterator]();case 9:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context17.next=22;break;}payload=_step.value;if(!payload.discardable){_context17.next=15;break;}/** If the payload is deleted and not dirty, remove it from db. */deleted.push(payload);_context17.next=19;break;case 15:_context17.next=17;return this.protocolService.payloadByEncryptingPayload({payload:payload,intent:this.encryptionPolicy===StorageEncryptionPolicies.Default?_Protocol__WEBPACK_IMPORTED_MODULE_2__["EncryptionIntents"].LocalStoragePreferEncrypted:_Protocol__WEBPACK_IMPORTED_MODULE_2__["EncryptionIntents"].LocalStorageDecrypted});case 17:encrypted=_context17.sent;nondeleted.push(encrypted);case 19:_iteratorNormalCompletion=true;_context17.next=9;break;case 22:_context17.next=28;break;case 24:_context17.prev=24;_context17.t0=_context17["catch"](7);_didIteratorError=true;_iteratorError=_context17.t0;case 28:_context17.prev=28;_context17.prev=29;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 31:_context17.prev=31;if(!_didIteratorError){_context17.next=34;break;}throw _iteratorError;case 34:return _context17.finish(31);case 35:return _context17.finish(28);case 36:if(!(deleted.length>0)){_context17.next=39;break;}_context17.next=39;return this.deletePayloads(deleted);case 39:_context17.next=41;return this.deviceInterface.saveRawDatabasePayloads(nondeleted);case 41:case"end":return _context17.stop();}}},_callee17,this,[[7,24,28,36],[29,,31,35]]);}));function savePayloads(_x12){return _savePayloads.apply(this,arguments);}return savePayloads;}()},{key:"deletePayloads",value:function(){var _deletePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee18(payloads){var _iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,payload;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context18.prev=3;_iterator2=payloads[Symbol.iterator]();case 5:if(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done){_context18.next=12;break;}payload=_step2.value;_context18.next=9;return this.deletePayloadWithId(payload.uuid);case 9:_iteratorNormalCompletion2=true;_context18.next=5;break;case 12:_context18.next=18;break;case 14:_context18.prev=14;_context18.t0=_context18["catch"](3);_didIteratorError2=true;_iteratorError2=_context18.t0;case 18:_context18.prev=18;_context18.prev=19;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 21:_context18.prev=21;if(!_didIteratorError2){_context18.next=24;break;}throw _iteratorError2;case 24:return _context18.finish(21);case 25:return _context18.finish(18);case 26:case"end":return _context18.stop();}}},_callee18,this,[[3,14,18,26],[19,,21,25]]);}));function deletePayloads(_x13){return _deletePayloads.apply(this,arguments);}return deletePayloads;}()},{key:"deletePayloadWithId",value:function(){var _deletePayloadWithId=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee19(id){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:return _context19.abrupt("return",this.deviceInterface.removeRawDatabasePayloadWithId(id));case 1:case"end":return _context19.stop();}}},_callee19,this);}));function deletePayloadWithId(_x14){return _deletePayloadWithId.apply(this,arguments);}return deletePayloadWithId;}()},{key:"clearAllPayloads",value:function(){var _clearAllPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee20(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:return _context20.abrupt("return",this.deviceInterface.removeAllRawDatabasePayloads());case 1:case"end":return _context20.stop();}}},_callee20,this);}));function clearAllPayloads(){return _clearAllPayloads.apply(this,arguments);}return clearAllPayloads;}()},{key:"clearAllData",value:function(){var _clearAllData=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee21(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:return _context21.abrupt("return",Promise.all([this.clearValues(),this.clearAllPayloads()]));case 1:case"end":return _context21.stop();}}},_callee21,this);}));function clearAllData(){return _clearAllData.apply(this,arguments);}return clearAllData;}()}],[{key:"defaultValuesObject",value:function defaultValuesObject(){var _ref5;var _ref4=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref4$wrapped=_ref4.wrapped,wrapped=_ref4$wrapped===void 0?{}:_ref4$wrapped,_ref4$unwrapped=_ref4.unwrapped,unwrapped=_ref4$unwrapped===void 0?{}:_ref4$unwrapped,_ref4$nonwrapped=_ref4.nonwrapped,nonwrapped=_ref4$nonwrapped===void 0?{}:_ref4$nonwrapped;return _ref5={},_defineProperty(_ref5,ValueModesKeys.Wrapped,wrapped),_defineProperty(_ref5,ValueModesKeys.Unwrapped,unwrapped),_defineProperty(_ref5,ValueModesKeys.Nonwrapped,nonwrapped),_ref5;}/** @access private */},{key:"domainKeyForMode",value:function domainKeyForMode(mode){if(mode===StorageValueModes.Default){return ValueModesKeys.Unwrapped;}else if(mode===StorageValueModes.Nonwrapped){return ValueModesKeys.Nonwrapped;}else{throw'Invalid mode';}}}]);return SNStorageService;}(_Lib_services_pure_service__WEBPACK_IMPORTED_MODULE_1__["PureService"]);/***/},/***/"./lib/services/sync/account/downloader.js":/*!*************************************************!*\ - !*** ./lib/services/sync/account/downloader.js ***! - \*************************************************/ /*! exports provided: AccountDownloader */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"AccountDownloader",function(){return AccountDownloader;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Lib_protocol_payloads_sources__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Lib/protocol/payloads/sources */"./lib/protocol/payloads/sources.ts");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i0){collections.push(collectionRetrieved);}_context.next=7;return this.collectionByProcessingRawItems({rawItems:this.response.rawSavedItems,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_2__["PayloadSources"].RemoteSaved});case 7:collectionSaved=_context.sent;if(collectionSaved.getAllPayloads().length>0){collections.push(collectionSaved);}_context.next=11;return this.collectionByProcessingRawItems({rawItems:this.response.rawUuidConflictItems,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_2__["PayloadSources"].ConflictUuid});case 11:collectionUuidConflicts=_context.sent;if(collectionUuidConflicts.getAllPayloads().length>0){collections.push(collectionUuidConflicts);}_context.next=15;return this.collectionByProcessingRawItems({rawItems:this.response.rawDataConflictItems,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_2__["PayloadSources"].ConflictData});case 15:collectionDataConflicts=_context.sent;if(collectionDataConflicts.getAllPayloads().length>0){collections.push(collectionDataConflicts);}return _context.abrupt("return",collections);case 18:case"end":return _context.stop();}}},_callee,this);}));function collectionsByProcessingResponse(){return _collectionsByProcessingResponse.apply(this,arguments);}return collectionsByProcessingResponse;}()},{key:"collectionByProcessingRawItems",value:function(){var _collectionByProcessingRawItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(_ref2){var _this=this;var rawItems,source,payloads,collection,deltaClass,delta,resultCollection,updatedDirtyPayloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:rawItems=_ref2.rawItems,source=_ref2.source;payloads=rawItems.map(function(rawItem){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_5__["CreateSourcedPayloadFromObject"])({object:rawItem,source:source});});collection=new _Payloads_collection__WEBPACK_IMPORTED_MODULE_3__["PayloadCollection"]({payloads:payloads,source:source});deltaClass=Object(_Payloads_deltas_generator__WEBPACK_IMPORTED_MODULE_1__["DeltaClassForSource"])(source);// eslint-disable-next-line new-cap -delta=new deltaClass({baseCollection:this.baseCollection,applyCollection:collection,relatedCollectionSet:this.relatedCollectionSet});_context2.next=7;return delta.resultingCollection();case 7:resultCollection=_context2.sent;updatedDirtyPayloads=resultCollection.allPayloads.map(function(payload){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_5__["CopyPayload"])({payload:payload,override:{dirty:_this.finalDirtyStateForPayload(payload)}});});return _context2.abrupt("return",new _Payloads_collection__WEBPACK_IMPORTED_MODULE_3__["PayloadCollection"]({payloads:updatedDirtyPayloads,source:source}));case 10:case"end":return _context2.stop();}}},_callee2,this);}));function collectionByProcessingRawItems(_x){return _collectionByProcessingRawItems.apply(this,arguments);}return collectionByProcessingRawItems;}()},{key:"finalDirtyStateForPayload",value:function finalDirtyStateForPayload(payload){var current=this.baseCollection.findPayload(payload.uuid);/** - * `current` can be null in the case of new - * items that haven't yet been mapped - */var stillDirty;if(current){/** Marking items dirty after lastSyncBegan will cause them to sync again. */stillDirty=current.dirtiedDate>current.lastSyncBegan;}else{/** Forward whatever value any delta resolver may have set */stillDirty=payload.dirty;}return stillDirty;}}]);return SyncResponseResolver;}();/***/},/***/"./lib/services/sync/events.js":/*!*************************************!*\ - !*** ./lib/services/sync/events.js ***! - \*************************************/ /*! exports provided: SyncEvents */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SyncEvents",function(){return SyncEvents;});var SyncEvents={/** A full sync can consist of many round-trips to the server */FullSyncCompleted:'sync:full-completed',/** A single sync is just one round-trip to the server completion */SingleSyncCompleted:'sync:single-completed',SyncWillBegin:'sync:will-begin',DownloadFirstSyncCompleted:'sync:download-first-completed',SyncTakingTooLong:'sync:taking-too-long',SyncError:'sync:error',InvalidSession:'sync:invalid-session',MajorDataChange:'major-data-change',LocalDataIncrementalLoad:'local-data-incremental-load',LocalDataLoaded:'local-data-loaded',EnterOutOfSync:'enter-out-of-sync',ExitOutOfSync:'exit-out-of-sync',StatusChanged:'status-changed',DatabaseWriteError:'database-write-error',DatabaseReadError:'database-read-error'};/***/},/***/"./lib/services/sync/offline/operation.js":/*!************************************************!*\ - !*** ./lib/services/sync/offline/operation.js ***! - \************************************************/ /*! exports provided: OfflineSyncOperation */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"OfflineSyncOperation",function(){return OfflineSyncOperation;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Services_sync_signals__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Services/sync/signals */"./lib/services/sync/signals.js");/* harmony import */var _Payloads_fields__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Payloads/fields */"./lib/protocol/payloads/fields.js");/* harmony import */var _Payloads_sources__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Payloads/sources */"./lib/protocol/payloads/sources.ts");/* harmony import */var _Services_sync_response__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Services/sync/response */"./lib/services/sync/response.js");/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;iHEALTHY_SYNC_DURATION_THRESHOLD_S){_this.receiver(_Lib__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].SyncTakingTooLong);_this.stopTimingMonitor();}},TIMING_MONITOR_POLL_FREQUENCY_MS);}},{key:"stopTimingMonitor",value:function stopTimingMonitor(){if(Object.prototype.hasOwnProperty.call(this.interval,'cancel')){this.interval.cancel(this.timingMonitor);}else{clearInterval(this.timingMonitor);}this.timingMonitor=null;}},{key:"hasError",value:function hasError(){return!!this.error;}},{key:"setError",value:function setError(error){this.error=error;}},{key:"clearError",value:function clearError(){this.error=null;}},{key:"reset",value:function reset(){this.downloaded=0;this.completedUpload=0;this.totalUpload=0;this.inProgress=false;this.syncing=false;this.error=null;this.receiver(_Lib__WEBPACK_IMPORTED_MODULE_0__["SyncEvents"].StatusChanged);}},{key:"syncInProgress",get:function get(){return this.syncing===true;}},{key:"secondsSinceSyncStart",get:function get(){return(new Date()-this.syncStart)/1000;}}]);return SyncOpStatus;}();/***/},/***/"./lib/services/sync/sync_service.js":/*!*******************************************!*\ - !*** ./lib/services/sync/sync_service.js ***! - \*******************************************/ /*! exports provided: TIMING_STRATEGY_RESOLVE_ON_NEXT, TIMING_STRATEGY_FORCE_SPAWN_NEW, SyncModes, SyncSources, SNSyncService */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"TIMING_STRATEGY_RESOLVE_ON_NEXT",function(){return TIMING_STRATEGY_RESOLVE_ON_NEXT;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"TIMING_STRATEGY_FORCE_SPAWN_NEW",function(){return TIMING_STRATEGY_FORCE_SPAWN_NEW;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SyncModes",function(){return SyncModes;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SyncSources",function(){return SyncSources;});/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SNSyncService",function(){return SNSyncService;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");/* harmony import */var _Services_pure_service__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(/*! @Services/pure_service */"./lib/services/pure_service.js");/* harmony import */var _Services_sync_utils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(/*! @Services/sync/utils */"./lib/services/sync/utils.js");/* harmony import */var _Services_sync_sync_op_status__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(/*! @Services/sync/sync_op_status */"./lib/services/sync/sync_op_status.js");/* harmony import */var _Services_sync_sync_state__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(/*! @Services/sync/sync_state */"./lib/services/sync/sync_state.js");/* harmony import */var _Services_sync_account_downloader__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(/*! @Services/sync/account/downloader */"./lib/services/sync/account/downloader.js");/* harmony import */var _Services_sync_account_response_resolver__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(/*! @Services/sync/account/response_resolver */"./lib/services/sync/account/response_resolver.js");/* harmony import */var _Services_sync_account_operation__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(/*! @Services/sync/account/operation */"./lib/services/sync/account/operation.js");/* harmony import */var _Services_sync_offline_operation__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(/*! @Services/sync/offline/operation */"./lib/services/sync/offline/operation.js");/* harmony import */var _Payloads_deltas__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(/*! @Payloads/deltas */"./lib/protocol/payloads/deltas/index.js");/* harmony import */var _Payloads_fields__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(/*! @Payloads/fields */"./lib/protocol/payloads/fields.js");/* harmony import */var _Payloads_sources__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(/*! @Payloads/sources */"./lib/protocol/payloads/sources.ts");/* harmony import */var _Payloads_collection__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(/*! @Payloads/collection */"./lib/protocol/payloads/collection.js");/* harmony import */var _Payloads_functions__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(/*! @Payloads/functions */"./lib/protocol/payloads/functions.js");/* harmony import */var _Payloads_generator__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(/*! @Payloads/generator */"./lib/protocol/payloads/generator.js");/* harmony import */var _Protocol_intents__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(/*! @Protocol/intents */"./lib/protocol/intents.js");/* harmony import */var _Models_content_types__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(/*! @Models/content_types */"./lib/models/content_types.js");/* harmony import */var _Models_generator__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(/*! @Models/generator */"./lib/models/generator.js");/* harmony import */var _Services_sync_signals__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(/*! @Services/sync/signals */"./lib/services/sync/signals.js");/* harmony import */var _Lib__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(/*! @Lib */"./lib/index.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i} rawPayloads - use `getDatabasePayloads` to get these payloads. - * They are fed as a parameter so that callers don't have to await the loading, but can - * await getting the raw payloads from storage - */},{key:"loadDatabasePayloads",value:function(){var _loadDatabasePayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(rawPayloads){var unsortedPayloads,payloads,itemsKeysPayloads,decryptedItemsKeys,payloadCount,batchSize,numBatches,batchIndex,currentPosition,batch,decrypted;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:if(!this.databaseLoaded){_context3.next=2;break;}throw'Attempting to initialize already initialized local database.';case 2:unsortedPayloads=rawPayloads.map(function(rawPayload){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_15__["CreateMaxPayloadFromAnyObject"])({object:rawPayload});});payloads=Object(_Services_sync_utils__WEBPACK_IMPORTED_MODULE_3__["SortPayloadsByRecentAndContentPriority"])(unsortedPayloads,this.localLoadPriorty);/** Decrypt and map items keys first */itemsKeysPayloads=payloads.filter(function(payload){return payload.content_type===_Models_content_types__WEBPACK_IMPORTED_MODULE_17__["ContentTypes"].ItemsKey;});Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["subtractFromArray"])(payloads,itemsKeysPayloads);_context3.next=8;return this.protocolService.payloadsByDecryptingPayloads({payloads:itemsKeysPayloads});case 8:decryptedItemsKeys=_context3.sent;_context3.next=11;return this.modelManager.mapPayloadsToLocalItems({payloads:decryptedItemsKeys,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_12__["PayloadSources"].LocalRetrieved});case 11:/** Map in batches to give interface a chance to update */payloadCount=payloads.length;batchSize=DEFAULT_DATABASE_LOAD_BATCH_SIZE;numBatches=Math.ceil(payloadCount/batchSize);batchIndex=0;case 15:if(!(batchIndex0&&_args11[0]!==undefined?_args11[0]:{},alternateUuids=_ref2.alternateUuids;this.log('Marking all items as needing sync');if(!alternateUuids){_context11.next=30;break;}/** Make a copy of the array, as alternating uuid will affect array */_items=this.modelManager.allNondummyItems.filter(function(item){return!item.errorDecrypting;}).slice();_iteratorNormalCompletion=true;_didIteratorError=false;_iteratorError=undefined;_context11.prev=7;_iterator=_items[Symbol.iterator]();case 9:if(_iteratorNormalCompletion=(_step=_iterator.next()).done){_context11.next=16;break;}item=_step.value;_context11.next=13;return this.alternateUuidForItem(item);case 13:_iteratorNormalCompletion=true;_context11.next=9;break;case 16:_context11.next=22;break;case 18:_context11.prev=18;_context11.t0=_context11["catch"](7);_didIteratorError=true;_iteratorError=_context11.t0;case 22:_context11.prev=22;_context11.prev=23;if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}case 25:_context11.prev=25;if(!_didIteratorError){_context11.next=28;break;}throw _iteratorError;case 28:return _context11.finish(25);case 29:return _context11.finish(22);case 30:items=this.modelManager.allNondummyItems;payloads=items.map(function(item){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_15__["CreateMaxPayloadFromAnyObject"])({object:item,override:{dirty:true}});});_context11.next=34;return this.modelManager.mapPayloadsToLocalItems({payloads:payloads,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_12__["PayloadSources"].LocalChanged});case 34:_context11.next=36;return this.persistPayloads({decryptedPayloads:payloads});case 36:case"end":return _context11.stop();}}},_callee11,this,[[7,18,22,30],[23,,25,29]]);}));function markAllItemsAsNeedingSync(){return _markAllItemsAsNeedingSync.apply(this,arguments);}return markAllItemsAsNeedingSync;}()/** - * If encryption status changes (esp. on mobile, where local storage encryption - * can be disabled), consumers may call this function to repersist all items to - * disk using latest encryption status. - * @access public - */},{key:"repersistAllItems",value:function(){var _repersistAllItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(){var items,payloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:items=this.modelManager.allItems;payloads=items.map(function(item){return Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_15__["CreateMaxPayloadFromAnyObject"])({object:item});});return _context12.abrupt("return",this.persistPayloads({decryptedPayloads:payloads}));case 3:case"end":return _context12.stop();}}},_callee12,this);}));function repersistAllItems(){return _repersistAllItems.apply(this,arguments);}return repersistAllItems;}()/** - * Return the payloads that need local persistence, before beginning a sync. - * This way, if the application is closed before a sync request completes, - * pending data will be saved to disk, and synced the next time the app opens. - * @access private - */},{key:"popPayloadsNeedingPreSyncSave",value:function(){var _popPayloadsNeedingPreSyncSave=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(from){var lastPreSyncSave,payloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:lastPreSyncSave=this.state.lastPreSyncSaveDate;if(lastPreSyncSave){_context13.next=3;break;}return _context13.abrupt("return",from);case 3:/** dirtiedDate can be null if the payload was created as dirty */payloads=from.filter(function(candidate){return!candidate.dirtiedDate||candidate.dirtiedDate>lastPreSyncSave;});this.state.setLastPresaveSyncDate(new Date());return _context13.abrupt("return",payloads);case 6:case"end":return _context13.stop();}}},_callee13,this);}));function popPayloadsNeedingPreSyncSave(_x5){return _popPayloadsNeedingPreSyncSave.apply(this,arguments);}return popPayloadsNeedingPreSyncSave;}()/** @access private */},{key:"timingStrategyResolveOnNext",value:function timingStrategyResolveOnNext(){var _this5=this;return new Promise(function(resolve,reject){_this5.resolveQueue.push({resolve:resolve,reject:reject});});}/** @access private */},{key:"timingStrategyForceSpawnNew",value:function timingStrategyForceSpawnNew(options){var _this6=this;return new Promise(function(resolve,reject){_this6.spawnQueue.push({resolve:resolve,reject:reject,options:options});});}/** - * For timing strategy TIMING_STRATEGY_FORCE_SPAWN_NEW, we will execute a whole sync request - * and pop it from the queue. - * @access private - */},{key:"popSpawnQueue",value:function popSpawnQueue(){if(this.spawnQueue.length===0){return null;}var promise=this.spawnQueue[0];Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["removeFromIndex"])(this.spawnQueue,0);this.log('Syncing again from spawn queue');return this.sync(_objectSpread({timingStrategy:TIMING_STRATEGY_FORCE_SPAWN_NEW,source:SyncSources.SpawnQueue},promise.options)).then(function(){promise.resolve();}).catch(function(){promise.reject();});}/** - * Certain content types should not be encrypted when sending to server, - * such as server extensions - * @access private - */},{key:"payloadsByPreparingForServer",value:function payloadsByPreparingForServer(payloads){var _this7=this;return this.protocolService.payloadsByEncryptingPayloads({payloads:payloads,intent:function intent(payload){return _this7.nonEncryptedTypes.includes(payload.content_type)?_Protocol_intents__WEBPACK_IMPORTED_MODULE_16__["EncryptionIntents"].SyncDecrypted:_Protocol_intents__WEBPACK_IMPORTED_MODULE_16__["EncryptionIntents"].Sync;}});}/** - * @access public - * @param timingStrategy TIMING_STRATEGY_RESOLVE_ON_NEXT | Default - * Promise will be resolved on the next sync request after the current one completes. - * If there is no scheduled sync request, one will be scheduled. - * - * TIMING_STRATEGY_FORCE_SPAWN_NEW - * A new sync request is guarenteed to be generated for your request, no matter how long it takes. - * Promise will be resolved whenever this sync request is processed in the serial queue. - * - * @param mode SyncModes.Default - * Performs a standard sync, uploading any dirty items and retrieving items. - * SyncModes.DownloadFirst - * The first sync for an account, where we first want to download all remote items first - * before uploading any dirty items. This allows a consumer, for example, to download - * all data to see if user has an items key, and if not, only then create a new one. - * @param checkIntegrity Whether the server should compute and return an integrity hash. - * @param source SyncSource value. Internally used to keep track of how sync requests were spawned. - */},{key:"sync",value:function(){var _sync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14(){var _this8=this;var _ref3,timingStrategy,mode,checkIntegrity,source,syncLocked,captureLock,releaseLock,syncInProgress,databaseLoaded,canExecuteSync,items,neverSyncedDeleted,decryptedPayloads,payloadsNeedingSave,inTimeResolveQueue,useStrategy,beginDate,online,useMode,uploadPayloads,operation,_iteratorNormalCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,callback,_args14=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_ref3=_args14.length>0&&_args14[0]!==undefined?_args14[0]:{},timingStrategy=_ref3.timingStrategy,mode=_ref3.mode,checkIntegrity=_ref3.checkIntegrity,source=_ref3.source;if(!this.locked){_context14.next=4;break;}this.log('Sync Locked');return _context14.abrupt("return");case 4:/** - * Allows us to lock this function from triggering duplicate network requests. - * There are two types of locking checks: - * 1. syncLocked(): If a call to sync() call has begun preparing to be sent to the server. - * but not yet completed all the code below before reaching that point. - * (before reaching opStatus.setDidBegin). - * 2. syncOpInProgress: If a sync() call is in flight to the server. - */syncLocked=function syncLocked(){return _this8.syncLock;};captureLock=function captureLock(){_this8.syncLock=true;};releaseLock=function releaseLock(){_this8.syncLock=false;};syncInProgress=this.opStatus.syncInProgress;databaseLoaded=this.databaseLoaded;canExecuteSync=!syncLocked();if(canExecuteSync&&databaseLoaded&&!syncInProgress){captureLock();}if(!source){source=SyncSources.External;}_context14.next=14;return this.itemsNeedingSync();case 14:items=_context14.sent;/** - * Items that have never been synced and marked as deleted should not be - * uploaded to server, and instead deleted directly after sync completion. - */neverSyncedDeleted=items.filter(function(item){return item.neverSynced&&item.deleted;});Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["subtractFromArray"])(items,neverSyncedDeleted);decryptedPayloads=items.map(function(item){return item.payloadRepresentation();});_context14.next=20;return this.popPayloadsNeedingPreSyncSave(decryptedPayloads);case 20:payloadsNeedingSave=_context14.sent;_context14.next=23;return this.persistPayloads({decryptedPayloads:payloadsNeedingSave});case 23:/** The in time resolve queue refers to any sync requests that were made while we still - * have not sent out the current request. So, anything in the in time resolve queue - * will have made it in time to piggyback on the current request. Anything that comes - * _after_ in-time will schedule a new sync request. */inTimeResolveQueue=this.resolveQueue.slice();useStrategy=!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(timingStrategy)?timingStrategy:TIMING_STRATEGY_RESOLVE_ON_NEXT;if(!(syncInProgress||!databaseLoaded||!canExecuteSync)){_context14.next=36;break;}this.log(!canExecuteSync?'Another function call has begun preparing for sync.':syncInProgress?'Attempting to sync while existing sync in progress.':'Attempting to sync before local database has loaded.');if(!(useStrategy===TIMING_STRATEGY_RESOLVE_ON_NEXT)){_context14.next=31;break;}return _context14.abrupt("return",this.timingStrategyResolveOnNext());case 31:if(!(useStrategy===TIMING_STRATEGY_FORCE_SPAWN_NEW)){_context14.next=35;break;}return _context14.abrupt("return",this.timingStrategyForceSpawnNew({mode:mode,checkIntegrity:checkIntegrity,source:source}));case 35:throw"Unhandled timing strategy ".concat(useStrategy);case 36:/** Lock syncing immediately after checking in progress above */this.opStatus.setDidBegin();this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].SyncWillBegin);/* Subtract from array as soon as we're sure they'll be called. - resolves are triggered at the end of this function call */Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["subtractFromArray"])(this.resolveQueue,inTimeResolveQueue);/** - * lastSyncBegan must be set *after* any point we may have returned above. - * Setting this value means the item was 100% sent to the server. - */beginDate=new Date();_context14.next=42;return this.modelManager.setItemsProperties({items:items,properties:_defineProperty({},_Payloads_fields__WEBPACK_IMPORTED_MODULE_11__["PayloadFields"].LastSyncBegan,beginDate)});case 42:_context14.next=44;return this.sessionManager.online();case 44:online=_context14.sent;useMode=function(tryMode){if(online&&!_this8.completedOnlineDownloadFirstSync){return SyncModes.DownloadFirst;}else if(!Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(tryMode)){return tryMode;}else{return SyncModes.Default;}}(mode);if(!(useMode===SyncModes.Default)){_context14.next=58;break;}if(!(online&&!this.completedOnlineDownloadFirstSync)){_context14.next=49;break;}throw'Attempting to default mode sync without having completed initial.';case 49:if(!online){_context14.next=55;break;}_context14.next=52;return this.payloadsByPreparingForServer(decryptedPayloads);case 52:uploadPayloads=_context14.sent;_context14.next=56;break;case 55:uploadPayloads=decryptedPayloads;case 56:_context14.next=59;break;case 58:if(useMode===SyncModes.DownloadFirst){uploadPayloads=[];}case 59:if(!online){_context14.next=65;break;}_context14.next=62;return this.syncOnlineOperation({payloads:uploadPayloads,checkIntegrity:checkIntegrity,source:source,mode:useMode});case 62:operation=_context14.sent;_context14.next=68;break;case 65:_context14.next=67;return this.syncOfflineOperation({payloads:uploadPayloads,source:source,mode:useMode});case 67:operation=_context14.sent;case 68:_context14.next=70;return operation.run();case 70:this.opStatus.setDidEnd();releaseLock();if(!this.opStatus.hasError()){_context14.next=74;break;}return _context14.abrupt("return");case 74:this.opStatus.reset();this.state.setLastSyncDate(new Date());if(operation.numberOfItemsInvolved>=this.majorChangeThreshold){this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].MajorDataChange);}_context14.next=79;return this.handleNeverSyncedDeleted(neverSyncedDeleted);case 79:if(!(useMode!==SyncModes.DownloadFirst)){_context14.next=82;break;}_context14.next=82;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].FullSyncCompleted,{source:source});case 82:if(!(useMode===SyncModes.DownloadFirst)){_context14.next=90;break;}if(online){this.completedOnlineDownloadFirstSync=true;}_context14.next=86;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].DownloadFirstSyncCompleted);case 86:_context14.next=88;return this.sync({source:SyncSources.AfterDownloadFirst,checkIntegrity:true});case 88:_context14.next=108;break;case 90:if(!(!this.popSpawnQueue()&&this.resolveQueue.length>0)){_context14.next=95;break;}this.log('Syncing again from resolve queue');/** No need to await. */this.sync({source:SyncSources.ResolveQueue});_context14.next=108;break;case 95:_context14.next=97;return this.itemsNeedingSync();case 97:_context14.t0=_context14.sent.length;if(!(_context14.t0>0)){_context14.next=102;break;}return _context14.abrupt("return",this.sync({source:SyncSources.MoreDirtyItems}));case 102:if(!operation.checkIntegrity){_context14.next=106;break;}if(this.state.needsSync&&operation.done){this.log('Syncing again from integrity check');this.sync({checkIntegrity:true,timingStrategy:TIMING_STRATEGY_FORCE_SPAWN_NEW,source:SyncSources.IntegrityCheck});}_context14.next=108;break;case 106:_context14.next=108;return this.state.clearIntegrityHashes();case 108:/** - * For timing strategy TIMING_STRATEGY_RESOLVE_ON_NEXT. - * Execute any callbacks pulled before this sync request began. - * Calling resolve on the callbacks should be the last thing we do in this function, - * to simulate calling .sync as if it went through straight to the end without having - * to be queued. - */_iteratorNormalCompletion2=true;_didIteratorError2=false;_iteratorError2=undefined;_context14.prev=111;for(_iterator2=inTimeResolveQueue[Symbol.iterator]();!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){callback=_step2.value;callback.resolve();}_context14.next=119;break;case 115:_context14.prev=115;_context14.t1=_context14["catch"](111);_didIteratorError2=true;_iteratorError2=_context14.t1;case 119:_context14.prev=119;_context14.prev=120;if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}case 122:_context14.prev=122;if(!_didIteratorError2){_context14.next=125;break;}throw _iteratorError2;case 125:return _context14.finish(122);case 126:return _context14.finish(119);case 127:case"end":return _context14.stop();}}},_callee14,this,[[111,115,119,127],[120,,122,126]]);}));function sync(){return _sync.apply(this,arguments);}return sync;}()/** @access private */},{key:"syncOnlineOperation",value:function(){var _syncOnlineOperation=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee16(_ref4){var _this9=this;var payloads,checkIntegrity,source,mode,operation;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:payloads=_ref4.payloads,checkIntegrity=_ref4.checkIntegrity,source=_ref4.source,mode=_ref4.mode;this.log('Syncing online user','source:',source,'mode:',mode,'payloads:',payloads);_context16.t0=_Services_sync_account_operation__WEBPACK_IMPORTED_MODULE_8__["AccountSyncOperation"];_context16.t1=this.apiService;_context16.t2=payloads;_context16.t3=checkIntegrity;_context16.next=8;return this.getLastSyncToken();case 8:_context16.t4=_context16.sent;_context16.next=11;return this.getPaginationToken();case 11:_context16.t5=_context16.sent;_context16.t6=function(){var _receiver=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee15(signal,type){var response;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:if(!(type===_Services_sync_signals__WEBPACK_IMPORTED_MODULE_19__["SIGNAL_TYPE_RESPONSE"])){_context15.next=11;break;}response=signal;if(!response.hasError){_context15.next=7;break;}_context15.next=5;return _this9.handleErrorServerResponse({operation:operation,response:response});case 5:_context15.next=9;break;case 7:_context15.next=9;return _this9.handleSuccessServerResponse({operation:operation,response:response});case 9:_context15.next=14;break;case 11:if(!(type===_Services_sync_signals__WEBPACK_IMPORTED_MODULE_19__["SIGNAL_TYPE_STATUS_CHANGED"])){_context15.next=14;break;}_context15.next=14;return _this9.handleStatusChange({operation:operation});case 14:case"end":return _context15.stop();}}},_callee15);}));function receiver(_x7,_x8){return _receiver.apply(this,arguments);}return receiver;}();_context16.t7={apiService:_context16.t1,payloads:_context16.t2,checkIntegrity:_context16.t3,lastSyncToken:_context16.t4,paginationToken:_context16.t5,receiver:_context16.t6};operation=new _context16.t0(_context16.t7);return _context16.abrupt("return",operation);case 16:case"end":return _context16.stop();}}},_callee16,this);}));function syncOnlineOperation(_x6){return _syncOnlineOperation.apply(this,arguments);}return syncOnlineOperation;}()/** @access private */},{key:"syncOfflineOperation",value:function(){var _syncOfflineOperation=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee18(_ref5){var _this10=this;var payloads,source,mode,operation;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:payloads=_ref5.payloads,source=_ref5.source,mode=_ref5.mode;this.log('Syncing offline user','source:',source,'mode:',mode,'payloads:',payloads);operation=new _Services_sync_offline_operation__WEBPACK_IMPORTED_MODULE_9__["OfflineSyncOperation"]({payloads:payloads,receiver:function(){var _receiver2=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee17(signal,type){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:if(!(type===_Services_sync_signals__WEBPACK_IMPORTED_MODULE_19__["SIGNAL_TYPE_RESPONSE"])){_context17.next=5;break;}_context17.next=3;return _this10.handleOfflineResponse(signal);case 3:_context17.next=8;break;case 5:if(!(type===_Services_sync_signals__WEBPACK_IMPORTED_MODULE_19__["SIGNAL_TYPE_STATUS_CHANGED"])){_context17.next=8;break;}_context17.next=8;return _this10.handleStatusChange({operation:operation});case 8:case"end":return _context17.stop();}}},_callee17);}));function receiver(_x10,_x11){return _receiver2.apply(this,arguments);}return receiver;}()});return _context18.abrupt("return",operation);case 4:case"end":return _context18.stop();}}},_callee18,this);}));function syncOfflineOperation(_x9){return _syncOfflineOperation.apply(this,arguments);}return syncOfflineOperation;}()/** @access private */},{key:"handleStatusChange",value:function(){var _handleStatusChange=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee19(_ref6){var operation,pendingUploadCount,totalUploadCount,completedUploadCount;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:operation=_ref6.operation;pendingUploadCount=operation.pendingUploadCount();totalUploadCount=operation.totalUploadCount();completedUploadCount=totalUploadCount-pendingUploadCount;this.opStatus.setUploadStatus({completed:completedUploadCount,total:totalUploadCount});case 5:case"end":return _context19.stop();}}},_callee19,this);}));function handleStatusChange(_x12){return _handleStatusChange.apply(this,arguments);}return handleStatusChange;}()/** @access private */},{key:"handleOfflineResponse",value:function(){var _handleOfflineResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee20(response){var payloadsToMap,masterCollection,payloadsToPersist;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:this.log('Offline Sync Response',response.rawResponse);payloadsToMap=response.savedPayloads;/** Before persisting, merge with current base value that has content field */masterCollection=this.modelManager.getMasterCollection();payloadsToPersist=payloadsToMap.map(function(payload){var base=masterCollection.findPayload(payload.uuid);return base.mergedWith(payload);});_context20.next=6;return this.persistPayloads({decryptedPayloads:payloadsToPersist});case 6:_context20.next=8;return this.modelManager.mapPayloadsToLocalItems({payloads:payloadsToMap,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_12__["PayloadSources"].LocalSaved});case 8:this.opStatus.clearError();this.opStatus.setDownloadStatus({downloaded:response.retrievedPayloads.length});_context20.next=12;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].SingleSyncCompleted,response);case 12:case"end":return _context20.stop();}}},_callee20,this);}));function handleOfflineResponse(_x13){return _handleOfflineResponse.apply(this,arguments);}return handleOfflineResponse;}()/** @access private */},{key:"handleErrorServerResponse",value:function(){var _handleErrorServerResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee21(_ref7){var response;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:response=_ref7.response;this.log('Sync Error',response);if(response.status===INVALID_SESSION_RESPONSE_STATUS){this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].InvalidSession);}this.opStatus.setError(response.error);this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].SyncError,response.error);case 5:case"end":return _context21.stop();}}},_callee21,this);}));function handleErrorServerResponse(_x14){return _handleErrorServerResponse.apply(this,arguments);}return handleErrorServerResponse;}()/** @access private */},{key:"handleSuccessServerResponse",value:function(){var _handleSuccessServerResponse=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee22(_ref8){var operation,response,decryptedPayloads,_iteratorNormalCompletion3,_didIteratorError3,_iteratorError3,_iterator3,_step3,payload,decrypted,masterCollection,resolver,collections,_iteratorNormalCompletion4,_didIteratorError4,_iteratorError4,_iterator4,_step4,collection,payloadsToPersist,payloadClass,clientHash;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee22$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:operation=_ref8.operation,response=_ref8.response;if(!this._simulate_latency){_context22.next=4;break;}_context22.next=4;return Object(_Lib_utils__WEBPACK_IMPORTED_MODULE_1__["sleep"])(this._simulate_latency.latency);case 4:this.log('Online Sync Response',response.rawResponse);this.setLastSyncToken(response.lastSyncToken);this.setPaginationToken(response.paginationToken);this.opStatus.clearError();this.opStatus.setDownloadStatus({downloaded:response.retrievedPayloads.length});decryptedPayloads=[];_iteratorNormalCompletion3=true;_didIteratorError3=false;_iteratorError3=undefined;_context22.prev=13;_iterator3=response.allProcessedPayloads[Symbol.iterator]();case 15:if(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done){_context22.next=26;break;}payload=_step3.value;if(!(payload.deleted||!payload.fields().includes(_Payloads_fields__WEBPACK_IMPORTED_MODULE_11__["PayloadFields"].Content))){_context22.next=19;break;}return _context22.abrupt("continue",23);case 19:_context22.next=21;return this.protocolService.payloadByDecryptingPayload({payload:payload});case 21:decrypted=_context22.sent;decryptedPayloads.push(decrypted);case 23:_iteratorNormalCompletion3=true;_context22.next=15;break;case 26:_context22.next=32;break;case 28:_context22.prev=28;_context22.t0=_context22["catch"](13);_didIteratorError3=true;_iteratorError3=_context22.t0;case 32:_context22.prev=32;_context22.prev=33;if(!_iteratorNormalCompletion3&&_iterator3.return!=null){_iterator3.return();}case 35:_context22.prev=35;if(!_didIteratorError3){_context22.next=38;break;}throw _iteratorError3;case 38:return _context22.finish(35);case 39:return _context22.finish(32);case 40:masterCollection=this.modelManager.getMasterCollection();resolver=new _Services_sync_account_response_resolver__WEBPACK_IMPORTED_MODULE_7__["SyncResponseResolver"]({response:response,decryptedResponsePayloads:decryptedPayloads,payloadsSavedOrSaving:operation.payloadsSavedOrSaving,baseCollection:masterCollection});_context22.next=44;return resolver.collectionsByProcessingResponse();case 44:collections=_context22.sent;_iteratorNormalCompletion4=true;_didIteratorError4=false;_iteratorError4=undefined;_context22.prev=48;_iterator4=collections[Symbol.iterator]();case 50:if(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done){_context22.next=62;break;}collection=_step4.value;_context22.next=54;return this.modelManager.mapCollectionToLocalItems({collection:collection});case 54:payloadsToPersist=void 0;payloadClass=Object(_Payloads_generator__WEBPACK_IMPORTED_MODULE_15__["payloadClassForSource"])(collection.source);if(!payloadClass.fields().includes(_Payloads_fields__WEBPACK_IMPORTED_MODULE_11__["PayloadFields"].Content)){/** Before persisting, merge with current base value that has content field */payloadsToPersist=collection.allPayloads.map(function(payload){var base=masterCollection.findPayload(payload.uuid);return base.mergedWith(payload);});}else{payloadsToPersist=collection.allPayloads;}_context22.next=59;return this.persistPayloads({decryptedPayloads:payloadsToPersist});case 59:_iteratorNormalCompletion4=true;_context22.next=50;break;case 62:_context22.next=68;break;case 64:_context22.prev=64;_context22.t1=_context22["catch"](48);_didIteratorError4=true;_iteratorError4=_context22.t1;case 68:_context22.prev=68;_context22.prev=69;if(!_iteratorNormalCompletion4&&_iterator4.return!=null){_iterator4.return();}case 71:_context22.prev=71;if(!_didIteratorError4){_context22.next=74;break;}throw _iteratorError4;case 74:return _context22.finish(71);case 75:return _context22.finish(68);case 76:_context22.next=78;return this.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].SingleSyncCompleted,response);case 78:if(!response.checkIntegrity){_context22.next=84;break;}_context22.next=81;return this.computeDataIntegrityHash();case 81:clientHash=_context22.sent;_context22.next=84;return this.state.setIntegrityHashes({clientHash:clientHash,serverHash:response.integrityHash});case 84:case"end":return _context22.stop();}}},_callee22,this,[[13,28,32,40],[33,,35,39],[48,64,68,76],[69,,71,75]]);}));function handleSuccessServerResponse(_x15){return _handleSuccessServerResponse.apply(this,arguments);}return handleSuccessServerResponse;}()/** - * Items that have never been synced and marked as deleted should be cleared - * as dirty, mapped, then removed from storage. - * @access private - */},{key:"handleNeverSyncedDeleted",value:function(){var _handleNeverSyncedDeleted=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee23(items){var payloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee23$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:payloads=items.map(function(item){return item.payloadRepresentation({override:{dirty:false}});});_context23.next=3;return this.modelManager.mapPayloadsToLocalItems({payloads:payloads,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_12__["PayloadSources"].LocalChanged});case 3:_context23.next=5;return this.persistPayloads({decryptedPayloads:payloads});case 5:case"end":return _context23.stop();}}},_callee23,this);}));function handleNeverSyncedDeleted(_x16){return _handleNeverSyncedDeleted.apply(this,arguments);}return handleNeverSyncedDeleted;}()/** @access public */},{key:"persistPayloads",value:function(){var _persistPayloads=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee24(_ref9){var _this11=this;var _ref9$decryptedPayloa,decryptedPayloads;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee24$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:_ref9$decryptedPayloa=_ref9.decryptedPayloads,decryptedPayloads=_ref9$decryptedPayloa===void 0?[]:_ref9$decryptedPayloa;if(!(decryptedPayloads.length===0)){_context24.next=3;break;}return _context24.abrupt("return");case 3:return _context24.abrupt("return",this.storageService.savePayloads(decryptedPayloads).catch(function(error){_this11.notifyEvent(_Lib__WEBPACK_IMPORTED_MODULE_20__["SyncEvents"].DatabaseWriteError,error);throw error;}));case 4:case"end":return _context24.stop();}}},_callee24,this);}));function persistPayloads(_x17){return _persistPayloads.apply(this,arguments);}return persistPayloads;}()/** - * Computes a hash of all items updated_at strings joined with a comma. - * The server will also do the same, to determine whether the client values match server values. - * @access private - * @returns {Promise} A SHA256 digest string (hex). - */},{key:"computeDataIntegrityHash",value:function(){var _computeDataIntegrityHash=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee25(){var items,dates,string;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee25$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:_context25.prev=0;items=this.modelManager.nonDeletedItems.sort(function(a,b){return b.updated_at-a.updated_at;});dates=items.map(function(item){return item.updatedAtTimestamp();});string=dates.join(',');return _context25.abrupt("return",this.protocolService.crypto.sha256(string));case 7:_context25.prev=7;_context25.t0=_context25["catch"](0);console.error('Error computing data integrity hash',_context25.t0);return _context25.abrupt("return",null);case 11:case"end":return _context25.stop();}}},_callee25,this,[[0,7]]);}));function computeDataIntegrityHash(){return _computeDataIntegrityHash.apply(this,arguments);}return computeDataIntegrityHash;}()/** - * Downloads all items and maps to lcoal items to attempt resolve out-of-sync state - * @access public - */},{key:"resolveOutOfSync",value:function(){var _resolveOutOfSync=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee26(){var downloader,payloads,delta,collection;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee26$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:downloader=new _Services_sync_account_downloader__WEBPACK_IMPORTED_MODULE_6__["AccountDownloader"]({apiService:this.apiService,protocolService:this.protocolService,customEvent:'resolve-out-of-sync'});_context26.next=3;return downloader.run();case 3:payloads=_context26.sent;delta=new _Payloads_deltas__WEBPACK_IMPORTED_MODULE_10__["DeltaOutOfSync"]({baseCollection:this.modelManager.getMasterCollection(),applyCollection:new _Payloads_collection__WEBPACK_IMPORTED_MODULE_13__["PayloadCollection"]({payloads:payloads,source:_Payloads_sources__WEBPACK_IMPORTED_MODULE_12__["PayloadSources"].RemoteRetrieved})});_context26.next=7;return delta.resultingCollection();case 7:collection=_context26.sent;_context26.next=10;return this.modelManager.mapCollectionToLocalItems({collection:collection});case 10:_context26.next=12;return this.persistPayloads({decryptedPayloads:collection.payloads});case 12:return _context26.abrupt("return",this.sync({checkIntegrity:true,source:SyncSources.ResolveOutOfSync}));case 13:case"end":return _context26.stop();}}},_callee26,this);}));function resolveOutOfSync(){return _resolveOutOfSync.apply(this,arguments);}return resolveOutOfSync;}()/** @access public */},{key:"statelessDownloadAllItems",value:function(){var _statelessDownloadAllItems=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee27(){var _ref10,contentType,customEvent,downloader,payloads,_args27=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee27$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_ref10=_args27.length>0&&_args27[0]!==undefined?_args27[0]:{},contentType=_ref10.contentType,customEvent=_ref10.customEvent;downloader=new _Services_sync_account_downloader__WEBPACK_IMPORTED_MODULE_6__["AccountDownloader"]({apiService:this.apiService,protocolService:this.protocolService,contentType:contentType,customEvent:customEvent});_context27.next=4;return downloader.run();case 4:payloads=_context27.sent;return _context27.abrupt("return",payloads.map(function(payload){return Object(_Models_generator__WEBPACK_IMPORTED_MODULE_18__["CreateItemFromPayload"])(payload);}));case 6:case"end":return _context27.stop();}}},_callee27,this);}));function statelessDownloadAllItems(){return _statelessDownloadAllItems.apply(this,arguments);}return statelessDownloadAllItems;}()/** @unit_testing */ // eslint-disable-next-line camelcase -},{key:"ut_setDatabaseLoaded",value:function ut_setDatabaseLoaded(loaded){this.databaseLoaded=loaded;}/** @unit_testing */ // eslint-disable-next-line camelcase -},{key:"ut_clearLastSyncDate",value:function ut_clearLastSyncDate(){this.state.setLastSyncDate(null);}/** @unit_testing */ // eslint-disable-next-line camelcase -},{key:"ut_beginLatencySimulator",value:function ut_beginLatencySimulator(latency){this._simulate_latency={latency:latency||1000,enabled:true};}/** @unit_testing */ // eslint-disable-next-line camelcase -},{key:"ut_endLatencySimulator",value:function ut_endLatencySimulator(){this._simulate_latency=null;}}]);return SNSyncService;}(_Services_pure_service__WEBPACK_IMPORTED_MODULE_2__["PureService"]);/***/},/***/"./lib/services/sync/sync_state.js":/*!*****************************************!*\ - !*** ./lib/services/sync/sync_state.js ***! - \*****************************************/ /*! exports provided: SyncState */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"SyncState",function(){return SyncState;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib */"./lib/index.js");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i=this.maxDiscordance&&!this.outOfSync){this.outOfSync=true;this.receiver(_Lib__WEBPACK_IMPORTED_MODULE_1__["SyncEvents"].EnterOutOfSync);}}case 5:case"end":return _context.stop();}}},_callee,this);}));function setIntegrityHashes(_x){return _setIntegrityHashes.apply(this,arguments);}return setIntegrityHashes;}()},{key:"lastPreSyncSaveDate",get:function get(){return this._lastPreSyncSave;}},{key:"lastSyncDate",get:function get(){return this._lastSyncDate;}},{key:"needsSync",get:function get(){return this.discordance>0&&this.discordance} array - * @param {string} key - * @param {object} value - * @returns {object|null} Matching object or null if not found - */function findInArray(array,key,value){return array.find(function(item){return item[key]===value;});}/** - * @returns {boolean} Whether the value is a function or object - */function isObject(value){if(value===null){return false;}return typeof value==='function'||_typeof(value)==='object';}/** - * @returns {boolean} Whether the value is a function - */function isFunction(value){if(value===null){return false;}return typeof value==='function';}/** - * @param {object|null} value - * @returns {boolean} True if the object is null or undefined, otherwise false - */function isNullOrUndefined(value){return value===null||value===undefined;}/** - * @returns {boolean} Whether the value is a string - */function isString(value){return typeof value==='string'||value instanceof String;}/** - * @returns {Date} The greater of the two dates - */function greaterOfTwoDates(dateA,dateB){if(dateA>dateB){return dateA;}else{return dateB;}}/** - * Returns a new array containing only unique values by combining the two input arrays. - * Elements are unique based on the values of `equalityKeys`. - * @param {Array.} arrayA - * @param {Array.} arrayB - * @param {Array.} equalityKeys - Keys to determine element equality - * @returns {Array.} Array containing unique values - */function uniqCombineObjArrays(arrayA,arrayB,equalityKeys){return lodash_uniqWith__WEBPACK_IMPORTED_MODULE_3___default()(arrayA.concat(arrayB),function(a,b){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=equalityKeys[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var key=_step.value;if(a[key]!==b[key]){return false;}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}return true;});}/** - * Returns a new array containing only unique values - * @param {Array.} array - * @returns {Array.} Array containing unique values - */function uniqueArray(array){return lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(array);}/** - * Returns the last element in the array. - * @returns {object} The last element in the array - */function lastElement(array){return array[array.length-1];}/** - * Adds all items from otherArray into inArray, in-place. - * Does not return a value. - * @returns {void} - */function extendArray(inArray,otherArray){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=otherArray[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var value=_step2.value;inArray.push(value);}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return!=null){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}}/** - * Removes all items appearing in toSubtract from inArray, in-place - * @param {Array} inArray - * @param {Array} toSubtract - The list of items to remove from inArray - * @returns {void} - */function subtractFromArray(inArray,toSubtract){var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=toSubtract[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var value=_step3.value;inArray.splice(inArray.indexOf(value),1);}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return!=null){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}}/** - * Removes an object from the array by value - * @returns {void} - */function removeFromArray(array,value){array.splice(array.indexOf(value),1);}/** - * Returns a new array by removing all elements in subtract from array - * @returns {Array} - */function arrayByDifference(array,subtract){return array.filter(function(x){return!subtract.includes(x);}).concat(subtract.filter(function(x){return!array.includes(x);}));}/** - * Removes the value from the array at the given index, in-place. - * @returns {void} - */function removeFromIndex(array,index){array.splice(index,1);}/** - * Returns a new array by removeing the value from the array at the given index - * @returns {Array} - */function arrayByRemovingFromIndex(array,index){var copy=array.slice();removeFromIndex(copy,index);return copy;}/** - * Returns an array where each element is the value of a top-level - * object key. - * Example: objectToValueArray({a: 1, b: 2}) returns [1, 2] - * @param {object} object - */function objectToValueArray(object){var values=[];for(var _i=0,_Object$keys=Object.keys(object);_i<_Object$keys.length;_i++){var key=_Object$keys[_i];values.push(object[key]);}return values;}/** - * Returns a new object by attempting to JSON.parse any top-level object keys. - * @param {object} object - */function jsonParseEmbeddedKeys(object){var result={};for(var _i2=0,_Object$keys2=Object.keys(object);_i2<_Object$keys2.length;_i2++){var key=_Object$keys2[_i2];var value=void 0;try{value=JSON.parse(object[key]);;}catch(error){value=object[key];}result[key]=value;}return result;}/** - * Deletes keys of the input object. - * @param {object} object - * @param {Array.} keys - * @returns {void} - */function omitInPlace(object,keys){if(!object){return;}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=keys[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var key=_step4.value;delete object[key];}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return!=null){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}}/** - * Creates a new object by omitting `keys` from `object` - * @param {object} object - * @param {Array.} keys - * @returns {object} - */function omitByCopy(object,keys){var newObject=Object.assign({},object);/** - * Lodash's omit, which was previously used, seems to cause unexpected behavior - * when payload is an ES6 item class. So we instead manually omit each key. - */var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=keys[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var key=_step5.value;delete newObject[key];}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return!=null){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}return newObject;}/** - * Similiar to Node's path.join, this function combines an array of paths into - * one resolved path. - * @param {...string} args - * @returns {string} - */function joinPaths(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return args.map(function(part,i){if(i===0){return part.trim().replace(/[\/]*$/g,'');}else{return part.trim().replace(/(^[\/]*|[\/]*$)/g,'');}}).filter(function(x){return x.length;}).join('/');}/** - * Creates a copy of the input object by JSON stringifying then JSON parsing the string. - * @returns {object} - */function Copy(object){return JSON.parse(JSON.stringify(object));}/** - * Merges the second object parameter into the first object, in-place. - * @returns {object} The now modified first object parameter passed into the function. - */function deepMerge(a,b){/** - * lodash.merge will not merge a full array with an empty one. - * deepMerge will replace arrays wholesale - */if(!a||!b){throw'Attempting to deepMerge with null values';}var customizer=function customizer(aValue,bValue){if(lodash_isArray__WEBPACK_IMPORTED_MODULE_1___default()(aValue)){return bValue;}};lodash_mergeWith__WEBPACK_IMPORTED_MODULE_2___default()(a,b,customizer);return a;}/** - * Returns a new object by selecting certain keys from input object. - * @param {object} object - * @param {Array.} keys - * @returns {object} - */function pickByCopy(object,keys){var result={};var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=keys[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var key=_step6.value;result[key]=object[key];}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally{try{if(!_iteratorNormalCompletion6&&_iterator6.return!=null){_iterator6.return();}}finally{if(_didIteratorError6){throw _iteratorError6;}}}return Copy(result);}/** - * Recursively makes an object immutable via Object.freeze - */function deepFreeze(object){var propNames=Object.getOwnPropertyNames(object);var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=propNames[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var name=_step7.value;var value=object[name];object[name]=value&&_typeof(value)==='object'?deepFreeze(value):value;}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally{try{if(!_iteratorNormalCompletion7&&_iterator7.return!=null){_iterator7.return();}}finally{if(_didIteratorError7){throw _iteratorError7;}}}return Object.freeze(object);}/** - * Determines if an object has a getter defined for a given property - * @param {object} object - * @param {string} property - */function hasGetter(object,property){var descriptor=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(object),property);return descriptor&&!isNullOrUndefined(descriptor.get);}/** - * Truncates a hex string into a desired number of bits - * @param {string} string - * @param {number} desiredBits - * @returns {string} A hexadecimal string truncated to the number of desired bits - */function truncateHexString(string,desiredBits){var BITS_PER_HEX_CHAR=4;var desiredCharLength=desiredBits/BITS_PER_HEX_CHAR;return string.substring(0,desiredCharLength);}/** - * When awaited, this function allows code execution to pause for a set time. - * Should be used primarily for testing. - * @param {number} milliseconds - */function sleep(_x){return _sleep.apply(this,arguments);}function _sleep(){_sleep=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(milliseconds){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:console.warn('Sleeping for',milliseconds);return _context.abrupt("return",new Promise(function(resolve,reject){setTimeout(function(){resolve();},milliseconds);}));case 2:case"end":return _context.stop();}}},_callee);}));return _sleep.apply(this,arguments);}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./lib/uuid.js":/*!*********************!*\ - !*** ./lib/uuid.js ***! - \*********************/ /*! exports provided: Uuid */ /***/function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);/* harmony export (binding) */__webpack_require__.d(__webpack_exports__,"Uuid",function(){return Uuid;});/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(/*! @babel/runtime/regenerator */"./node_modules/@babel/runtime/regenerator/index.js");/* harmony import */var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=/*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);/* harmony import */var _Lib_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(/*! @Lib/utils */"./lib/utils.js");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i} - */},{key:"GenerateUuid",value:function(){var _GenerateUuid=_asyncToGenerator(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!this.syncUuidFunc){_context.next=4;break;}return _context.abrupt("return",this.syncUuidFunc());case 4:return _context.abrupt("return",this.asyncUuidFunc());case 5:case"end":return _context.stop();}}},_callee,this);}));function GenerateUuid(){return _GenerateUuid.apply(this,arguments);}return GenerateUuid;}()/** - * Generates a UUID string syncronously. - * @returns {string} - */},{key:"GenerateUuidSynchronously",value:function GenerateUuidSynchronously(){return this.syncUuidFunc();}}]);return Uuid;}();/***/},/***/"./node_modules/@babel/runtime/regenerator/index.js":/*!**********************************************************!*\ - !*** ./node_modules/@babel/runtime/regenerator/index.js ***! - \**********************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){module.exports=__webpack_require__(/*! regenerator-runtime */"./node_modules/regenerator-runtime/runtime.js");/***/},/***/"./node_modules/lodash/_DataView.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_DataView.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getNative=__webpack_require__(/*! ./_getNative */"./node_modules/lodash/_getNative.js"),root=__webpack_require__(/*! ./_root */"./node_modules/lodash/_root.js");/* Built-in method references that are verified to be native. */var DataView=getNative(root,'DataView');module.exports=DataView;/***/},/***/"./node_modules/lodash/_Hash.js":/*!**************************************!*\ - !*** ./node_modules/lodash/_Hash.js ***! - \**************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var hashClear=__webpack_require__(/*! ./_hashClear */"./node_modules/lodash/_hashClear.js"),hashDelete=__webpack_require__(/*! ./_hashDelete */"./node_modules/lodash/_hashDelete.js"),hashGet=__webpack_require__(/*! ./_hashGet */"./node_modules/lodash/_hashGet.js"),hashHas=__webpack_require__(/*! ./_hashHas */"./node_modules/lodash/_hashHas.js"),hashSet=__webpack_require__(/*! ./_hashSet */"./node_modules/lodash/_hashSet.js");/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index-1;}module.exports=arrayIncludes;/***/},/***/"./node_modules/lodash/_arrayIncludesWith.js":/*!***************************************************!*\ - !*** ./node_modules/lodash/_arrayIncludesWith.js ***! - \***************************************************/ /*! no static exports found */ /***/function(module,exports){/** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index0&&predicate(value)){if(depth>1){// Recursively flatten arrays (susceptible to call stack limits). -baseFlatten(value,depth-1,predicate,isStrict,result);}else{arrayPush(result,value);}}else if(!isStrict){result[result.length]=value;}}return result;}module.exports=baseFlatten;/***/},/***/"./node_modules/lodash/_baseFor.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/_baseFor.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var createBaseFor=__webpack_require__(/*! ./_createBaseFor */"./node_modules/lodash/_createBaseFor.js");/** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */var baseFor=createBaseFor();module.exports=baseFor;/***/},/***/"./node_modules/lodash/_baseForOwn.js":/*!********************************************!*\ - !*** ./node_modules/lodash/_baseForOwn.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseFor=__webpack_require__(/*! ./_baseFor */"./node_modules/lodash/_baseFor.js"),keys=__webpack_require__(/*! ./keys */"./node_modules/lodash/keys.js");/** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys);}module.exports=baseForOwn;/***/},/***/"./node_modules/lodash/_baseGet.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/_baseGet.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var castPath=__webpack_require__(/*! ./_castPath */"./node_modules/lodash/_castPath.js"),toKey=__webpack_require__(/*! ./_toKey */"./node_modules/lodash/_toKey.js");/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&index-1){if(seen!==array){splice.call(seen,fromIndex,1);}splice.call(array,fromIndex,1);}}return array;}module.exports=basePullAll;/***/},/***/"./node_modules/lodash/_basePullAt.js":/*!********************************************!*\ - !*** ./node_modules/lodash/_basePullAt.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseUnset=__webpack_require__(/*! ./_baseUnset */"./node_modules/lodash/_baseUnset.js"),isIndex=__webpack_require__(/*! ./_isIndex */"./node_modules/lodash/_isIndex.js");/** Used for built-in method references. */var arrayProto=Array.prototype;/** Built-in value references. */var splice=arrayProto.splice;/** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */function basePullAt(array,indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index)){splice.call(array,index,1);}else{baseUnset(array,index);}}}return array;}module.exports=basePullAt;/***/},/***/"./node_modules/lodash/_baseRest.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_baseRest.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var identity=__webpack_require__(/*! ./identity */"./node_modules/lodash/identity.js"),overRest=__webpack_require__(/*! ./_overRest */"./node_modules/lodash/_overRest.js"),setToString=__webpack_require__(/*! ./_setToString */"./node_modules/lodash/_setToString.js");/** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */function baseRest(func,start){return setToString(overRest(func,start,identity),func+'');}module.exports=baseRest;/***/},/***/"./node_modules/lodash/_baseSetToString.js":/*!*************************************************!*\ - !*** ./node_modules/lodash/_baseSetToString.js ***! - \*************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var constant=__webpack_require__(/*! ./constant */"./node_modules/lodash/constant.js"),defineProperty=__webpack_require__(/*! ./_defineProperty */"./node_modules/lodash/_defineProperty.js"),identity=__webpack_require__(/*! ./identity */"./node_modules/lodash/identity.js");/** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,'toString',{'configurable':true,'enumerable':false,'value':constant(string),'writable':true});};module.exports=baseSetToString;/***/},/***/"./node_modules/lodash/_baseSlice.js":/*!*******************************************!*\ - !*** ./node_modules/lodash/_baseSlice.js ***! - \*******************************************/ /*! no static exports found */ /***/function(module,exports){/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start;}end=end>length?length:end;if(end<0){end+=length;}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set);}isCommon=false;includes=cacheHas;seen=new SetCache();}else{seen=iteratee?[]:result;}outer:while(++index1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=='function'?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1;}object=Object(object);while(++index-1?iterable[iteratee?collection[index]:index]:undefined;};}module.exports=createFind;/***/},/***/"./node_modules/lodash/_createSet.js":/*!*******************************************!*\ - !*** ./node_modules/lodash/_createSet.js ***! - \*******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var Set=__webpack_require__(/*! ./_Set */"./node_modules/lodash/_Set.js"),noop=__webpack_require__(/*! ./noop */"./node_modules/lodash/noop.js"),setToArray=__webpack_require__(/*! ./_setToArray */"./node_modules/lodash/_setToArray.js");/** Used as references for various `Number` constants. */var INFINITY=1/0;/** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */var createSet=!(Set&&1/setToArray(new Set([,-0]))[1]==INFINITY)?noop:function(values){return new Set(values);};module.exports=createSet;/***/},/***/"./node_modules/lodash/_customOmitClone.js":/*!*************************************************!*\ - !*** ./node_modules/lodash/_customOmitClone.js ***! - \*************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var isPlainObject=__webpack_require__(/*! ./isPlainObject */"./node_modules/lodash/isPlainObject.js");/** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */function customOmitClone(value){return isPlainObject(value)?undefined:value;}module.exports=customOmitClone;/***/},/***/"./node_modules/lodash/_defineProperty.js":/*!************************************************!*\ - !*** ./node_modules/lodash/_defineProperty.js ***! - \************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getNative=__webpack_require__(/*! ./_getNative */"./node_modules/lodash/_getNative.js");var defineProperty=function(){try{var func=getNative(Object,'defineProperty');func({},'',{});return func;}catch(e){}}();module.exports=defineProperty;/***/},/***/"./node_modules/lodash/_equalArrays.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/_equalArrays.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var SetCache=__webpack_require__(/*! ./_SetCache */"./node_modules/lodash/_SetCache.js"),arraySome=__webpack_require__(/*! ./_arraySome */"./node_modules/lodash/_arraySome.js"),cacheHas=__webpack_require__(/*! ./_cacheHas */"./node_modules/lodash/_cacheHas.js");/** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;/** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false;}// Assume cyclic values are equal. -var stacked=stack.get(array);if(stacked&&stack.get(other)){return stacked==other;}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache():undefined;stack.set(array,other);stack.set(other,array);// Ignore non-index properties. -while(++index-1&&value%1==0&&value-1;}module.exports=listCacheHas;/***/},/***/"./node_modules/lodash/_listCacheSet.js":/*!**********************************************!*\ - !*** ./node_modules/lodash/_listCacheSet.js ***! - \**********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var assocIndexOf=__webpack_require__(/*! ./_assocIndexOf */"./node_modules/lodash/_assocIndexOf.js");/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value]);}else{data[index][1]=value;}return this;}module.exports=listCacheSet;/***/},/***/"./node_modules/lodash/_mapCacheClear.js":/*!***********************************************!*\ - !*** ./node_modules/lodash/_mapCacheClear.js ***! - \***********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var Hash=__webpack_require__(/*! ./_Hash */"./node_modules/lodash/_Hash.js"),ListCache=__webpack_require__(/*! ./_ListCache */"./node_modules/lodash/_ListCache.js"),Map=__webpack_require__(/*! ./_Map */"./node_modules/lodash/_Map.js");/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}module.exports=mapCacheClear;/***/},/***/"./node_modules/lodash/_mapCacheDelete.js":/*!************************************************!*\ - !*** ./node_modules/lodash/_mapCacheDelete.js ***! - \************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getMapData=__webpack_require__(/*! ./_getMapData */"./node_modules/lodash/_getMapData.js");/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */function mapCacheDelete(key){var result=getMapData(this,key)['delete'](key);this.size-=result?1:0;return result;}module.exports=mapCacheDelete;/***/},/***/"./node_modules/lodash/_mapCacheGet.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/_mapCacheGet.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getMapData=__webpack_require__(/*! ./_getMapData */"./node_modules/lodash/_getMapData.js");/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */function mapCacheGet(key){return getMapData(this,key).get(key);}module.exports=mapCacheGet;/***/},/***/"./node_modules/lodash/_mapCacheHas.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/_mapCacheHas.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getMapData=__webpack_require__(/*! ./_getMapData */"./node_modules/lodash/_getMapData.js");/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */function mapCacheHas(key){return getMapData(this,key).has(key);}module.exports=mapCacheHas;/***/},/***/"./node_modules/lodash/_mapCacheSet.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/_mapCacheSet.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getMapData=__webpack_require__(/*! ./_getMapData */"./node_modules/lodash/_getMapData.js");/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this;}module.exports=mapCacheSet;/***/},/***/"./node_modules/lodash/_mapToArray.js":/*!********************************************!*\ - !*** ./node_modules/lodash/_mapToArray.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value];});return result;}module.exports=mapToArray;/***/},/***/"./node_modules/lodash/_matchesStrictComparable.js":/*!*********************************************************!*\ - !*** ./node_modules/lodash/_matchesStrictComparable.js ***! - \*********************************************************/ /*! no static exports found */ /***/function(module,exports){/** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false;}return object[key]===srcValue&&(srcValue!==undefined||key in Object(object));};}module.exports=matchesStrictComparable;/***/},/***/"./node_modules/lodash/_memoizeCapped.js":/*!***********************************************!*\ - !*** ./node_modules/lodash/_memoizeCapped.js ***! - \***********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var memoize=__webpack_require__(/*! ./memoize */"./node_modules/lodash/memoize.js");/** Used as the maximum memoize cache size. */var MAX_MEMOIZE_SIZE=500;/** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE){cache.clear();}return key;});var cache=result.cache;return result;}module.exports=memoizeCapped;/***/},/***/"./node_modules/lodash/_nativeCreate.js":/*!**********************************************!*\ - !*** ./node_modules/lodash/_nativeCreate.js ***! - \**********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var getNative=__webpack_require__(/*! ./_getNative */"./node_modules/lodash/_getNative.js");/* Built-in method references that are verified to be native. */var nativeCreate=getNative(Object,'create');module.exports=nativeCreate;/***/},/***/"./node_modules/lodash/_nativeKeys.js":/*!********************************************!*\ - !*** ./node_modules/lodash/_nativeKeys.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var overArg=__webpack_require__(/*! ./_overArg */"./node_modules/lodash/_overArg.js");/* Built-in method references for those with the same name as other `lodash` methods. */var nativeKeys=overArg(Object.keys,Object);module.exports=nativeKeys;/***/},/***/"./node_modules/lodash/_nativeKeysIn.js":/*!**********************************************!*\ - !*** ./node_modules/lodash/_nativeKeysIn.js ***! - \**********************************************/ /*! no static exports found */ /***/function(module,exports){/** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key);}}return result;}module.exports=nativeKeysIn;/***/},/***/"./node_modules/lodash/_nodeUtil.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_nodeUtil.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var freeGlobal=__webpack_require__(/*! ./_freeGlobal */"./node_modules/lodash/_freeGlobal.js");/** Detect free variable `exports`. */var freeExports=(false?undefined:_typeof(exports))=='object'&&exports&&!exports.nodeType&&exports;/** Detect free variable `module`. */var freeModule=freeExports&&(false?undefined:_typeof(module))=='object'&&module&&!module.nodeType&&module;/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;/** Detect free variable `process` from Node.js. */var freeProcess=moduleExports&&freeGlobal.process;/** Used to access faster Node.js helpers. */var nodeUtil=function(){try{// Use `util.types` for Node.js 10+. -var types=freeModule&&freeModule.require&&freeModule.require('util').types;if(types){return types;}// Legacy `process.binding('util')` for Node.js < 10. -return freeProcess&&freeProcess.binding&&freeProcess.binding('util');}catch(e){}}();module.exports=nodeUtil;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./node_modules/lodash/_objectToString.js":/*!************************************************!*\ - !*** ./node_modules/lodash/_objectToString.js ***! - \************************************************/ /*! no static exports found */ /***/function(module,exports){/** Used for built-in method references. */var objectProto=Object.prototype;/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */var nativeObjectToString=objectProto.toString;/** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */function objectToString(value){return nativeObjectToString.call(value);}module.exports=objectToString;/***/},/***/"./node_modules/lodash/_overArg.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/_overArg.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */function overArg(func,transform){return function(arg){return func(transform(arg));};}module.exports=overArg;/***/},/***/"./node_modules/lodash/_overRest.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_overRest.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var apply=__webpack_require__(/*! ./_apply */"./node_modules/lodash/_apply.js");/* Built-in method references for those with the same name as other `lodash` methods. */var nativeMax=Math.max;/** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */function overRest(func,start,transform){start=nativeMax(start===undefined?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index0){if(++count>=HOT_COUNT){return arguments[0];}}else{count=0;}return func.apply(undefined,arguments);};}module.exports=shortOut;/***/},/***/"./node_modules/lodash/_stackClear.js":/*!********************************************!*\ - !*** ./node_modules/lodash/_stackClear.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var ListCache=__webpack_require__(/*! ./_ListCache */"./node_modules/lodash/_ListCache.js");/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */function stackClear(){this.__data__=new ListCache();this.size=0;}module.exports=stackClear;/***/},/***/"./node_modules/lodash/_stackDelete.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/_stackDelete.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */function stackDelete(key){var data=this.__data__,result=data['delete'](key);this.size=data.size;return result;}module.exports=stackDelete;/***/},/***/"./node_modules/lodash/_stackGet.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_stackGet.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */function stackGet(key){return this.__data__.get(key);}module.exports=stackGet;/***/},/***/"./node_modules/lodash/_stackHas.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_stackHas.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */function stackHas(key){return this.__data__.has(key);}module.exports=stackHas;/***/},/***/"./node_modules/lodash/_stackSet.js":/*!******************************************!*\ - !*** ./node_modules/lodash/_stackSet.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var ListCache=__webpack_require__(/*! ./_ListCache */"./node_modules/lodash/_ListCache.js"),Map=__webpack_require__(/*! ./_Map */"./node_modules/lodash/_Map.js"),MapCache=__webpack_require__(/*! ./_MapCache */"./node_modules/lodash/_MapCache.js");/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length [{ 'a': 1 }, { 'a': 1 }] - * - * console.log(objects[0] === objects[1]); - * // => true - */function constant(value){return function(){return value;};}module.exports=constant;/***/},/***/"./node_modules/lodash/eq.js":/*!***********************************!*\ - !*** ./node_modules/lodash/eq.js ***! - \***********************************/ /*! no static exports found */ /***/function(module,exports){/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */function eq(value,other){return value===other||value!==value&&other!==other;}module.exports=eq;/***/},/***/"./node_modules/lodash/find.js":/*!*************************************!*\ - !*** ./node_modules/lodash/find.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var createFind=__webpack_require__(/*! ./_createFind */"./node_modules/lodash/_createFind.js"),findIndex=__webpack_require__(/*! ./findIndex */"./node_modules/lodash/findIndex.js");/** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */var find=createFind(findIndex);module.exports=find;/***/},/***/"./node_modules/lodash/findIndex.js":/*!******************************************!*\ - !*** ./node_modules/lodash/findIndex.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseFindIndex=__webpack_require__(/*! ./_baseFindIndex */"./node_modules/lodash/_baseFindIndex.js"),baseIteratee=__webpack_require__(/*! ./_baseIteratee */"./node_modules/lodash/_baseIteratee.js"),toInteger=__webpack_require__(/*! ./toInteger */"./node_modules/lodash/toInteger.js");/* Built-in method references for those with the same name as other `lodash` methods. */var nativeMax=Math.max;/** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length){return-1;}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0);}return baseFindIndex(array,baseIteratee(predicate,3),index);}module.exports=findIndex;/***/},/***/"./node_modules/lodash/flatten.js":/*!****************************************!*\ - !*** ./node_modules/lodash/flatten.js ***! - \****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseFlatten=__webpack_require__(/*! ./_baseFlatten */"./node_modules/lodash/_baseFlatten.js");/** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[];}module.exports=flatten;/***/},/***/"./node_modules/lodash/get.js":/*!************************************!*\ - !*** ./node_modules/lodash/get.js ***! - \************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseGet=__webpack_require__(/*! ./_baseGet */"./node_modules/lodash/_baseGet.js");/** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result;}module.exports=get;/***/},/***/"./node_modules/lodash/hasIn.js":/*!**************************************!*\ - !*** ./node_modules/lodash/hasIn.js ***! - \**************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseHasIn=__webpack_require__(/*! ./_baseHasIn */"./node_modules/lodash/_baseHasIn.js"),hasPath=__webpack_require__(/*! ./_hasPath */"./node_modules/lodash/_hasPath.js");/** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn);}module.exports=hasIn;/***/},/***/"./node_modules/lodash/identity.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/identity.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports){/** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; - * - * console.log(_.identity(object) === object); - * // => true - */function identity(value){return value;}module.exports=identity;/***/},/***/"./node_modules/lodash/isArguments.js":/*!********************************************!*\ - !*** ./node_modules/lodash/isArguments.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseIsArguments=__webpack_require__(/*! ./_baseIsArguments */"./node_modules/lodash/_baseIsArguments.js"),isObjectLike=__webpack_require__(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js");/** Used for built-in method references. */var objectProto=Object.prototype;/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty;/** Built-in value references. */var propertyIsEnumerable=objectProto.propertyIsEnumerable;/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */var isArguments=baseIsArguments(function(){return arguments;}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,'callee')&&!propertyIsEnumerable.call(value,'callee');};module.exports=isArguments;/***/},/***/"./node_modules/lodash/isArray.js":/*!****************************************!*\ - !*** ./node_modules/lodash/isArray.js ***! - \****************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */var isArray=Array.isArray;module.exports=isArray;/***/},/***/"./node_modules/lodash/isArrayLike.js":/*!********************************************!*\ - !*** ./node_modules/lodash/isArrayLike.js ***! - \********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var isFunction=__webpack_require__(/*! ./isFunction */"./node_modules/lodash/isFunction.js"),isLength=__webpack_require__(/*! ./isLength */"./node_modules/lodash/isLength.js");/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value);}module.exports=isArrayLike;/***/},/***/"./node_modules/lodash/isArrayLikeObject.js":/*!**************************************************!*\ - !*** ./node_modules/lodash/isArrayLikeObject.js ***! - \**************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var isArrayLike=__webpack_require__(/*! ./isArrayLike */"./node_modules/lodash/isArrayLike.js"),isObjectLike=__webpack_require__(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js");/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value);}module.exports=isArrayLikeObject;/***/},/***/"./node_modules/lodash/isBuffer.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/isBuffer.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(module){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var root=__webpack_require__(/*! ./_root */"./node_modules/lodash/_root.js"),stubFalse=__webpack_require__(/*! ./stubFalse */"./node_modules/lodash/stubFalse.js");/** Detect free variable `exports`. */var freeExports=(false?undefined:_typeof(exports))=='object'&&exports&&!exports.nodeType&&exports;/** Detect free variable `module`. */var freeModule=freeExports&&(false?undefined:_typeof(module))=='object'&&module&&!module.nodeType&&module;/** Detect the popular CommonJS extension `module.exports`. */var moduleExports=freeModule&&freeModule.exports===freeExports;/** Built-in value references. */var Buffer=moduleExports?root.Buffer:undefined;/* Built-in method references for those with the same name as other `lodash` methods. */var nativeIsBuffer=Buffer?Buffer.isBuffer:undefined;/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */var isBuffer=nativeIsBuffer||stubFalse;module.exports=isBuffer;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./node_modules/lodash/isFunction.js":/*!*******************************************!*\ - !*** ./node_modules/lodash/isFunction.js ***! - \*******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseGetTag=__webpack_require__(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),isObject=__webpack_require__(/*! ./isObject */"./node_modules/lodash/isObject.js");/** `Object#toString` result references. */var asyncTag='[object AsyncFunction]',funcTag='[object Function]',genTag='[object GeneratorFunction]',proxyTag='[object Proxy]';/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */function isFunction(value){if(!isObject(value)){return false;}// The use of `Object#toString` avoids issues with the `typeof` operator -// in Safari 9 which returns 'object' for typed arrays and other constructors. -var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag;}module.exports=isFunction;/***/},/***/"./node_modules/lodash/isLength.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/isLength.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports){/** Used as references for various `Number` constants. */var MAX_SAFE_INTEGER=9007199254740991;/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */function isLength(value){return typeof value=='number'&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER;}module.exports=isLength;/***/},/***/"./node_modules/lodash/isMap.js":/*!**************************************!*\ - !*** ./node_modules/lodash/isMap.js ***! - \**************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseIsMap=__webpack_require__(/*! ./_baseIsMap */"./node_modules/lodash/_baseIsMap.js"),baseUnary=__webpack_require__(/*! ./_baseUnary */"./node_modules/lodash/_baseUnary.js"),nodeUtil=__webpack_require__(/*! ./_nodeUtil */"./node_modules/lodash/_nodeUtil.js");/* Node.js helper references. */var nodeIsMap=nodeUtil&&nodeUtil.isMap;/** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;module.exports=isMap;/***/},/***/"./node_modules/lodash/isObject.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/isObject.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */function isObject(value){var type=_typeof(value);return value!=null&&(type=='object'||type=='function');}module.exports=isObject;/***/},/***/"./node_modules/lodash/isObjectLike.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/isObjectLike.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */function isObjectLike(value){return value!=null&&_typeof(value)=='object';}module.exports=isObjectLike;/***/},/***/"./node_modules/lodash/isPlainObject.js":/*!**********************************************!*\ - !*** ./node_modules/lodash/isPlainObject.js ***! - \**********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseGetTag=__webpack_require__(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),getPrototype=__webpack_require__(/*! ./_getPrototype */"./node_modules/lodash/_getPrototype.js"),isObjectLike=__webpack_require__(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js");/** `Object#toString` result references. */var objectTag='[object Object]';/** Used for built-in method references. */var funcProto=Function.prototype,objectProto=Object.prototype;/** Used to resolve the decompiled source of functions. */var funcToString=funcProto.toString;/** Used to check objects for own properties. */var hasOwnProperty=objectProto.hasOwnProperty;/** Used to infer the `Object` constructor. */var objectCtorString=funcToString.call(Object);/** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag){return false;}var proto=getPrototype(value);if(proto===null){return true;}var Ctor=hasOwnProperty.call(proto,'constructor')&&proto.constructor;return typeof Ctor=='function'&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString;}module.exports=isPlainObject;/***/},/***/"./node_modules/lodash/isSet.js":/*!**************************************!*\ - !*** ./node_modules/lodash/isSet.js ***! - \**************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseIsSet=__webpack_require__(/*! ./_baseIsSet */"./node_modules/lodash/_baseIsSet.js"),baseUnary=__webpack_require__(/*! ./_baseUnary */"./node_modules/lodash/_baseUnary.js"),nodeUtil=__webpack_require__(/*! ./_nodeUtil */"./node_modules/lodash/_nodeUtil.js");/* Node.js helper references. */var nodeIsSet=nodeUtil&&nodeUtil.isSet;/** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;module.exports=isSet;/***/},/***/"./node_modules/lodash/isSymbol.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/isSymbol.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var baseGetTag=__webpack_require__(/*! ./_baseGetTag */"./node_modules/lodash/_baseGetTag.js"),isObjectLike=__webpack_require__(/*! ./isObjectLike */"./node_modules/lodash/isObjectLike.js");/** `Object#toString` result references. */var symbolTag='[object Symbol]';/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */function isSymbol(value){return _typeof(value)=='symbol'||isObjectLike(value)&&baseGetTag(value)==symbolTag;}module.exports=isSymbol;/***/},/***/"./node_modules/lodash/isTypedArray.js":/*!*********************************************!*\ - !*** ./node_modules/lodash/isTypedArray.js ***! - \*********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseIsTypedArray=__webpack_require__(/*! ./_baseIsTypedArray */"./node_modules/lodash/_baseIsTypedArray.js"),baseUnary=__webpack_require__(/*! ./_baseUnary */"./node_modules/lodash/_baseUnary.js"),nodeUtil=__webpack_require__(/*! ./_nodeUtil */"./node_modules/lodash/_nodeUtil.js");/* Node.js helper references. */var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=isTypedArray;/***/},/***/"./node_modules/lodash/keys.js":/*!*************************************!*\ - !*** ./node_modules/lodash/keys.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var arrayLikeKeys=__webpack_require__(/*! ./_arrayLikeKeys */"./node_modules/lodash/_arrayLikeKeys.js"),baseKeys=__webpack_require__(/*! ./_baseKeys */"./node_modules/lodash/_baseKeys.js"),isArrayLike=__webpack_require__(/*! ./isArrayLike */"./node_modules/lodash/isArrayLike.js");/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object);}module.exports=keys;/***/},/***/"./node_modules/lodash/keysIn.js":/*!***************************************!*\ - !*** ./node_modules/lodash/keysIn.js ***! - \***************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var arrayLikeKeys=__webpack_require__(/*! ./_arrayLikeKeys */"./node_modules/lodash/_arrayLikeKeys.js"),baseKeysIn=__webpack_require__(/*! ./_baseKeysIn */"./node_modules/lodash/_baseKeysIn.js"),isArrayLike=__webpack_require__(/*! ./isArrayLike */"./node_modules/lodash/isArrayLike.js");/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object);}module.exports=keysIn;/***/},/***/"./node_modules/lodash/last.js":/*!*************************************!*\ - !*** ./node_modules/lodash/last.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports){/** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined;}module.exports=last;/***/},/***/"./node_modules/lodash/map.js":/*!************************************!*\ - !*** ./node_modules/lodash/map.js ***! - \************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var arrayMap=__webpack_require__(/*! ./_arrayMap */"./node_modules/lodash/_arrayMap.js"),baseIteratee=__webpack_require__(/*! ./_baseIteratee */"./node_modules/lodash/_baseIteratee.js"),baseMap=__webpack_require__(/*! ./_baseMap */"./node_modules/lodash/_baseMap.js"),isArray=__webpack_require__(/*! ./isArray */"./node_modules/lodash/isArray.js");/** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,baseIteratee(iteratee,3));}module.exports=map;/***/},/***/"./node_modules/lodash/memoize.js":/*!****************************************!*\ - !*** ./node_modules/lodash/memoize.js ***! - \****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var MapCache=__webpack_require__(/*! ./_MapCache */"./node_modules/lodash/_MapCache.js");/** Error message constants. */var FUNC_ERROR_TEXT='Expected a function';/** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */function memoize(func,resolver){if(typeof func!='function'||resolver!=null&&typeof resolver!='function'){throw new TypeError(FUNC_ERROR_TEXT);}var memoized=function memoized(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key);}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result;};memoized.cache=new(memoize.Cache||MapCache)();return memoized;}// Expose `MapCache`. -memoize.Cache=MapCache;module.exports=memoize;/***/},/***/"./node_modules/lodash/merge.js":/*!**************************************!*\ - !*** ./node_modules/lodash/merge.js ***! - \**************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseMerge=__webpack_require__(/*! ./_baseMerge */"./node_modules/lodash/_baseMerge.js"),createAssigner=__webpack_require__(/*! ./_createAssigner */"./node_modules/lodash/_createAssigner.js");/** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex);});module.exports=merge;/***/},/***/"./node_modules/lodash/mergeWith.js":/*!******************************************!*\ - !*** ./node_modules/lodash/mergeWith.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseMerge=__webpack_require__(/*! ./_baseMerge */"./node_modules/lodash/_baseMerge.js"),createAssigner=__webpack_require__(/*! ./_createAssigner */"./node_modules/lodash/_createAssigner.js");/** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer);});module.exports=mergeWith;/***/},/***/"./node_modules/lodash/noop.js":/*!*************************************!*\ - !*** ./node_modules/lodash/noop.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports){/** - * This method returns `undefined`. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Util - * @example - * - * _.times(2, _.noop); - * // => [undefined, undefined] - */function noop(){// No operation performed. -}module.exports=noop;/***/},/***/"./node_modules/lodash/omit.js":/*!*************************************!*\ - !*** ./node_modules/lodash/omit.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var arrayMap=__webpack_require__(/*! ./_arrayMap */"./node_modules/lodash/_arrayMap.js"),baseClone=__webpack_require__(/*! ./_baseClone */"./node_modules/lodash/_baseClone.js"),baseUnset=__webpack_require__(/*! ./_baseUnset */"./node_modules/lodash/_baseUnset.js"),castPath=__webpack_require__(/*! ./_castPath */"./node_modules/lodash/_castPath.js"),copyObject=__webpack_require__(/*! ./_copyObject */"./node_modules/lodash/_copyObject.js"),customOmitClone=__webpack_require__(/*! ./_customOmitClone */"./node_modules/lodash/_customOmitClone.js"),flatRest=__webpack_require__(/*! ./_flatRest */"./node_modules/lodash/_flatRest.js"),getAllKeysIn=__webpack_require__(/*! ./_getAllKeysIn */"./node_modules/lodash/_getAllKeysIn.js");/** Used to compose bitmasks for cloning. */var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;/** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */var omit=flatRest(function(object,paths){var result={};if(object==null){return result;}var isDeep=false;paths=arrayMap(paths,function(path){path=castPath(path,object);isDeep||(isDeep=path.length>1);return path;});copyObject(object,getAllKeysIn(object),result);if(isDeep){result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone);}var length=paths.length;while(length--){baseUnset(result,paths[length]);}return result;});module.exports=omit;/***/},/***/"./node_modules/lodash/property.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/property.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseProperty=__webpack_require__(/*! ./_baseProperty */"./node_modules/lodash/_baseProperty.js"),basePropertyDeep=__webpack_require__(/*! ./_basePropertyDeep */"./node_modules/lodash/_basePropertyDeep.js"),isKey=__webpack_require__(/*! ./_isKey */"./node_modules/lodash/_isKey.js"),toKey=__webpack_require__(/*! ./_toKey */"./node_modules/lodash/_toKey.js");/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - * @example - * - * var objects = [ - * { 'a': { 'b': 2 } }, - * { 'a': { 'b': 1 } } - * ]; - * - * _.map(objects, _.property('a.b')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); - * // => [1, 2] - */function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path);}module.exports=property;/***/},/***/"./node_modules/lodash/pull.js":/*!*************************************!*\ - !*** ./node_modules/lodash/pull.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseRest=__webpack_require__(/*! ./_baseRest */"./node_modules/lodash/_baseRest.js"),pullAll=__webpack_require__(/*! ./pullAll */"./node_modules/lodash/pullAll.js");/** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */var pull=baseRest(pullAll);module.exports=pull;/***/},/***/"./node_modules/lodash/pullAll.js":/*!****************************************!*\ - !*** ./node_modules/lodash/pullAll.js ***! - \****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var basePullAll=__webpack_require__(/*! ./_basePullAll */"./node_modules/lodash/_basePullAll.js");/** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array;}module.exports=pullAll;/***/},/***/"./node_modules/lodash/remove.js":/*!***************************************!*\ - !*** ./node_modules/lodash/remove.js ***! - \***************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseIteratee=__webpack_require__(/*! ./_baseIteratee */"./node_modules/lodash/_baseIteratee.js"),basePullAt=__webpack_require__(/*! ./_basePullAt */"./node_modules/lodash/_basePullAt.js");/** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */function remove(array,predicate){var result=[];if(!(array&&array.length)){return result;}var index=-1,indexes=[],length=array.length;predicate=baseIteratee(predicate,3);while(++index [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */function stubArray(){return[];}module.exports=stubArray;/***/},/***/"./node_modules/lodash/stubFalse.js":/*!******************************************!*\ - !*** ./node_modules/lodash/stubFalse.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports){/** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */function stubFalse(){return false;}module.exports=stubFalse;/***/},/***/"./node_modules/lodash/toFinite.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/toFinite.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var toNumber=__webpack_require__(/*! ./toNumber */"./node_modules/lodash/toNumber.js");/** Used as references for various `Number` constants. */var INFINITY=1/0,MAX_INTEGER=1.7976931348623157e+308;/** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */function toFinite(value){if(!value){return value===0?value:0;}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER;}return value===value?value:0;}module.exports=toFinite;/***/},/***/"./node_modules/lodash/toInteger.js":/*!******************************************!*\ - !*** ./node_modules/lodash/toInteger.js ***! - \******************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var toFinite=__webpack_require__(/*! ./toFinite */"./node_modules/lodash/toFinite.js");/** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0;}module.exports=toInteger;/***/},/***/"./node_modules/lodash/toNumber.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/toNumber.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var isObject=__webpack_require__(/*! ./isObject */"./node_modules/lodash/isObject.js"),isSymbol=__webpack_require__(/*! ./isSymbol */"./node_modules/lodash/isSymbol.js");/** Used as references for various `Number` constants. */var NAN=0/0;/** Used to match leading and trailing whitespace. */var reTrim=/^\s+|\s+$/g;/** Used to detect bad signed hexadecimal string values. */var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;/** Used to detect binary string values. */var reIsBinary=/^0b[01]+$/i;/** Used to detect octal string values. */var reIsOctal=/^0o[0-7]+$/i;/** Built-in method references without a dependency on `root`. */var freeParseInt=parseInt;/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */function toNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}if(isObject(value)){var other=typeof value.valueOf=='function'?value.valueOf():value;value=isObject(other)?other+'':other;}if(typeof value!='string'){return value===0?value:+value;}value=value.replace(reTrim,'');var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value;}module.exports=toNumber;/***/},/***/"./node_modules/lodash/toPlainObject.js":/*!**********************************************!*\ - !*** ./node_modules/lodash/toPlainObject.js ***! - \**********************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var copyObject=__webpack_require__(/*! ./_copyObject */"./node_modules/lodash/_copyObject.js"),keysIn=__webpack_require__(/*! ./keysIn */"./node_modules/lodash/keysIn.js");/** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */function toPlainObject(value){return copyObject(value,keysIn(value));}module.exports=toPlainObject;/***/},/***/"./node_modules/lodash/toString.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/toString.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseToString=__webpack_require__(/*! ./_baseToString */"./node_modules/lodash/_baseToString.js");/** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */function toString(value){return value==null?'':baseToString(value);}module.exports=toString;/***/},/***/"./node_modules/lodash/uniq.js":/*!*************************************!*\ - !*** ./node_modules/lodash/uniq.js ***! - \*************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseUniq=__webpack_require__(/*! ./_baseUniq */"./node_modules/lodash/_baseUniq.js");/** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */function uniq(array){return array&&array.length?baseUniq(array):[];}module.exports=uniq;/***/},/***/"./node_modules/lodash/uniqWith.js":/*!*****************************************!*\ - !*** ./node_modules/lodash/uniqWith.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){var baseUniq=__webpack_require__(/*! ./_baseUniq */"./node_modules/lodash/_baseUniq.js");/** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */function uniqWith(array,comparator){comparator=typeof comparator=='function'?comparator:undefined;return array&&array.length?baseUniq(array,undefined,comparator):[];}module.exports=uniqWith;/***/},/***/"./node_modules/process/browser.js":/*!*****************************************!*\ - !*** ./node_modules/process/browser.js ***! - \*****************************************/ /*! no static exports found */ /***/function(module,exports){// shim for using process in browser -var process=module.exports={};// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. -var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error('setTimeout has not been defined');}function defaultClearTimeout(){throw new Error('clearTimeout has not been defined');}(function(){try{if(typeof setTimeout==='function'){cachedSetTimeout=setTimeout;}else{cachedSetTimeout=defaultSetTimout;}}catch(e){cachedSetTimeout=defaultSetTimout;}try{if(typeof clearTimeout==='function'){cachedClearTimeout=clearTimeout;}else{cachedClearTimeout=defaultClearTimeout;}}catch(e){cachedClearTimeout=defaultClearTimeout;}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){//normal enviroments in sane situations -return setTimeout(fun,0);}// if setTimeout wasn't available but was latter defined -if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0);}try{// when when somebody has screwed with setTimeout but no I.E. maddness -return cachedSetTimeout(fun,0);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally -return cachedSetTimeout.call(null,fun,0);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error -return cachedSetTimeout.call(this,fun,0);}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){//normal enviroments in sane situations -return clearTimeout(marker);}// if clearTimeout wasn't available but was latter defined -if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker);}try{// when when somebody has screwed with setTimeout but no I.E. maddness -return cachedClearTimeout(marker);}catch(e){try{// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally -return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. -// Some versions of I.E. have different rules for clearTimeout vs setTimeout -return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex1){for(var i=1;i result for the -// current iteration. -result.value=unwrapped;resolve(result);},function(error){// If a rejected Promise was yielded, throw the rejection back -// into the async generator function so it can be handled there. -return invoke("throw",error,resolve,reject);});}}var previousPromise;function enqueue(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=// If enqueue has been called before, then we want to wait until -// all previous Promises have been resolved before calling invoke, -// so that results are always delivered in the correct order. If -// enqueue has not been called before, then it is important to -// call invoke immediately, without waiting on a callback to fire, -// so that the async generator function has the opportunity to do -// any necessary setup in a predictable way. This predictability -// is why the Promise constructor synchronously invokes its -// executor callback, and why async functions synchronously -// execute code before the first await. Since we implement simple -// async functions in terms of async generators, it is especially -// important to get this right, even though it requires care. -previousPromise?previousPromise.then(callInvokeWithMethodAndArg,// Avoid propagating failures to Promises returned by later -// invocations of the iterator. -callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}// Define the unified helper method that is used to implement .next, -// .throw, and .return (see defineIteratorMethods). -this._invoke=enqueue;}defineIteratorMethods(AsyncIterator.prototype);AsyncIterator.prototype[asyncIteratorSymbol]=function(){return this;};exports.AsyncIterator=AsyncIterator;// Note that simple async functions are implemented on top of -// AsyncIterator objects; they just return a Promise for the value of -// the final result produced by the iterator. -exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){if(PromiseImpl===void 0)PromiseImpl=Promise;var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter// If outerFn is a generator, return the full iterator. -:iter.next().then(function(result){return result.done?result.value:iter.next();});};function makeInvokeMethod(innerFn,self,context){var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running");}if(state===GenStateCompleted){if(method==="throw"){throw arg;}// Be forgiving, per 25.3.3.3.3 of the spec: -// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume -return doneResult();}context.method=method;context.arg=arg;while(true){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if(context.method==="next"){// Setting context._sent for legacy support of Babel's -// function.sent implementation. -context.sent=context._sent=context.arg;}else if(context.method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw context.arg;}context.dispatchException(context.arg);}else if(context.method==="return"){context.abrupt("return",context.arg);}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){// If an exception is thrown from innerFn, we leave state === -// GenStateExecuting and loop back for another invocation. -state=context.done?GenStateCompleted:GenStateSuspendedYield;if(record.arg===ContinueSentinel){continue;}return{value:record.arg,done:context.done};}else if(record.type==="throw"){state=GenStateCompleted;// Dispatch the exception by looping back around to the -// context.dispatchException(context.arg) call above. -context.method="throw";context.arg=record.arg;}}};}// Call delegate.iterator[context.method](context.arg) and handle the -// result, either by returning a { value, done } result from the -// delegate iterator, or by modifying context.method and context.arg, -// setting context.delegate to null, and returning the ContinueSentinel. -function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(method===undefined){// A .throw or .return when the delegate iterator has no .throw -// method always terminates the yield* loop. -context.delegate=null;if(context.method==="throw"){// Note: ["return"] must be used for ES3 parsing compatibility. -if(delegate.iterator["return"]){// If the delegate iterator has a return method, give it a -// chance to clean up. -context.method="return";context.arg=undefined;maybeInvokeDelegate(delegate,context);if(context.method==="throw"){// If maybeInvokeDelegate(context) changed context.method from -// "return" to "throw", let that override the TypeError below. -return ContinueSentinel;}}context.method="throw";context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if(record.type==="throw"){context.method="throw";context.arg=record.arg;context.delegate=null;return ContinueSentinel;}var info=record.arg;if(!info){context.method="throw";context.arg=new TypeError("iterator result is not an object");context.delegate=null;return ContinueSentinel;}if(info.done){// Assign the result of the finished delegate to the temporary -// variable specified by delegate.resultName (see delegateYield). -context[delegate.resultName]=info.value;// Resume execution at the desired location (see delegateYield). -context.next=delegate.nextLoc;// If context.method was "throw" but the delegate handled the -// exception, let the outer generator proceed normally. If -// context.method was "next", forget context.arg since it has been -// "consumed" by the delegate iterator. If context.method was -// "return", allow the original .return call to continue in the -// outer generator. -if(context.method!=="return"){context.method="next";context.arg=undefined;}}else{// Re-yield the result returned by the delegate method. -return info;}// The delegate iterator is finished, so forget it and continue with -// the outer generator. -context.delegate=null;return ContinueSentinel;}// Define Generator.prototype.{next,throw,return} in terms of the -// unified ._invoke helper method. -defineIteratorMethods(Gp);Gp[toStringTagSymbol]="Generator";// A Generator should always return itself as the iterator object when the -// @@iterator function is called on it. Some browsers' implementations of the -// iterator prototype chain incorrectly implement this, causing the Generator -// object to not be returned from this call. This ensures that doesn't happen. -// See https://github.com/facebook/regenerator/issues/274 for more details. -Gp[iteratorSymbol]=function(){return this;};Gp.toString=function(){return"[object Generator]";};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1];}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3];}this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal";delete record.arg;entry.completion=record;}function Context(tryLocsList){// The root entry object (effectively a try statement without a catch -// or a finally block) gives us a place to store values thrown from -// locations where there is no enclosing try statement. -this.tryEntries=[{tryLoc:"root"}];tryLocsList.forEach(pushTryEntry,this);this.reset(true);}exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}keys.reverse();// Rather than returning an object with a next method, we keep -// things simple and return the next function itself. -return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next;}}// To avoid creating an additional object, we just hang the .value -// and .done properties off the next function object itself. This -// also ensures that the minifier will not anonymize the function. -next.done=true;return next;};};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable);}if(typeof iterable.next==="function"){return iterable;}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){// Exception thrown outside of any try block that could handle -// it, so set the completion value of the entire function to -// throw the exception. -return handle("end");}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel;}}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}// The context.catch method must only be called with a location -// argument that corresponds to a known catch block. -throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};if(this.method==="next"){// Deliberately forget the last sent value so that we don't -// accidentally pass it on to the delegate. -this.arg=undefined;}return ContinueSentinel;}};// Regardless of whether this script is executing as a CommonJS module -// or not, return the runtime object so that we can declare the variable -// regeneratorRuntime in the outer scope, which allows this module to be -// injected easily by `bin/regenerator --include-runtime script.js`. -return exports;}(// If this script is executing as a CommonJS module, use module.exports -// as the regeneratorRuntime namespace. Otherwise create a new empty -// object. Either way, the resulting object will be used to initialize -// the regeneratorRuntime variable at the top of this file. -(false?undefined:_typeof(module))==="object"?module.exports:{});try{regeneratorRuntime=runtime;}catch(accidentalStrictMode){// This module should not be running in strict mode, so the above -// assignment should always work unless something is misconfigured. Just -// in case runtime.js accidentally runs in strict mode, we can escape -// strict mode using a global Function call. This could conceivably fail -// if a Content Security Policy forbids using Function, but in that case -// the proper solution is to fix the accidental strict mode problem. If -// you've misconfigured your bundler to force strict mode and applied a -// CSP to forbid Function, and you're not willing to fix either of those -// problems, please detail your unique predicament in a GitHub issue. -Function("r","regeneratorRuntime = r")(runtime);}/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/module.js */"./node_modules/webpack/buildin/module.js")(module));/***/},/***/"./node_modules/setimmediate/setImmediate.js":/*!***************************************************!*\ - !*** ./node_modules/setimmediate/setImmediate.js ***! - \***************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global,process){(function(global,undefined){"use strict";if(global.setImmediate){return;}var nextHandle=1;// Spec says greater than zero -var tasksByHandle={};var currentlyRunningATask=false;var doc=global.document;var registerImmediate;function setImmediate(callback){// Callback can either be a function or a string -if(typeof callback!=="function"){callback=new Function(""+callback);}// Copy function arguments -var args=new Array(arguments.length-1);for(var i=0;i element; its readystatechange event will be fired asynchronously once it is inserted -// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. -var script=doc.createElement("script");script.onreadystatechange=function(){runIfPresent(handle);script.onreadystatechange=null;html.removeChild(script);script=null;};html.appendChild(script);};}function installSetTimeoutImplementation(){registerImmediate=function registerImmediate(handle){setTimeout(runIfPresent,0,handle);};}// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. -var attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global;// Don't get fooled by e.g. browserify environments. -if({}.toString.call(global.process)==="[object process]"){// For Node.js before 0.9 -installNextTickImplementation();}else if(canUsePostMessage()){// For non-IE10 modern browsers -installPostMessageImplementation();}else if(global.MessageChannel){// For web workers, where supported -installMessageChannelImplementation();}else if(doc&&"onreadystatechange"in doc.createElement("script")){// For IE 6–8 -installReadyStateChangeImplementation();}else{// For older browsers -installSetTimeoutImplementation();}attachTo.setImmediate=setImmediate;attachTo.clearImmediate=clearImmediate;})(typeof self==="undefined"?typeof global==="undefined"?this:global:self);/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"),__webpack_require__(/*! ./../process/browser.js */"./node_modules/process/browser.js"));/***/},/***/"./node_modules/timers-browserify/main.js":/*!************************************************!*\ - !*** ./node_modules/timers-browserify/main.js ***! - \************************************************/ /*! no static exports found */ /***/function(module,exports,__webpack_require__){/* WEBPACK VAR INJECTION */(function(global){var scope=typeof global!=="undefined"&&global||typeof self!=="undefined"&&self||window;var apply=Function.prototype.apply;// DOM APIs, for completeness -exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,scope,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,scope,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){if(timeout){timeout.close();}};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(scope,this._id);};// Does not start the time, just sets up the members needed. -exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// setimmediate attaches itself to the global object -__webpack_require__(/*! setimmediate */"./node_modules/setimmediate/setImmediate.js");// On some exotic environments, it's not clear which object `setimmediate` was -// able to install onto. Search each possibility in the same order as the -// `setimmediate` library. -exports.setImmediate=typeof self!=="undefined"&&self.setImmediate||typeof global!=="undefined"&&global.setImmediate||this&&this.setImmediate;exports.clearImmediate=typeof self!=="undefined"&&self.clearImmediate||typeof global!=="undefined"&&global.clearImmediate||this&&this.clearImmediate;/* WEBPACK VAR INJECTION */}).call(this,__webpack_require__(/*! ./../webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"));/***/},/***/"./node_modules/webpack/buildin/global.js":/*!***********************************!*\ - !*** (webpack)/buildin/global.js ***! - \***********************************/ /*! no static exports found */ /***/function(module,exports){function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var g;// This works in non-strict mode -g=function(){return this;}();try{// This works if eval is allowed (see CSP) -g=g||new Function("return this")();}catch(e){// This works if the window reference is available -if((typeof window==="undefined"?"undefined":_typeof(window))==="object")g=window;}// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} -module.exports=g;/***/},/***/"./node_modules/webpack/buildin/module.js":/*!***********************************!*\ - !*** (webpack)/buildin/module.js ***! - \***********************************/ /*! no static exports found */ /***/function(module,exports){module.exports=function(module){if(!module.webpackPolyfill){module.deprecate=function(){};module.paths=[];// module.parent = undefined by default -if(!module.children)module.children=[];Object.defineProperty(module,"loaded",{enumerable:true,get:function get(){return module.l;}});Object.defineProperty(module,"id",{enumerable:true,get:function get(){return module.i;}});module.webpackPolyfill=1;}return module;};/***/}/******/}));}); - -/***/ }), - -/***/ "./app/assets/javascripts/app.js": -/*!***************************************!*\ - !*** ./app/assets/javascripts/app.js ***! - \***************************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _routes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./routes */ "./app/assets/javascripts/routes.js"); -/* harmony import */ var _applicationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./applicationManager */ "./app/assets/javascripts/applicationManager.js"); -/* harmony import */ var _controllers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./controllers */ "./app/assets/javascripts/controllers/index.js"); -/* harmony import */ var _directives_functional__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./directives/functional */ "./app/assets/javascripts/directives/functional/index.js"); -/* harmony import */ var _directives_views__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./directives/views */ "./app/assets/javascripts/directives/views/index.js"); -/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./filters */ "./app/assets/javascripts/filters/index.js"); - - - - - - - - - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app', ['ngSanitize']); // Config - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').config(_routes__WEBPACK_IMPORTED_MODULE_1__["configRoutes"]).constant('appVersion', "3.5.0"); // Controllers - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').directive('root', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["Root"](); -}).directive('applicationView', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["ApplicationView"](); -}).directive('tagsPanel', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["TagsPanel"](); -}).directive('notesPanel', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["NotesPanel"](); -}).directive('editorPanel', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["EditorPanel"](); -}).directive('footer', function () { - return new _controllers__WEBPACK_IMPORTED_MODULE_3__["Footer"](); -}); // .directive('lockScreen', () => new LockScreen()); -// Directives - Functional - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').directive('snAutofocus', ['$timeout', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["autofocus"]]).directive('clickOutside', ['$document', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["clickOutside"]]).directive('delayHide', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["delayHide"]).directive('elemReady', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["elemReady"]).directive('fileChange', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["fileChange"]).directive('infiniteScroll', [_directives_functional__WEBPACK_IMPORTED_MODULE_4__["infiniteScroll"]]).directive('lowercase', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["lowercase"]).directive('selectOnClick', ['$window', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["selectOnClick"]]).directive('snEnter', _directives_functional__WEBPACK_IMPORTED_MODULE_4__["snEnter"]); // Directives - Views - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').directive('accountMenu', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["AccountMenu"](); -}).directive('actionsMenu', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["ActionsMenu"](); -}).directive('challengeModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["ChallengeModal"](); -}).directive('componentModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["ComponentModal"](); -}).directive('componentView', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["ComponentView"](); -}) // .directive( -// 'componentView', -// ($rootScope, componentManager, desktopManager, $timeout) => -// new ComponentView($rootScope, componentManager, desktopManager, $timeout) -// ) -.directive('conflictResolutionModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["ConflictResolutionModal"](); -}).directive('editorMenu', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["EditorMenu"](); -}).directive('inputModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["InputModal"](); -}).directive('menuRow', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["MenuRow"](); -}).directive('panelResizer', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["PanelResizer"](); -}).directive('passwordWizard', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["PasswordWizard"](); -}).directive('permissionsModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["PermissionsModal"](); -}).directive('privilegesAuthModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["PrivilegesAuthModal"](); -}).directive('privilegesManagementModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["PrivilegesManagementModal"](); -}).directive('revisionPreviewModal', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["RevisionPreviewModal"](); -}).directive('sessionHistoryMenu', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["SessionHistoryMenu"](); -}).directive('syncResolutionMenu', function () { - return new _directives_views__WEBPACK_IMPORTED_MODULE_5__["SyncResolutionMenu"](); -}); // Filters - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').filter('trusted', ['$sce', _filters__WEBPACK_IMPORTED_MODULE_6__["trusted"]]); // Services - -angular__WEBPACK_IMPORTED_MODULE_0___default.a.module('app').service('applicationManager', _applicationManager__WEBPACK_IMPORTED_MODULE_2__["ApplicationManager"]); - -/***/ }), - -/***/ "./app/assets/javascripts/application.js": -/*!***********************************************!*\ - !*** ./app/assets/javascripts/application.js ***! - \***********************************************/ -/*! exports provided: WebApplication */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebApplication", function() { return WebApplication; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _services_alertService__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @/services/alertService */ "./app/assets/javascripts/services/alertService.js"); -/* harmony import */ var _web_device_interface__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/web_device_interface */ "./app/assets/javascripts/web_device_interface.js"); - - - - - - - - - - - - - - -var WebApplication = /*#__PURE__*/function (_SNApplication) { - WebApplication.$inject = ["$compile", "$timeout", "scope", "onDeinit"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(WebApplication, _SNApplication); - - /* @ngInject */ - function WebApplication($compile, $timeout, scope, onDeinit) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, WebApplication); - - var deviceInterface = new _web_device_interface__WEBPACK_IMPORTED_MODULE_13__["WebDeviceInterface"]({ - timeout: $timeout - }); - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(WebApplication).call(this, { - environment: snjs__WEBPACK_IMPORTED_MODULE_9__["Environments"].Web, - platform: Object(snjs__WEBPACK_IMPORTED_MODULE_9__["platformFromString"])(Object(_utils__WEBPACK_IMPORTED_MODULE_11__["getPlatformString"])()), - namespace: '', - deviceInterface: deviceInterface, - swapClasses: [{ - swap: snjs__WEBPACK_IMPORTED_MODULE_9__["SNAlertService"], - with: _services_alertService__WEBPACK_IMPORTED_MODULE_12__["AlertService"] - }] - })); - _this.$compile = $compile; - _this.scope = scope; - _this.onDeinit = onDeinit; - deviceInterface.setApplication(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this)); - return _this; - } - /** @override */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(WebApplication, [{ - key: "deinit", - value: function deinit() { - for (var _i = 0, _Object$keys = Object.keys(this.webServices); _i < _Object$keys.length; _i++) { - var key = _Object$keys[_i]; - var service = this.webServices[key]; - - if (service.deinit) { - service.deinit(); - } - - service.application = null; - delete this.webServices[key]; - } - - this.webServices = {}; - this.onDeinit(this); - this.onDeinit = null; - this.$compile = null; - this.$timeout = null; - this.scope.application = null; - this.scope.$destroy(); - this.scope = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(WebApplication.prototype), "deinit", this).call(this); - } - /** - * @access public - * @param {object} services - */ - - }, { - key: "setWebServices", - value: function setWebServices(services) { - this.webServices = services; - } - /** @access public */ - - }, { - key: "getAppState", - value: function getAppState() { - return this.webServices.appState; - } - /** @access public */ - - }, { - key: "getDesktopService", - value: function getDesktopService() { - return this.webServices.desktopService; - } - /** @access public */ - - }, { - key: "getLockService", - value: function getLockService() { - return this.webServices.lockService; - } - /** @access public */ - - }, { - key: "getArchiveService", - value: function getArchiveService() { - return this.webServices.archiveService; - } - /** @access public */ - - }, { - key: "getNativeExtService", - value: function getNativeExtService() { - return this.webServices.nativeExtService; - } - /** @access public */ - - }, { - key: "getStatusService", - value: function getStatusService() { - return this.webServices.statusService; - } - /** @access public */ - - }, { - key: "getThemeService", - value: function getThemeService() { - return this.webServices.themeService; - } - /** @access public */ - - }, { - key: "getPrefsService", - value: function getPrefsService() { - return this.webServices.prefsService; - } - /** @access public */ - - }, { - key: "getKeyboardService", - value: function getKeyboardService() { - return this.webServices.keyboardService; - } - }, { - key: "checkForSecurityUpdate", - value: function () { - var _checkForSecurityUpdate = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", this.protocolUpgradeAvailable()); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function checkForSecurityUpdate() { - return _checkForSecurityUpdate.apply(this, arguments); - } - - return checkForSecurityUpdate; - }() - }, { - key: "presentPasswordWizard", - value: function presentPasswordWizard(type) { - var scope = this.scope.$new(true); - scope.type = type; - scope.application = this; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - } - }, { - key: "promptForChallenge", - value: function promptForChallenge(challenge, orchestrator) { - var scope = this.scope.$new(true); - scope.challenge = challenge; - scope.orchestrator = orchestrator; - scope.application = this; - var el = this.$compile("" + "")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - } - }, { - key: "performProtocolUpgrade", - value: function () { - var _performProtocolUpgrade = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var errors; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.upgradeProtocolVersion(); - - case 2: - errors = _context2.sent; - - if (errors.length === 0) { - this.alertService.alert({ - text: "Success! Your encryption version has been upgraded." + " You'll be asked to enter your credentials again on other devices you're signed into." - }); - } else { - this.alertService.alert({ - text: "Unable to upgrade encryption version. Please try again." - }); - } - - case 4: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function performProtocolUpgrade() { - return _performProtocolUpgrade.apply(this, arguments); - } - - return performProtocolUpgrade; - }() - }, { - key: "presentPrivilegesModal", - value: function () { - var _presentPrivilegesModal = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(action, onSuccess, onCancel) { - var _this2 = this; - - var customSuccess, customCancel, scope, el; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - if (!this.authenticationInProgress()) { - _context5.next = 3; - break; - } - - onCancel && onCancel(); - return _context5.abrupt("return"); - - case 3: - customSuccess = /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _context3.t0 = onSuccess; - - if (!_context3.t0) { - _context3.next = 4; - break; - } - - _context3.next = 4; - return onSuccess(); - - case 4: - _this2.currentAuthenticationElement = null; - - case 5: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - return function customSuccess() { - return _ref.apply(this, arguments); - }; - }(); - - customCancel = /*#__PURE__*/function () { - var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.t0 = onCancel; - - if (!_context4.t0) { - _context4.next = 4; - break; - } - - _context4.next = 4; - return onCancel(); - - case 4: - _this2.currentAuthenticationElement = null; - - case 5: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - - return function customCancel() { - return _ref2.apply(this, arguments); - }; - }(); - - scope = this.scope.$new(true); - scope.action = action; - scope.onSuccess = customSuccess; - scope.onCancel = customCancel; - scope.application = this; - el = this.$compile("\n \n ")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - this.currentAuthenticationElement = el; - - case 13: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function presentPrivilegesModal(_x, _x2, _x3) { - return _presentPrivilegesModal.apply(this, arguments); - } - - return presentPrivilegesModal; - }() - }, { - key: "presentPrivilegesManagementModal", - value: function presentPrivilegesManagementModal() { - var scope = this.scope.$new(true); - scope.application = this; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - } - }, { - key: "authenticationInProgress", - value: function authenticationInProgress() { - return this.currentAuthenticationElement != null; - } - }, { - key: "presentPasswordModal", - value: function presentPasswordModal(callback) { - var scope = this.scope.$new(true); - scope.type = "password"; - scope.title = "Decryption Assistance"; - scope.message = "Unable to decrypt this item with your current keys. \n Please enter your account password at the time of this revision."; - scope.callback = callback; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - } - }, { - key: "presentRevisionPreviewModal", - value: function presentRevisionPreviewModal(uuid, content) { - var scope = this.scope.$new(true); - scope.uuid = uuid; - scope.content = content; - scope.application = this; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document.body).append(el); - } - }]); - - return WebApplication; -}(snjs__WEBPACK_IMPORTED_MODULE_9__["SNApplication"]); - -/***/ }), - -/***/ "./app/assets/javascripts/applicationManager.js": -/*!******************************************************!*\ - !*** ./app/assets/javascripts/applicationManager.js ***! - \******************************************************/ -/*! exports provided: ApplicationManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationManager", function() { return ApplicationManager; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _application__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./application */ "./app/assets/javascripts/application.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./services */ "./app/assets/javascripts/services/index.js"); - - - - - -var ApplicationManager = /*#__PURE__*/function () { - ApplicationManager.$inject = ["$compile", "$rootScope", "$timeout"]; - - /* @ngInject */ - function ApplicationManager($compile, $rootScope, $timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ApplicationManager); - - this.$compile = $compile; - this.$timeout = $timeout; - this.$rootScope = $rootScope; - this.applications = []; - this.changeObservers = []; - this.onApplicationDeinit = this.onApplicationDeinit.bind(this); - this.createDefaultApplication(); - } - /** @access private */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ApplicationManager, [{ - key: "createDefaultApplication", - value: function createDefaultApplication() { - this.activeApplication = this.createNewApplication(); - this.applications.push(this.activeApplication); - this.notifyObserversOfAppChange(); - } - /** @callback */ - - }, { - key: "onApplicationDeinit", - value: function onApplicationDeinit(application) { - Object(snjs__WEBPACK_IMPORTED_MODULE_3__["removeFromArray"])(this.applications, application); - - if (this.activeApplication === application) { - this.activeApplication = null; - } - - if (this.applications.length === 0) { - this.createDefaultApplication(); - } - - this.notifyObserversOfAppChange(); - } - /** @access private */ - - }, { - key: "createNewApplication", - value: function createNewApplication() { - var scope = this.$rootScope.$new(true); - var application = new _application__WEBPACK_IMPORTED_MODULE_2__["WebApplication"](this.$compile, this.$timeout, scope, this.onApplicationDeinit); - var appState = new _services__WEBPACK_IMPORTED_MODULE_4__["AppState"](this.$rootScope, this.$timeout, application); - var archiveService = new _services__WEBPACK_IMPORTED_MODULE_4__["ArchiveManager"](application); - var desktopService = new _services__WEBPACK_IMPORTED_MODULE_4__["DesktopManager"](this.$rootScope, this.$timeout, application); - var keyboardService = new _services__WEBPACK_IMPORTED_MODULE_4__["KeyboardManager"](); - var lockService = new _services__WEBPACK_IMPORTED_MODULE_4__["LockManager"](application); - var nativeExtService = new _services__WEBPACK_IMPORTED_MODULE_4__["NativeExtManager"](application); - var prefsService = new _services__WEBPACK_IMPORTED_MODULE_4__["PreferencesManager"](application); - var statusService = new _services__WEBPACK_IMPORTED_MODULE_4__["StatusManager"](); - var themeService = new _services__WEBPACK_IMPORTED_MODULE_4__["ThemeManager"](application); - application.setWebServices({ - appState: appState, - archiveService: archiveService, - desktopService: desktopService, - keyboardService: keyboardService, - lockService: lockService, - nativeExtService: nativeExtService, - prefsService: prefsService, - statusService: statusService, - themeService: themeService - }); - return application; - } - }, { - key: "getApplications", - - /** @access public */ - value: function getApplications() { - return this.applications.slice(); - } - /** - * Notifies observer when the active application has changed. - * Any application which is no longer active is destroyed, and - * must be removed from the interface. - * @access public - * @param {function} callback - */ - - }, { - key: "addApplicationChangeObserver", - value: function addApplicationChangeObserver(callback) { - this.changeObservers.push(callback); - - if (this.application) { - callback(); - } - } - }, { - key: "notifyObserversOfAppChange", - value: function notifyObserversOfAppChange() { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.changeObservers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var observer = _step.value; - observer(); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - }, { - key: "application", - get: function get() { - return this.activeApplication; - } - }]); - - return ApplicationManager; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/abstract/pure_ctrl.js": -/*!******************************************************************!*\ - !*** ./app/assets/javascripts/controllers/abstract/pure_ctrl.js ***! - \******************************************************************/ -/*! exports provided: PureCtrl */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(setImmediate) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PureCtrl", function() { return PureCtrl; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_4__); - - - - - -var PureCtrl = /*#__PURE__*/function () { - PureCtrl.$inject = ["$timeout"]; - - /* @ngInject */ - function PureCtrl($timeout) { - var _this = this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PureCtrl); - - if (!$timeout) { - throw Error('$timeout must not be null'); - } - - this.$timeout = $timeout; - this.props = {}; - this.state = {}; - /* Allow caller constructor to finish setting instance variables */ - - setImmediate(function () { - _this.state = _this.getInitialState(); - }); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(PureCtrl, [{ - key: "$onInit", - value: function $onInit() { - this.addAppEventObserver(); - this.addAppStateObserver(); - } - }, { - key: "deinit", - value: function deinit() { - this.unsubApp(); - this.unsubState(); - this.unsubApp = null; - this.unsubState = null; - this.application = null; - - if (this.stateTimeout) { - this.$timeout.cancel(this.stateTimeout); - } - } - }, { - key: "$onDestroy", - value: function $onDestroy() { - this.deinit(); - } - /** @private */ - - }, { - key: "resetState", - value: function () { - var _resetState = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - this.state = this.getInitialState(); - _context.next = 3; - return this.setState(this.state); - - case 3: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function resetState() { - return _resetState.apply(this, arguments); - } - - return resetState; - }() - /** @override */ - - }, { - key: "getInitialState", - value: function getInitialState() { - return {}; - } - }, { - key: "setState", - value: function () { - var _setState = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(state) { - var _this2 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (this.$timeout) { - _context2.next = 2; - break; - } - - return _context2.abrupt("return"); - - case 2: - return _context2.abrupt("return", new Promise(function (resolve) { - _this2.stateTimeout = _this2.$timeout(function () { - _this2.state = Object.freeze(Object.assign({}, _this2.state, state)); - resolve(); - }); - })); - - case 3: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function setState(_x) { - return _setState.apply(this, arguments); - } - - return setState; - }() - }, { - key: "initProps", - value: function initProps(props) { - if (Object.keys(this.props).length > 0) { - throw 'Already init-ed props.'; - } - - this.props = Object.freeze(Object.assign({}, this.props, props)); - } - }, { - key: "addAppStateObserver", - value: function addAppStateObserver() { - var _this3 = this; - - this.unsubState = this.application.getAppState().addObserver(function (eventName, data) { - _this3.onAppStateEvent(eventName, data); - }); - } - }, { - key: "onAppStateEvent", - value: function onAppStateEvent(eventName, data) { - /** Optional override */ - } - }, { - key: "addAppEventObserver", - value: function addAppEventObserver() { - var _this4 = this; - - if (this.application.isStarted()) { - this.onAppStart(); - } - - if (this.application.isLaunched()) { - this.onAppLaunch(); - } - - this.unsubApp = this.application.addEventObserver( /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(eventName) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _this4.onAppEvent(eventName); - - if (!(eventName === snjs__WEBPACK_IMPORTED_MODULE_4__["ApplicationEvents"].Started)) { - _context3.next = 6; - break; - } - - _context3.next = 4; - return _this4.onAppStart(); - - case 4: - _context3.next = 12; - break; - - case 6: - if (!(eventName === snjs__WEBPACK_IMPORTED_MODULE_4__["ApplicationEvents"].Launched)) { - _context3.next = 11; - break; - } - - _context3.next = 9; - return _this4.onAppLaunch(); - - case 9: - _context3.next = 12; - break; - - case 11: - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_4__["ApplicationEvents"].CompletedSync) { - _this4.onAppSync(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_4__["ApplicationEvents"].KeyStatusChanged) { - _this4.onAppKeyChange(); - } - - case 12: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - return function (_x2) { - return _ref.apply(this, arguments); - }; - }()); - } - }, { - key: "onAppEvent", - value: function onAppEvent(eventName) {} - /** Optional override */ - - /** @override */ - - }, { - key: "onAppStart", - value: function () { - var _onAppStart = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.next = 2; - return this.resetState(); - - case 2: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function onAppStart() { - return _onAppStart.apply(this, arguments); - } - - return onAppStart; - }() - }, { - key: "onAppLaunch", - value: function () { - var _onAppLaunch = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - case "end": - return _context5.stop(); - } - } - }, _callee5); - })); - - function onAppLaunch() { - return _onAppLaunch.apply(this, arguments); - } - - return onAppLaunch; - }() - }, { - key: "onAppKeyChange", - value: function () { - var _onAppKeyChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - case "end": - return _context6.stop(); - } - } - }, _callee6); - })); - - function onAppKeyChange() { - return _onAppKeyChange.apply(this, arguments); - } - - return onAppKeyChange; - }() - }, { - key: "onAppSync", - value: function onAppSync() { - /** Optional override */ - } - }]); - - return PureCtrl; -}(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../node_modules/timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/applicationView.js": -/*!***************************************************************!*\ - !*** ./app/assets/javascripts/controllers/applicationView.js ***! - \***************************************************************/ -/*! exports provided: ApplicationView */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationView", function() { return ApplicationView; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _application_view_pug__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! %/application-view.pug */ "./app/assets/templates/application-view.pug"); -/* harmony import */ var _application_view_pug__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_application_view_pug__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_13__); -/* harmony import */ var _controllers_constants__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/controllers/constants */ "./app/assets/javascripts/controllers/constants.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @/strings */ "./app/assets/javascripts/strings.js"); -/* harmony import */ var _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./abstract/pure_ctrl */ "./app/assets/javascripts/controllers/abstract/pure_ctrl.js"); - - - - - - - - - - - - - - - - - - -var ApplicationViewCtrl = /*#__PURE__*/function (_PureCtrl) { - ApplicationViewCtrl.$inject = ["$compile", "$location", "$rootScope", "$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(ApplicationViewCtrl, _PureCtrl); - - /* @ngInject */ - function ApplicationViewCtrl($compile, $location, $rootScope, $timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ApplicationViewCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl).call(this, $timeout)); - _this.$location = $location; - _this.$rootScope = $rootScope; - _this.$compile = $compile; - _this.platformString = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getPlatformString"])(); - _this.state = { - appClass: '' - }; - _this.onDragDrop = _this.onDragDrop.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this)); - _this.onDragOver = _this.onDragOver.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this)); - _this.openModalComponent = _this.openModalComponent.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this)); - _this.presentPermissionsDialog = _this.presentPermissionsDialog.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this)); - - _this.addDragDropHandlers(); - - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ApplicationViewCtrl, [{ - key: "deinit", - value: function deinit() { - this.$location = null; - this.$rootScope = null; - this.$compile = null; - this.application = null; - this.lockScreenPuppet = null; - window.removeEventListener('dragover', this.onDragOver, true); - window.removeEventListener('drop', this.onDragDrop, true); - this.onDragDrop = null; - this.onDragOver = null; - this.openModalComponent = null; - this.presentPermissionsDialog = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl.prototype), "$onInit", this).call(this); - - this.loadApplication(); - } - }, { - key: "loadApplication", - value: function () { - var _loadApplication = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var _this2 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.application.prepareForLaunch({ - callbacks: { - receiveChallenge: function () { - var _receiveChallenge = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(challenge, orchestrator) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _this2.application.promptForChallenge(challenge, orchestrator); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - function receiveChallenge(_x, _x2) { - return _receiveChallenge.apply(this, arguments); - } - - return receiveChallenge; - }() - } - }); - - case 2: - _context2.next = 4; - return this.application.launch(); - - case 4: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function loadApplication() { - return _loadApplication.apply(this, arguments); - } - - return loadApplication; - }() - }, { - key: "onAppStart", - value: function onAppStart() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl.prototype), "onAppStart", this).call(this); - - this.overrideComponentManagerFunctions(); - this.application.componentManager.setDesktopManager(this.application.getDesktopService()); - this.setState({ - ready: true, - needsUnlock: this.application.hasPasscode() - }); - } - }, { - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl.prototype), "onAppLaunch", this).call(this); - - this.setState({ - needsUnlock: false - }); - this.handleAutoSignInFromParams(); - } - }, { - key: "onUpdateAvailable", - value: function onUpdateAvailable() { - this.$rootScope.$broadcast('new-update-available'); - } - }, { - key: "onAppEvent", - - /** @override */ - value: function () { - var _onAppEvent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(eventName) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(ApplicationViewCtrl.prototype), "onAppEvent", this).call(this, eventName); - - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].LocalDataIncrementalLoad) { - this.updateLocalDataStatus(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].SyncStatusChanged || eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].FailedSync) { - this.updateSyncStatus(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].LocalDataLoaded) { - this.updateLocalDataStatus(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].WillSync) { - if (!this.completedInitialSync) { - this.syncStatus = this.application.getStatusService().replaceStatusWithString(this.syncStatus, "Syncing..."); - } - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].CompletedSync) { - if (!this.completedInitialSync) { - this.syncStatus = this.application.getStatusService().removeStatus(this.syncStatus); - this.completedInitialSync = true; - } - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].InvalidSyncSession) { - this.showInvalidSessionAlert(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].LocalDatabaseReadError) { - this.application.alertService.alert({ - text: 'Unable to load local database. Please restart the app and try again.' - }); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].LocalDatabaseWriteError) { - this.application.alertService.alert({ - text: 'Unable to write to local database. Please restart the app and try again.' - }); - } - - case 2: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function onAppEvent(_x3) { - return _onAppEvent.apply(this, arguments); - } - - return onAppEvent; - }() - /** @override */ - - }, { - key: "onAppStateEvent", - value: function () { - var _onAppStateEvent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(eventName, data) { - var appClass; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - if (!(eventName === _services_state__WEBPACK_IMPORTED_MODULE_11__["AppStateEvents"].PanelResized)) { - _context4.next = 9; - break; - } - - if (data.panel === _controllers_constants__WEBPACK_IMPORTED_MODULE_14__["PANEL_NAME_NOTES"]) { - this.notesCollapsed = data.collapsed; - } - - if (data.panel === _controllers_constants__WEBPACK_IMPORTED_MODULE_14__["PANEL_NAME_TAGS"]) { - this.tagsCollapsed = data.collapsed; - } - - appClass = ""; - - if (this.notesCollapsed) { - appClass += "collapsed-notes"; - } - - if (this.tagsCollapsed) { - appClass += " collapsed-tags"; - } - - this.setState({ - appClass: appClass - }); - _context4.next = 14; - break; - - case 9: - if (!(eventName === _services_state__WEBPACK_IMPORTED_MODULE_11__["AppStateEvents"].WindowDidFocus)) { - _context4.next = 14; - break; - } - - _context4.next = 12; - return this.application.isLocked(); - - case 12: - if (_context4.sent) { - _context4.next = 14; - break; - } - - this.application.sync(); - - case 14: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function onAppStateEvent(_x4, _x5) { - return _onAppStateEvent.apply(this, arguments); - } - - return onAppStateEvent; - }() - }, { - key: "updateLocalDataStatus", - value: function updateLocalDataStatus() { - var syncStatus = this.application.getSyncStatus(); - var stats = syncStatus.getStats(); - var encryption = this.application.isEncryptionAvailable(); - - if (stats.localDataDone) { - this.syncStatus = this.application.getStatusService().removeStatus(this.syncStatus); - return; - } - - var notesString = "".concat(stats.localDataCurrent, "/").concat(stats.localDataTotal, " items..."); - var loadingStatus = encryption ? "Decrypting ".concat(notesString) : "Loading ".concat(notesString); - this.syncStatus = this.application.getStatusService().replaceStatusWithString(this.syncStatus, loadingStatus); - } - }, { - key: "updateSyncStatus", - value: function updateSyncStatus() { - var _this3 = this; - - var syncStatus = this.application.getSyncStatus(); - var stats = syncStatus.getStats(); - - if (syncStatus.hasError()) { - this.syncStatus = this.application.getStatusService().replaceStatusWithString(this.syncStatus, 'Unable to Sync'); - } else if (stats.downloadCount > 20) { - var text = "Downloading ".concat(stats.downloadCount, " items. Keep app open."); - this.syncStatus = this.application.getStatusService().replaceStatusWithString(this.syncStatus, text); - this.showingDownloadStatus = true; - } else if (this.showingDownloadStatus) { - this.showingDownloadStatus = false; - var _text = "Download Complete."; - this.syncStatus = this.application.getStatusService().replaceStatusWithString(this.syncStatus, _text); - setTimeout(function () { - _this3.syncStatus = _this3.application.getStatusService().removeStatus(_this3.syncStatus); - }, 2000); - } else if (stats.uploadTotalCount > 20) { - this.uploadSyncStatus = this.application.getStatusService().replaceStatusWithString(this.uploadSyncStatus, "Syncing ".concat(stats.uploadCompletionCount, "/").concat(stats.uploadTotalCount, " items...")); - } else if (this.uploadSyncStatus) { - this.uploadSyncStatus = this.application.getStatusService().removeStatus(this.uploadSyncStatus); - } - } - }, { - key: "openModalComponent", - value: function openModalComponent(component) { - var scope = this.$rootScope.$new(true); - scope.component = component; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_13___default.a.element(document.body).append(el); - } - }, { - key: "presentPermissionsDialog", - value: function presentPermissionsDialog(dialog) { - var scope = this.$rootScope.$new(true); - scope.permissionsString = dialog.permissionsString; - scope.component = dialog.component; - scope.callback = dialog.callback; - var el = this.$compile("")(scope); - angular__WEBPACK_IMPORTED_MODULE_13___default.a.element(document.body).append(el); - } - }, { - key: "overrideComponentManagerFunctions", - value: function overrideComponentManagerFunctions() { - this.application.componentManager.openModalComponent = this.openModalComponent; - this.application.componentManager.presentPermissionsDialog = this.presentPermissionsDialog; - } - }, { - key: "showInvalidSessionAlert", - value: function showInvalidSessionAlert() { - var _this4 = this; - - /** Don't show repeatedly; at most 30 seconds in between */ - var SHOW_INTERVAL = 30; - var lastShownSeconds = (new Date() - this.lastShownDate) / 1000; - - if (!this.lastShownDate || lastShownSeconds > SHOW_INTERVAL) { - this.lastShownDate = new Date(); - setTimeout(function () { - _this4.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_15__["STRING_SESSION_EXPIRED"] - }); - }, 500); - } - } - }, { - key: "addDragDropHandlers", - value: function addDragDropHandlers() { - /** - * Disable dragging and dropping of files (but allow text) into main SN interface. - * both 'dragover' and 'drop' are required to prevent dropping of files. - * This will not prevent extensions from receiving drop events. - */ - window.addEventListener('dragover', this.onDragOver, true); - window.addEventListener('drop', this.onDragDrop, true); - } - }, { - key: "onDragOver", - value: function onDragOver(event) { - if (event.dataTransfer.files.length > 0) { - event.preventDefault(); - } - } - }, { - key: "onDragDrop", - value: function onDragDrop(event) { - if (event.dataTransfer.files.length > 0) { - event.preventDefault(); - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_15__["STRING_DEFAULT_FILE_ERROR"] - }); - } - } - }, { - key: "handleAutoSignInFromParams", - value: function () { - var _handleAutoSignInFromParams = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - var params, server, email, password, user; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - params = this.$location.search(); - server = params.server; - email = params.email; - password = params.pw; - - if (!(!server || !email || !password)) { - _context5.next = 6; - break; - } - - return _context5.abrupt("return"); - - case 6: - user = this.application.getUser(); - - if (!user) { - _context5.next = 23; - break; - } - - _context5.t0 = user.email === email; - - if (!_context5.t0) { - _context5.next = 15; - break; - } - - _context5.next = 12; - return this.application.getHost(); - - case 12: - _context5.t1 = _context5.sent; - _context5.t2 = server; - _context5.t0 = _context5.t1 === _context5.t2; - - case 15: - if (!_context5.t0) { - _context5.next = 19; - break; - } - - return _context5.abrupt("return"); - - case 19: - _context5.next = 21; - return this.application.signOut(); - - case 21: - _context5.next = 23; - return this.application.restart(); - - case 23: - _context5.next = 25; - return this.application.setHost(server); - - case 25: - this.application.signIn({ - email: email, - password: password - }); - - case 26: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function handleAutoSignInFromParams() { - return _handleAutoSignInFromParams.apply(this, arguments); - } - - return handleAutoSignInFromParams; - }() - }]); - - return ApplicationViewCtrl; -}(_abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_16__["PureCtrl"]); - -var ApplicationView = function ApplicationView() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ApplicationView); - - this.template = _application_view_pug__WEBPACK_IMPORTED_MODULE_10___default.a; - this.controller = ApplicationViewCtrl; - this.replace = true; - this.controllerAs = 'self'; - this.bindToController = { - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/constants.js": -/*!*********************************************************!*\ - !*** ./app/assets/javascripts/controllers/constants.js ***! - \*********************************************************/ -/*! exports provided: PANEL_NAME_NOTES, PANEL_NAME_TAGS */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PANEL_NAME_NOTES", function() { return PANEL_NAME_NOTES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PANEL_NAME_TAGS", function() { return PANEL_NAME_TAGS; }); -var PANEL_NAME_NOTES = 'notes'; -var PANEL_NAME_TAGS = 'tags'; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/editor.js": -/*!******************************************************!*\ - !*** ./app/assets/javascripts/controllers/editor.js ***! - \******************************************************/ -/*! exports provided: EditorPanel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EditorPanel", function() { return EditorPanel; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var lodash_find__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash/find */ "./node_modules/lodash/find.js"); -/* harmony import */ var lodash_find__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(lodash_find__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/services/keyboardManager */ "./app/assets/javascripts/services/keyboardManager.js"); -/* harmony import */ var _editor_pug__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! %/editor.pug */ "./app/assets/templates/editor.pug"); -/* harmony import */ var _editor_pug__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_editor_pug__WEBPACK_IMPORTED_MODULE_15__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @/strings */ "./app/assets/javascripts/strings.js"); -/* harmony import */ var _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @/services/preferencesManager */ "./app/assets/javascripts/services/preferencesManager.js"); - - - - - - - - - - - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - - - - - - - - - - - -var NOTE_PREVIEW_CHAR_LIMIT = 80; -var MINIMUM_STATUS_DURATION = 400; -var SAVE_TIMEOUT_DEBOUNCE = 350; -var SAVE_TIMEOUT_NO_DEBOUNCE = 100; -var EDITOR_DEBOUNCE = 200; -var AppDataKeys = { - Pinned: 'pinned', - Locked: 'locked', - Archived: 'archived', - PrefersPlainEditor: 'prefersPlainEditor' -}; -var ElementIds = { - NoteTextEditor: 'note-text-editor', - NoteTitleEditor: 'note-title-editor', - EditorContent: 'editor-content', - NoteTagsComponentContainer: 'note-tags-component-container' -}; -var Fonts = { - DesktopMonospaceFamily: "Menlo,Consolas,'DejaVu Sans Mono',monospace", - WebMonospaceFamily: "monospace", - SansSerifFamily: "inherit" -}; - -var EditorCtrl = /*#__PURE__*/function (_PureCtrl) { - EditorCtrl.$inject = ["$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(EditorCtrl, _PureCtrl); - - /* @ngInject */ - function EditorCtrl($timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, EditorCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(EditorCtrl).call(this, $timeout)); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "editorMenuOnSelect", function (component) { - if (!component || component.area === 'editor-editor') { - /** If plain editor or other editor */ - _this.setMenuState('showEditorMenu', false); - - var editor = component; - - if (_this.state.selectedEditor && editor !== _this.state.selectedEditor) { - _this.disassociateComponentWithCurrentNote(_this.state.selectedEditor); - } - - if (editor) { - var prefersPlain = _this.state.note.getAppDataItem(AppDataKeys.PrefersPlainEditor) === true; - - if (prefersPlain) { - _this.state.note.setAppDataItem(AppDataKeys.PrefersPlainEditor, false); - - _this.application.setItemNeedsSync({ - item: _this.state.note - }); - } - - _this.associateComponentWithCurrentNote(editor); - } else { - /** Note prefers plain editor */ - if (!_this.state.note.getAppDataItem(AppDataKeys.PrefersPlainEditor)) { - _this.state.note.setAppDataItem(AppDataKeys.PrefersPlainEditor, true); - - _this.application.setItemNeedsSync({ - item: _this.state.note - }); - } - - _this.reloadFont(); - } - - _this.setState({ - selectedEditor: editor - }); - } else if (component.area === 'editor-stack') { - _this.toggleStackComponentForCurrentItem(component); - } - /** Dirtying can happen above */ - - - _this.application.sync(); - }); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "onPanelResizeFinish", function (width, left, isMaxWidth) { - if (isMaxWidth) { - _this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorWidth, null); - } else { - if (width !== undefined && width !== null) { - _this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorWidth, width); - - _this.leftPanelPuppet.setWidth(width); - } - } - - if (left !== undefined && left !== null) { - _this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorLeft, left); - - _this.rightPanelPuppet.setLeft(left); - } - - _this.application.getPrefsService().syncUserPreferences(); - }); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "onEditorLoad", function (editor) { - _this.application.getDesktopService().redoSearch(); - }); - - _this.leftPanelPuppet = { - onReady: function onReady() { - return _this.reloadPreferences(); - } - }; - _this.rightPanelPuppet = { - onReady: function onReady() { - return _this.reloadPreferences(); - } - }; - /** Used by .pug template */ - - _this.prefKeyMonospace = _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorMonospaceEnabled; - _this.prefKeySpellcheck = _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorSpellcheck; - _this.prefKeyMarginResizers = _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorResizersEnabled; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(EditorCtrl, [{ - key: "deinit", - value: function deinit() { - this.removeTabObserver(); - this.leftPanelPuppet = null; - this.rightPanelPuppet = null; - this.onEditorLoad = null; - this.unregisterComponent(); - this.unregisterComponent = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(EditorCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(EditorCtrl.prototype), "$onInit", this).call(this); - - this.registerKeyboardShortcuts(); - } - /** @override */ - - }, { - key: "getInitialState", - value: function getInitialState() { - return { - componentStack: [], - editorDebounce: EDITOR_DEBOUNCE, - isDesktop: Object(_utils__WEBPACK_IMPORTED_MODULE_13__["isDesktopApplication"])(), - spellcheck: true, - mutable: { - tagsString: '' - } - }; - } - }, { - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(EditorCtrl.prototype), "onAppLaunch", this).call(this); - - this.streamItems(); - this.registerComponentHandler(); - } - /** @override */ - - }, { - key: "onAppStateEvent", - value: function onAppStateEvent(eventName, data) { - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_17__["AppStateEvents"].NoteChanged) { - this.handleNoteSelectionChange(this.application.getAppState().getSelectedNote(), data.previousNote); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_17__["AppStateEvents"].PreferencesChanged) { - this.reloadPreferences(); - } - } - /** @override */ - - }, { - key: "onAppEvent", - value: function onAppEvent(eventName) { - if (!this.state.note) { - return; - } - - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].HighLatencySync) { - this.setState({ - syncTakingTooLong: true - }); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].CompletedSync) { - this.setState({ - syncTakingTooLong: false - }); - - if (this.state.note.dirty) { - /** if we're still dirty, don't change status, a sync is likely upcoming. */ - } else { - var saved = this.state.note.lastSyncEnd > this.state.note.lastSyncBegan; - var isInErrorState = this.state.saveError; - - if (isInErrorState || saved) { - this.showAllChangesSavedStatus(); - } - } - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].FailedSync) { - /** - * Only show error status in editor if the note is dirty. - * Otherwise, it means the originating sync came from somewhere else - * and we don't want to display an error here. - */ - if (this.state.note.dirty) { - this.showErrorStatus(); - } - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].LocalDatabaseWriteError) { - this.showErrorStatus({ - message: "Offline Saving Issue", - desc: "Changes not saved" - }); - } - } - /** - * Because note.locked accesses note.content.appData, - * we do not want to expose the template to direct access to note.locked, - * otherwise an exception will occur when trying to access note.locked if the note - * is deleted. There is potential for race conditions to occur with setState, where a - * previous setState call may have queued a digest cycle, and the digest cycle triggers - * on a deleted note. - */ - - }, { - key: "streamItems", - value: function streamItems() { - var _this2 = this; - - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Note, - stream: function () { - var _stream = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(_ref) { - var items, source, matchingNote; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - items = _ref.items, source = _ref.source; - - if (_this2.state.note) { - _context.next = 3; - break; - } - - return _context.abrupt("return"); - - case 3: - if (!_this2.state.note.deleted) { - _context.next = 7; - break; - } - - _context.next = 6; - return _this2.setState({ - note: null, - noteReady: false - }); - - case 6: - return _context.abrupt("return"); - - case 7: - if (!_this2.state.note.content.trashed) { - _context.next = 9; - break; - } - - return _context.abrupt("return"); - - case 9: - if (Object(snjs__WEBPACK_IMPORTED_MODULE_11__["isPayloadSourceRetrieved"])(source)) { - _context.next = 11; - break; - } - - return _context.abrupt("return"); - - case 11: - matchingNote = items.find(function (item) { - return item.uuid === _this2.state.note.uuid; - }); - - if (matchingNote) { - _context.next = 14; - break; - } - - return _context.abrupt("return"); - - case 14: - _this2.reloadTagsString(); - - case 15: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - function stream(_x) { - return _stream.apply(this, arguments); - } - - return stream; - }() - }); - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Tag, - stream: function () { - var _stream2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(_ref2) { - var items, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tag; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - items = _ref2.items; - - if (_this2.state.note) { - _context2.next = 3; - break; - } - - return _context2.abrupt("return"); - - case 3: - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context2.prev = 6; - _iterator = items[Symbol.iterator](); - - case 8: - if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { - _context2.next = 16; - break; - } - - tag = _step.value; - - if (!(!_this2.state.note.savedTagsString || tag.deleted || tag.hasRelationshipWithItem(_this2.state.note))) { - _context2.next = 13; - break; - } - - _this2.reloadTagsString(); - - return _context2.abrupt("break", 16); - - case 13: - _iteratorNormalCompletion = true; - _context2.next = 8; - break; - - case 16: - _context2.next = 22; - break; - - case 18: - _context2.prev = 18; - _context2.t0 = _context2["catch"](6); - _didIteratorError = true; - _iteratorError = _context2.t0; - - case 22: - _context2.prev = 22; - _context2.prev = 23; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 25: - _context2.prev = 25; - - if (!_didIteratorError) { - _context2.next = 28; - break; - } - - throw _iteratorError; - - case 28: - return _context2.finish(25); - - case 29: - return _context2.finish(22); - - case 30: - case "end": - return _context2.stop(); - } - } - }, _callee2, null, [[6, 18, 22, 30], [23,, 25, 29]]); - })); - - function stream(_x2) { - return _stream2.apply(this, arguments); - } - - return stream; - }() - }); - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Component, - stream: function () { - var _stream3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(_ref3) { - var items, editors, editor; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - items = _ref3.items; - - if (_this2.state.note) { - _context3.next = 3; - break; - } - - return _context3.abrupt("return"); - - case 3: - /** Reload componentStack in case new ones were added or removed */ - _this2.reloadComponentStackArray(); - /** Observe editor changes to see if the current note should update its editor */ - - - editors = items.filter(function (item) { - return item.isEditor(); - }); - - if (!(editors.length === 0)) { - _context3.next = 7; - break; - } - - return _context3.abrupt("return"); - - case 7: - /** Find the most recent editor for note */ - editor = _this2.editorForNote(_this2.state.note); - - _this2.setState({ - selectedEditor: editor - }); - - if (!editor) { - _this2.reloadFont(); - } - - case 10: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - function stream(_x3) { - return _stream3.apply(this, arguments); - } - - return stream; - }() - }); - } - }, { - key: "handleNoteSelectionChange", - value: function () { - var _handleNoteSelectionChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(note, previousNote) { - var associatedEditor; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - console.log("SN: handleNoteSelectionChange -> note", note); - console.log(this.application.itemsKeyManager.allItemsKeys); - this.setState({ - note: this.application.getAppState().getSelectedNote(), - showExtensions: false, - showOptionsMenu: false, - altKeyDown: false, - noteStatus: null - }); - - if (note) { - _context4.next = 6; - break; - } - - this.setState({ - noteReady: false - }); - return _context4.abrupt("return"); - - case 6: - associatedEditor = this.editorForNote(note); - - if (associatedEditor && associatedEditor !== this.state.selectedEditor) { - /** - * Setting note to not ready will remove the editor from view in a flash, - * so we only want to do this if switching between external editors - */ - this.setState({ - noteReady: false, - selectedEditor: associatedEditor - }); - } else if (!associatedEditor) { - /** No editor */ - this.setState({ - selectedEditor: null - }); - } - - _context4.next = 10; - return this.setState({ - noteReady: true - }); - - case 10: - this.reloadTagsString(); - this.reloadPreferences(); - - if (note.dummy) { - this.focusTitle(); - } - - if (previousNote && previousNote !== note) { - if (previousNote.dummy) { - this.performNoteDeletion(previousNote); - } - } - - this.reloadComponentContext(); - - case 15: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function handleNoteSelectionChange(_x4, _x5) { - return _handleNoteSelectionChange.apply(this, arguments); - } - - return handleNoteSelectionChange; - }() - }, { - key: "editorForNote", - value: function editorForNote(note) { - return this.application.componentManager.editorForNote(note); - } - }, { - key: "setMenuState", - value: function setMenuState(menu, state) { - this.setState(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()({}, menu, state)); - this.closeAllMenus({ - exclude: menu - }); - } - }, { - key: "toggleMenu", - value: function toggleMenu(menu) { - this.setMenuState(menu, !this.state[menu]); - } - }, { - key: "closeAllMenus", - value: function closeAllMenus() { - var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - exclude = _ref4.exclude; - - var allMenus = ['showOptionsMenu', 'showEditorMenu', 'showExtensions', 'showSessionHistory']; - var menuState = {}; - - for (var _i = 0, _allMenus = allMenus; _i < _allMenus.length; _i++) { - var candidate = _allMenus[_i]; - - if (candidate !== exclude) { - menuState[candidate] = false; - } - } - - this.setState(menuState); - } - }, { - key: "hasAvailableExtensions", - value: function hasAvailableExtensions() { - return this.application.actionsManager.extensionsInContextOfItem(this.state.note).length > 0; - } - }, { - key: "performFirefoxPinnedTabFix", - value: function performFirefoxPinnedTabFix() { - /** - * For Firefox pinned tab issue: - * When a new browser session is started, and SN is in a pinned tab, - * SN is unusable until the tab is reloaded. - */ - if (document.hidden) { - window.location.reload(); - } - } - }, { - key: "saveNote", - value: function saveNote(_ref5) { - var _this3 = this; - - var bypassDebouncer = _ref5.bypassDebouncer, - updateClientModified = _ref5.updateClientModified, - dontUpdatePreviews = _ref5.dontUpdatePreviews; - this.performFirefoxPinnedTabFix(); - var note = this.state.note; - note.dummy = false; - - if (note.deleted) { - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_18__["STRING_DELETED_NOTE"] - }); - return; - } - - if (!this.application.findItem({ - uuid: note.uuid - })) { - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_18__["STRING_INVALID_NOTE"] - }); - return; - } - - this.showSavingStatus(); - - if (!dontUpdatePreviews) { - var text = note.text || ''; - var truncate = text.length > NOTE_PREVIEW_CHAR_LIMIT; - var substring = text.substring(0, NOTE_PREVIEW_CHAR_LIMIT); - var previewPlain = substring + (truncate ? _strings__WEBPACK_IMPORTED_MODULE_18__["STRING_ELLIPSES"] : ''); - note.content.preview_plain = previewPlain; - note.content.preview_html = null; - } - - this.application.setItemNeedsSync({ - item: note, - updateUserModifiedDate: updateClientModified - }); - - if (this.saveTimeout) { - this.$timeout.cancel(this.saveTimeout); - } - - var noDebounce = bypassDebouncer || this.application.noAccount(); - var syncDebouceMs = noDebounce ? SAVE_TIMEOUT_NO_DEBOUNCE : SAVE_TIMEOUT_DEBOUNCE; - this.saveTimeout = this.$timeout(function () { - _this3.application.sync(); - }, syncDebouceMs); - } - }, { - key: "showSavingStatus", - value: function showSavingStatus() { - this.setStatus({ - message: "Saving..." - }, false); - } - }, { - key: "showAllChangesSavedStatus", - value: function showAllChangesSavedStatus() { - this.setState({ - saveError: false, - syncTakingTooLong: false - }); - this.setStatus({ - message: 'All changes saved' - }); - } - }, { - key: "showErrorStatus", - value: function showErrorStatus(error) { - if (!error) { - error = { - message: "Sync Unreachable", - desc: "Changes saved offline" - }; - } - - this.setState({ - saveError: true, - syncTakingTooLong: false - }); - this.setStatus(error); - } - }, { - key: "setStatus", - value: function setStatus(status) { - var _this4 = this; - - var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var waitForMs; - - if (!this.state.noteStatus || !this.state.noteStatus.date) { - waitForMs = 0; - } else { - waitForMs = MINIMUM_STATUS_DURATION - (new Date() - this.state.noteStatus.date); - } - - if (!wait || waitForMs < 0) { - waitForMs = 0; - } - - if (this.statusTimeout) { - this.$timeout.cancel(this.statusTimeout); - } - - this.statusTimeout = this.$timeout(function () { - status.date = new Date(); - - _this4.setState({ - noteStatus: status - }); - }, waitForMs); - } - }, { - key: "contentChanged", - value: function contentChanged() { - this.saveNote({ - updateClientModified: true - }); - } - }, { - key: "onTitleEnter", - value: function onTitleEnter($event) { - $event.target.blur(); - this.onTitleChange(); - this.focusEditor(); - } - }, { - key: "onTitleChange", - value: function onTitleChange() { - this.saveNote({ - dontUpdatePreviews: true, - updateClientModified: true - }); - } - }, { - key: "focusEditor", - value: function focusEditor() { - var element = document.getElementById(ElementIds.NoteTextEditor); - - if (element) { - this.lastEditorFocusEventSource = _services_state__WEBPACK_IMPORTED_MODULE_17__["EventSources"].Script; - element.focus(); - } - } - }, { - key: "focusTitle", - value: function focusTitle() { - document.getElementById(ElementIds.NoteTitleEditor).focus(); - } - }, { - key: "clickedTextArea", - value: function clickedTextArea() { - this.setMenuState('showOptionsMenu', false); - } - }, { - key: "onNameFocus", - value: function onNameFocus() { - this.editingName = true; - } - }, { - key: "onContentFocus", - value: function onContentFocus() { - this.application.getAppState().editorDidFocus(this.lastEditorFocusEventSource); - this.lastEditorFocusEventSource = null; - } - }, { - key: "onNameBlur", - value: function onNameBlur() { - this.editingName = false; - } - }, { - key: "selectedMenuItem", - value: function selectedMenuItem(hide) { - if (hide) { - this.setMenuState('showOptionsMenu', false); - } - } - }, { - key: "deleteNote", - value: function () { - var _deleteNote = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(permanently) { - var _this5 = this; - - var run, requiresPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - if (!this.state.note.dummy) { - _context5.next = 3; - break; - } - - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_18__["STRING_DELETE_PLACEHOLDER_ATTEMPT"] - }); - return _context5.abrupt("return"); - - case 3: - run = function run() { - if (_this5.state.note.locked) { - _this5.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_18__["STRING_DELETE_LOCKED_ATTEMPT"] - }); - - return; - } - - var title = _this5.state.note.safeTitle().length ? "'".concat(_this5.state.note.title, "'") : "this note"; - var text = Object(_strings__WEBPACK_IMPORTED_MODULE_18__["StringDeleteNote"])({ - title: title, - permanently: permanently - }); - - _this5.application.alertService.confirm({ - text: text, - destructive: true, - onConfirm: function onConfirm() { - if (permanently) { - _this5.performNoteDeletion(_this5.state.note); - } else { - _this5.state.note.content.trashed = true; - - _this5.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - } - - _this5.application.getAppState().setSelectedNote(null); - - _this5.setMenuState('showOptionsMenu', false); - } - }); - }; - - _context5.next = 6; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].DeleteNote); - - case 6: - requiresPrivilege = _context5.sent; - - if (requiresPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].DeleteNote, function () { - run(); - }); - } else { - run(); - } - - case 8: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function deleteNote(_x6) { - return _deleteNote.apply(this, arguments); - } - - return deleteNote; - }() - }, { - key: "performNoteDeletion", - value: function performNoteDeletion(note) { - this.application.deleteItem({ - item: note - }); - - if (note === this.state.note) { - this.setState({ - note: null - }); - } - - if (note.dummy) { - this.application.deleteItemLocally({ - item: note - }); - return; - } - - this.application.sync(); - } - }, { - key: "restoreTrashedNote", - value: function restoreTrashedNote() { - this.state.note.content.trashed = false; - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - this.application.getAppState().setSelectedNote(null); - } - }, { - key: "deleteNotePermanantely", - value: function deleteNotePermanantely() { - this.deleteNote(true); - } - }, { - key: "getTrashCount", - value: function getTrashCount() { - return this.application.getTrashedItems().length; - } - }, { - key: "emptyTrash", - value: function emptyTrash() { - var _this6 = this; - - var count = this.getTrashCount(); - this.application.alertService.confirm({ - text: Object(_strings__WEBPACK_IMPORTED_MODULE_18__["StringEmptyTrash"])({ - count: count - }), - destructive: true, - onConfirm: function onConfirm() { - _this6.application.emptyTrash(); - - _this6.application.sync(); - } - }); - } - }, { - key: "togglePin", - value: function togglePin() { - this.state.note.setAppDataItem(AppDataKeys.Pinned, !this.state.note.pinned); - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - } - }, { - key: "toggleLockNote", - value: function toggleLockNote() { - this.state.note.setAppDataItem(AppDataKeys.Locked, !this.state.note.locked); - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - } - }, { - key: "toggleProtectNote", - value: function toggleProtectNote() { - var _this7 = this; - - this.state.note.content.protected = !this.state.note.content.protected; - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - /** Show privileges manager if protection is not yet set up */ - - this.application.privilegesService.actionHasPrivilegesConfigured(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ViewProtectedNotes).then(function (configured) { - if (!configured) { - _this7.application.presentPrivilegesManagementModal(); - } - }); - } - }, { - key: "toggleNotePreview", - value: function toggleNotePreview() { - this.state.note.content.hidePreview = !this.state.note.content.hidePreview; - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - } - }, { - key: "toggleArchiveNote", - value: function toggleArchiveNote() { - this.state.note.setAppDataItem(AppDataKeys.Archived, !this.state.note.archived); - this.saveNote({ - bypassDebouncer: true, - dontUpdatePreviews: true - }); - } - }, { - key: "reloadTagsString", - value: function reloadTagsString() { - this.setState({ - mutable: _objectSpread({}, this.state.mutable, { - tagsString: this.state.note.tagsString() - }) - }); - } - }, { - key: "addTag", - value: function addTag(tag) { - var strings = this.state.note.tags.map(function (currentTag) { - return currentTag.title; - }); - strings.push(tag.title); - this.saveTags({ - strings: strings - }); - } - }, { - key: "removeTag", - value: function removeTag(tag) { - var strings = this.state.note.tags.map(function (currentTag) { - return currentTag.title; - }).filter(function (title) { - return title !== tag.title; - }); - this.saveTags({ - strings: strings - }); - } - }, { - key: "saveTags", - value: function () { - var _saveTags = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6() { - var _ref6, - strings, - toRemove, - _iteratorNormalCompletion2, - _didIteratorError2, - _iteratorError2, - _iterator2, - _step2, - tag, - _i2, - _toRemove, - tagToRemove, - tags, - _iteratorNormalCompletion3, - _didIteratorError3, - _iteratorError3, - _iterator3, - _step3, - tagString, - existingRelationship, - _i3, - _tags, - _tag, - _args6 = arguments; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - _ref6 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, strings = _ref6.strings; - - if (!(!strings && this.state.mutable.tagsString === this.state.note.tagsString())) { - _context6.next = 3; - break; - } - - return _context6.abrupt("return"); - - case 3: - if (!strings) { - strings = this.state.mutable.tagsString.split('#').filter(function (string) { - return string.length > 0; - }).map(function (string) { - return string.trim(); - }); - } - - this.state.note.dummy = false; - toRemove = []; - _iteratorNormalCompletion2 = true; - _didIteratorError2 = false; - _iteratorError2 = undefined; - _context6.prev = 9; - - for (_iterator2 = this.state.note.tags[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - tag = _step2.value; - - if (strings.indexOf(tag.title) === -1) { - toRemove.push(tag); - } - } - - _context6.next = 17; - break; - - case 13: - _context6.prev = 13; - _context6.t0 = _context6["catch"](9); - _didIteratorError2 = true; - _iteratorError2 = _context6.t0; - - case 17: - _context6.prev = 17; - _context6.prev = 18; - - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - - case 20: - _context6.prev = 20; - - if (!_didIteratorError2) { - _context6.next = 23; - break; - } - - throw _iteratorError2; - - case 23: - return _context6.finish(20); - - case 24: - return _context6.finish(17); - - case 25: - for (_i2 = 0, _toRemove = toRemove; _i2 < _toRemove.length; _i2++) { - tagToRemove = _toRemove[_i2]; - tagToRemove.removeItemAsRelationship(this.state.note); - } - - this.application.setItemsNeedsSync({ - items: toRemove - }); - tags = []; - _iteratorNormalCompletion3 = true; - _didIteratorError3 = false; - _iteratorError3 = undefined; - _context6.prev = 31; - _iterator3 = strings[Symbol.iterator](); - - case 33: - if (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done) { - _context6.next = 45; - break; - } - - tagString = _step3.value; - existingRelationship = lodash_find__WEBPACK_IMPORTED_MODULE_12___default()(this.state.note.tags, { - title: tagString - }); - - if (existingRelationship) { - _context6.next = 42; - break; - } - - _context6.t1 = tags; - _context6.next = 40; - return this.application.findOrCreateTag({ - title: tagString - }); - - case 40: - _context6.t2 = _context6.sent; - - _context6.t1.push.call(_context6.t1, _context6.t2); - - case 42: - _iteratorNormalCompletion3 = true; - _context6.next = 33; - break; - - case 45: - _context6.next = 51; - break; - - case 47: - _context6.prev = 47; - _context6.t3 = _context6["catch"](31); - _didIteratorError3 = true; - _iteratorError3 = _context6.t3; - - case 51: - _context6.prev = 51; - _context6.prev = 52; - - if (!_iteratorNormalCompletion3 && _iterator3.return != null) { - _iterator3.return(); - } - - case 54: - _context6.prev = 54; - - if (!_didIteratorError3) { - _context6.next = 57; - break; - } - - throw _iteratorError3; - - case 57: - return _context6.finish(54); - - case 58: - return _context6.finish(51); - - case 59: - for (_i3 = 0, _tags = tags; _i3 < _tags.length; _i3++) { - _tag = _tags[_i3]; - - _tag.addItemAsRelationship(this.state.note); - } - - this.application.saveItems({ - items: tags - }); - this.reloadTagsString(); - - case 62: - case "end": - return _context6.stop(); - } - } - }, _callee6, this, [[9, 13, 17, 25], [18,, 20, 24], [31, 47, 51, 59], [52,, 54, 58]]); - })); - - function saveTags() { - return _saveTags.apply(this, arguments); - } - - return saveTags; - }() - }, { - key: "reloadPreferences", - value: function reloadPreferences() { - var monospaceEnabled = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorMonospaceEnabled, true); - var spellcheck = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorSpellcheck, true); - var marginResizersEnabled = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorResizersEnabled, true); - this.setState({ - monospaceEnabled: monospaceEnabled, - spellcheck: spellcheck, - marginResizersEnabled: marginResizersEnabled - }); - - if (!document.getElementById(ElementIds.EditorContent)) { - /** Elements have not yet loaded due to ng-if around wrapper */ - return; - } - - this.reloadFont(); - - if (this.state.marginResizersEnabled && this.leftPanelPuppet.ready && this.rightPanelPuppet.ready) { - var width = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorWidth, null); - - if (width != null) { - this.leftPanelPuppet.setWidth(width); - this.rightPanelPuppet.setWidth(width); - } - - var left = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorLeft, null); - - if (left != null) { - this.leftPanelPuppet.setLeft(left); - this.rightPanelPuppet.setLeft(left); - } - } - } - }, { - key: "reloadFont", - value: function reloadFont() { - var editor = document.getElementById(ElementIds.NoteTextEditor); - - if (!editor) { - return; - } - - if (this.state.monospaceEnabled) { - if (this.state.isDesktop) { - editor.style.fontFamily = Fonts.DesktopMonospaceFamily; - } else { - editor.style.fontFamily = Fonts.WebMonospaceFamily; - } - } else { - editor.style.fontFamily = Fonts.SansSerifFamily; - } - } - }, { - key: "toggleKey", - value: function () { - var _toggleKey = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(key) { - var _this8 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - this[key] = !this[key]; - this.application.getPrefsService().setUserPrefValue(key, this[key], true); - this.reloadFont(); - - if (!(key === _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorSpellcheck)) { - _context7.next = 10; - break; - } - - _context7.next = 6; - return this.setState({ - noteReady: false - }); - - case 6: - this.setState({ - noteReady: true - }); - this.reloadFont(); - _context7.next = 11; - break; - - case 10: - if (key === _services_preferencesManager__WEBPACK_IMPORTED_MODULE_19__["PrefKeys"].EditorResizersEnabled && this[key] === true) { - this.$timeout(function () { - _this8.leftPanelPuppet.flash(); - - _this8.rightPanelPuppet.flash(); - }); - } - - case 11: - case "end": - return _context7.stop(); - } - } - }, _callee7, this); - })); - - function toggleKey(_x7) { - return _toggleKey.apply(this, arguments); - } - - return toggleKey; - }() - /** @components */ - - }, { - key: "registerComponentHandler", - value: function registerComponentHandler() { - var _this9 = this; - - this.unregisterComponent = this.application.componentManager.registerHandler({ - identifier: 'editor', - areas: ['note-tags', 'editor-stack', 'editor-editor'], - activationHandler: function activationHandler(component) { - if (component.area === 'note-tags') { - _this9.setState({ - tagsComponent: component.active ? component : null - }); - } else if (component.area === 'editor-editor') { - if (component === _this9.state.selectedEditor && !component.active) { - _this9.setState({ - selectedEditor: null - }); - } else if (_this9.state.selectedEditor) { - if (_this9.state.selectedEditor.active && _this9.state.note) { - if (component.isExplicitlyEnabledForItem(_this9.state.note) && !_this9.state.selectedEditor.isExplicitlyEnabledForItem(_this9.state.note)) { - _this9.setState({ - selectedEditor: component - }); - } - } - } else if (_this9.state.note) { - var enableable = component.isExplicitlyEnabledForItem(_this9.state.note) || component.isDefaultEditor(); - - if (component.active && enableable) { - _this9.setState({ - selectedEditor: component - }); - } else { - /** - * Not a candidate, and no qualified editor. - * Disable the current editor. - */ - _this9.setState({ - selectedEditor: null - }); - } - } - } else if (component.area === 'editor-stack') { - _this9.reloadComponentContext(); - } - }, - contextRequestHandler: function contextRequestHandler(component) { - if (component === _this9.state.selectedEditor || component === _this9.state.tagsComponent || _this9.state.componentStack.includes(component)) { - return _this9.state.note; - } - }, - focusHandler: function focusHandler(component, focused) { - if (component.isEditor() && focused) { - _this9.closeAllMenus(); - } - }, - actionHandler: function actionHandler(component, action, data) { - if (action === 'set-size') { - var setSize = function setSize(element, size) { - var widthString = typeof size.width === 'string' ? size.width : "".concat(data.width, "px"); - var heightString = typeof size.height === 'string' ? size.height : "".concat(data.height, "px"); - element.setAttribute('style', "width: ".concat(widthString, "; height: ").concat(heightString, ";")); - }; - - if (data.type === 'container') { - if (component.area === 'note-tags') { - var container = document.getElementById(ElementIds.NoteTagsComponentContainer); - setSize(container, data); - } - } - } else if (action === 'associate-item') { - if (data.item.content_type === 'Tag') { - var tag = _this9.application.findItem({ - uuid: data.item.uuid - }); - - _this9.addTag(tag); - } - } else if (action === 'deassociate-item') { - var _tag2 = _this9.application.findItem({ - uuid: data.item.uuid - }); - - _this9.removeTag(_tag2); - } else if (action === 'save-items') { - var includesNote = data.items.map(function (item) { - return item.uuid; - }).includes(_this9.state.note.uuid); - - if (includesNote) { - _this9.showSavingStatus(); - } - } - } - }); - } - }, { - key: "reloadComponentStackArray", - value: function reloadComponentStackArray() { - var components = this.application.componentManager.componentsForArea('editor-stack').sort(function (a, b) { - return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; - }); - this.setState({ - componentStack: components - }); - } - }, { - key: "reloadComponentContext", - value: function reloadComponentContext() { - this.reloadComponentStackArray(); - - if (this.state.note) { - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; - - try { - for (var _iterator4 = this.state.componentStack[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - var component = _step4.value; - - if (component.active) { - this.application.componentManager.setComponentHidden(component, !component.isExplicitlyEnabledForItem(this.state.note)); - } - } - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return != null) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } - } - - this.application.componentManager.contextItemDidChangeInArea('note-tags'); - this.application.componentManager.contextItemDidChangeInArea('editor-stack'); - this.application.componentManager.contextItemDidChangeInArea('editor-editor'); - } - }, { - key: "toggleStackComponentForCurrentItem", - value: function toggleStackComponentForCurrentItem(component) { - if (component.hidden || !component.active) { - this.application.componentManager.setComponentHidden(component, false); - this.associateComponentWithCurrentNote(component); - - if (!component.active) { - this.application.componentManager.activateComponent(component); - } - - this.application.componentManager.contextItemDidChangeInArea('editor-stack'); - } else { - this.application.componentManager.setComponentHidden(component, true); - this.disassociateComponentWithCurrentNote(component); - } - } - }, { - key: "disassociateComponentWithCurrentNote", - value: function disassociateComponentWithCurrentNote(component) { - var _this10 = this; - - component.associatedItemIds = component.associatedItemIds.filter(function (id) { - return id !== _this10.state.note.uuid; - }); - - if (!component.disassociatedItemIds.includes(this.state.note.uuid)) { - component.disassociatedItemIds.push(this.state.note.uuid); - } - - this.application.saveItem({ - item: component - }); - } - }, { - key: "associateComponentWithCurrentNote", - value: function associateComponentWithCurrentNote(component) { - var _this11 = this; - - component.disassociatedItemIds = component.disassociatedItemIds.filter(function (id) { - return id !== _this11.state.note.uuid; - }); - - if (!component.associatedItemIds.includes(this.state.note.uuid)) { - component.associatedItemIds.push(this.state.note.uuid); - } - - this.application.saveItem({ - item: component - }); - } - }, { - key: "registerKeyboardShortcuts", - value: function registerKeyboardShortcuts() { - var _this12 = this; - - this.altKeyObserver = this.application.getKeyboardService().addKeyObserver({ - modifiers: [_services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardModifiers"].Alt], - onKeyDown: function onKeyDown() { - _this12.setState({ - altKeyDown: true - }); - }, - onKeyUp: function onKeyUp() { - _this12.setState({ - altKeyDown: false - }); - } - }); - this.trashKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardKeys"].Backspace, - notElementIds: [ElementIds.NoteTextEditor, ElementIds.NoteTitleEditor], - modifiers: [_services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardModifiers"].Meta], - onKeyDown: function onKeyDown() { - _this12.deleteNote(); - } - }); - this.deleteKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardKeys"].Backspace, - modifiers: [_services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardModifiers"].Meta, _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardModifiers"].Shift, _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardModifiers"].Alt], - onKeyDown: function onKeyDown(event) { - event.preventDefault(); - - _this12.deleteNote(true); - } - }); - } - }, { - key: "onSystemEditorLoad", - value: function onSystemEditorLoad() { - var _this13 = this; - - if (this.tabObserver) { - return; - } - /** - * Insert 4 spaces when a tab key is pressed, - * only used when inside of the text editor. - * If the shift key is pressed first, this event is - * not fired. - */ - - - var editor = document.getElementById(ElementIds.NoteTextEditor); - this.tabObserver = this.application.getKeyboardService().addKeyObserver({ - element: editor, - key: _services_keyboardManager__WEBPACK_IMPORTED_MODULE_14__["KeyboardKeys"].Tab, - onKeyDown: function onKeyDown(event) { - if (_this13.state.note.locked || event.shiftKey) { - return; - } - - event.preventDefault(); - /** Using document.execCommand gives us undo support */ - - var insertSuccessful = document.execCommand('insertText', false, '\t'); - - if (!insertSuccessful) { - /** document.execCommand works great on Chrome/Safari but not Firefox */ - var start = editor.selectionStart; - var end = editor.selectionEnd; - var spaces = ' '; - /** Insert 4 spaces */ - - editor.value = editor.value.substring(0, start) + spaces + editor.value.substring(end); - /** Place cursor 4 spaces away from where the tab key was pressed */ - - editor.selectionStart = editor.selectionEnd = start + 4; - } - - var note = _this13.state.note; - note.text = editor.value; - - _this13.setState({ - note: note - }); - - _this13.saveNote({ - bypassDebouncer: true - }); - } - }); - /** - * Handles when the editor is destroyed, - * (and not when our controller is destroyed.) - */ - - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(editor).one('$destroy', function () { - _this13.removeTabObserver(); - }); - } - }, { - key: "removeTabObserver", - value: function removeTabObserver() { - if (!this.application) { - return; - } - - var keyboardService = this.application.getKeyboardService(); - - if (this.tabObserver && keyboardService) { - keyboardService.removeKeyObserver(this.tabObserver); - this.tabObserver = null; - } - } - }, { - key: "noteLocked", - get: function get() { - if (!this.state.note || this.state.note.deleted) { - return false; - } - - return this.state.note.locked; - } - }]); - - return EditorCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_16__["PureCtrl"]); - -var EditorPanel = function EditorPanel() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, EditorPanel); - - this.restrict = 'E'; - this.scope = { - application: '=' - }; - this.template = _editor_pug__WEBPACK_IMPORTED_MODULE_15___default.a; - this.replace = true; - this.controller = EditorCtrl; - this.controllerAs = 'self'; - this.bindToController = true; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/footer.js": -/*!******************************************************!*\ - !*** ./app/assets/javascripts/controllers/footer.js ***! - \******************************************************/ -/*! exports provided: Footer */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Footer", function() { return Footer; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _footer_pug__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! %/footer.pug */ "./app/assets/templates/footer.pug"); -/* harmony import */ var _footer_pug__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_footer_pug__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/strings */ "./app/assets/javascripts/strings.js"); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - - - - - - - - -var FooterCtrl = /*#__PURE__*/function (_PureCtrl) { - FooterCtrl.$inject = ["$rootScope", "$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(FooterCtrl, _PureCtrl); - - /* @ngInject */ - function FooterCtrl($rootScope, $timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, FooterCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(FooterCtrl).call(this, $timeout)); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "toggleSyncResolutionMenu", function () { - _this.showSyncResolution = !_this.showSyncResolution; - }); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "closeAccountMenu", function () { - _this.showAccountMenu = false; - }); - - _this.$rootScope = $rootScope; - _this.rooms = []; - _this.themesWithIcons = []; - _this.showSyncResolution = false; - - _this.addRootScopeListeners(); - - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(FooterCtrl, [{ - key: "deinit", - value: function deinit() { - this.rooms.length = 0; - this.themesWithIcons.length = 0; - this.unregisterComponent(); - this.unregisterComponent = null; - this.rootScopeListener1(); - this.rootScopeListener2(); - this.rootScopeListener1 = null; - this.rootScopeListener2 = null; - this.closeAccountMenu = null; - this.toggleSyncResolutionMenu = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(FooterCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "$onInit", - value: function $onInit() { - var _this2 = this; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(FooterCtrl.prototype), "$onInit", this).call(this); - - this.application.getStatusService().addStatusObserver(function (string) { - _this2.$timeout(function () { - _this2.arbitraryStatusMessage = string; - }); - }); - } - }, { - key: "getInitialState", - value: function getInitialState() { - return { - hasPasscode: false - }; - } - }, { - key: "reloadUpgradeStatus", - value: function reloadUpgradeStatus() { - var _this3 = this; - - this.application.checkForSecurityUpdate().then(function (available) { - _this3.setState({ - dataUpgradeAvailable: available - }); - }); - } - }, { - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(FooterCtrl.prototype), "onAppLaunch", this).call(this); - - this.reloadPasscodeStatus(); - this.reloadUpgradeStatus(); - this.user = this.application.getUser(); - this.updateOfflineStatus(); - this.findErrors(); - this.streamItems(); - this.registerComponentHandler(); - } - }, { - key: "reloadPasscodeStatus", - value: function () { - var _reloadPasscodeStatus = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var hasPasscode; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - hasPasscode = this.application.hasPasscode(); - this.setState({ - hasPasscode: hasPasscode - }); - - case 2: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function reloadPasscodeStatus() { - return _reloadPasscodeStatus.apply(this, arguments); - } - - return reloadPasscodeStatus; - }() - }, { - key: "addRootScopeListeners", - value: function addRootScopeListeners() { - var _this4 = this; - - this.rootScopeListener1 = this.$rootScope.$on("reload-ext-data", function () { - _this4.reloadExtendedData(); - }); - this.rootScopeListener2 = this.$rootScope.$on("new-update-available", function () { - _this4.$timeout(function () { - _this4.onNewUpdateAvailable(); - }); - }); - } - /** @override */ - - }, { - key: "onAppStateEvent", - value: function onAppStateEvent(eventName, data) { - var _this5 = this; - - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_13__["AppStateEvents"].EditorFocused) { - if (data.eventSource === _services_state__WEBPACK_IMPORTED_MODULE_13__["EventSources"].UserInteraction) { - this.closeAllRooms(); - this.closeAccountMenu(); - } - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_13__["AppStateEvents"].BeganBackupDownload) { - this.backupStatus = this.application.getStatusService().addStatusFromString("Saving local backup..."); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_13__["AppStateEvents"].EndedBackupDownload) { - if (data.success) { - this.backupStatus = this.application.getStatusService().replaceStatusWithString(this.backupStatus, "Successfully saved backup."); - } else { - this.backupStatus = this.application.getStatusService().replaceStatusWithString(this.backupStatus, "Unable to save local backup."); - } - - this.$timeout(function () { - _this5.backupStatus = _this5.application.getStatusService().removeStatus(_this5.backupStatus); - }, 2000); - } - } - /** @override */ - - }, { - key: "onAppKeyChange", - value: function () { - var _onAppKeyChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(FooterCtrl.prototype), "onAppKeyChange", this).call(this); - - this.reloadPasscodeStatus(); - - case 2: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function onAppKeyChange() { - return _onAppKeyChange.apply(this, arguments); - } - - return onAppKeyChange; - }() - /** @override */ - - }, { - key: "onAppEvent", - value: function onAppEvent(eventName) { - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].KeyStatusChanged) { - this.reloadUpgradeStatus(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].EnteredOutOfSync) { - this.setState({ - outOfSync: true - }); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].ExitedOutOfSync) { - this.setState({ - outOfSync: false - }); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].CompletedSync) { - if (this.offline && this.application.getNoteCount() === 0) { - this.showAccountMenu = true; - } - - this.syncUpdated(); - this.findErrors(); - this.updateOfflineStatus(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_11__["ApplicationEvents"].FailedSync) { - this.findErrors(); - this.updateOfflineStatus(); - } - } - }, { - key: "streamItems", - value: function streamItems() { - var _this6 = this; - - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Component, - stream: function () { - var _stream = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _this6.rooms = _this6.application.getItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Component - }).filter(function (candidate) { - return candidate.area === 'rooms' && !candidate.deleted; - }); - - if (_this6.queueExtReload) { - _this6.queueExtReload = false; - - _this6.reloadExtendedData(); - } - - case 2: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - function stream() { - return _stream.apply(this, arguments); - } - - return stream; - }() - }); - this.application.streamItems({ - contentType: 'SN|Theme', - stream: function () { - var _stream2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - var themes, differ; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - themes = _this6.application.getDisplayableItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_11__["ContentTypes"].Theme - }).filter(function (candidate) { - return !candidate.deleted && candidate.content.package_info && candidate.content.package_info.dock_icon; - }).sort(function (a, b) { - return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; - }); - differ = themes.length !== _this6.themesWithIcons.length; - _this6.themesWithIcons = themes; - - if (differ) { - _this6.reloadDockShortcuts(); - } - - case 4: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - - function stream() { - return _stream2.apply(this, arguments); - } - - return stream; - }() - }); - } - }, { - key: "registerComponentHandler", - value: function registerComponentHandler() { - var _this7 = this; - - this.unregisterComponent = this.application.componentManager.registerHandler({ - identifier: "roomBar", - areas: ["rooms", "modal"], - activationHandler: function activationHandler(component) {}, - actionHandler: function actionHandler(component, action, data) { - if (action === "set-size") { - component.setLastSize(data); - } - }, - focusHandler: function focusHandler(component, focused) { - if (component.isEditor() && focused) { - _this7.closeAllRooms(); - - _this7.closeAccountMenu(); - } - } - }); - } - }, { - key: "reloadExtendedData", - value: function reloadExtendedData() { - var _this8 = this; - - if (this.reloadInProgress) { - return; - } - - this.reloadInProgress = true; - /** - * A reload consists of opening the extensions manager, - * then closing it after a short delay. - */ - - var extWindow = this.rooms.find(function (room) { - return room.package_info.identifier === _this8.application.getNativeExtService().extManagerId; - }); - - if (!extWindow) { - this.queueExtReload = true; - this.reloadInProgress = false; - return; - } - - this.selectRoom(extWindow); - this.$timeout(function () { - _this8.selectRoom(extWindow); - - _this8.reloadInProgress = false; - - _this8.$rootScope.$broadcast('ext-reload-complete'); - }, 2000); - } - }, { - key: "updateOfflineStatus", - value: function updateOfflineStatus() { - this.offline = this.application.noAccount(); - } - }, { - key: "openSecurityUpdate", - value: function openSecurityUpdate() { - this.application.performProtocolUpgrade(); - } - }, { - key: "findErrors", - value: function findErrors() { - this.error = this.application.getSyncStatus().error; - } - }, { - key: "accountMenuPressed", - value: function accountMenuPressed() { - this.showAccountMenu = !this.showAccountMenu; - this.closeAllRooms(); - } - }, { - key: "lockApp", - value: function lockApp() { - this.application.lock(); - } - }, { - key: "refreshData", - value: function refreshData() { - var _this9 = this; - - this.isRefreshing = true; - this.application.sync({ - timingStrategy: snjs__WEBPACK_IMPORTED_MODULE_11__["TIMING_STRATEGY_FORCE_SPAWN_NEW"], - checkIntegrity: true - }).then(function (response) { - _this9.$timeout(function () { - _this9.isRefreshing = false; - }, 200); - - if (response && response.error) { - _this9.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_14__["STRING_GENERIC_SYNC_ERROR"] - }); - } else { - _this9.syncUpdated(); - } - }); - } - }, { - key: "syncUpdated", - value: function syncUpdated() { - this.lastSyncDate = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["dateToLocalizedString"])(this.application.getLastSyncDate()); - } - }, { - key: "onNewUpdateAvailable", - value: function onNewUpdateAvailable() { - this.newUpdateAvailable = true; - } - }, { - key: "clickedNewUpdateAnnouncement", - value: function clickedNewUpdateAnnouncement() { - this.newUpdateAvailable = false; - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_14__["STRING_NEW_UPDATE_READY"] - }); - } - }, { - key: "reloadDockShortcuts", - value: function reloadDockShortcuts() { - var shortcuts = []; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.themesWithIcons[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var theme = _step.value; - var name = theme.content.package_info.name; - var icon = theme.content.package_info.dock_icon; - - if (!icon) { - continue; - } - - shortcuts.push({ - name: name, - component: theme, - icon: icon - }); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.dockShortcuts = shortcuts.sort(function (a, b) { - /** Circles first, then images */ - var aType = a.icon.type; - var bType = b.icon.type; - - if (aType === bType) { - return 0; - } else if (aType === 'circle' && bType === 'svg') { - return -1; - } else if (bType === 'circle' && aType === 'svg') { - return 1; - } - }); - } - }, { - key: "initSvgForShortcut", - value: function initSvgForShortcut(shortcut) { - var id = 'dock-svg-' + shortcut.component.uuid; - var element = document.getElementById(id); - var parser = new DOMParser(); - var svg = shortcut.component.content.package_info.dock_icon.source; - var doc = parser.parseFromString(svg, 'image/svg+xml'); - element.appendChild(doc.documentElement); - } - }, { - key: "selectShortcut", - value: function selectShortcut(shortcut) { - this.application.componentManager.toggleComponent(shortcut.component); - } - }, { - key: "onRoomDismiss", - value: function onRoomDismiss(room) { - room.showRoom = false; - } - }, { - key: "closeAllRooms", - value: function closeAllRooms() { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.rooms[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var room = _step2.value; - room.showRoom = false; - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } - }, { - key: "selectRoom", - value: function () { - var _selectRoom = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(room) { - var _this10 = this; - - var run, requiresPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - run = function run() { - _this10.$timeout(function () { - room.showRoom = !room.showRoom; - }); - }; - - if (room.showRoom) { - _context5.next = 8; - break; - } - - _context5.next = 4; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManageExtensions); - - case 4: - requiresPrivilege = _context5.sent; - - if (requiresPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManageExtensions, run); - } else { - run(); - } - - _context5.next = 9; - break; - - case 8: - run(); - - case 9: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function selectRoom(_x) { - return _selectRoom.apply(this, arguments); - } - - return selectRoom; - }() - }, { - key: "clickOutsideAccountMenu", - value: function clickOutsideAccountMenu() { - if (this.application && this.application.authenticationInProgress()) { - return; - } - - this.showAccountMenu = false; - } - }]); - - return FooterCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_15__["PureCtrl"]); - -var Footer = function Footer() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, Footer); - - this.restrict = 'E'; - this.template = _footer_pug__WEBPACK_IMPORTED_MODULE_12___default.a; - this.controller = FooterCtrl; - this.replace = true; - this.controllerAs = 'ctrl'; - this.bindToController = { - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/index.js": -/*!*****************************************************!*\ - !*** ./app/assets/javascripts/controllers/index.js ***! - \*****************************************************/ -/*! exports provided: PureCtrl, EditorPanel, Footer, NotesPanel, TagsPanel, Root, ApplicationView */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract/pure_ctrl */ "./app/assets/javascripts/controllers/abstract/pure_ctrl.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PureCtrl", function() { return _abstract_pure_ctrl__WEBPACK_IMPORTED_MODULE_0__["PureCtrl"]; }); - -/* harmony import */ var _editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./editor */ "./app/assets/javascripts/controllers/editor.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EditorPanel", function() { return _editor__WEBPACK_IMPORTED_MODULE_1__["EditorPanel"]; }); - -/* harmony import */ var _footer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./footer */ "./app/assets/javascripts/controllers/footer.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Footer", function() { return _footer__WEBPACK_IMPORTED_MODULE_2__["Footer"]; }); - -/* harmony import */ var _notes_notes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./notes/notes */ "./app/assets/javascripts/controllers/notes/notes.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NotesPanel", function() { return _notes_notes__WEBPACK_IMPORTED_MODULE_3__["NotesPanel"]; }); - -/* harmony import */ var _tags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./tags */ "./app/assets/javascripts/controllers/tags.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TagsPanel", function() { return _tags__WEBPACK_IMPORTED_MODULE_4__["TagsPanel"]; }); - -/* harmony import */ var _root__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./root */ "./app/assets/javascripts/controllers/root.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Root", function() { return _root__WEBPACK_IMPORTED_MODULE_5__["Root"]; }); - -/* harmony import */ var _applicationView__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./applicationView */ "./app/assets/javascripts/controllers/applicationView.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ApplicationView", function() { return _applicationView__WEBPACK_IMPORTED_MODULE_6__["ApplicationView"]; }); - - - - - - - - - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/notes/note_utils.js": -/*!****************************************************************!*\ - !*** ./app/assets/javascripts/controllers/notes/note_utils.js ***! - \****************************************************************/ -/*! exports provided: SORT_KEY_CREATED_AT, SORT_KEY_UPDATED_AT, SORT_KEY_CLIENT_UPDATED_AT, SORT_KEY_TITLE, filterAndSortNotes, filterNotes, sortNotes */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SORT_KEY_CREATED_AT", function() { return SORT_KEY_CREATED_AT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SORT_KEY_UPDATED_AT", function() { return SORT_KEY_UPDATED_AT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SORT_KEY_CLIENT_UPDATED_AT", function() { return SORT_KEY_CLIENT_UPDATED_AT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SORT_KEY_TITLE", function() { return SORT_KEY_TITLE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filterAndSortNotes", function() { return filterAndSortNotes; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filterNotes", function() { return filterNotes; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortNotes", function() { return sortNotes; }); -var SORT_KEY_CREATED_AT = 'created_at'; -var SORT_KEY_UPDATED_AT = 'updated_at'; -var SORT_KEY_CLIENT_UPDATED_AT = 'client_updated_at'; -var SORT_KEY_TITLE = 'title'; -function filterAndSortNotes(_ref) { - var notes = _ref.notes, - selectedTag = _ref.selectedTag, - showArchived = _ref.showArchived, - hidePinned = _ref.hidePinned, - filterText = _ref.filterText, - sortBy = _ref.sortBy, - reverse = _ref.reverse; - var filtered = filterNotes({ - notes: notes, - selectedTag: selectedTag, - showArchived: showArchived, - hidePinned: hidePinned, - filterText: filterText - }); - var sorted = sortNotes({ - notes: filtered, - sortBy: sortBy, - reverse: reverse - }); - return sorted; -} -function filterNotes(_ref2) { - var notes = _ref2.notes, - selectedTag = _ref2.selectedTag, - showArchived = _ref2.showArchived, - hidePinned = _ref2.hidePinned, - filterText = _ref2.filterText; - return notes.filter(function (note) { - var canShowArchived = showArchived; - var canShowPinned = !hidePinned; - var isTrash = selectedTag.content.isTrashTag; - - if (!isTrash && note.content.trashed) { - return false; - } - - var isSmartTag = selectedTag.isSmartTag(); - - if (isSmartTag) { - canShowArchived = canShowArchived || selectedTag.content.isArchiveTag || isTrash; - } - - if (note.archived && !canShowArchived || note.pinned && !canShowPinned) { - return false; - } - - return noteMatchesQuery({ - note: note, - query: filterText - }); - }); -} - -function noteMatchesQuery(_ref3) { - var note = _ref3.note, - query = _ref3.query; - - if (query.length === 0) { - return true; - } - - var title = note.safeTitle().toLowerCase(); - var text = note.safeText().toLowerCase(); - var lowercaseText = query.toLowerCase(); - var quotedText = stringBetweenQuotes(lowercaseText); - - if (quotedText) { - return title.includes(quotedText) || text.includes(quotedText); - } - - if (stringIsUuid(lowercaseText)) { - return note.uuid === lowercaseText; - } - - var words = lowercaseText.split(" "); - var matchesTitle = words.every(function (word) { - return title.indexOf(word) >= 0; - }); - var matchesBody = words.every(function (word) { - return text.indexOf(word) >= 0; - }); - return matchesTitle || matchesBody; -} - -function stringBetweenQuotes(text) { - var matches = text.match(/"(.*?)"/); - return matches ? matches[1] : null; -} - -function stringIsUuid(text) { - var matches = text.match(/\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b/); // eslint-disable-next-line no-unneeded-ternary - - return matches ? true : false; -} - -function sortNotes(_ref4) { - var _ref4$notes = _ref4.notes, - notes = _ref4$notes === void 0 ? [] : _ref4$notes, - sortBy = _ref4.sortBy, - reverse = _ref4.reverse; - - var sortValueFn = function sortValueFn(a, b) { - var pinCheck = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (a.dummy) { - return -1; - } - - if (b.dummy) { - return 1; - } - - if (!pinCheck) { - if (a.pinned && b.pinned) { - return sortValueFn(a, b, true); - } - - if (a.pinned) { - return -1; - } - - if (b.pinned) { - return 1; - } - } - - var aValue = a[sortBy] || ''; - var bValue = b[sortBy] || ''; - var vector = 1; - - if (reverse) { - vector *= -1; - } - - if (sortBy === SORT_KEY_TITLE) { - aValue = aValue.toLowerCase(); - bValue = bValue.toLowerCase(); - - if (aValue.length === 0 && bValue.length === 0) { - return 0; - } else if (aValue.length === 0 && bValue.length !== 0) { - return 1 * vector; - } else if (aValue.length !== 0 && bValue.length === 0) { - return -1 * vector; - } else { - vector *= -1; - } - } - - if (aValue > bValue) { - return -1 * vector; - } else if (aValue < bValue) { - return 1 * vector; - } - - return 0; - }; - - var result = notes.sort(function (a, b) { - return sortValueFn(a, b); - }); - return result; -} - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/notes/notes.js": -/*!***********************************************************!*\ - !*** ./app/assets/javascripts/controllers/notes/notes.js ***! - \***********************************************************/ -/*! exports provided: NotesPanel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotesPanel", function() { return NotesPanel; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _notes_pug__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! %/notes.pug */ "./app/assets/templates/notes.pug"); -/* harmony import */ var _notes_pug__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_notes_pug__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); -/* harmony import */ var _services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @/services/keyboardManager */ "./app/assets/javascripts/services/keyboardManager.js"); -/* harmony import */ var _services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @/services/preferencesManager */ "./app/assets/javascripts/services/preferencesManager.js"); -/* harmony import */ var _controllers_constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @/controllers/constants */ "./app/assets/javascripts/controllers/constants.js"); -/* harmony import */ var _note_utils__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./note_utils */ "./app/assets/javascripts/controllers/notes/note_utils.js"); - - - - - - - - - - - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - - - - - - - - - - -/** - * This is the height of a note cell with nothing but the title, - * which *is* a display option - */ - -var MIN_NOTE_CELL_HEIGHT = 51.0; -var DEFAULT_LIST_NUM_NOTES = 20; -var ELEMENT_ID_SEARCH_BAR = 'search-bar'; -var ELEMENT_ID_SCROLL_CONTAINER = 'notes-scrollable'; - -var NotesCtrl = /*#__PURE__*/function (_PureCtrl) { - NotesCtrl.$inject = ["$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(NotesCtrl, _PureCtrl); - - /* @ngInject */ - function NotesCtrl($timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, NotesCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(NotesCtrl).call(this, $timeout)); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "onPanelResize", function (newWidth, lastLeft, isAtMaxWidth, isCollapsed) { - _this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesPanelWidth, newWidth); - - _this.application.getPrefsService().syncUserPreferences(); - - _this.application.getAppState().panelDidResize({ - name: _controllers_constants__WEBPACK_IMPORTED_MODULE_17__["PANEL_NAME_NOTES"], - collapsed: isCollapsed - }); - }); - - _this.resetPagination(); - - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(NotesCtrl, [{ - key: "$onInit", - value: function $onInit() { - var _this2 = this; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(NotesCtrl.prototype), "$onInit", this).call(this); - - angular__WEBPACK_IMPORTED_MODULE_10___default.a.element(document).ready(function () { - _this2.reloadPreferences(); - }); - this.panelPuppet = { - onReady: function onReady() { - return _this2.reloadPreferences(); - } - }; - this.onWindowResize = this.onWindowResize.bind(this); - window.addEventListener('resize', this.onWindowResize, true); - this.registerKeyboardShortcuts(); - } - }, { - key: "onWindowResize", - value: function onWindowResize() { - this.resetPagination({ - keepCurrentIfLarger: true - }); - } - }, { - key: "deinit", - value: function deinit() { - this.panelPuppet.onReady = null; - this.panelPuppet = null; - window.removeEventListener('resize', this.onWindowResize, true); - this.onWindowResize = null; - this.onPanelResize = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(NotesCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "getInitialState", - value: function getInitialState() { - return { - notes: [], - renderedNotes: [], - selectedNote: null, - tag: null, - sortBy: null, - showArchived: null, - hidePinned: null, - sortReverse: null, - panelTitle: null, - mutable: { - showMenu: false - }, - noteFilter: { - text: '' - } - }; - } - }, { - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(NotesCtrl.prototype), "onAppLaunch", this).call(this); - - this.streamNotesAndTags(); - this.reloadPreferences(); - } - /** @override */ - - }, { - key: "onAppStateEvent", - value: function onAppStateEvent(eventName, data) { - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_14__["AppStateEvents"].TagChanged) { - this.handleTagChange(this.application.getAppState().getSelectedTag(), data.previousTag); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_14__["AppStateEvents"].NoteChanged) { - this.handleNoteSelection(this.application.getAppState().getSelectedNote()); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_14__["AppStateEvents"].PreferencesChanged) { - this.reloadPreferences(); - this.reloadNotes(); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_14__["AppStateEvents"].EditorFocused) { - this.setShowMenuFalse(); - } - } - /** @override */ - - }, { - key: "onAppEvent", - value: function () { - var _onAppEvent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(eventName) { - var _this3 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!(eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].SignedIn)) { - _context.next = 9; - break; - } - - if (!(this.state.selectedNote && this.state.selectedNote.dummy)) { - _context.next = 7; - break; - } - - this.application.deleteItemLocally({ - item: this.state.selectedNote - }); - _context.next = 5; - return this.selectNote(null); - - case 5: - _context.next = 7; - return this.reloadNotes(); - - case 7: - _context.next = 10; - break; - - case 9: - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_12__["ApplicationEvents"].CompletedSync) { - this.getMostValidNotes().then(function (notes) { - if (notes.length === 0) { - _this3.createPlaceholderNote(); - } - }); - } - - case 10: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function onAppEvent(_x) { - return _onAppEvent.apply(this, arguments); - } - - return onAppEvent; - }() - /** - * @access private - * Access the current state notes without awaiting any potential reloads - * that may be in progress. This is the sync alternative to `async getMostValidNotes` - */ - - }, { - key: "getPossiblyStaleNotes", - value: function getPossiblyStaleNotes() { - return this.state.notes; - } - /** - * @access private - * Access the current state notes after waiting for any pending reloads. - * This returns the most up to date notes, but is the asyncronous counterpart - * to `getPossiblyStaleNotes` - */ - - }, { - key: "getMostValidNotes", - value: function () { - var _getMostValidNotes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.reloadNotesPromise; - - case 2: - return _context2.abrupt("return", this.getPossiblyStaleNotes()); - - case 3: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function getMostValidNotes() { - return _getMostValidNotes.apply(this, arguments); - } - - return getMostValidNotes; - }() - /** - * Triggered programatically to create a new placeholder note - * when conditions allow for it. This is as opposed to creating a new note - * as part of user interaction (pressing the + button). - * @access private - */ - - }, { - key: "createPlaceholderNote", - value: function () { - var _createPlaceholderNote = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() { - var selectedTag; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - selectedTag = this.application.getAppState().getSelectedTag(); - - if (!(selectedTag.isSmartTag() && !selectedTag.content.isAllTag)) { - _context3.next = 3; - break; - } - - return _context3.abrupt("return"); - - case 3: - return _context3.abrupt("return", this.createNewNote()); - - case 4: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function createPlaceholderNote() { - return _createPlaceholderNote.apply(this, arguments); - } - - return createPlaceholderNote; - }() - }, { - key: "streamNotesAndTags", - value: function streamNotesAndTags() { - var _this4 = this; - - this.application.streamItems({ - contentType: [snjs__WEBPACK_IMPORTED_MODULE_12__["ContentTypes"].Note, snjs__WEBPACK_IMPORTED_MODULE_12__["ContentTypes"].Tag], - stream: function () { - var _stream = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(_ref) { - var items, selectedNote, discarded, notes, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, note; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - items = _ref.items; - _context4.next = 3; - return _this4.reloadNotes(); - - case 3: - selectedNote = _this4.state.selectedNote; - - if (selectedNote) { - discarded = selectedNote.deleted || selectedNote.content.trashed; - - if (discarded) { - _this4.selectNextOrCreateNew(); - } - } else { - _this4.selectFirstNote(); - } - /** Note has changed values, reset its flags */ - - - notes = items.filter(function (item) { - return item.content_type === snjs__WEBPACK_IMPORTED_MODULE_12__["ContentTypes"].Note; - }); - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context4.prev = 9; - _iterator = notes[Symbol.iterator](); - - case 11: - if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { - _context4.next = 21; - break; - } - - note = _step.value; - - if (!note.deleted) { - _context4.next = 15; - break; - } - - return _context4.abrupt("continue", 18); - - case 15: - _this4.loadFlagsForNote(note); - - note.cachedCreatedAtString = note.createdAtString(); - note.cachedUpdatedAtString = note.updatedAtString(); - - case 18: - _iteratorNormalCompletion = true; - _context4.next = 11; - break; - - case 21: - _context4.next = 27; - break; - - case 23: - _context4.prev = 23; - _context4.t0 = _context4["catch"](9); - _didIteratorError = true; - _iteratorError = _context4.t0; - - case 27: - _context4.prev = 27; - _context4.prev = 28; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 30: - _context4.prev = 30; - - if (!_didIteratorError) { - _context4.next = 33; - break; - } - - throw _iteratorError; - - case 33: - return _context4.finish(30); - - case 34: - return _context4.finish(27); - - case 35: - case "end": - return _context4.stop(); - } - } - }, _callee4, null, [[9, 23, 27, 35], [28,, 30, 34]]); - })); - - function stream(_x2) { - return _stream.apply(this, arguments); - } - - return stream; - }() - }); - } - }, { - key: "selectNote", - value: function () { - var _selectNote = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(note) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - return _context5.abrupt("return", this.application.getAppState().setSelectedNote(note)); - - case 1: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function selectNote(_x3) { - return _selectNote.apply(this, arguments); - } - - return selectNote; - }() - }, { - key: "createNewNote", - value: function () { - var _createNewNote = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6() { - var selectedTag, title, isDummyNote, newNote; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - selectedTag = this.application.getAppState().getSelectedTag(); - - if (selectedTag) { - _context6.next = 3; - break; - } - - throw 'Attempting to create note with no selected tag'; - - case 3: - isDummyNote = true; - - if (!this.isFiltering()) { - _context6.next = 9; - break; - } - - title = this.state.noteFilter.text; - isDummyNote = false; - _context6.next = 14; - break; - - case 9: - if (!(this.state.selectedNote && this.state.selectedNote.dummy)) { - _context6.next = 13; - break; - } - - return _context6.abrupt("return"); - - case 13: - title = "Note ".concat(this.state.notes.length + 1); - - case 14: - _context6.next = 16; - return this.application.createManagedItem({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_12__["ContentTypes"].Note, - content: { - text: '', - title: title - }, - override: { - dummy: isDummyNote, - client_updated_at: new Date() - } - }); - - case 16: - newNote = _context6.sent; - this.application.setItemNeedsSync({ - item: newNote - }); - - if (!selectedTag.isSmartTag()) { - selectedTag.addItemAsRelationship(newNote); - this.application.setItemNeedsSync({ - item: selectedTag - }); - } - - this.selectNote(newNote); - - case 20: - case "end": - return _context6.stop(); - } - } - }, _callee6, this); - })); - - function createNewNote() { - return _createNewNote.apply(this, arguments); - } - - return createNewNote; - }() - }, { - key: "handleTagChange", - value: function () { - var _handleTagChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7(tag, previousTag) { - var dbLoaded; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - if (!(this.state.selectedNote && this.state.selectedNote.dummy)) { - _context7.next = 6; - break; - } - - _context7.next = 3; - return this.application.deleteItemLocally({ - item: this.state.selectedNote - }); - - case 3: - if (previousTag) { - Object(snjs__WEBPACK_IMPORTED_MODULE_12__["removeFromArray"])(previousTag.notes, this.state.selectedNote); - } - - _context7.next = 6; - return this.selectNote(null); - - case 6: - _context7.next = 8; - return this.setState({ - tag: tag - }); - - case 8: - this.resetScrollPosition(); - this.setShowMenuFalse(); - _context7.next = 12; - return this.setNoteFilterText(''); - - case 12: - this.application.getDesktopService().searchText(); - this.resetPagination(); - /* Capture db load state before beginning reloadNotes, since this status may change during reload */ - - dbLoaded = this.application.isDatabaseLoaded(); - _context7.next = 17; - return this.reloadNotes(); - - case 17: - if (this.state.notes.length > 0) { - this.selectFirstNote(); - } else if (dbLoaded) { - if (!tag.isSmartTag() || tag.content.isAllTag) { - this.createPlaceholderNote(); - } else if (this.state.selectedNote && !this.state.notes.includes(this.state.selectedNote)) { - this.selectNote(null); - } - } - - case 18: - case "end": - return _context7.stop(); - } - } - }, _callee7, this); - })); - - function handleTagChange(_x4, _x5) { - return _handleTagChange.apply(this, arguments); - } - - return handleTagChange; - }() - }, { - key: "resetScrollPosition", - value: function resetScrollPosition() { - var scrollable = document.getElementById(ELEMENT_ID_SCROLL_CONTAINER); - - if (scrollable) { - scrollable.scrollTop = 0; - scrollable.scrollLeft = 0; - } - } - }, { - key: "removeNoteFromList", - value: function () { - var _removeNoteFromList = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(note) { - var notes; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - notes = this.state.notes; - Object(snjs__WEBPACK_IMPORTED_MODULE_12__["removeFromArray"])(notes, note); - _context8.next = 4; - return this.setState({ - notes: notes, - renderedNotes: notes.slice(0, this.notesToDisplay) - }); - - case 4: - case "end": - return _context8.stop(); - } - } - }, _callee8, this); - })); - - function removeNoteFromList(_x6) { - return _removeNoteFromList.apply(this, arguments); - } - - return removeNoteFromList; - }() - }, { - key: "reloadNotes", - value: function () { - var _reloadNotes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - this.reloadNotesPromise = this.performPeloadNotes(); - return _context9.abrupt("return", this.reloadNotesPromise); - - case 2: - case "end": - return _context9.stop(); - } - } - }, _callee9, this); - })); - - function reloadNotes() { - return _reloadNotes.apply(this, arguments); - } - - return reloadNotes; - }() - }, { - key: "performPeloadNotes", - value: function () { - var _performPeloadNotes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10() { - var notes, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, note; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - if (this.state.tag) { - _context10.next = 2; - break; - } - - return _context10.abrupt("return"); - - case 2: - notes = Object(_note_utils__WEBPACK_IMPORTED_MODULE_18__["filterAndSortNotes"])({ - notes: this.state.tag.notes, - selectedTag: this.state.tag, - showArchived: this.state.showArchived, - hidePinned: this.state.hidePinned, - filterText: this.state.noteFilter.text.toLowerCase(), - sortBy: this.state.sortBy, - reverse: this.state.sortReverse - }); - _iteratorNormalCompletion2 = true; - _didIteratorError2 = false; - _iteratorError2 = undefined; - _context10.prev = 6; - - for (_iterator2 = notes[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - note = _step2.value; - - if (note.errorDecrypting) { - this.loadFlagsForNote(note); - } - - note.shouldShowTags = this.shouldShowTagsForNote(note); - } - - _context10.next = 14; - break; - - case 10: - _context10.prev = 10; - _context10.t0 = _context10["catch"](6); - _didIteratorError2 = true; - _iteratorError2 = _context10.t0; - - case 14: - _context10.prev = 14; - _context10.prev = 15; - - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - - case 17: - _context10.prev = 17; - - if (!_didIteratorError2) { - _context10.next = 20; - break; - } - - throw _iteratorError2; - - case 20: - return _context10.finish(17); - - case 21: - return _context10.finish(14); - - case 22: - _context10.next = 24; - return this.setState({ - notes: notes, - renderedNotes: notes.slice(0, this.notesToDisplay) - }); - - case 24: - this.reloadPanelTitle(); - - case 25: - case "end": - return _context10.stop(); - } - } - }, _callee10, this, [[6, 10, 14, 22], [15,, 17, 21]]); - })); - - function performPeloadNotes() { - return _performPeloadNotes.apply(this, arguments); - } - - return performPeloadNotes; - }() - }, { - key: "setShowMenuFalse", - value: function setShowMenuFalse() { - this.setState({ - mutable: _objectSpread({}, this.state.mutable, { - showMenu: false - }) - }); - } - }, { - key: "handleNoteSelection", - value: function () { - var _handleNoteSelection = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11(note) { - var previousNote; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - previousNote = this.state.selectedNote; - - if (!(previousNote === note)) { - _context11.next = 3; - break; - } - - return _context11.abrupt("return"); - - case 3: - if (!(previousNote && previousNote.dummy)) { - _context11.next = 7; - break; - } - - _context11.next = 6; - return this.application.deleteItemLocally({ - item: previousNote - }); - - case 6: - this.removeNoteFromList(previousNote); - - case 7: - _context11.next = 9; - return this.setState({ - selectedNote: note - }); - - case 9: - if (note) { - _context11.next = 11; - break; - } - - return _context11.abrupt("return"); - - case 11: - this.selectedIndex = Math.max(0, this.displayableNotes().indexOf(note)); - - if (note.content.conflict_of) { - note.content.conflict_of = null; - this.application.saveItem({ - item: note - }); - } - - if (this.isFiltering()) { - this.application.getDesktopService().searchText(this.state.noteFilter.text); - } - - case 14: - case "end": - return _context11.stop(); - } - } - }, _callee11, this); - })); - - function handleNoteSelection(_x7) { - return _handleNoteSelection.apply(this, arguments); - } - - return handleNoteSelection; - }() - }, { - key: "reloadPreferences", - value: function reloadPreferences() { - var viewOptions = {}; - var prevSortValue = this.state.sortBy; - var sortBy = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].SortNotesBy, _note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_CREATED_AT"]); - - if (sortBy === _note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_UPDATED_AT"]) { - /** Use client_updated_at instead */ - sortBy = _note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_CLIENT_UPDATED_AT"]; - } - - viewOptions.sortBy = sortBy; - viewOptions.sortReverse = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].SortNotesReverse, false); - viewOptions.showArchived = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesShowArchived, false); - viewOptions.hidePinned = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesHidePinned, false); - viewOptions.hideNotePreview = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesHideNotePreview, false); - viewOptions.hideDate = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesHideDate, false); - viewOptions.hideTags = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesHideTags, false); - this.setState(_objectSpread({}, viewOptions)); - - if (prevSortValue && prevSortValue !== sortBy) { - this.selectFirstNote(); - } - - var width = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].NotesPanelWidth); - - if (width && this.panelPuppet.ready) { - this.panelPuppet.setWidth(width); - - if (this.panelPuppet.isCollapsed()) { - this.application.getAppState().panelDidResize({ - name: _controllers_constants__WEBPACK_IMPORTED_MODULE_17__["PANEL_NAME_NOTES"], - collapsed: this.panelPuppet.isCollapsed() - }); - } - } - } - }, { - key: "paginate", - value: function paginate() { - this.notesToDisplay += this.pageSize; - this.reloadNotes(); - - if (this.searchSubmitted) { - this.application.getDesktopService().searchText(this.state.noteFilter.text); - } - } - }, { - key: "resetPagination", - value: function resetPagination() { - var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - keepCurrentIfLarger = _ref2.keepCurrentIfLarger; - - var clientHeight = document.documentElement.clientHeight; - this.pageSize = Math.ceil(clientHeight / MIN_NOTE_CELL_HEIGHT); - - if (this.pageSize === 0) { - this.pageSize = DEFAULT_LIST_NUM_NOTES; - } - - if (keepCurrentIfLarger && this.notesToDisplay > this.pageSize) { - return; - } - - this.notesToDisplay = this.pageSize; - } - }, { - key: "reloadPanelTitle", - value: function reloadPanelTitle() { - var title; - - if (this.isFiltering()) { - var resultCount = this.state.notes.length; - title = "".concat(resultCount, " search results"); - } else if (this.state.tag) { - title = "".concat(this.state.tag.title); - } - - this.setState({ - panelTitle: title - }); - } - }, { - key: "optionsSubtitle", - value: function optionsSubtitle() { - var base = ""; - - if (this.state.sortBy === 'created_at') { - base += " Date Added"; - } else if (this.state.sortBy === 'client_updated_at') { - base += " Date Modified"; - } else if (this.state.sortBy === 'title') { - base += " Title"; - } - - if (this.state.showArchived) { - base += " | + Archived"; - } - - if (this.state.hidePinned) { - base += " | – Pinned"; - } - - if (this.state.sortReverse) { - base += " | Reversed"; - } - - return base; - } - }, { - key: "loadFlagsForNote", - value: function loadFlagsForNote(note) { - var flags = []; - - if (note.pinned) { - flags.push({ - text: "Pinned", - class: 'info' - }); - } - - if (note.archived) { - flags.push({ - text: "Archived", - class: 'warning' - }); - } - - if (note.content.protected) { - flags.push({ - text: "Protected", - class: 'success' - }); - } - - if (note.locked) { - flags.push({ - text: "Locked", - class: 'neutral' - }); - } - - if (note.content.trashed) { - flags.push({ - text: "Deleted", - class: 'danger' - }); - } - - if (note.content.conflict_of) { - flags.push({ - text: "Conflicted Copy", - class: 'danger' - }); - } - - if (note.errorDecrypting) { - if (note.waitingForKey) { - flags.push({ - text: "Waiting For Keys", - class: 'info' - }); - } else { - flags.push({ - text: "Missing Keys", - class: 'danger' - }); - } - } - - if (note.deleted) { - flags.push({ - text: "Deletion Pending Sync", - class: 'danger' - }); - } - - note.flags = flags; - return flags; - } - }, { - key: "displayableNotes", - value: function displayableNotes() { - return this.state.notes; - } - }, { - key: "getFirstNonProtectedNote", - value: function getFirstNonProtectedNote() { - var displayableNotes = this.displayableNotes(); - var index = 0; - var note = displayableNotes[index]; - - while (note && note.content.protected) { - index++; - - if (index >= displayableNotes.length) { - break; - } - - note = displayableNotes[index]; - } - - return note; - } - }, { - key: "selectFirstNote", - value: function selectFirstNote() { - var note = this.getFirstNonProtectedNote(); - - if (note) { - this.selectNote(note); - } - } - }, { - key: "selectNextNote", - value: function selectNextNote() { - var displayableNotes = this.displayableNotes(); - var currentIndex = displayableNotes.indexOf(this.state.selectedNote); - - if (currentIndex + 1 < displayableNotes.length) { - this.selectNote(displayableNotes[currentIndex + 1]); - } - } - }, { - key: "selectNextOrCreateNew", - value: function selectNextOrCreateNew() { - var note = this.getFirstNonProtectedNote(); - - if (note) { - this.selectNote(note); - } else if (!this.state.tag || !this.state.tag.isSmartTag()) { - this.createPlaceholderNote(); - } else { - this.selectNote(null); - } - } - }, { - key: "selectPreviousNote", - value: function selectPreviousNote() { - var displayableNotes = this.displayableNotes(); - var currentIndex = displayableNotes.indexOf(this.state.selectedNote); - - if (currentIndex - 1 >= 0) { - this.selectNote(displayableNotes[currentIndex - 1]); - return true; - } else { - return false; - } - } - }, { - key: "isFiltering", - value: function isFiltering() { - return this.state.noteFilter.text && this.state.noteFilter.text.length > 0; - } - }, { - key: "setNoteFilterText", - value: function () { - var _setNoteFilterText = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12(text) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - _context12.next = 2; - return this.setState({ - noteFilter: _objectSpread({}, this.state.noteFilter, { - text: text - }) - }); - - case 2: - case "end": - return _context12.stop(); - } - } - }, _callee12, this); - })); - - function setNoteFilterText(_x8) { - return _setNoteFilterText.apply(this, arguments); - } - - return setNoteFilterText; - }() - }, { - key: "clearFilterText", - value: function () { - var _clearFilterText = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - _context13.next = 2; - return this.setNoteFilterText(''); - - case 2: - this.onFilterEnter(); - this.filterTextChanged(); - this.resetPagination(); - - case 5: - case "end": - return _context13.stop(); - } - } - }, _callee13, this); - })); - - function clearFilterText() { - return _clearFilterText.apply(this, arguments); - } - - return clearFilterText; - }() - }, { - key: "filterTextChanged", - value: function () { - var _filterTextChanged = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - if (this.searchSubmitted) { - this.searchSubmitted = false; - } - - _context14.next = 3; - return this.reloadNotes(); - - case 3: - case "end": - return _context14.stop(); - } - } - }, _callee14, this); - })); - - function filterTextChanged() { - return _filterTextChanged.apply(this, arguments); - } - - return filterTextChanged; - }() - }, { - key: "onFilterEnter", - value: function onFilterEnter() { - /** - * For Desktop, performing a search right away causes - * input to lose focus. We wait until user explicity hits - * enter before highlighting desktop search results. - */ - this.searchSubmitted = true; - this.application.getDesktopService().searchText(this.state.noteFilter.text); - } - }, { - key: "selectedMenuItem", - value: function selectedMenuItem() { - this.setShowMenuFalse(); - } - }, { - key: "togglePrefKey", - value: function togglePrefKey(key) { - this.application.getPrefsService().setUserPrefValue(key, !this.state[key]); - this.application.getPrefsService().syncUserPreferences(); - } - }, { - key: "selectedSortByCreated", - value: function selectedSortByCreated() { - this.setSortBy(_note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_CREATED_AT"]); - } - }, { - key: "selectedSortByUpdated", - value: function selectedSortByUpdated() { - this.setSortBy(_note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_CLIENT_UPDATED_AT"]); - } - }, { - key: "selectedSortByTitle", - value: function selectedSortByTitle() { - this.setSortBy(_note_utils__WEBPACK_IMPORTED_MODULE_18__["SORT_KEY_TITLE"]); - } - }, { - key: "toggleReverseSort", - value: function toggleReverseSort() { - this.selectedMenuItem(); - this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].SortNotesReverse, !this.state.sortReverse); - this.application.getPrefsService().syncUserPreferences(); - } - }, { - key: "setSortBy", - value: function setSortBy(type) { - this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_16__["PrefKeys"].SortNotesBy, type); - this.application.getPrefsService().syncUserPreferences(); - } - }, { - key: "shouldShowTagsForNote", - value: function shouldShowTagsForNote(note) { - if (this.state.hideTags || note.content.protected) { - return false; - } - - if (this.state.tag.content.isAllTag) { - return note.tags && note.tags.length > 0; - } - - if (this.state.tag.isSmartTag()) { - return true; - } - /** - * Inside a tag, only show tags string if - * note contains tags other than this.state.tag - */ - - - return note.tags && note.tags.length > 1; - } - }, { - key: "getSearchBar", - value: function getSearchBar() { - return document.getElementById(ELEMENT_ID_SEARCH_BAR); - } - }, { - key: "registerKeyboardShortcuts", - value: function registerKeyboardShortcuts() { - var _this5 = this; - - /** - * In the browser we're not allowed to override cmd/ctrl + n, so we have to - * use Control modifier as well. These rules don't apply to desktop, but - * probably better to be consistent. - */ - this.newNoteKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: 'n', - modifiers: [_services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardModifiers"].Meta, _services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardModifiers"].Ctrl], - onKeyDown: function onKeyDown(event) { - event.preventDefault(); - - _this5.createNewNote(); - } - }); - this.nextNoteKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: _services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardKeys"].Down, - elements: [document.body, this.getSearchBar()], - onKeyDown: function onKeyDown(event) { - var searchBar = _this5.getSearchBar(); - - if (searchBar === document.activeElement) { - searchBar.blur(); - } - - _this5.selectNextNote(); - } - }); - this.nextNoteKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: _services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardKeys"].Up, - element: document.body, - onKeyDown: function onKeyDown(event) { - _this5.selectPreviousNote(); - } - }); - this.searchKeyObserver = this.application.getKeyboardService().addKeyObserver({ - key: "f", - modifiers: [_services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardModifiers"].Meta, _services_keyboardManager__WEBPACK_IMPORTED_MODULE_15__["KeyboardModifiers"].Shift], - onKeyDown: function onKeyDown(event) { - var searchBar = _this5.getSearchBar(); - - if (searchBar) { - searchBar.focus(); - } - - ; - } - }); - } - }]); - - return NotesCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_13__["PureCtrl"]); - -var NotesPanel = function NotesPanel() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, NotesPanel); - - this.template = _notes_pug__WEBPACK_IMPORTED_MODULE_11___default.a; - this.replace = true; - this.controller = NotesCtrl; - this.controllerAs = 'self'; - this.bindToController = true; - this.scope = { - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/root.js": -/*!****************************************************!*\ - !*** ./app/assets/javascripts/controllers/root.js ***! - \****************************************************/ -/*! exports provided: Root */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Root", function() { return Root; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _root_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/root.pug */ "./app/assets/templates/root.pug"); -/* harmony import */ var _root_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var RootCtrl = /*#__PURE__*/function () { - RootCtrl.$inject = ["$timeout", "applicationManager"]; - - /* @ngInject */ - function RootCtrl($timeout, applicationManager) { - var _this = this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, RootCtrl); - - this.$timeout = $timeout; - this.applicationManager = applicationManager; - this.applicationManager.addApplicationChangeObserver(function () { - _this.reload(); - }); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(RootCtrl, [{ - key: "reload", - value: function reload() { - var _this2 = this; - - this.$timeout(function () { - _this2.applications = _this2.applicationManager.getApplications(); - }); - } - }]); - - return RootCtrl; -}(); - -var Root = function Root() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Root); - - this.template = _root_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = RootCtrl; - this.replace = true; - this.controllerAs = 'self'; - this.bindToController = true; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/controllers/tags.js": -/*!****************************************************!*\ - !*** ./app/assets/javascripts/controllers/tags.js ***! - \****************************************************/ -/*! exports provided: TagsPanel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TagsPanel", function() { return TagsPanel; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _tags_pug__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! %/tags.pug */ "./app/assets/templates/tags.pug"); -/* harmony import */ var _tags_pug__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_tags_pug__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); -/* harmony import */ var _controllers_constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/controllers/constants */ "./app/assets/javascripts/controllers/constants.js"); -/* harmony import */ var _services_preferencesManager__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @/services/preferencesManager */ "./app/assets/javascripts/services/preferencesManager.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @/strings */ "./app/assets/javascripts/strings.js"); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - - - - - - - - - -var TagsPanelCtrl = /*#__PURE__*/function (_PureCtrl) { - TagsPanelCtrl.$inject = ["$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(TagsPanelCtrl, _PureCtrl); - - /* @ngInject */ - function TagsPanelCtrl($timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, TagsPanelCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl).call(this, $timeout)); - - _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_9___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5___default()(_this), "onPanelResize", function (newWidth, lastLeft, isAtMaxWidth, isCollapsed) { - _this.application.getPrefsService().setUserPrefValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_14__["PrefKeys"].TagsPanelWidth, newWidth, true); - - _this.application.getAppState().panelDidResize({ - name: _controllers_constants__WEBPACK_IMPORTED_MODULE_13__["PANEL_NAME_TAGS"], - collapsed: isCollapsed - }); - }); - - _this.panelPuppet = { - onReady: function onReady() { - return _this.loadPreferences(); - } - }; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(TagsPanelCtrl, [{ - key: "deinit", - value: function deinit() { - this.unregisterComponent(); - this.unregisterComponent = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "getInitialState", - value: function getInitialState() { - return { - tags: [], - smartTags: [], - noteCounts: {} - }; - } - }, { - key: "onAppStart", - value: function onAppStart() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl.prototype), "onAppStart", this).call(this); - - this.registerComponentHandler(); - } - }, { - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl.prototype), "onAppLaunch", this).call(this); - - this.loadPreferences(); - this.beginStreamingItems(); - var smartTags = this.application.getSmartTags(); - this.setState({ - smartTags: smartTags - }); - this.selectTag(smartTags[0]); - } - /** @override */ - - }, { - key: "onAppSync", - value: function onAppSync() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl.prototype), "onAppSync", this).call(this); - - this.reloadNoteCounts(); - } - /** - * Returns all officially saved tags as reported by the model manager. - * @access private - */ - - }, { - key: "getMappedTags", - value: function getMappedTags() { - var tags = this.application.getItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].Tag - }); - return tags.sort(function (a, b) { - return a.content.title < b.content.title ? -1 : 1; - }); - } - }, { - key: "beginStreamingItems", - value: function beginStreamingItems() { - var _this2 = this; - - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].Tag, - stream: function () { - var _stream = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(_ref) { - var items, matchingTag; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - items = _ref.items; - _context.next = 3; - return _this2.setState({ - tags: _this2.getMappedTags(), - smartTags: _this2.application.getSmartTags() - }); - - case 3: - _this2.reloadNoteCounts(); - - if (_this2.state.selectedTag) { - /** If the selected tag has been deleted, revert to All view. */ - matchingTag = items.find(function (tag) { - return tag.uuid === _this2.state.selectedTag.uuid; - }); - - if (!matchingTag || matchingTag.deleted) { - _this2.selectTag(_this2.state.smartTags[0]); - } - } - - case 5: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - function stream(_x) { - return _stream.apply(this, arguments); - } - - return stream; - }() - }); - } - /** @override */ - - }, { - key: "onAppStateEvent", - value: function onAppStateEvent(eventName, data) { - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_12__["AppStateEvents"].PreferencesChanged) { - this.loadPreferences(); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_12__["AppStateEvents"].TagChanged) { - this.setState({ - selectedTag: this.application.getAppState().getSelectedTag() - }); - } - } - /** @override */ - - }, { - key: "onAppEvent", - value: function () { - var _onAppEvent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(eventName) { - var syncStatus, stats; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(TagsPanelCtrl.prototype), "onAppEvent", this).call(this, eventName); - - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_10__["ApplicationEvents"].LocalDataIncrementalLoad) { - this.reloadNoteCounts(); - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_10__["ApplicationEvents"].SyncStatusChanged) { - syncStatus = this.application.getSyncStatus(); - stats = syncStatus.getStats(); - - if (stats.downloadCount > 0) { - this.reloadNoteCounts(); - } - } - - case 2: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function onAppEvent(_x2) { - return _onAppEvent.apply(this, arguments); - } - - return onAppEvent; - }() - }, { - key: "reloadNoteCounts", - value: function reloadNoteCounts() { - var allTags = []; - - if (this.state.tags) { - allTags = allTags.concat(this.state.tags); - } - - if (this.state.smartTags) { - allTags = allTags.concat(this.state.smartTags); - } - - var noteCounts = {}; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = allTags[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var tag = _step.value; - var validNotes = snjs__WEBPACK_IMPORTED_MODULE_10__["SNNote"].filterDummyNotes(tag.notes).filter(function (note) { - return !note.archived && !note.content.trashed; - }); - noteCounts[tag.uuid] = validNotes.length; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.setState({ - noteCounts: noteCounts - }); - } - }, { - key: "loadPreferences", - value: function loadPreferences() { - if (!this.panelPuppet.ready) { - return; - } - - var width = this.application.getPrefsService().getValue(_services_preferencesManager__WEBPACK_IMPORTED_MODULE_14__["PrefKeys"].TagsPanelWidth); - - if (width) { - this.panelPuppet.setWidth(width); - - if (this.panelPuppet.isCollapsed()) { - this.application.getAppState().panelDidResize({ - name: _controllers_constants__WEBPACK_IMPORTED_MODULE_13__["PANEL_NAME_TAGS"], - collapsed: this.panelPuppet.isCollapsed() - }); - } - } - } - }, { - key: "registerComponentHandler", - value: function registerComponentHandler() { - var _this3 = this; - - this.unregisterComponent = this.application.componentManager.registerHandler({ - identifier: 'tags', - areas: ['tags-list'], - activationHandler: function activationHandler(component) { - _this3.component = component; - }, - contextRequestHandler: function contextRequestHandler(component) { - return null; - }, - actionHandler: function actionHandler(_, action, data) { - if (action === snjs__WEBPACK_IMPORTED_MODULE_10__["ComponentActions"].SelectItem) { - if (data.item.content_type === snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].Tag) { - var tag = _this3.application.findItem({ - uuid: data.item.uuid - }); - - if (tag) { - _this3.selectTag(tag); - } - } else if (data.item.content_type === snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].SmartTag) { - _this3.application.createTemplateItem({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].SmartTag, - content: data.item.content - }).then(function (smartTag) { - _this3.selectTag(smartTag); - }); - } - } else if (action === snjs__WEBPACK_IMPORTED_MODULE_10__["ComponentActions"].ClearSelection) { - _this3.selectTag(_this3.state.smartTags[0]); - } - } - }); - } - }, { - key: "selectTag", - value: function () { - var _selectTag = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(tag) { - var _this4 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (tag.isSmartTag()) { - Object.defineProperty(tag, 'notes', { - get: function get() { - return _this4.application.getNotesMatchingSmartTag({ - smartTag: tag - }); - } - }); - } - - if (tag.content.conflict_of) { - tag.content.conflict_of = null; - this.application.saveItem({ - item: tag - }); - } - - this.application.getAppState().setSelectedTag(tag); - - case 3: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function selectTag(_x3) { - return _selectTag.apply(this, arguments); - } - - return selectTag; - }() - }, { - key: "clickedAddNewTag", - value: function () { - var _clickedAddNewTag = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - var newTag; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - if (!this.state.editingTag) { - _context4.next = 2; - break; - } - - return _context4.abrupt("return"); - - case 2: - _context4.next = 4; - return this.application.createTemplateItem({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_10__["ContentTypes"].Tag - }); - - case 4: - newTag = _context4.sent; - this.setState({ - tags: [newTag].concat(this.state.tags), - previousTag: this.state.selectedTag, - selectedTag: newTag, - editingTag: newTag, - newTag: newTag - }); - - case 6: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function clickedAddNewTag() { - return _clickedAddNewTag.apply(this, arguments); - } - - return clickedAddNewTag; - }() - }, { - key: "tagTitleDidChange", - value: function tagTitleDidChange(tag) { - this.setState({ - editingTag: tag - }); - } - }, { - key: "saveTag", - value: function () { - var _saveTag = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5($event, tag) { - var newSelectedTag, matchingTag, alreadyExists; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - $event.target.blur(); - _context5.next = 3; - return this.setState({ - editingTag: null - }); - - case 3: - if (!(!tag.title || tag.title.length === 0)) { - _context5.next = 8; - break; - } - - newSelectedTag = this.state.selectedTag; - - if (this.state.editingTag) { - tag.title = this.editingOriginalName; - this.editingOriginalName = null; - } else if (this.state.newTag) { - newSelectedTag = this.state.previousTag; - } - - this.setState({ - newTag: null, - selectedTag: newSelectedTag, - tags: this.getMappedTags() - }); - return _context5.abrupt("return"); - - case 8: - this.editingOriginalName = null; - matchingTag = this.application.findTag({ - title: tag.title - }); - alreadyExists = matchingTag && matchingTag !== tag; - - if (!(this.state.newTag === tag && alreadyExists)) { - _context5.next = 15; - break; - } - - this.application.alertService.alert({ - text: "A tag with this name already exists." - }); - this.setState({ - newTag: null, - tags: this.getMappedTags(), - selectedTag: this.state.previousTag - }); - return _context5.abrupt("return"); - - case 15: - this.application.saveItem({ - item: tag - }); - this.selectTag(tag); - this.setState({ - newTag: null - }); - - case 18: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function saveTag(_x4, _x5) { - return _saveTag.apply(this, arguments); - } - - return saveTag; - }() - }, { - key: "selectedRenameTag", - value: function () { - var _selectedRenameTag = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6($event, tag) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - this.editingOriginalName = tag.title; - _context6.next = 3; - return this.setState({ - editingTag: tag - }); - - case 3: - document.getElementById('tag-' + tag.uuid).focus(); - - case 4: - case "end": - return _context6.stop(); - } - } - }, _callee6, this); - })); - - function selectedRenameTag(_x6, _x7) { - return _selectedRenameTag.apply(this, arguments); - } - - return selectedRenameTag; - }() - }, { - key: "selectedDeleteTag", - value: function selectedDeleteTag(tag) { - this.removeTag(tag); - } - }, { - key: "removeTag", - value: function removeTag(tag) { - var _this5 = this; - - this.application.alertService.confirm({ - text: _strings__WEBPACK_IMPORTED_MODULE_15__["STRING_DELETE_TAG"], - destructive: true, - onConfirm: function onConfirm() { - _this5.application.deleteItem({ - item: tag - }); - - _this5.selectTag(_this5.state.smartTags[0]); - } - }); - } - }]); - - return TagsPanelCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_16__["PureCtrl"]); - -var TagsPanel = function TagsPanel() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, TagsPanel); - - this.restrict = 'E'; - this.scope = { - application: '=' - }; - this.template = _tags_pug__WEBPACK_IMPORTED_MODULE_11___default.a; - this.replace = true; - this.controller = TagsPanelCtrl; - this.controllerAs = 'self'; - this.bindToController = true; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/database.js": -/*!********************************************!*\ - !*** ./app/assets/javascripts/database.js ***! - \********************************************/ -/*! exports provided: Database */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Database", function() { return Database; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); - - - - -var DB_NAME = 'standardnotes'; -var STORE_NAME = 'items'; -var READ_WRITE = 'readwrite'; -var OUT_OF_SPACE = 'Unable to save changes locally because your device is out of space. ' + 'Please free up some disk space and try again, otherwise, your data may end ' + 'up in an inconsistent state.'; -var DB_DELETION_BLOCKED = 'Your browser is blocking Standard Notes from deleting the local database. ' + 'Make sure there are no other open windows of this app and try again. ' + 'If the issue persists, please manually delete app data to sign out.'; -var QUOTE_EXCEEDED_ERROR = 'QuotaExceededError'; -var Database = /*#__PURE__*/function () { - function Database() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, Database); - - this.locked = true; - } - /** @access public */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(Database, [{ - key: "deinit", - value: function deinit() { - this.alertService = null; - this.db = null; - } - /** @access public */ - - }, { - key: "setApplication", - value: function setApplication(application) { - this.alertService = application.alertService; - } - /** - * Relinquishes the lock and allows db operations to proceed - * @access public - */ - - }, { - key: "unlock", - value: function unlock() { - this.locked = false; - } - /** - * Opens the database natively, or returns the existing database object if already opened. - * @access public - * @param {function} onNewDatabase - Callback to invoke when a database has been created - * as part of the open process. This can happen on new application sessions, or if the - * browser deleted the database without the user being aware. - */ - - }, { - key: "openDatabase", - value: function () { - var _openDatabase = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(onNewDatabase) { - var _this = this; - - var request; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!this.locked) { - _context.next = 2; - break; - } - - throw Error('Attempting to open locked database'); - - case 2: - if (!this.db) { - _context.next = 4; - break; - } - - return _context.abrupt("return", this.db); - - case 4: - request = window.indexedDB.open(DB_NAME, 1); - return _context.abrupt("return", new Promise(function (resolve, reject) { - request.onerror = function (event) { - if (event.target.errorCode) { - _this.showAlert('Offline database issue: ' + event.target.errorCode); - } else { - _this.displayOfflineAlert(); - } - - reject(new Error('Unable to open db')); - }; - - request.onblocked = function (event) { - reject(Error('IndexedDB open request blocked')); - }; - - request.onsuccess = function (event) { - var db = event.target.result; - - db.onversionchange = function () { - db.close(); - }; - - db.onerror = function (errorEvent) { - throw Error('Database error: ' + errorEvent.target.errorCode); - }; - - _this.db = db; - resolve(db); - }; - - request.onupgradeneeded = function (event) { - var db = event.target.result; - - db.onversionchange = function () { - db.close(); - }; - /* Create an objectStore for this database */ - - - var objectStore = db.createObjectStore(STORE_NAME, { - keyPath: 'uuid' - }); - objectStore.createIndex('uuid', 'uuid', { - unique: true - }); - - objectStore.transaction.oncomplete = function () { - /* Ready to store values in the newly created objectStore. */ - if (db.version === 1 && onNewDatabase) { - onNewDatabase(); - } - }; - }; - })); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function openDatabase(_x) { - return _openDatabase.apply(this, arguments); - } - - return openDatabase; - }() - /** @access public */ - - }, { - key: "getAllPayloads", - value: function () { - var _getAllPayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var db; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.openDatabase(); - - case 2: - db = _context2.sent; - return _context2.abrupt("return", new Promise(function (resolve, reject) { - var objectStore = db.transaction(STORE_NAME).objectStore(STORE_NAME); - var payloads = []; - var cursorRequest = objectStore.openCursor(); - - cursorRequest.onsuccess = function (event) { - var cursor = event.target.result; - - if (cursor) { - payloads.push(cursor.value); - cursor.continue(); - } else { - resolve(payloads); - } - }; - })); - - case 4: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function getAllPayloads() { - return _getAllPayloads.apply(this, arguments); - } - - return getAllPayloads; - }() - /** @access public */ - - }, { - key: "savePayload", - value: function () { - var _savePayload = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(payload) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - return _context3.abrupt("return", this.savePayloads([payload])); - - case 1: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function savePayload(_x2) { - return _savePayload.apply(this, arguments); - } - - return savePayload; - }() - /** @access public */ - - }, { - key: "savePayloads", - value: function () { - var _savePayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(payloads) { - var _this2 = this; - - var db, transaction; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - if (!(payloads.length === 0)) { - _context4.next = 2; - break; - } - - return _context4.abrupt("return"); - - case 2: - _context4.next = 4; - return this.openDatabase(); - - case 4: - db = _context4.sent; - transaction = db.transaction(STORE_NAME, READ_WRITE); - return _context4.abrupt("return", new Promise(function (resolve, reject) { - transaction.oncomplete = function () {}; - - transaction.onerror = function (event) { - _this2.showGenericError(event.target.error); - }; - - transaction.onblocked = function (event) { - _this2.showGenericError(event.target.error); - }; - - transaction.onabort = function (event) { - var error = event.target.error; - - if (error.name === QUOTE_EXCEEDED_ERROR) { - _this2.showAlert(OUT_OF_SPACE); - } else { - _this2.showGenericError(error); - } - - reject(error); - }; - - var objectStore = transaction.objectStore(STORE_NAME); - - _this2.putItems(objectStore, payloads).then(resolve); - })); - - case 7: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function savePayloads(_x3) { - return _savePayloads.apply(this, arguments); - } - - return savePayloads; - }() - /** @access private */ - - }, { - key: "putItems", - value: function putItems(objectStore, items) { - return Promise.all(items.map(function (item) { - return new Promise(function (resolve, reject) { - var request = objectStore.put(item); - request.onerror = resolve; - request.onsuccess = resolve; - }); - })); - } - /** @access public */ - - }, { - key: "deletePayload", - value: function () { - var _deletePayload = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(uuid) { - var db; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - _context5.next = 2; - return this.openDatabase(); - - case 2: - db = _context5.sent; - return _context5.abrupt("return", new Promise(function (resolve, reject) { - var request = db.transaction(STORE_NAME, READ_WRITE).objectStore(STORE_NAME).delete(uuid); - request.onsuccess = resolve; - request.onerror = reject; - })); - - case 4: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function deletePayload(_x4) { - return _deletePayload.apply(this, arguments); - } - - return deletePayload; - }() - /** @access public */ - - }, { - key: "clearAllPayloads", - value: function () { - var _clearAllPayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6() { - var _this3 = this; - - var deleteRequest; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - deleteRequest = window.indexedDB.deleteDatabase(DB_NAME); - return _context6.abrupt("return", new Promise(function (resolve, reject) { - deleteRequest.onerror = function () { - reject(Error('Error deleting database.')); - }; - - deleteRequest.onsuccess = function () { - _this3.db = null; - resolve(); - }; - - deleteRequest.onblocked = function (event) { - _this3.showAlert(DB_DELETION_BLOCKED); - - reject(Error('Delete request blocked')); - }; - })); - - case 2: - case "end": - return _context6.stop(); - } - } - }, _callee6); - })); - - function clearAllPayloads() { - return _clearAllPayloads.apply(this, arguments); - } - - return clearAllPayloads; - }() - /** @access private */ - - }, { - key: "showAlert", - value: function showAlert(message) { - this.alertService.alert({ - text: message - }); - } - /** - * @access private - * @param {object} error - {code, name} - */ - - }, { - key: "showGenericError", - value: function showGenericError(error) { - var message = "Unable to save changes locally due to an unknown system issue. " + "Issue Code: ".concat(error.code, " Issue Name: ").concat(error.name, "."); - this.showAlert(message); - } - /** @access private */ - - }, { - key: "displayOfflineAlert", - value: function displayOfflineAlert() { - var message = "There was an issue loading your offline database. This could happen for two reasons:" + "\n\n1. You're in a private window in your browser. We can't save your data without " + "access to the local database. Please use a non-private window." + "\n\n2. You have two windows of the app open at the same time. " + "Please close any other app instances and reload the page."; - this.alertService.alert({ - text: message - }); - } - }]); - - return Database; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/autofocus.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/autofocus.js ***! - \*******************************************************************/ -/*! exports provided: autofocus */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autofocus", function() { return autofocus; }); -autofocus.$inject = ["$timeout"]; - -/* @ngInject */ -function autofocus($timeout) { - return { - restrict: 'A', - scope: { - shouldFocus: '=' - }, - link: function link($scope, $element) { - $timeout(function () { - if ($scope.shouldFocus) { - $element[0].focus(); - } - }); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/click-outside.js": -/*!***********************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/click-outside.js ***! - \***********************************************************************/ -/*! exports provided: clickOutside */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clickOutside", function() { return clickOutside; }); -clickOutside.$inject = ["$document"]; - -/* @ngInject */ -function clickOutside($document) { - return { - restrict: 'A', - replace: false, - link: function link($scope, $element, attrs) {// Causes memory leak as-is: - // let didApplyClickOutside = false; - // $scope.$on('$destroy', () => { - // attrs.clickOutside = null; - // $element.unbind('click', $scope.onElementClick); - // $document.unbind('click', $scope.onDocumentClick); - // $scope.onElementClick = null; - // $scope.onDocumentClick = null; - // }); - // $scope.onElementClick = (event) => { - // didApplyClickOutside = false; - // if (attrs.isOpen) { - // event.stopPropagation(); - // } - // }; - // $scope.onDocumentClick = (event) => { - // /* Ignore click if on SKAlert */ - // if (event.target.closest('.sk-modal')) { - // return; - // } - // if (!didApplyClickOutside) { - // $scope.$apply(attrs.clickOutside); - // didApplyClickOutside = true; - // } - // }; - // $element.bind('click', $scope.onElementClick); - // $document.bind('click', $scope.onDocumentClick); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/delay-hide.js": -/*!********************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/delay-hide.js ***! - \********************************************************************/ -/*! exports provided: delayHide */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delayHide", function() { return delayHide; }); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); -delayHide.$inject = ["$timeout"]; - -/* @ngInject */ - -function delayHide($timeout) { - return { - restrict: 'A', - scope: { - show: '=', - delay: '@' - }, - link: function link(scope, elem, attrs) { - showElement(false); // This is where all the magic happens! - // Whenever the scope variable updates we simply - // show if it evaluates to 'true' and hide if 'false' - - scope.$watch('show', function (newVal) { - newVal ? showSpinner() : hideSpinner(); - }); - - function showSpinner() { - if (scope.hidePromise) { - $timeout.cancel(scope.hidePromise); - scope.hidePromise = null; - } - - showElement(true); - } - - function hideSpinner() { - scope.hidePromise = $timeout(showElement.bind(this, false), getDelay()); - } - - function showElement(show) { - show ? elem.css({ - display: '' - }) : elem.css({ - display: 'none' - }); - } - - function getDelay() { - var delay = parseInt(scope.delay); - return angular__WEBPACK_IMPORTED_MODULE_0___default.a.isNumber(delay) ? delay : 200; - } - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/elemReady.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/elemReady.js ***! - \*******************************************************************/ -/*! exports provided: elemReady */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elemReady", function() { return elemReady; }); -elemReady.$inject = ["$parse"]; - -/* @ngInject */ -function elemReady($parse) { - return { - restrict: 'A', - link: function link($scope, elem, attrs) { - elem.ready(function () { - $scope.$apply(function () { - var func = $parse(attrs.elemReady); - func($scope); - }); - }); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/file-change.js": -/*!*********************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/file-change.js ***! - \*********************************************************************/ -/*! exports provided: fileChange */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fileChange", function() { return fileChange; }); -/* @ngInject */ -function fileChange() { - return { - restrict: 'A', - scope: { - handler: '&' - }, - link: function link(scope, element) { - element.on('change', function (event) { - scope.$apply(function () { - scope.handler({ - files: event.target.files - }); - }); - }); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/index.js": -/*!***************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/index.js ***! - \***************************************************************/ -/*! exports provided: autofocus, clickOutside, delayHide, elemReady, fileChange, infiniteScroll, lowercase, selectOnClick, snEnter */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _autofocus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autofocus */ "./app/assets/javascripts/directives/functional/autofocus.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "autofocus", function() { return _autofocus__WEBPACK_IMPORTED_MODULE_0__["autofocus"]; }); - -/* harmony import */ var _click_outside__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./click-outside */ "./app/assets/javascripts/directives/functional/click-outside.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "clickOutside", function() { return _click_outside__WEBPACK_IMPORTED_MODULE_1__["clickOutside"]; }); - -/* harmony import */ var _delay_hide__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./delay-hide */ "./app/assets/javascripts/directives/functional/delay-hide.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayHide", function() { return _delay_hide__WEBPACK_IMPORTED_MODULE_2__["delayHide"]; }); - -/* harmony import */ var _elemReady__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./elemReady */ "./app/assets/javascripts/directives/functional/elemReady.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elemReady", function() { return _elemReady__WEBPACK_IMPORTED_MODULE_3__["elemReady"]; }); - -/* harmony import */ var _file_change__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./file-change */ "./app/assets/javascripts/directives/functional/file-change.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fileChange", function() { return _file_change__WEBPACK_IMPORTED_MODULE_4__["fileChange"]; }); - -/* harmony import */ var _infiniteScroll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./infiniteScroll */ "./app/assets/javascripts/directives/functional/infiniteScroll.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "infiniteScroll", function() { return _infiniteScroll__WEBPACK_IMPORTED_MODULE_5__["infiniteScroll"]; }); - -/* harmony import */ var _lowercase__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lowercase */ "./app/assets/javascripts/directives/functional/lowercase.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lowercase", function() { return _lowercase__WEBPACK_IMPORTED_MODULE_6__["lowercase"]; }); - -/* harmony import */ var _selectOnClick__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./selectOnClick */ "./app/assets/javascripts/directives/functional/selectOnClick.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectOnClick", function() { return _selectOnClick__WEBPACK_IMPORTED_MODULE_7__["selectOnClick"]; }); - -/* harmony import */ var _snEnter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./snEnter */ "./app/assets/javascripts/directives/functional/snEnter.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "snEnter", function() { return _snEnter__WEBPACK_IMPORTED_MODULE_8__["snEnter"]; }); - - - - - - - - - - - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/infiniteScroll.js": -/*!************************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/infiniteScroll.js ***! - \************************************************************************/ -/*! exports provided: infiniteScroll */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "infiniteScroll", function() { return infiniteScroll; }); -/* @ngInject */ -function infiniteScroll() { - return { - link: function link(scope, elem, attrs) { - var offset = parseInt(attrs.threshold) || 0; - var e = elem[0]; - - scope.onScroll = function () { - if (scope.$eval(attrs.canLoad) && e.scrollTop + e.offsetHeight >= e.scrollHeight - offset) { - scope.$apply(attrs.infiniteScroll); - } - }; - - elem.on('scroll', scope.onScroll); - scope.$on('$destroy', function () { - elem.off('scroll', scope.onScroll); - ; - }); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/lowercase.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/lowercase.js ***! - \*******************************************************************/ -/*! exports provided: lowercase */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lowercase", function() { return lowercase; }); -/* @ngInject */ -function lowercase() { - return { - require: 'ngModel', - link: function link(scope, element, attrs, modelCtrl) { - var lowercase = function lowercase(inputValue) { - if (inputValue === undefined) inputValue = ''; - var lowercased = inputValue.toLowerCase(); - - if (lowercased !== inputValue) { - modelCtrl.$setViewValue(lowercased); - modelCtrl.$render(); - } - - return lowercased; - }; - - modelCtrl.$parsers.push(lowercase); - lowercase(scope[attrs.ngModel]); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/selectOnClick.js": -/*!***********************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/selectOnClick.js ***! - \***********************************************************************/ -/*! exports provided: selectOnClick */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectOnClick", function() { return selectOnClick; }); -selectOnClick.$inject = ["$window"]; - -/* @ngInject */ -function selectOnClick($window) { - return { - restrict: 'A', - link: function link(scope, element, attrs) { - element.on('focus', function () { - if (!$window.getSelection().toString()) { - /** Required for mobile Safari */ - this.setSelectionRange(0, this.value.length); - } - }); - } - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/functional/snEnter.js": -/*!*****************************************************************!*\ - !*** ./app/assets/javascripts/directives/functional/snEnter.js ***! - \*****************************************************************/ -/*! exports provided: snEnter */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "snEnter", function() { return snEnter; }); -/* @ngInject */ -function snEnter() { - return function (scope, element, attrs) { - element.bind('keydown keypress', function (event) { - if (event.which === 13) { - scope.$apply(function () { - scope.$eval(attrs.snEnter, { - event: event - }); - }); - event.preventDefault(); - } - }); - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/accountMenu.js": -/*!****************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/accountMenu.js ***! - \****************************************************************/ -/*! exports provided: AccountMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AccountMenu", function() { return AccountMenu; }); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _directives_account_menu_pug__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! %/directives/account-menu.pug */ "./app/assets/templates/directives/account-menu.pug"); -/* harmony import */ var _directives_account_menu_pug__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_directives_account_menu_pug__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @/strings */ "./app/assets/javascripts/strings.js"); - - - - - - - - - - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - - - - - - -var ELEMENT_ID_IMPORT_PASSWORD_INPUT = 'import-password-request'; -var ELEMENT_NAME_AUTH_EMAIL = 'email'; -var ELEMENT_NAME_AUTH_PASSWORD = 'password'; -var ELEMENT_NAME_AUTH_PASSWORD_CONF = 'password_conf'; - -var AccountMenuCtrl = /*#__PURE__*/function (_PureCtrl) { - AccountMenuCtrl.$inject = ["$timeout", "appVersion"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(AccountMenuCtrl, _PureCtrl); - - /* @ngInject */ - function AccountMenuCtrl($timeout, appVersion) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, AccountMenuCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(AccountMenuCtrl).call(this, $timeout)); - _this.appVersion = appVersion; - return _this; - } - /** @override */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(AccountMenuCtrl, [{ - key: "getInitialState", - value: function getInitialState() { - return { - appVersion: 'v' + (window.electronAppVersion || this.appVersion), - passcodeAutoLockOptions: this.application.getLockService().getAutoLockIntervalOptions(), - user: this.application.getUser(), - formData: { - mergeLocal: true, - ephemeral: false - }, - mutable: {} - }; - } - }, { - key: "onAppKeyChange", - value: function () { - var _onAppKeyChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(AccountMenuCtrl.prototype), "onAppKeyChange", this).call(this); - - this.setState(this.refreshedCredentialState()); - - case 2: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function onAppKeyChange() { - return _onAppKeyChange.apply(this, arguments); - } - - return onAppKeyChange; - }() - }, { - key: "onAppLaunch", - value: function () { - var _onAppLaunch = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(AccountMenuCtrl.prototype), "onAppLaunch", this).call(this); - - this.setState(this.refreshedCredentialState()); - this.loadHost(); - this.reloadAutoLockInterval(); - this.loadBackupsAvailability(); - - case 5: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function onAppLaunch() { - return _onAppLaunch.apply(this, arguments); - } - - return onAppLaunch; - }() - }, { - key: "refreshedCredentialState", - value: function refreshedCredentialState() { - return { - user: this.application.getUser(), - canAddPasscode: !this.application.isEphemeralSession(), - hasPasscode: this.application.hasPasscode(), - showPasscodeForm: false - }; - } - }, { - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(AccountMenuCtrl.prototype), "$onInit", this).call(this); - - this.initProps({ - closeFunction: this.closeFunction - }); - this.syncStatus = this.application.getSyncStatus(); - } - }, { - key: "close", - value: function close() { - var _this2 = this; - - this.$timeout(function () { - _this2.props.closeFunction(); - }); - } - }, { - key: "loadHost", - value: function () { - var _loadHost = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3() { - var host; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _context3.next = 2; - return this.application.getHost(); - - case 2: - host = _context3.sent; - this.setState({ - server: host, - formData: _objectSpread({}, this.state.formData, { - url: host - }) - }); - - case 4: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function loadHost() { - return _loadHost.apply(this, arguments); - } - - return loadHost; - }() - }, { - key: "onHostInputChange", - value: function onHostInputChange() { - var url = this.state.formData.url; - this.application.setHost(url); - } - }, { - key: "loadBackupsAvailability", - value: function () { - var _loadBackupsAvailability = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4() { - var hasUser, hasPasscode, encryptedAvailable, encryptionStatusString; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - encryptionStatusString = function _ref() { - if (hasUser) { - return _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_E2E_ENABLED"]; - } else if (hasPasscode) { - return _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_LOCAL_ENC_ENABLED"]; - } else { - return _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_ENC_NOT_ENABLED"]; - } - }; - - hasUser = !Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isNullOrUndefined"])(this.application.getUser()); - hasPasscode = this.application.hasPasscode(); - encryptedAvailable = hasUser || hasPasscode; - this.setState({ - encryptionStatusString: encryptionStatusString(), - encryptionEnabled: encryptedAvailable, - mutable: _objectSpread({}, this.state.mutable, { - backupEncrypted: encryptedAvailable - }) - }); - - case 5: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function loadBackupsAvailability() { - return _loadBackupsAvailability.apply(this, arguments); - } - - return loadBackupsAvailability; - }() - }, { - key: "submitMfaForm", - value: function submitMfaForm() { - this.login(); - } - }, { - key: "blurAuthFields", - value: function blurAuthFields() { - var names = [ELEMENT_NAME_AUTH_EMAIL, ELEMENT_NAME_AUTH_PASSWORD, ELEMENT_NAME_AUTH_PASSWORD_CONF]; - - for (var _i = 0, _names = names; _i < _names.length; _i++) { - var name = _names[_i]; - var element = document.getElementsByName(name)[0]; - - if (element) { - element.blur(); - } - } - } - }, { - key: "submitAuthForm", - value: function submitAuthForm() { - if (!this.state.formData.email || !this.state.formData.user_password) { - return; - } - - this.blurAuthFields(); - - if (this.state.formData.showLogin) { - this.login(); - } else { - this.register(); - } - } - }, { - key: "setFormDataState", - value: function () { - var _setFormDataState = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee5(formData) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - return _context5.abrupt("return", this.setState({ - formData: _objectSpread({}, this.state.formData, {}, formData) - })); - - case 1: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function setFormDataState(_x) { - return _setFormDataState.apply(this, arguments); - } - - return setFormDataState; - }() - }, { - key: "login", - value: function () { - var _login = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee6() { - var response, hasError, error; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - _context6.next = 2; - return this.setFormDataState({ - status: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_GENERATING_LOGIN_KEYS"], - authenticating: true - }); - - case 2: - _context6.next = 4; - return this.application.signIn({ - email: this.state.formData.email, - password: this.state.formData.user_password, - strict: this.state.formData.strictSignin, - ephemeral: this.state.formData.ephemeral, - mfaKeyPath: this.state.formData.mfa && this.state.formData.mfa.payload.mfa_key, - mfaCode: this.state.formData.userMfaCode, - mergeLocal: this.state.formData.mergeLocal - }); - - case 4: - response = _context6.sent; - hasError = !response || response.error; - - if (hasError) { - _context6.next = 11; - break; - } - - _context6.next = 9; - return this.setFormDataState({ - authenticating: false, - user_password: null - }); - - case 9: - this.close(); - return _context6.abrupt("return"); - - case 11: - error = response ? response.error : { - message: "An unknown error occured." - }; - - if (!(error.tag === 'mfa-required' || error.tag === 'mfa-invalid')) { - _context6.next = 17; - break; - } - - _context6.next = 15; - return this.setFormDataState({ - showLogin: false, - mfa: error, - status: null - }); - - case 15: - _context6.next = 20; - break; - - case 17: - _context6.next = 19; - return this.setFormDataState({ - showLogin: true, - mfa: null, - status: null, - user_password: null - }); - - case 19: - if (error.message) { - this.application.alertService.alert({ - text: error.message - }); - } - - case 20: - _context6.next = 22; - return this.setFormDataState({ - authenticating: false - }); - - case 22: - case "end": - return _context6.stop(); - } - } - }, _callee6, this); - })); - - function login() { - return _login.apply(this, arguments); - } - - return login; - }() - }, { - key: "register", - value: function () { - var _register = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee7() { - var confirmation, response, error; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee7$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - confirmation = this.state.formData.password_conf; - - if (!(confirmation !== this.state.formData.user_password)) { - _context7.next = 4; - break; - } - - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_NON_MATCHING_PASSWORDS"] - }); - return _context7.abrupt("return"); - - case 4: - _context7.next = 6; - return this.setFormDataState({ - confirmPassword: false, - status: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_GENERATING_REGISTER_KEYS"], - authenticating: true - }); - - case 6: - _context7.next = 8; - return this.application.register({ - email: this.state.formData.email, - password: this.state.formData.user_password, - ephemeral: this.state.formData.ephemeral, - mergeLocal: this.state.formData.mergeLocal - }); - - case 8: - response = _context7.sent; - - if (!(!response || response.error)) { - _context7.next = 18; - break; - } - - _context7.next = 12; - return this.setFormDataState({ - status: null - }); - - case 12: - error = response ? response.error : { - message: "An unknown error occured." - }; - _context7.next = 15; - return this.setFormDataState({ - authenticating: false - }); - - case 15: - this.application.alertService.alert({ - text: error.message - }); - _context7.next = 21; - break; - - case 18: - _context7.next = 20; - return this.setFormDataState({ - authenticating: false - }); - - case 20: - this.close(); - - case 21: - case "end": - return _context7.stop(); - } - } - }, _callee7, this); - })); - - function register() { - return _register.apply(this, arguments); - } - - return register; - }() - }, { - key: "mergeLocalChanged", - value: function mergeLocalChanged() { - var _this3 = this; - - if (!this.state.formData.mergeLocal) { - this.application.alertService.confirm({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_ACCOUNT_MENU_UNCHECK_MERGE"], - destructive: true, - onCancel: function onCancel() { - _this3.setFormDataState({ - mergeLocal: true - }); - } - }); - } - } - }, { - key: "openPasswordWizard", - value: function openPasswordWizard() { - this.close(); - this.application.presentPasswordWizard(); - } - }, { - key: "openPrivilegesModal", - value: function () { - var _openPrivilegesModal = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee8() { - var _this4 = this; - - var run, needsPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee8$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - this.close(); - - run = function run() { - _this4.application.presentPrivilegesManagementModal(); - }; - - _context8.next = 4; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePrivileges); - - case 4: - needsPrivilege = _context8.sent; - - if (needsPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePrivileges, function () { - run(); - }); - } else { - run(); - } - - case 6: - case "end": - return _context8.stop(); - } - } - }, _callee8, this); - })); - - function openPrivilegesModal() { - return _openPrivilegesModal.apply(this, arguments); - } - - return openPrivilegesModal; - }() - }, { - key: "destroyLocalData", - value: function destroyLocalData() { - var _this5 = this; - - this.application.alertService.confirm({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_SIGN_OUT_CONFIRMATION"], - destructive: true, - onConfirm: function () { - var _onConfirm = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee9() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee9$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - _context9.next = 2; - return _this5.application.signOut(); - - case 2: - case "end": - return _context9.stop(); - } - } - }, _callee9); - })); - - function onConfirm() { - return _onConfirm.apply(this, arguments); - } - - return onConfirm; - }() - }); - } - }, { - key: "submitImportPassword", - value: function () { - var _submitImportPassword = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee10() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee10$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - _context10.next = 2; - return this.performImport(this.state.importData.data, this.state.importData.password); - - case 2: - case "end": - return _context10.stop(); - } - } - }, _callee10, this); - })); - - function submitImportPassword() { - return _submitImportPassword.apply(this, arguments); - } - - return submitImportPassword; - }() - }, { - key: "readFile", - value: function () { - var _readFile = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee11(file) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee11$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - return _context11.abrupt("return", new Promise(function (resolve, reject) { - var reader = new FileReader(); - - reader.onload = function (e) { - try { - var data = JSON.parse(e.target.result); - resolve(data); - } catch (e) { - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_INVALID_IMPORT_FILE"] - }); - } - }; - - reader.readAsText(file); - })); - - case 1: - case "end": - return _context11.stop(); - } - } - }, _callee11); - })); - - function readFile(_x2) { - return _readFile.apply(this, arguments); - } - - return readFile; - }() - /** - * @template - */ - - }, { - key: "importFileSelected", - value: function () { - var _importFileSelected = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee13(files) { - var _this6 = this; - - var run, needsPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee13$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - run = /*#__PURE__*/function () { - var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee12() { - var file, data, element; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee12$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - file = files[0]; - _context12.next = 3; - return _this6.readFile(file); - - case 3: - data = _context12.sent; - - if (data) { - _context12.next = 6; - break; - } - - return _context12.abrupt("return"); - - case 6: - if (!data.auth_params) { - _context12.next = 13; - break; - } - - _context12.next = 9; - return _this6.setState({ - importData: _objectSpread({}, _this6.state.importData, { - requestPassword: true, - data: data - }) - }); - - case 9: - element = document.getElementById(ELEMENT_ID_IMPORT_PASSWORD_INPUT); - - if (element) { - element.scrollIntoView(false); - } - - _context12.next = 15; - break; - - case 13: - _context12.next = 15; - return _this6.performImport(data, null); - - case 15: - case "end": - return _context12.stop(); - } - } - }, _callee12); - })); - - return function run() { - return _ref2.apply(this, arguments); - }; - }(); - - _context13.next = 3; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManageBackups); - - case 3: - needsPrivilege = _context13.sent; - - if (needsPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManageBackups, run); - } else { - run(); - } - - case 5: - case "end": - return _context13.stop(); - } - } - }, _callee13, this); - })); - - function importFileSelected(_x3) { - return _importFileSelected.apply(this, arguments); - } - - return importFileSelected; - }() - }, { - key: "performImport", - value: function () { - var _performImport = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee14(data, password) { - var errorCount, message; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee14$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - _context14.next = 2; - return this.setState({ - importData: _objectSpread({}, this.state.importData, { - loading: true - }) - }); - - case 2: - _context14.next = 4; - return this.importJSONData(data, password); - - case 4: - errorCount = _context14.sent; - this.setState({ - importData: null - }); - - if (errorCount > 0) { - message = Object(_strings__WEBPACK_IMPORTED_MODULE_13__["StringImportError"])({ - errorCount: errorCount - }); - this.application.alertService.alert({ - text: message - }); - } else { - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_IMPORT_SUCCESS"] - }); - } - - case 7: - case "end": - return _context14.stop(); - } - } - }, _callee14, this); - })); - - function performImport(_x4, _x5) { - return _performImport.apply(this, arguments); - } - - return performImport; - }() - }, { - key: "importJSONData", - value: function () { - var _importJSONData = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee15(data, password) { - var _ref3, affectedItems, errorCount, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, item; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee15$(_context15) { - while (1) { - switch (_context15.prev = _context15.next) { - case 0: - _context15.next = 2; - return this.application.importData({ - data: data.items, - password: password - }); - - case 2: - _ref3 = _context15.sent; - affectedItems = _ref3.affectedItems; - errorCount = _ref3.errorCount; - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context15.prev = 8; - - for (_iterator = affectedItems[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - item = _step.value; - - /** - * Don't want to activate any components during import process in - * case of exceptions breaking up the import proccess - */ - if (item.content_type === 'SN|Component') { - item.active = false; - } - } - - _context15.next = 16; - break; - - case 12: - _context15.prev = 12; - _context15.t0 = _context15["catch"](8); - _didIteratorError = true; - _iteratorError = _context15.t0; - - case 16: - _context15.prev = 16; - _context15.prev = 17; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 19: - _context15.prev = 19; - - if (!_didIteratorError) { - _context15.next = 22; - break; - } - - throw _iteratorError; - - case 22: - return _context15.finish(19); - - case 23: - return _context15.finish(16); - - case 24: - return _context15.abrupt("return", errorCount); - - case 25: - case "end": - return _context15.stop(); - } - } - }, _callee15, this, [[8, 12, 16, 24], [17,, 19, 23]]); - })); - - function importJSONData(_x6, _x7) { - return _importJSONData.apply(this, arguments); - } - - return importJSONData; - }() - }, { - key: "downloadDataArchive", - value: function () { - var _downloadDataArchive = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee16() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee16$(_context16) { - while (1) { - switch (_context16.prev = _context16.next) { - case 0: - this.application.getArchiveService().downloadBackup(this.state.mutable.backupEncrypted); - - case 1: - case "end": - return _context16.stop(); - } - } - }, _callee16, this); - })); - - function downloadDataArchive() { - return _downloadDataArchive.apply(this, arguments); - } - - return downloadDataArchive; - }() - }, { - key: "notesAndTagsCount", - value: function notesAndTagsCount() { - return this.application.getItems({ - contentType: ['Note', 'Tag'] - }).length; - } - }, { - key: "encryptionStatusForNotes", - value: function encryptionStatusForNotes() { - var length = this.notesAndTagsCount(); - return length + "/" + length + " notes and tags encrypted"; - } - }, { - key: "reloadAutoLockInterval", - value: function () { - var _reloadAutoLockInterval = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee17() { - var interval; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee17$(_context17) { - while (1) { - switch (_context17.prev = _context17.next) { - case 0: - _context17.next = 2; - return this.application.getLockService().getAutoLockInterval(); - - case 2: - interval = _context17.sent; - this.setState({ - selectedAutoLockInterval: interval - }); - - case 4: - case "end": - return _context17.stop(); - } - } - }, _callee17, this); - })); - - function reloadAutoLockInterval() { - return _reloadAutoLockInterval.apply(this, arguments); - } - - return reloadAutoLockInterval; - }() - }, { - key: "selectAutoLockInterval", - value: function () { - var _selectAutoLockInterval = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee19(interval) { - var _this7 = this; - - var run, needsPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee19$(_context19) { - while (1) { - switch (_context19.prev = _context19.next) { - case 0: - run = /*#__PURE__*/function () { - var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee18() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee18$(_context18) { - while (1) { - switch (_context18.prev = _context18.next) { - case 0: - _context18.next = 2; - return _this7.application.getLockService().setAutoLockInterval(interval); - - case 2: - _this7.reloadAutoLockInterval(); - - case 3: - case "end": - return _context18.stop(); - } - } - }, _callee18); - })); - - return function run() { - return _ref4.apply(this, arguments); - }; - }(); - - _context19.next = 3; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode); - - case 3: - needsPrivilege = _context19.sent; - - if (needsPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode, function () { - run(); - }); - } else { - run(); - } - - case 5: - case "end": - return _context19.stop(); - } - } - }, _callee19, this); - })); - - function selectAutoLockInterval(_x8) { - return _selectAutoLockInterval.apply(this, arguments); - } - - return selectAutoLockInterval; - }() - }, { - key: "hidePasswordForm", - value: function hidePasswordForm() { - this.setFormDataState({ - showLogin: false, - showRegister: false, - user_password: null, - password_conf: null - }); - } - }, { - key: "hasPasscode", - value: function hasPasscode() { - return this.passcodeManager.hasPasscode(); - } - }, { - key: "addPasscodeClicked", - value: function addPasscodeClicked() { - this.setFormDataState({ - showPasscodeForm: true - }); - } - }, { - key: "submitPasscodeForm", - value: function submitPasscodeForm() { - var _this8 = this; - - var passcode = this.state.formData.passcode; - - if (passcode !== this.state.formData.confirmPasscode) { - this.application.alertService.alert({ - text: _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_NON_MATCHING_PASSCODES"] - }); - return; - } - - (this.state.formData.changingPasscode ? this.application.changePasscode(passcode) : this.application.setPasscode(passcode)).then(function () { - _this8.setFormDataState({ - passcode: null, - confirmPasscode: null, - showPasscodeForm: false - }); - }); - } - }, { - key: "changePasscodePressed", - value: function () { - var _changePasscodePressed = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee20() { - var _this9 = this; - - var run, needsPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee20$(_context20) { - while (1) { - switch (_context20.prev = _context20.next) { - case 0: - run = function run() { - _this9.state.formData.changingPasscode = true; - - _this9.addPasscodeClicked(); - }; - - _context20.next = 3; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode); - - case 3: - needsPrivilege = _context20.sent; - - if (needsPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode, run); - } else { - run(); - } - - case 5: - case "end": - return _context20.stop(); - } - } - }, _callee20, this); - })); - - function changePasscodePressed() { - return _changePasscodePressed.apply(this, arguments); - } - - return changePasscodePressed; - }() - }, { - key: "removePasscodePressed", - value: function () { - var _removePasscodePressed = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee22() { - var _this10 = this; - - var run, needsPrivilege; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee22$(_context22) { - while (1) { - switch (_context22.prev = _context22.next) { - case 0: - run = /*#__PURE__*/function () { - var _ref5 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee21() { - var signedIn, message; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee21$(_context21) { - while (1) { - switch (_context21.prev = _context21.next) { - case 0: - _context21.t0 = _utils__WEBPACK_IMPORTED_MODULE_9__["isNullOrUndefined"]; - _context21.next = 3; - return _this10.application.getUser(); - - case 3: - _context21.t1 = _context21.sent; - signedIn = !(0, _context21.t0)(_context21.t1); - message = _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_REMOVE_PASSCODE_CONFIRMATION"]; - - if (!signedIn) { - message += _strings__WEBPACK_IMPORTED_MODULE_13__["STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM"]; - } - - _this10.application.alertService.confirm({ - text: message, - destructive: true, - onConfirm: function onConfirm() { - _this10.application.removePasscode(); - } - }); - - case 8: - case "end": - return _context21.stop(); - } - } - }, _callee21); - })); - - return function run() { - return _ref5.apply(this, arguments); - }; - }(); - - _context22.next = 3; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode); - - case 3: - needsPrivilege = _context22.sent; - - if (needsPrivilege) { - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_11__["ProtectedActions"].ManagePasscode, run); - } else { - run(); - } - - case 5: - case "end": - return _context22.stop(); - } - } - }, _callee22, this); - })); - - function removePasscodePressed() { - return _removePasscodePressed.apply(this, arguments); - } - - return removePasscodePressed; - }() - }, { - key: "isDesktopApplication", - value: function isDesktopApplication() { - return Object(_utils__WEBPACK_IMPORTED_MODULE_9__["isDesktopApplication"])(); - } - }]); - - return AccountMenuCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_12__["PureCtrl"]); - -var AccountMenu = function AccountMenu() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, AccountMenu); - - this.restrict = 'E'; - this.template = _directives_account_menu_pug__WEBPACK_IMPORTED_MODULE_10___default.a; - this.controller = AccountMenuCtrl; - this.controllerAs = 'self'; - this.bindToController = true; - this.scope = { - closeFunction: '&', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/actionsMenu.js": -/*!****************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/actionsMenu.js ***! - \****************************************************************/ -/*! exports provided: ActionsMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionsMenu", function() { return ActionsMenu; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _directives_actions_menu_pug__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! %/directives/actions-menu.pug */ "./app/assets/templates/directives/actions-menu.pug"); -/* harmony import */ var _directives_actions_menu_pug__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_directives_actions_menu_pug__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - - -var ActionsMenuCtrl = /*#__PURE__*/function (_PureCtrl) { - ActionsMenuCtrl.$inject = ["$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(ActionsMenuCtrl, _PureCtrl); - - /* @ngInject */ - function ActionsMenuCtrl($timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ActionsMenuCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ActionsMenuCtrl).call(this, $timeout)); - _this.state = { - extensions: [] - }; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ActionsMenuCtrl, [{ - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ActionsMenuCtrl.prototype), "$onInit", this).call(this); - - this.initProps({ - item: this.item - }); - this.loadExtensions(); - } - }, { - key: "loadExtensions", - value: function () { - var _loadExtensions = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var extensions, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, extension; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - extensions = this.application.actionsManager.getExtensions().sort(function (a, b) { - return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; - }); - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context.prev = 4; - _iterator = extensions[Symbol.iterator](); - - case 6: - if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { - _context.next = 15; - break; - } - - extension = _step.value; - extension.loading = true; - _context.next = 11; - return this.application.actionsManager.loadExtensionInContextOfItem(extension, this.props.item); - - case 11: - extension.loading = false; - - case 12: - _iteratorNormalCompletion = true; - _context.next = 6; - break; - - case 15: - _context.next = 21; - break; - - case 17: - _context.prev = 17; - _context.t0 = _context["catch"](4); - _didIteratorError = true; - _iteratorError = _context.t0; - - case 21: - _context.prev = 21; - _context.prev = 22; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 24: - _context.prev = 24; - - if (!_didIteratorError) { - _context.next = 27; - break; - } - - throw _iteratorError; - - case 27: - return _context.finish(24); - - case 28: - return _context.finish(21); - - case 29: - this.setState({ - extensions: extensions - }); - - case 30: - case "end": - return _context.stop(); - } - } - }, _callee, this, [[4, 17, 21, 29], [22,, 24, 28]]); - })); - - function loadExtensions() { - return _loadExtensions.apply(this, arguments); - } - - return loadExtensions; - }() - }, { - key: "executeAction", - value: function () { - var _executeAction = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(action, extension) { - var result; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(action.verb === 'nested')) { - _context2.next = 3; - break; - } - - if (!action.subrows) { - action.subrows = this.subRowsForAction(action, extension); - } else { - action.subrows = null; - } - - return _context2.abrupt("return"); - - case 3: - action.running = true; - _context2.next = 6; - return this.application.actionsManager.runAction({ - action: action, - item: this.props.item, - passwordRequestHandler: function passwordRequestHandler() {} - }); - - case 6: - result = _context2.sent; - - if (!action.error) { - _context2.next = 9; - break; - } - - return _context2.abrupt("return"); - - case 9: - action.running = false; - this.handleActionResult(action, result); - _context2.next = 13; - return this.application.actionsManager.loadExtensionInContextOfItem(extension, this.props.item); - - case 13: - this.setState({ - extensions: this.state.extensions - }); - - case 14: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function executeAction(_x, _x2) { - return _executeAction.apply(this, arguments); - } - - return executeAction; - }() - }, { - key: "handleActionResult", - value: function handleActionResult(action, result) { - switch (action.verb) { - case 'render': - { - var item = result.item; - this.application.presentRevisionPreviewModal(item.uuid, item.content); - } - } - } - }, { - key: "subRowsForAction", - value: function subRowsForAction(parentAction, extension) { - var _this2 = this; - - if (!parentAction.subactions) { - return null; - } - - return parentAction.subactions.map(function (subaction) { - return { - onClick: function onClick() { - _this2.executeAction(subaction, extension, parentAction); - }, - label: subaction.label, - subtitle: subaction.desc, - spinnerClass: subaction.running ? 'info' : null - }; - }); - } - }]); - - return ActionsMenuCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_9__["PureCtrl"]); - -var ActionsMenu = function ActionsMenu() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ActionsMenu); - - this.restrict = 'E'; - this.template = _directives_actions_menu_pug__WEBPACK_IMPORTED_MODULE_8___default.a; - this.replace = true; - this.controller = ActionsMenuCtrl; - this.controllerAs = 'self'; - this.bindToController = true; - this.scope = { - item: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/challengeModal.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/challengeModal.js ***! - \*******************************************************************/ -/*! exports provided: ChallengeModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChallengeModal", function() { return ChallengeModal; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _directives_challenge_modal_pug__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! %/directives/challenge-modal.pug */ "./app/assets/templates/directives/challenge-modal.pug"); -/* harmony import */ var _directives_challenge_modal_pug__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_directives_challenge_modal_pug__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - - - -var ChallengeModalCtrl = /*#__PURE__*/function (_PureCtrl) { - ChallengeModalCtrl.$inject = ["$element", "$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(ChallengeModalCtrl, _PureCtrl); - - /* @ngInject */ - function ChallengeModalCtrl($element, $timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ChallengeModalCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ChallengeModalCtrl).call(this, $timeout)); - _this.$element = $element; - _this.processingTypes = []; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ChallengeModalCtrl, [{ - key: "$onInit", - value: function $onInit() { - var _this2 = this; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ChallengeModalCtrl.prototype), "$onInit", this).call(this); - - var values = {}; - var types = this.challenge.types; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = types[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var type = _step.value; - values[type] = { - value: '', - invalid: false - }; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.setState({ - types: types, - values: values, - processing: false - }); - this.orchestrator.setCallbacks({ - onComplete: function onComplete() { - _this2.dismiss(); - }, - onValidValue: function onValidValue(value) { - _this2.state.values[value.type].invalid = false; - Object(snjs__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(_this2.processingTypes, value.type); - - _this2.reloadProcessingStatus(); - }, - onInvalidValue: function onInvalidValue(value) { - _this2.state.values[value.type].invalid = true; - Object(snjs__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(_this2.processingTypes, value.type); - - _this2.reloadProcessingStatus(); - } - }); - } - }, { - key: "deinit", - value: function deinit() { - this.application = null; - this.orchestrator = null; - this.challenge = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ChallengeModalCtrl.prototype), "deinit", this).call(this); - } - }, { - key: "reloadProcessingStatus", - value: function reloadProcessingStatus() { - this.setState({ - processing: this.processingTypes.length > 0 - }); - } - }, { - key: "promptForChallenge", - value: function promptForChallenge(challenge) { - if (challenge === snjs__WEBPACK_IMPORTED_MODULE_9__["ChallengeType"].LocalPasscode) { - return 'Enter your application passcode'; - } else { - return 'Enter your account password'; - } - } - }, { - key: "cancel", - value: function cancel() { - if (!this.cancelable) { - return; - } - - this.dismiss(); - } - }, { - key: "onTextValueChange", - value: function onTextValueChange(challenge) { - var values = this.state.values; - values[challenge].invalid = false; - this.setState({ - values: values - }); - } - }, { - key: "validate", - value: function validate() { - var failed = []; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.state.types[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var type = _step2.value; - var value = this.state.values[type]; - - if (!value || value.length === 0) { - this.state.values[type].invalid = true; - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - return failed.length === 0; - } - }, { - key: "submit", - value: function () { - var _submit = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var values, _i, _Object$keys, key, type, rawValue, value; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (this.validate()) { - _context.next = 2; - break; - } - - return _context.abrupt("return"); - - case 2: - this.setState({ - processing: true - }); - values = []; - _i = 0, _Object$keys = Object.keys(this.state.values); - - case 5: - if (!(_i < _Object$keys.length)) { - _context.next = 16; - break; - } - - key = _Object$keys[_i]; - type = Number(key); - - if (!this.state.values[key].valid) { - _context.next = 10; - break; - } - - return _context.abrupt("continue", 13); - - case 10: - rawValue = this.state.values[key].value; - value = new snjs__WEBPACK_IMPORTED_MODULE_9__["ChallengeValue"](type, rawValue); - values.push(value); - - case 13: - _i++; - _context.next = 5; - break; - - case 16: - this.processingTypes = values.map(function (v) { - return v.type; - }); - this.orchestrator.submitValues(values); - - case 18: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function submit() { - return _submit.apply(this, arguments); - } - - return submit; - }() - }, { - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return ChallengeModalCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_10__["PureCtrl"]); - -var ChallengeModal = function ChallengeModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ChallengeModal); - - this.restrict = 'E'; - this.template = _directives_challenge_modal_pug__WEBPACK_IMPORTED_MODULE_8___default.a; - this.controller = ChallengeModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = { - challenge: '=', - orchestrator: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/componentModal.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/componentModal.js ***! - \*******************************************************************/ -/*! exports provided: ComponentModalCtrl, ComponentModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentModalCtrl", function() { return ComponentModalCtrl; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentModal", function() { return ComponentModal; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_component_modal_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/component-modal.pug */ "./app/assets/templates/directives/component-modal.pug"); -/* harmony import */ var _directives_component_modal_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_component_modal_pug__WEBPACK_IMPORTED_MODULE_2__); - - - -var ComponentModalCtrl = /*#__PURE__*/function () { - ComponentModalCtrl.$inject = ["$element"]; - - /* @ngInject */ - function ComponentModalCtrl($element) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ComponentModalCtrl); - - this.$element = $element; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ComponentModalCtrl, [{ - key: "dismiss", - value: function dismiss() { - if (this.onDismiss) { - this.onDismiss(this.component); - } - - this.callback && this.callback(); - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return ComponentModalCtrl; -}(); -var ComponentModal = function ComponentModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ComponentModal); - - this.restrict = 'E'; - this.template = _directives_component_modal_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = ComponentModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - show: '=', - component: '=', - callback: '=', - onDismiss: '&', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/componentView.js": -/*!******************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/componentView.js ***! - \******************************************************************/ -/*! exports provided: ComponentView */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentView", function() { return ComponentView; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _directives_component_view_pug__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! %/directives/component-view.pug */ "./app/assets/templates/directives/component-view.pug"); -/* harmony import */ var _directives_component_view_pug__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_directives_component_view_pug__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./app/assets/javascripts/utils.js"); - - - - - - -/** - * The maximum amount of time we'll wait for a component - * to load before displaying error - */ - -var MAX_LOAD_THRESHOLD = 4000; -var VISIBILITY_CHANGE_LISTENER_KEY = 'visibilitychange'; - -var ComponentViewCtrl = /*#__PURE__*/function () { - ComponentViewCtrl.$inject = ["$scope", "$rootScope", "$timeout"]; - - /* @ngInject */ - function ComponentViewCtrl($scope, $rootScope, $timeout) { - var _this = this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ComponentViewCtrl); - - this.$rootScope = $rootScope; - this.$timeout = $timeout; - this.componentValid = true; - this.cleanUpOn = $scope.$on('ext-reload-complete', function () { - _this.reloadStatus(false); - }); - /** To allow for registering events */ - - this.onVisibilityChange = this.onVisibilityChange.bind(this); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ComponentViewCtrl, [{ - key: "$onDestroy", - value: function $onDestroy() { - this.cleanUpOn(); - this.cleanUpOn = null; - this.unregisterComponentHandler(); - this.unregisterComponentHandler = null; - - if (this.component && !this.manualDealloc) { - var dontSync = true; - /* application and componentManager may be destroyed if this onDestroy is part of - the entire application being destroyed rather than part of just a single component - view being removed */ - - if (this.application && this.application.componentManager) { - this.application.componentManager.deactivateComponent(this.component, dontSync); - } - } - - this.unregisterDesktopObserver(); - this.unregisterDesktopObserver = null; - document.removeEventListener(VISIBILITY_CHANGE_LISTENER_KEY, this.onVisibilityChange); - this.component = null; - this.onLoad = null; - this.application = null; - this.onVisibilityChange = null; - } - }, { - key: "$onChanges", - value: function $onChanges() { - var _this2 = this; - - if (!this.didRegisterObservers) { - this.didRegisterObservers = true; - this.registerComponentHandlers(); - this.registerPackageUpdateObserver(); - } - - var newComponent = this.component; - var oldComponent = this.lastComponentValue; - this.lastComponentValue = newComponent; - var dontSync = true; - - if (oldComponent && oldComponent !== newComponent) { - this.application.componentManager.deactivateComponent(oldComponent, dontSync); - } - - if (newComponent && newComponent !== oldComponent) { - this.application.componentManager.activateComponent(newComponent, dontSync).then(function () { - _this2.reloadStatus(); - }); - } - } - }, { - key: "registerPackageUpdateObserver", - value: function registerPackageUpdateObserver() { - var _this3 = this; - - this.unregisterDesktopObserver = this.application.getDesktopService().registerUpdateObserver(function (component) { - if (component === _this3.component && component.active) { - _this3.reloadComponent(); - } - }); - } - }, { - key: "registerComponentHandlers", - value: function registerComponentHandlers() { - var _this4 = this; - - this.unregisterComponentHandler = this.application.componentManager.registerHandler({ - identifier: 'component-view-' + Math.random(), - areas: [this.component.area], - activationHandler: function activationHandler(component) { - if (component !== _this4.component) { - return; - } - - _this4.$timeout(function () { - _this4.handleActivation(); - }); - }, - actionHandler: function actionHandler(component, action, data) { - if (action === 'set-size') { - _this4.application.componentManager.handleSetSizeEvent(component, data); - } - } - }); - } - }, { - key: "onVisibilityChange", - value: function onVisibilityChange() { - if (document.visibilityState === 'hidden') { - return; - } - - if (this.issueLoading) { - this.reloadComponent(); - } - } - }, { - key: "reloadComponent", - value: function () { - var _reloadComponent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - this.componentValid = false; - _context.next = 3; - return this.application.componentManager.reloadComponent(this.component); - - case 3: - this.reloadStatus(); - - case 4: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function reloadComponent() { - return _reloadComponent.apply(this, arguments); - } - - return reloadComponent; - }() - }, { - key: "reloadStatus", - value: function reloadStatus() { - var _this5 = this; - - var doManualReload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - this.reloading = true; - var component = this.component; - var previouslyValid = this.componentValid; - var offlineRestricted = component.offlineOnly && !Object(_utils__WEBPACK_IMPORTED_MODULE_5__["isDesktopApplication"])(); - - var hasUrlError = function () { - if (Object(_utils__WEBPACK_IMPORTED_MODULE_5__["isDesktopApplication"])()) { - return !component.local_url && !component.hasValidHostedUrl(); - } else { - return !component.hasValidHostedUrl(); - } - }(); - - this.expired = component.valid_until && component.valid_until <= new Date(); - - if (!component.lockReadonly) { - component.readonly = this.expired; - } - - this.componentValid = !offlineRestricted && !hasUrlError; - - if (!this.componentValid) { - this.loading = false; - } - - if (offlineRestricted) { - this.error = 'offline-restricted'; - } else if (hasUrlError) { - this.error = 'url-missing'; - } else { - this.error = null; - } - - if (this.componentValid !== previouslyValid) { - if (this.componentValid) { - this.application.componentManager.reloadComponent(component, true); - } - } - - if (this.expired && doManualReload) { - this.$rootScope.$broadcast('reload-ext-dat'); - } - - this.$timeout(function () { - _this5.reloading = false; - }, 500); - } - }, { - key: "handleActivation", - value: function handleActivation() { - var _this6 = this; - - if (!this.component || !this.component.active) { - return; - } - - var iframe = this.application.componentManager.iframeForComponent(this.component); - - if (!iframe) { - return; - } - - this.loading = true; - - if (this.loadTimeout) { - this.$timeout.cancel(this.loadTimeout); - } - - this.loadTimeout = this.$timeout(function () { - _this6.handleIframeLoadTimeout(); - }, MAX_LOAD_THRESHOLD); - - iframe.onload = function (event) { - _this6.handleIframeLoad(iframe); - }; - } - }, { - key: "handleIframeLoadTimeout", - value: function () { - var _handleIframeLoadTimeout = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (this.loading) { - this.loading = false; - this.issueLoading = true; - - if (!this.didAttemptReload) { - this.didAttemptReload = true; - this.reloadComponent(); - } else { - document.addEventListener(VISIBILITY_CHANGE_LISTENER_KEY, this.onVisibilityChange); - } - } - - case 1: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function handleIframeLoadTimeout() { - return _handleIframeLoadTimeout.apply(this, arguments); - } - - return handleIframeLoadTimeout; - }() - }, { - key: "handleIframeLoad", - value: function () { - var _handleIframeLoad = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(iframe) { - var _this7 = this; - - var desktopError, avoidFlickerTimeout; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - desktopError = false; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_5__["isDesktopApplication"])()) { - try { - /** Accessing iframe.contentWindow.origin only allowed in desktop app. */ - if (!iframe.contentWindow.origin || iframe.contentWindow.origin === 'null') { - desktopError = true; - } - } catch (e) {} - } - - this.$timeout.cancel(this.loadTimeout); - _context3.next = 5; - return this.application.componentManager.registerComponentWindow(this.component, iframe.contentWindow); - - case 5: - avoidFlickerTimeout = 7; - this.$timeout(function () { - _this7.loading = false; // eslint-disable-next-line no-unneeded-ternary - - _this7.issueLoading = desktopError ? true : false; - _this7.onLoad && _this7.onLoad(_this7.component); - }, avoidFlickerTimeout); - - case 7: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function handleIframeLoad(_x) { - return _handleIframeLoad.apply(this, arguments); - } - - return handleIframeLoad; - }() - }, { - key: "disableActiveTheme", - value: function disableActiveTheme() { - this.application.getThemeService().deactivateAllThemes(); - } - }, { - key: "getUrl", - value: function getUrl() { - var url = this.application.componentManager.urlForComponent(this.component); - this.component.runningLocally = url === this.component.local_url; - return url; - } - }]); - - return ComponentViewCtrl; -}(); - -var ComponentView = function ComponentView() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ComponentView); - - this.restrict = 'E'; - this.template = _directives_component_view_pug__WEBPACK_IMPORTED_MODULE_4___default.a; - this.scope = { - component: '=', - onLoad: '=?', - manualDealloc: '=?', - application: '=' - }; - this.controller = ComponentViewCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/conflictResolutionModal.js": -/*!****************************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/conflictResolutionModal.js ***! - \****************************************************************************/ -/*! exports provided: ConflictResolutionModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConflictResolutionModal", function() { return ConflictResolutionModal; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_conflict_resolution_modal_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/conflict-resolution-modal.pug */ "./app/assets/templates/directives/conflict-resolution-modal.pug"); -/* harmony import */ var _directives_conflict_resolution_modal_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_conflict_resolution_modal_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var ConflictResolutionCtrl = /*#__PURE__*/function () { - ConflictResolutionCtrl.$inject = ["$element"]; - - /* @ngInject */ - function ConflictResolutionCtrl($element) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ConflictResolutionCtrl); - - this.$element = $element; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(ConflictResolutionCtrl, [{ - key: "$onInit", - value: function $onInit() { - this.contentType = this.item1.content_type; - this.item1Content = this.createContentString(this.item1); - this.item2Content = this.createContentString(this.item2); - } - }, { - key: "createContentString", - value: function createContentString(item) { - var data = Object.assign({ - created_at: item.created_at, - updated_at: item.updated_at - }, item.content); - return JSON.stringify(data, null, 2); - } - }, { - key: "keepItem1", - value: function keepItem1() { - var _this = this; - - this.application.alertService.confirm({ - text: "Are you sure you want to delete the item on the right?", - destructive: true, - onConfirm: function onConfirm() { - _this.application.deleteItem({ - item: _this.item2 - }); - - _this.triggerCallback(); - - _this.dismiss(); - } - }); - } - }, { - key: "keepItem2", - value: function keepItem2() { - var _this2 = this; - - this.application.alertService.confirm({ - text: "Are you sure you want to delete the item on the left?", - destructive: true, - onConfirm: function onConfirm() { - _this2.application.deleteItem({ - item: _this2.item1 - }); - - _this2.triggerCallback(); - - _this2.dismiss(); - } - }); - } - }, { - key: "keepBoth", - value: function keepBoth() { - this.triggerCallback(); - this.dismiss(); - } - }, { - key: "export", - value: function _export() { - this.application.getArchiveService().downloadBackupOfItems([this.item1, this.item2], true); - } - }, { - key: "triggerCallback", - value: function triggerCallback() { - this.callback && this.callback(); - } - }, { - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return ConflictResolutionCtrl; -}(); - -var ConflictResolutionModal = function ConflictResolutionModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, ConflictResolutionModal); - - this.restrict = 'E'; - this.template = _directives_conflict_resolution_modal_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = ConflictResolutionCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - item1: '=', - item2: '=', - callback: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/editorMenu.js": -/*!***************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/editorMenu.js ***! - \***************************************************************/ -/*! exports provided: EditorMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EditorMenu", function() { return EditorMenu; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _directives_editor_menu_pug__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! %/directives/editor-menu.pug */ "./app/assets/templates/directives/editor-menu.pug"); -/* harmony import */ var _directives_editor_menu_pug__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_directives_editor_menu_pug__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - -var EditorMenuCtrl = /*#__PURE__*/function (_PureCtrl) { - EditorMenuCtrl.$inject = ["$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5___default()(EditorMenuCtrl, _PureCtrl); - - /* @ngInject */ - function EditorMenuCtrl($timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, EditorMenuCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(EditorMenuCtrl).call(this, $timeout)); - _this.state = { - isDesktop: Object(_utils__WEBPACK_IMPORTED_MODULE_6__["isDesktopApplication"])() - }; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(EditorMenuCtrl, [{ - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_4___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(EditorMenuCtrl.prototype), "$onInit", this).call(this); - - var editors = this.application.componentManager.componentsForArea('editor-editor').sort(function (a, b) { - return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; - }); - var defaultEditor = editors.filter(function (e) { - return e.isDefaultEditor(); - })[0]; - this.setState({ - editors: editors, - defaultEditor: defaultEditor - }); - } - }, { - key: "selectComponent", - value: function selectComponent(component) { - var _this2 = this; - - if (component) { - if (component.content.conflict_of) { - component.content.conflict_of = null; - this.application.saveItem({ - item: component - }); - } - } - - this.$timeout(function () { - _this2.callback()(component); - }); - } - }, { - key: "toggleDefaultForEditor", - value: function toggleDefaultForEditor(editor) { - if (this.state.defaultEditor === editor) { - this.removeEditorDefault(editor); - } else { - this.makeEditorDefault(editor); - } - } - }, { - key: "offlineAvailableForComponent", - value: function offlineAvailableForComponent(component) { - return component.local_url && this.state.isDesktop; - } - }, { - key: "makeEditorDefault", - value: function makeEditorDefault(component) { - var currentDefault = this.application.componentManager.componentsForArea('editor-editor').filter(function (e) { - return e.isDefaultEditor(); - })[0]; - - if (currentDefault) { - currentDefault.setAppDataItem('defaultEditor', false); - this.application.setItemsNeedsSync({ - item: currentDefault - }); - } - - component.setAppDataItem('defaultEditor', true); - this.application.saveItem({ - item: component - }); - this.setState({ - defaultEditor: component - }); - } - }, { - key: "removeEditorDefault", - value: function removeEditorDefault(component) { - component.setAppDataItem('defaultEditor', false); - this.application.saveItem({ - item: component - }); - this.setState({ - defaultEditor: null - }); - } - }, { - key: "shouldDisplayRunningLocallyLabel", - value: function shouldDisplayRunningLocallyLabel(component) { - if (!component.runningLocally) { - return false; - } - - if (component === this.selectedEditor) { - return true; - } else { - return false; - } - } - }]); - - return EditorMenuCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_8__["PureCtrl"]); - -var EditorMenu = function EditorMenu() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, EditorMenu); - - this.restrict = 'E'; - this.template = _directives_editor_menu_pug__WEBPACK_IMPORTED_MODULE_7___default.a; - this.controller = EditorMenuCtrl; - this.controllerAs = 'self'; - this.bindToController = true; - this.scope = { - callback: '&', - selectedEditor: '=', - currentItem: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/index.js": -/*!**********************************************************!*\ - !*** ./app/assets/javascripts/directives/views/index.js ***! - \**********************************************************/ -/*! exports provided: AccountMenu, ActionsMenu, ChallengeModal, ComponentModal, ComponentView, ConflictResolutionModal, EditorMenu, InputModal, MenuRow, PanelResizer, PasswordWizard, PermissionsModal, PrivilegesAuthModal, PrivilegesManagementModal, RevisionPreviewModal, SessionHistoryMenu, SyncResolutionMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _accountMenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./accountMenu */ "./app/assets/javascripts/directives/views/accountMenu.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AccountMenu", function() { return _accountMenu__WEBPACK_IMPORTED_MODULE_0__["AccountMenu"]; }); - -/* harmony import */ var _actionsMenu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./actionsMenu */ "./app/assets/javascripts/directives/views/actionsMenu.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionsMenu", function() { return _actionsMenu__WEBPACK_IMPORTED_MODULE_1__["ActionsMenu"]; }); - -/* harmony import */ var _challengeModal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./challengeModal */ "./app/assets/javascripts/directives/views/challengeModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ChallengeModal", function() { return _challengeModal__WEBPACK_IMPORTED_MODULE_2__["ChallengeModal"]; }); - -/* harmony import */ var _componentModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./componentModal */ "./app/assets/javascripts/directives/views/componentModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ComponentModal", function() { return _componentModal__WEBPACK_IMPORTED_MODULE_3__["ComponentModal"]; }); - -/* harmony import */ var _componentView__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./componentView */ "./app/assets/javascripts/directives/views/componentView.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ComponentView", function() { return _componentView__WEBPACK_IMPORTED_MODULE_4__["ComponentView"]; }); - -/* harmony import */ var _conflictResolutionModal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./conflictResolutionModal */ "./app/assets/javascripts/directives/views/conflictResolutionModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConflictResolutionModal", function() { return _conflictResolutionModal__WEBPACK_IMPORTED_MODULE_5__["ConflictResolutionModal"]; }); - -/* harmony import */ var _editorMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./editorMenu */ "./app/assets/javascripts/directives/views/editorMenu.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EditorMenu", function() { return _editorMenu__WEBPACK_IMPORTED_MODULE_6__["EditorMenu"]; }); - -/* harmony import */ var _inputModal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./inputModal */ "./app/assets/javascripts/directives/views/inputModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InputModal", function() { return _inputModal__WEBPACK_IMPORTED_MODULE_7__["InputModal"]; }); - -/* harmony import */ var _menuRow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./menuRow */ "./app/assets/javascripts/directives/views/menuRow.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MenuRow", function() { return _menuRow__WEBPACK_IMPORTED_MODULE_8__["MenuRow"]; }); - -/* harmony import */ var _panelResizer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./panelResizer */ "./app/assets/javascripts/directives/views/panelResizer.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PanelResizer", function() { return _panelResizer__WEBPACK_IMPORTED_MODULE_9__["PanelResizer"]; }); - -/* harmony import */ var _passwordWizard__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./passwordWizard */ "./app/assets/javascripts/directives/views/passwordWizard.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PasswordWizard", function() { return _passwordWizard__WEBPACK_IMPORTED_MODULE_10__["PasswordWizard"]; }); - -/* harmony import */ var _permissionsModal__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./permissionsModal */ "./app/assets/javascripts/directives/views/permissionsModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PermissionsModal", function() { return _permissionsModal__WEBPACK_IMPORTED_MODULE_11__["PermissionsModal"]; }); - -/* harmony import */ var _privilegesAuthModal__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./privilegesAuthModal */ "./app/assets/javascripts/directives/views/privilegesAuthModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PrivilegesAuthModal", function() { return _privilegesAuthModal__WEBPACK_IMPORTED_MODULE_12__["PrivilegesAuthModal"]; }); - -/* harmony import */ var _privilegesManagementModal__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./privilegesManagementModal */ "./app/assets/javascripts/directives/views/privilegesManagementModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PrivilegesManagementModal", function() { return _privilegesManagementModal__WEBPACK_IMPORTED_MODULE_13__["PrivilegesManagementModal"]; }); - -/* harmony import */ var _revisionPreviewModal__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./revisionPreviewModal */ "./app/assets/javascripts/directives/views/revisionPreviewModal.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RevisionPreviewModal", function() { return _revisionPreviewModal__WEBPACK_IMPORTED_MODULE_14__["RevisionPreviewModal"]; }); - -/* harmony import */ var _sessionHistoryMenu__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./sessionHistoryMenu */ "./app/assets/javascripts/directives/views/sessionHistoryMenu.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SessionHistoryMenu", function() { return _sessionHistoryMenu__WEBPACK_IMPORTED_MODULE_15__["SessionHistoryMenu"]; }); - -/* harmony import */ var _syncResolutionMenu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./syncResolutionMenu */ "./app/assets/javascripts/directives/views/syncResolutionMenu.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SyncResolutionMenu", function() { return _syncResolutionMenu__WEBPACK_IMPORTED_MODULE_16__["SyncResolutionMenu"]; }); - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/inputModal.js": -/*!***************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/inputModal.js ***! - \***************************************************************/ -/*! exports provided: InputModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputModal", function() { return InputModal; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_input_modal_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/input-modal.pug */ "./app/assets/templates/directives/input-modal.pug"); -/* harmony import */ var _directives_input_modal_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_input_modal_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var InputModalCtrl = /*#__PURE__*/function () { - InputModalCtrl.$inject = ["$element"]; - - /* @ngInject */ - function InputModalCtrl($element) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputModalCtrl); - - this.$element = $element; - this.formData = {}; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(InputModalCtrl, [{ - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }, { - key: "submit", - value: function submit() { - this.callback()(this.formData.input); - this.dismiss(); - } - }]); - - return InputModalCtrl; -}(); - -var InputModal = function InputModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, InputModal); - - this.restrict = 'E'; - this.template = _directives_input_modal_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = InputModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - type: '=', - title: '=', - message: '=', - placeholder: '=', - callback: '&' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/menuRow.js": -/*!************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/menuRow.js ***! - \************************************************************/ -/*! exports provided: MenuRow */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuRow", function() { return MenuRow; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_menu_row_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/menu-row.pug */ "./app/assets/templates/directives/menu-row.pug"); -/* harmony import */ var _directives_menu_row_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_menu_row_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var MenuRowCtrl = /*#__PURE__*/function () { - function MenuRowCtrl() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, MenuRowCtrl); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(MenuRowCtrl, [{ - key: "onClick", - value: function onClick($event) { - if (this.disabled) { - return; - } - - $event.stopPropagation(); - this.action(); - } - }, { - key: "clickAccessoryButton", - value: function clickAccessoryButton($event) { - if (this.disabled) { - return; - } - - $event.stopPropagation(); - this.buttonAction(); - } - }]); - - return MenuRowCtrl; -}(); - -var MenuRow = function MenuRow() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, MenuRow); - - this.restrict = 'E'; - this.transclude = true; - this.template = _directives_menu_row_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = MenuRowCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - action: '&', - buttonAction: '&', - buttonClass: '=', - buttonText: '=', - desc: '=', - disabled: '=', - circle: '=', - circleAlign: '=', - faded: '=', - hasButton: '=', - label: '=', - spinnerClass: '=', - stylekitClass: '=', - subRows: '=', - subtitle: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/panelResizer.js": -/*!*****************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/panelResizer.js ***! - \*****************************************************************/ -/*! exports provided: PanelResizer */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelResizer", function() { return PanelResizer; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _directives_panel_resizer_pug__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! %/directives/panel-resizer.pug */ "./app/assets/templates/directives/panel-resizer.pug"); -/* harmony import */ var _directives_panel_resizer_pug__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_directives_panel_resizer_pug__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); - - - - - -var PanelSides = { - Right: 'right', - Left: 'left' -}; -var MouseEvents = { - Move: 'mousemove', - Down: 'mousedown', - Up: 'mouseup' -}; -var CssClasses = { - Hoverable: 'hoverable', - AlwaysVisible: 'always-visible', - Dragging: 'dragging', - NoSelection: 'no-selection', - Collapsed: 'collapsed', - AnimateOpacity: 'animate-opacity' -}; -var WINDOW_EVENT_RESIZE = 'resize'; - -var PanelResizerCtrl = /*#__PURE__*/function () { - PanelResizerCtrl.$inject = ["$compile", "$element", "$timeout"]; - - /* @ngInject */ - function PanelResizerCtrl($compile, $element, $timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, PanelResizerCtrl); - - this.$compile = $compile; - this.$element = $element; - this.$timeout = $timeout; - /** To allow for registering events */ - - this.handleResize = this.handleResize.bind(this); - this.onMouseMove = this.onMouseMove.bind(this); - this.onMouseUp = this.onMouseUp.bind(this); - this.onMouseDown = this.onMouseDown.bind(this); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(PanelResizerCtrl, [{ - key: "$onInit", - value: function $onInit() { - this.configureDefaults(); - this.reloadDefaultValues(); - this.configureControl(); - this.addDoubleClickHandler(); - this.addMouseDownListener(); - this.addMouseMoveListener(); - this.addMouseUpListener(); - } - }, { - key: "$onDestroy", - value: function $onDestroy() { - this.onResizeFinish = null; - this.control = null; - window.removeEventListener(WINDOW_EVENT_RESIZE, this.handleResize); - document.removeEventListener(MouseEvents.Move, this.onMouseMove); - document.removeEventListener(MouseEvents.Up, this.onMouseUp); - this.resizerColumn.removeEventListener(MouseEvents.Down, this.onMouseDown); - this.handleResize = null; - this.onMouseMove = null; - this.onMouseUp = null; - this.onMouseDown = null; - } - }, { - key: "configureControl", - value: function configureControl() { - var _this = this; - - this.control.setWidth = function (value) { - _this.setWidth(value, true); - }; - - this.control.setLeft = function (value) { - _this.setLeft(value); - }; - - this.control.flash = function () { - _this.flash(); - }; - - this.control.isCollapsed = function () { - return _this.isCollapsed(); - }; - - this.control.ready = true; - this.control.onReady(); - } - }, { - key: "configureDefaults", - value: function configureDefaults() { - this.panel = document.getElementById(this.panelId); - - if (!this.panel) { - console.error('Panel not found for', this.panelId); - } - - this.resizerColumn = this.$element[0]; - this.currentMinWidth = this.minWidth || this.resizerColumn.offsetWidth; - this.pressed = false; - this.startWidth = this.panel.scrollWidth; - this.lastDownX = 0; - this.collapsed = false; - this.lastWidth = this.startWidth; - this.startLeft = this.panel.offsetLeft; - this.lastLeft = this.startLeft; - this.appFrame = null; - this.widthBeforeLastDblClick = 0; - - if (this.property === PanelSides.Right) { - this.configureRightPanel(); - } - - if (this.alwaysVisible) { - this.resizerColumn.classList.add(CssClasses.AlwaysVisible); - } - - if (this.hoverable) { - this.resizerColumn.classList.add(CssClasses.Hoverable); - } - } - }, { - key: "configureRightPanel", - value: function configureRightPanel() { - window.addEventListener(WINDOW_EVENT_RESIZE, this.handleResize); - } - }, { - key: "handleResize", - value: function handleResize() { - var _this2 = this; - - Object(_utils__WEBPACK_IMPORTED_MODULE_4__["debounce"])(function () { - _this2.reloadDefaultValues(); - - _this2.handleWidthEvent(); - - _this2.$timeout(function () { - _this2.finishSettingWidth(); - }); - }, 250); - } - }, { - key: "getParentRect", - value: function getParentRect() { - return this.panel.parentNode.getBoundingClientRect(); - } - }, { - key: "reloadDefaultValues", - value: function reloadDefaultValues() { - this.startWidth = this.isAtMaxWidth() ? this.getParentRect().width : this.panel.scrollWidth; - this.lastWidth = this.startWidth; - this.appFrame = document.getElementById('app').getBoundingClientRect(); - } - }, { - key: "addDoubleClickHandler", - value: function addDoubleClickHandler() { - var _this3 = this; - - this.resizerColumn.ondblclick = function () { - _this3.$timeout(function () { - var preClickCollapseState = _this3.isCollapsed(); - - if (preClickCollapseState) { - _this3.setWidth(_this3.widthBeforeLastDblClick || _this3.defaultWidth); - } else { - _this3.widthBeforeLastDblClick = _this3.lastWidth; - - _this3.setWidth(_this3.currentMinWidth); - } - - _this3.finishSettingWidth(); - - var newCollapseState = !preClickCollapseState; - - _this3.onResizeFinish(_this3.lastWidth, _this3.lastLeft, _this3.isAtMaxWidth(), newCollapseState); - }); - }; - } - }, { - key: "addMouseDownListener", - value: function addMouseDownListener() { - this.resizerColumn.addEventListener(MouseEvents.Down, this.onMouseDown); - } - }, { - key: "onMouseDown", - value: function onMouseDown(event) { - this.addInvisibleOverlay(); - this.pressed = true; - this.lastDownX = event.clientX; - this.startWidth = this.panel.scrollWidth; - this.startLeft = this.panel.offsetLeft; - this.panel.classList.add(CssClasses.NoSelection); - - if (this.hoverable) { - this.resizerColumn.classList.add(CssClasses.Dragging); - } - } - }, { - key: "addMouseMoveListener", - value: function addMouseMoveListener() { - document.addEventListener(MouseEvents.Move, this.onMouseMove); - } - }, { - key: "onMouseMove", - value: function onMouseMove(event) { - if (!this.pressed) { - return; - } - - event.preventDefault(); - - if (this.property && this.property === PanelSides.Left) { - this.handleLeftEvent(event); - } else { - this.handleWidthEvent(event); - } - } - }, { - key: "handleWidthEvent", - value: function handleWidthEvent(event) { - var x; - - if (event) { - x = event.clientX; - } else { - /** Coming from resize event */ - x = 0; - this.lastDownX = 0; - } - - var deltaX = x - this.lastDownX; - var newWidth = this.startWidth + deltaX; - this.setWidth(newWidth, false); - } - }, { - key: "handleLeftEvent", - value: function handleLeftEvent(event) { - var panelRect = this.panel.getBoundingClientRect(); - var x = event.clientX || panelRect.x; - var deltaX = x - this.lastDownX; - var newLeft = this.startLeft + deltaX; - - if (newLeft < 0) { - newLeft = 0; - deltaX = -this.startLeft; - } - - var parentRect = this.getParentRect(); - var newWidth = this.startWidth - deltaX; - - if (newWidth < this.currentMinWidth) { - newWidth = this.currentMinWidth; - } - - if (newWidth > parentRect.width) { - newWidth = parentRect.width; - } - - if (newLeft + newWidth > parentRect.width) { - newLeft = parentRect.width - newWidth; - } - - this.setLeft(newLeft, false); - this.setWidth(newWidth, false); - } - }, { - key: "addMouseUpListener", - value: function addMouseUpListener() { - document.addEventListener(MouseEvents.Up, this.onMouseUp); - } - }, { - key: "onMouseUp", - value: function onMouseUp() { - this.removeInvisibleOverlay(); - - if (!this.pressed) { - return; - } - - this.pressed = false; - this.resizerColumn.classList.remove(CssClasses.Dragging); - this.panel.classList.remove(CssClasses.NoSelection); - var isMaxWidth = this.isAtMaxWidth(); - - if (this.onResizeFinish) { - this.onResizeFinish(this.lastWidth, this.lastLeft, isMaxWidth, this.isCollapsed()); - } - - this.finishSettingWidth(); - } - }, { - key: "isAtMaxWidth", - value: function isAtMaxWidth() { - return Math.round(this.lastWidth + this.lastLeft) === Math.round(this.getParentRect().width); - } - }, { - key: "isCollapsed", - value: function isCollapsed() { - return this.lastWidth <= this.currentMinWidth; - } - }, { - key: "setWidth", - value: function setWidth(width, finish) { - if (width < this.currentMinWidth) { - width = this.currentMinWidth; - } - - var parentRect = this.getParentRect(); - - if (width > parentRect.width) { - width = parentRect.width; - } - - var maxWidth = this.appFrame.width - this.panel.getBoundingClientRect().x; - - if (width > maxWidth) { - width = maxWidth; - } - - if (Math.round(width + this.lastLeft) === Math.round(parentRect.width)) { - this.panel.style.width = "calc(100% - ".concat(this.lastLeft, "px)"); - this.panel.style.flexBasis = "calc(100% - ".concat(this.lastLeft, "px)"); - } else { - this.panel.style.flexBasis = width + 'px'; - this.panel.style.width = width + 'px'; - } - - this.lastWidth = width; - - if (finish) { - this.finishSettingWidth(); - } - } - }, { - key: "setLeft", - value: function setLeft(left) { - this.panel.style.left = left + 'px'; - this.lastLeft = left; - } - }, { - key: "finishSettingWidth", - value: function finishSettingWidth() { - if (!this.collapsable) { - return; - } - - this.collapsed = this.isCollapsed(); - - if (this.collapsed) { - this.resizerColumn.classList.add(CssClasses.Collapsed); - } else { - this.resizerColumn.classList.remove(CssClasses.Collapsed); - } - } - /** - * If an iframe is displayed adjacent to our panel, and the mouse exits over the iframe, - * document[onmouseup] is not triggered because the document is no longer the same over - * the iframe. We add an invisible overlay while resizing so that the mouse context - * remains in our main document. - */ - - }, { - key: "addInvisibleOverlay", - value: function addInvisibleOverlay() { - if (this.overlay) { - return; - } - - this.overlay = this.$compile("
")(this); - angular__WEBPACK_IMPORTED_MODULE_2___default.a.element(document.body).prepend(this.overlay); - } - }, { - key: "removeInvisibleOverlay", - value: function removeInvisibleOverlay() { - if (this.overlay) { - this.overlay.remove(); - this.overlay = null; - } - } - }, { - key: "flash", - value: function flash() { - var _this4 = this; - - var FLASH_DURATION = 3000; - this.resizerColumn.classList.add(CssClasses.AnimateOpacity); - this.$timeout(function () { - _this4.resizerColumn.classList.remove(CssClasses.AnimateOpacity); - }, FLASH_DURATION); - } - }]); - - return PanelResizerCtrl; -}(); - -var PanelResizer = function PanelResizer() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, PanelResizer); - - this.restrict = 'E'; - this.template = _directives_panel_resizer_pug__WEBPACK_IMPORTED_MODULE_3___default.a; - this.controller = PanelResizerCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - alwaysVisible: '=', - collapsable: '=', - control: '=', - defaultWidth: '=', - hoverable: '=', - index: '=', - minWidth: '=', - onResizeFinish: '&', - panelId: '=', - property: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/passwordWizard.js": -/*!*******************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/passwordWizard.js ***! - \*******************************************************************/ -/*! exports provided: PasswordWizard */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PasswordWizard", function() { return PasswordWizard; }); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"); -/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _directives_password_wizard_pug__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! %/directives/password-wizard.pug */ "./app/assets/templates/directives/password-wizard.pug"); -/* harmony import */ var _directives_password_wizard_pug__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_directives_password_wizard_pug__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - - - -var DEFAULT_CONTINUE_TITLE = "Continue"; -var Steps = { - PasswordStep: 1, - FinishStep: 2 -}; - -var PasswordWizardCtrl = /*#__PURE__*/function (_PureCtrl) { - PasswordWizardCtrl.$inject = ["$element", "$timeout"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_8___default()(PasswordWizardCtrl, _PureCtrl); - - /* @ngInject */ - function PasswordWizardCtrl($element, $timeout) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, PasswordWizardCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(PasswordWizardCtrl).call(this, $timeout)); - _this.$element = $element; - _this.$timeout = $timeout; - - _this.registerWindowUnloadStopper(); - - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(PasswordWizardCtrl, [{ - key: "$onInit", - value: function $onInit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(PasswordWizardCtrl.prototype), "$onInit", this).call(this); - - this.initProps({ - type: this.type, - changePassword: this.type === 'change-pw', - securityUpdate: this.type === 'upgrade-security' - }); - this.setState({ - formData: {}, - continueTitle: DEFAULT_CONTINUE_TITLE, - step: Steps.PasswordStep, - title: this.props.changePassword ? 'Change Password' : 'Account Update' - }); - } - }, { - key: "$onDestroy", - value: function $onDestroy() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(PasswordWizardCtrl.prototype), "$onDestroy", this).call(this); - - window.onbeforeunload = null; - } - /** Confirms with user before closing tab */ - - }, { - key: "registerWindowUnloadStopper", - value: function registerWindowUnloadStopper() { - window.onbeforeunload = function (e) { - return true; - }; - } - }, { - key: "resetContinueState", - value: function resetContinueState() { - this.setState({ - showSpinner: false, - continueTitle: DEFAULT_CONTINUE_TITLE - }); - this.isContinuing = false; - } - }, { - key: "nextStep", - value: function () { - var _nextStep = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee() { - var valid, success; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!(this.state.lockContinue || this.isContinuing)) { - _context.next = 2; - break; - } - - return _context.abrupt("return"); - - case 2: - if (!(this.state.step === Steps.FinishStep)) { - _context.next = 5; - break; - } - - this.dismiss(); - return _context.abrupt("return"); - - case 5: - this.isContinuing = true; - this.setState({ - showSpinner: true, - continueTitle: "Generating Keys..." - }); - _context.next = 9; - return this.validateCurrentPassword(); - - case 9: - valid = _context.sent; - - if (valid) { - _context.next = 13; - break; - } - - this.resetContinueState(); - return _context.abrupt("return"); - - case 13: - _context.next = 15; - return this.processPasswordChange(); - - case 15: - success = _context.sent; - - if (success) { - _context.next = 19; - break; - } - - this.resetContinueState(); - return _context.abrupt("return"); - - case 19: - this.isContinuing = false; - this.setState({ - showSpinner: false, - continueTitle: "Finish", - step: Steps.FinishStep - }); - - case 21: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function nextStep() { - return _nextStep.apply(this, arguments); - } - - return nextStep; - }() - }, { - key: "setFormDataState", - value: function () { - var _setFormDataState = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(formData) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - return _context2.abrupt("return", this.setState({ - formData: _objectSpread({}, this.state.formData, {}, formData) - })); - - case 1: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function setFormDataState(_x) { - return _setFormDataState.apply(this, arguments); - } - - return setFormDataState; - }() - }, { - key: "validateCurrentPassword", - value: function () { - var _validateCurrentPassword = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee3() { - var currentPassword, newPass, success; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - currentPassword = this.state.formData.currentPassword; - newPass = this.props.securityUpdate ? currentPassword : this.state.formData.newPassword; - - if (!(!currentPassword || currentPassword.length === 0)) { - _context3.next = 5; - break; - } - - this.application.alertService.alert({ - text: "Please enter your current password." - }); - return _context3.abrupt("return", false); - - case 5: - if (!this.props.changePassword) { - _context3.next = 13; - break; - } - - if (!(!newPass || newPass.length === 0)) { - _context3.next = 9; - break; - } - - this.application.alertService.alert({ - text: "Please enter a new password." - }); - return _context3.abrupt("return", false); - - case 9: - if (!(newPass !== this.state.formData.newPasswordConfirmation)) { - _context3.next = 13; - break; - } - - this.application.alertService.alert({ - text: "Your new password does not match its confirmation." - }); - this.state.formData.status = null; - return _context3.abrupt("return", false); - - case 13: - if (this.application.getUser().email) { - _context3.next = 17; - break; - } - - this.application.alertService.alert({ - text: "We don't have your email stored. Please log out then log back in to fix this issue." - }); - this.state.formData.status = null; - return _context3.abrupt("return", false); - - case 17: - _context3.next = 19; - return this.application.validateAccountPassword({ - password: this.state.formData.currentPassword - }); - - case 19: - success = _context3.sent; - - if (!success) { - this.application.alertService.alert({ - text: "The current password you entered is not correct. Please try again." - }); - } - - return _context3.abrupt("return", success); - - case 22: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function validateCurrentPassword() { - return _validateCurrentPassword.apply(this, arguments); - } - - return validateCurrentPassword; - }() - }, { - key: "processPasswordChange", - value: function () { - var _processPasswordChange = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee4() { - var newPassword, response, success; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - this.setState({ - lockContinue: true, - processing: true - }); - this.setFormDataState({ - status: "Processing encryption keys..." - }); - newPassword = this.props.securityUpdate ? this.state.formData.currentPassword : this.state.formData.newPassword; - _context4.next = 5; - return this.application.changePassword({ - currentPassword: this.state.formData.currentPassword, - newPassword: newPassword - }); - - case 5: - response = _context4.sent; - success = !response.error; - this.setFormDataState({ - statusError: !success, - processing: success - }); - - if (!success) { - this.application.alertService.alert({ - text: response.error.message ? response.error.message : "There was an error changing your password. Please try again." - }); - this.setFormDataState({ - status: "Unable to process your password. Please try again." - }); - } else { - this.setState({ - lockContinue: false, - formData: _objectSpread({}, this.state.formData, { - status: this.props.changePassword ? "Successfully changed password." : "Successfully performed account update." - }) - }); - } - - return _context4.abrupt("return", success); - - case 10: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function processPasswordChange() { - return _processPasswordChange.apply(this, arguments); - } - - return processPasswordChange; - }() - }, { - key: "dismiss", - value: function dismiss() { - if (this.state.lockContinue) { - this.application.alertService.alert({ - text: "Cannot close window until pending tasks are complete." - }); - } else { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - } - }]); - - return PasswordWizardCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_10__["PureCtrl"]); - -var PasswordWizard = function PasswordWizard() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, PasswordWizard); - - this.restrict = 'E'; - this.template = _directives_password_wizard_pug__WEBPACK_IMPORTED_MODULE_9___default.a; - this.controller = PasswordWizardCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - type: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/permissionsModal.js": -/*!*********************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/permissionsModal.js ***! - \*********************************************************************/ -/*! exports provided: PermissionsModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PermissionsModal", function() { return PermissionsModal; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_permissions_modal_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/permissions-modal.pug */ "./app/assets/templates/directives/permissions-modal.pug"); -/* harmony import */ var _directives_permissions_modal_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_permissions_modal_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var PermissionsModalCtrl = /*#__PURE__*/function () { - PermissionsModalCtrl.$inject = ["$element"]; - - /* @ngInject */ - function PermissionsModalCtrl($element) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, PermissionsModalCtrl); - - this.$element = $element; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(PermissionsModalCtrl, [{ - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }, { - key: "accept", - value: function accept() { - this.callback(true); - this.dismiss(); - } - }, { - key: "deny", - value: function deny() { - this.callback(false); - this.dismiss(); - } - }]); - - return PermissionsModalCtrl; -}(); - -var PermissionsModal = function PermissionsModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, PermissionsModal); - - this.restrict = 'E'; - this.template = _directives_permissions_modal_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = PermissionsModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - show: '=', - component: '=', - permissionsString: '=', - callback: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/privilegesAuthModal.js": -/*!************************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/privilegesAuthModal.js ***! - \************************************************************************/ -/*! exports provided: PrivilegesAuthModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrivilegesAuthModal", function() { return PrivilegesAuthModal; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _directives_privileges_auth_modal_pug__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! %/directives/privileges-auth-modal.pug */ "./app/assets/templates/directives/privileges-auth-modal.pug"); -/* harmony import */ var _directives_privileges_auth_modal_pug__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_directives_privileges_auth_modal_pug__WEBPACK_IMPORTED_MODULE_4__); - - - - - - -var PrivilegesAuthModalCtrl = /*#__PURE__*/function () { - PrivilegesAuthModalCtrl.$inject = ["$element", "$timeout"]; - - /* @ngInject */ - function PrivilegesAuthModalCtrl($element, $timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PrivilegesAuthModalCtrl); - - this.$element = $element; - this.$timeout = $timeout; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(PrivilegesAuthModalCtrl, [{ - key: "$onInit", - value: function $onInit() { - var _this = this; - - this.authParameters = {}; - this.sessionLengthOptions = this.application.privilegesService.getSessionLengthOptions(); - this.application.privilegesService.getSelectedSessionLength().then(function (length) { - _this.$timeout(function () { - _this.selectedSessionLength = length; - }); - }); - this.application.privilegesService.netCredentialsForAction(this.action).then(function (credentials) { - _this.$timeout(function () { - _this.requiredCredentials = credentials.sort(); - }); - }); - } - }, { - key: "selectSessionLength", - value: function selectSessionLength(length) { - this.selectedSessionLength = length; - } - }, { - key: "promptForCredential", - value: function promptForCredential(credential) { - return this.application.privilegesService.displayInfoForCredential(credential).prompt; - } - }, { - key: "cancel", - value: function cancel() { - this.dismiss(); - this.onCancel && this.onCancel(); - } - }, { - key: "isCredentialInFailureState", - value: function isCredentialInFailureState(credential) { - if (!this.failedCredentials) { - return false; - } - - return this.failedCredentials.find(function (candidate) { - return candidate === credential; - }) != null; - } - }, { - key: "validate", - value: function validate() { - var failed = []; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.requiredCredentials[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var cred = _step.value; - var value = this.authParameters[cred]; - - if (!value || value.length === 0) { - failed.push(cred); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - this.failedCredentials = failed; - return failed.length === 0; - } - }, { - key: "submit", - value: function () { - var _submit = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var _this2 = this; - - var result; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (this.validate()) { - _context.next = 2; - break; - } - - return _context.abrupt("return"); - - case 2: - _context.next = 4; - return this.application.privilegesService.authenticateAction(this.action, this.authParameters); - - case 4: - result = _context.sent; - this.$timeout(function () { - if (result.success) { - _this2.application.privilegesService.setSessionLength(_this2.selectedSessionLength); - - _this2.onSuccess(); - - _this2.dismiss(); - } else { - _this2.failedCredentials = result.failedCredentials; - } - }); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function submit() { - return _submit.apply(this, arguments); - } - - return submit; - }() - }, { - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return PrivilegesAuthModalCtrl; -}(); - -var PrivilegesAuthModal = function PrivilegesAuthModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PrivilegesAuthModal); - - this.restrict = 'E'; - this.template = _directives_privileges_auth_modal_pug__WEBPACK_IMPORTED_MODULE_4___default.a; - this.controller = PrivilegesAuthModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - action: '=', - onSuccess: '=', - onCancel: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/privilegesManagementModal.js": -/*!******************************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/privilegesManagementModal.js ***! - \******************************************************************************/ -/*! exports provided: PrivilegesManagementModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrivilegesManagementModal", function() { return PrivilegesManagementModal; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _directives_privileges_management_modal_pug__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! %/directives/privileges-management-modal.pug */ "./app/assets/templates/directives/privileges-management-modal.pug"); -/* harmony import */ var _directives_privileges_management_modal_pug__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_directives_privileges_management_modal_pug__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _Controllers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @Controllers */ "./app/assets/javascripts/controllers/index.js"); - - - - - - - - - - - - -var PrivilegesManagementModalCtrl = /*#__PURE__*/function (_PureCtrl) { - PrivilegesManagementModalCtrl.$inject = ["$timeout", "$element"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(PrivilegesManagementModalCtrl, _PureCtrl); - - /* @ngInject */ - function PrivilegesManagementModalCtrl($timeout, $element) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PrivilegesManagementModalCtrl); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(PrivilegesManagementModalCtrl).call(this, $timeout)); - _this.$element = $element; - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(PrivilegesManagementModalCtrl, [{ - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(PrivilegesManagementModalCtrl.prototype), "onAppLaunch", this).call(this); - - this.hasPasscode = this.application.hasPasscode(); - this.hasAccount = !this.application.noAccount(); - this.reloadPrivileges(); - } - }, { - key: "displayInfoForCredential", - value: function displayInfoForCredential(credential) { - var info = this.application.privilegesService.displayInfoForCredential(credential); - - if (credential === snjs__WEBPACK_IMPORTED_MODULE_9__["PrivilegeCredentials"].LocalPasscode) { - info.availability = this.hasPasscode; - } else if (credential === snjs__WEBPACK_IMPORTED_MODULE_9__["PrivilegeCredentials"].AccountPassword) { - info.availability = this.hasAccount; - } else { - info.availability = true; - } - - return info; - } - }, { - key: "displayInfoForAction", - value: function displayInfoForAction(action) { - return this.application.privilegesService.displayInfoForAction(action).label; - } - }, { - key: "isCredentialRequiredForAction", - value: function isCredentialRequiredForAction(action, credential) { - if (!this.privileges) { - return false; - } - - return this.privileges.isCredentialRequiredForAction(action, credential); - } - }, { - key: "clearSession", - value: function () { - var _clearSession = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this.application.privilegesService.clearSession(); - - case 2: - this.reloadPrivileges(); - - case 3: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function clearSession() { - return _clearSession.apply(this, arguments); - } - - return clearSession; - }() - }, { - key: "reloadPrivileges", - value: function () { - var _reloadPrivileges = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var _this2 = this; - - var sessionEndDate, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, cred, privs; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - this.availableActions = this.application.privilegesService.getAvailableActions(); - this.availableCredentials = this.application.privilegesService.getAvailableCredentials(); - _context2.next = 4; - return this.application.privilegesService.getSessionExpirey(); - - case 4: - sessionEndDate = _context2.sent; - this.sessionExpirey = sessionEndDate.toLocaleString(); - this.sessionExpired = new Date() >= sessionEndDate; - this.credentialDisplayInfo = {}; - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context2.prev = 11; - - for (_iterator = this.availableCredentials[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - cred = _step.value; - this.credentialDisplayInfo[cred] = this.displayInfoForCredential(cred); - } - - _context2.next = 19; - break; - - case 15: - _context2.prev = 15; - _context2.t0 = _context2["catch"](11); - _didIteratorError = true; - _iteratorError = _context2.t0; - - case 19: - _context2.prev = 19; - _context2.prev = 20; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 22: - _context2.prev = 22; - - if (!_didIteratorError) { - _context2.next = 25; - break; - } - - throw _iteratorError; - - case 25: - return _context2.finish(22); - - case 26: - return _context2.finish(19); - - case 27: - _context2.next = 29; - return this.application.privilegesService.getPrivileges(); - - case 29: - privs = _context2.sent; - this.$timeout(function () { - _this2.privileges = privs; - }); - - case 31: - case "end": - return _context2.stop(); - } - } - }, _callee2, this, [[11, 15, 19, 27], [20,, 22, 26]]); - })); - - function reloadPrivileges() { - return _reloadPrivileges.apply(this, arguments); - } - - return reloadPrivileges; - }() - }, { - key: "checkboxValueChanged", - value: function checkboxValueChanged(action, credential) { - this.privileges.toggleCredentialForAction(action, credential); - this.application.privilegesService.savePrivileges(); - } - }, { - key: "cancel", - value: function cancel() { - this.dismiss(); - this.onCancel && this.onCancel(); - } - }, { - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return PrivilegesManagementModalCtrl; -}(_Controllers__WEBPACK_IMPORTED_MODULE_10__["PureCtrl"]); - -var PrivilegesManagementModal = function PrivilegesManagementModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PrivilegesManagementModal); - - this.restrict = 'E'; - this.template = _directives_privileges_management_modal_pug__WEBPACK_IMPORTED_MODULE_8___default.a; - this.controller = PrivilegesManagementModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/revisionPreviewModal.js": -/*!*************************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/revisionPreviewModal.js ***! - \*************************************************************************/ -/*! exports provided: RevisionPreviewModal */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevisionPreviewModal", function() { return RevisionPreviewModal; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _directives_revision_preview_modal_pug__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! %/directives/revision-preview-modal.pug */ "./app/assets/templates/directives/revision-preview-modal.pug"); -/* harmony import */ var _directives_revision_preview_modal_pug__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_directives_revision_preview_modal_pug__WEBPACK_IMPORTED_MODULE_5__); - - - - - - - -var RevisionPreviewModalCtrl = /*#__PURE__*/function () { - RevisionPreviewModalCtrl.$inject = ["$element", "$timeout"]; - - /* @ngInject */ - function RevisionPreviewModalCtrl($element, $timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, RevisionPreviewModalCtrl); - - this.$element = $element; - this.$timeout = $timeout; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(RevisionPreviewModalCtrl, [{ - key: "$onInit", - value: function $onInit() { - this.configure(); - } - }, { - key: "$onDestroy", - value: function $onDestroy() { - if (this.unregisterComponent) { - this.unregisterComponent(); - this.unregisterComponent = null; - } - } - }, { - key: "configure", - value: function () { - var _configure = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var _this = this; - - var editorForNote, editorCopy; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this.application.createTemplateItem({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Note, - content: this.content - }); - - case 2: - this.note = _context.sent; - - /** - * Set UUID so editoForNote can find proper editor, but then generate new uuid - * for note as not to save changes to original, if editor makes changes. - */ - this.note.uuid = this.uuid; - editorForNote = this.application.componentManager.editorForNote(this.note); - _context.next = 7; - return this.application.generateUuid(); - - case 7: - this.note.uuid = _context.sent; - - if (!editorForNote) { - _context.next = 16; - break; - } - - _context.next = 11; - return this.application.createTemplateItem({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_4__["ContentTypes"].Component, - content: editorForNote.content - }); - - case 11: - editorCopy = _context.sent; - editorCopy.readonly = true; - editorCopy.lockReadonly = true; - this.unregisterComponent = this.application.componentManager.registerHandler({ - identifier: editorCopy.uuid, - areas: ['editor-editor'], - contextRequestHandler: function contextRequestHandler(component) { - if (component === _this.editor) { - return _this.note; - } - }, - componentForSessionKeyHandler: function componentForSessionKeyHandler(key) { - if (key === _this.editor.sessionKey) { - return _this.editor; - } - } - }); - this.editor = editorCopy; - - case 16: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function configure() { - return _configure.apply(this, arguments); - } - - return configure; - }() - }, { - key: "restore", - value: function restore(asCopy) { - var _this2 = this; - - var run = /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var item, contentCopy, uuid; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!asCopy) { - _context2.next = 8; - break; - } - - contentCopy = Object.assign({}, _this2.content); - - if (contentCopy.title) { - contentCopy.title += " (copy)"; - } - - _context2.next = 5; - return _this2.application.createManagedItem({ - contentType: 'Note', - content: contentCopy, - needsSync: true - }); - - case 5: - item = _context2.sent; - _context2.next = 13; - break; - - case 8: - uuid = _this2.uuid; - item = _this2.application.findItem({ - uuid: uuid - }); - item.content = Object.assign({}, _this2.content); - _context2.next = 13; - return _this2.application.mergeItem({ - item: item, - source: snjs__WEBPACK_IMPORTED_MODULE_4__["PAYLOAD_SOURCE_REMOTE_ACTION_RETRIEVED"] - }); - - case 13: - _this2.application.saveItem({ - item: item - }); - - _this2.dismiss(); - - case 15: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - return function run() { - return _ref.apply(this, arguments); - }; - }(); - - if (!asCopy) { - this.application.alertService.confirm({ - text: "Are you sure you want to replace the current note's contents with what you see in this preview?", - destructive: true, - onConfirm: run - }); - } else { - run(); - } - } - }, { - key: "dismiss", - value: function dismiss() { - var elem = this.$element; - var scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } - }]); - - return RevisionPreviewModalCtrl; -}(); - -var RevisionPreviewModal = function RevisionPreviewModal() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, RevisionPreviewModal); - - this.restrict = 'E'; - this.template = _directives_revision_preview_modal_pug__WEBPACK_IMPORTED_MODULE_5___default.a; - this.controller = RevisionPreviewModalCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - uuid: '=', - content: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/sessionHistoryMenu.js": -/*!***********************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/sessionHistoryMenu.js ***! - \***********************************************************************/ -/*! exports provided: SessionHistoryMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SessionHistoryMenu", function() { return SessionHistoryMenu; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _directives_session_history_menu_pug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! %/directives/session-history-menu.pug */ "./app/assets/templates/directives/session-history-menu.pug"); -/* harmony import */ var _directives_session_history_menu_pug__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_directives_session_history_menu_pug__WEBPACK_IMPORTED_MODULE_2__); - - - - -var SessionHistoryMenuCtrl = /*#__PURE__*/function () { - SessionHistoryMenuCtrl.$inject = ["$timeout"]; - - /* @ngInject */ - function SessionHistoryMenuCtrl($timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SessionHistoryMenuCtrl); - - this.$timeout = $timeout; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(SessionHistoryMenuCtrl, [{ - key: "$onInit", - value: function $onInit() { - this.reloadHistory(); - this.diskEnabled = this.application.historyManager.isDiskEnabled(); - this.autoOptimize = this.application.historyManager.isAutoOptimizeEnabled(); - } - }, { - key: "reloadHistory", - value: function reloadHistory() { - var history = this.application.historyManager.historyForItem(this.item); - this.entries = history.entries.slice(0).sort(function (a, b) { - return a.item.updated_at < b.item.updated_at ? 1 : -1; - }); - this.history = history; - } - }, { - key: "openRevision", - value: function openRevision(revision) { - this.application.presentRevisionPreviewModal(revision.item.uuid, revision.item.content); - } - }, { - key: "classForRevision", - value: function classForRevision(revision) { - var vector = revision.operationVector(); - - if (vector === 0) { - return 'default'; - } else if (vector === 1) { - return 'success'; - } else if (vector === -1) { - return 'danger'; - } - } - }, { - key: "clearItemHistory", - value: function clearItemHistory() { - var _this = this; - - this.application.alertService.confirm({ - text: "Are you sure you want to delete the local session history for this note?", - destructive: true, - onConfirm: function onConfirm() { - _this.application.historyManager.clearHistoryForItem(_this.item).then(function () { - _this.$timeout(function () { - _this.reloadHistory(); - }); - }); - } - }); - } - }, { - key: "clearAllHistory", - value: function clearAllHistory() { - var _this2 = this; - - this.application.alertService.confirm({ - text: "Are you sure you want to delete the local session history for all notes?", - destructive: true, - onConfirm: function onConfirm() { - _this2.application.historyManager.clearAllHistory().then(function () { - _this2.$timeout(function () { - _this2.reloadHistory(); - }); - }); - } - }); - } - }, { - key: "toggleDiskSaving", - value: function toggleDiskSaving() { - var _this3 = this; - - var run = function run() { - _this3.application.historyManager.toggleDiskSaving().then(function () { - _this3.$timeout(function () { - _this3.diskEnabled = _this3.application.historyManager.diskEnabled; - }); - }); - }; - - if (!this.application.historyManager.diskEnabled) { - this.application.alertService.confirm({ - text: "Are you sure you want to save history to disk? This will decrease general \n performance, especially as you type. You are advised to disable this feature \n if you experience any lagging.", - destructive: true, - onConfirm: run - }); - } else { - run(); - } - } - }, { - key: "toggleAutoOptimize", - value: function toggleAutoOptimize() { - var _this4 = this; - - this.application.historyManager.toggleAutoOptimize().then(function () { - _this4.$timeout(function () { - _this4.autoOptimize = _this4.application.historyManager.autoOptimize; - }); - }); - } - }]); - - return SessionHistoryMenuCtrl; -}(); - -var SessionHistoryMenu = function SessionHistoryMenu() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, SessionHistoryMenu); - - this.restrict = 'E'; - this.template = _directives_session_history_menu_pug__WEBPACK_IMPORTED_MODULE_2___default.a; - this.controller = SessionHistoryMenuCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - item: '=', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/directives/views/syncResolutionMenu.js": -/*!***********************************************************************!*\ - !*** ./app/assets/javascripts/directives/views/syncResolutionMenu.js ***! - \***********************************************************************/ -/*! exports provided: SyncResolutionMenu */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyncResolutionMenu", function() { return SyncResolutionMenu; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _directives_sync_resolution_menu_pug__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! %/directives/sync-resolution-menu.pug */ "./app/assets/templates/directives/sync-resolution-menu.pug"); -/* harmony import */ var _directives_sync_resolution_menu_pug__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_directives_sync_resolution_menu_pug__WEBPACK_IMPORTED_MODULE_4__); - - - - - - -var SyncResolutionMenuCtrl = /*#__PURE__*/function () { - SyncResolutionMenuCtrl.$inject = ["$timeout"]; - - /* @ngInject */ - function SyncResolutionMenuCtrl($timeout) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, SyncResolutionMenuCtrl); - - this.$timeout = $timeout; - this.status = {}; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(SyncResolutionMenuCtrl, [{ - key: "downloadBackup", - value: function downloadBackup(encrypted) { - this.application.getArchiveService().downloadBackup(encrypted); - this.status.backupFinished = true; - } - }, { - key: "skipBackup", - value: function skipBackup() { - this.status.backupFinished = true; - } - }, { - key: "performSyncResolution", - value: function () { - var _performSyncResolution = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var _this = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - this.status.resolving = true; - _context.next = 3; - return this.application.resolveOutOfSync(); - - case 3: - this.$timeout(function () { - _this.status.resolving = false; - _this.status.attemptedResolution = true; - - if (_this.application.getSyncStatus().isOutOfSync()) { - _this.status.fail = true; - } else { - _this.status.success = true; - } - }); - - case 4: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function performSyncResolution() { - return _performSyncResolution.apply(this, arguments); - } - - return performSyncResolution; - }() - }, { - key: "close", - value: function close() { - var _this2 = this; - - this.$timeout(function () { - _this2.closeFunction(); - }); - } - }]); - - return SyncResolutionMenuCtrl; -}(); - -var SyncResolutionMenu = function SyncResolutionMenu() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, SyncResolutionMenu); - - this.restrict = 'E'; - this.template = _directives_sync_resolution_menu_pug__WEBPACK_IMPORTED_MODULE_4___default.a; - this.controller = SyncResolutionMenuCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - closeFunction: '&', - application: '=' - }; -}; - -/***/ }), - -/***/ "./app/assets/javascripts/filters/index.js": -/*!*************************************************!*\ - !*** ./app/assets/javascripts/filters/index.js ***! - \*************************************************/ -/*! exports provided: trusted */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _trusted__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./trusted */ "./app/assets/javascripts/filters/trusted.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "trusted", function() { return _trusted__WEBPACK_IMPORTED_MODULE_0__["trusted"]; }); - - - -/***/ }), - -/***/ "./app/assets/javascripts/filters/trusted.js": -/*!***************************************************!*\ - !*** ./app/assets/javascripts/filters/trusted.js ***! - \***************************************************/ -/*! exports provided: trusted */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trusted", function() { return trusted; }); -trusted.$inject = ["$sce"]; - -/* @ngInject */ -function trusted($sce) { - return function (url) { - return $sce.trustAsResourceUrl(url); - }; -} - -/***/ }), - -/***/ "./app/assets/javascripts/index.js": -/*!*****************************************!*\ - !*** ./app/assets/javascripts/index.js ***! - \*****************************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var sn_stylekit_dist_stylekit_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sn-stylekit/dist/stylekit.css */ "./node_modules/sn-stylekit/dist/stylekit.css"); -/* harmony import */ var sn_stylekit_dist_stylekit_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sn_stylekit_dist_stylekit_css__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _stylesheets_index_css_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../stylesheets/index.css.scss */ "./app/assets/stylesheets/index.css.scss"); -/* harmony import */ var _stylesheets_index_css_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_stylesheets_index_css_scss__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! angular */ "./node_modules/angular/index.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _vendor_assets_javascripts_angular_sanitize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../vendor/assets/javascripts/angular-sanitize */ "./vendor/assets/javascripts/angular-sanitize.js"); -/* harmony import */ var _vendor_assets_javascripts_angular_sanitize__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_vendor_assets_javascripts_angular_sanitize__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _vendor_assets_javascripts_zip_deflate__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../vendor/assets/javascripts/zip/deflate */ "./vendor/assets/javascripts/zip/deflate.js"); -/* harmony import */ var _vendor_assets_javascripts_zip_deflate__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_vendor_assets_javascripts_zip_deflate__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _vendor_assets_javascripts_zip_inflate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../vendor/assets/javascripts/zip/inflate */ "./vendor/assets/javascripts/zip/inflate.js"); -/* harmony import */ var _vendor_assets_javascripts_zip_inflate__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_vendor_assets_javascripts_zip_inflate__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _vendor_assets_javascripts_zip_zip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../vendor/assets/javascripts/zip/zip */ "./vendor/assets/javascripts/zip/zip.js"); -/* harmony import */ var _vendor_assets_javascripts_zip_zip__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_vendor_assets_javascripts_zip_zip__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _vendor_assets_javascripts_zip_z_worker__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../vendor/assets/javascripts/zip/z-worker */ "./vendor/assets/javascripts/zip/z-worker.js"); -/* harmony import */ var _vendor_assets_javascripts_zip_z_worker__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_vendor_assets_javascripts_zip_z_worker__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./app */ "./app/assets/javascripts/app.js"); -//= require_tree ./app -// css - - // Vendor - - - - - - - // entry point -// eslint-disable-next-line import/first - - - -/***/ }), - -/***/ "./app/assets/javascripts/routes.js": -/*!******************************************!*\ - !*** ./app/assets/javascripts/routes.js ***! - \******************************************/ -/*! exports provided: configRoutes */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "configRoutes", function() { return configRoutes; }); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./app/assets/javascripts/utils.js"); -configRoutes.$inject = ["$locationProvider"]; - -/* @ngInject */ - -function configRoutes($locationProvider) { - if (!Object(_utils__WEBPACK_IMPORTED_MODULE_0__["isDesktopApplication"])()) { - if (window.history && window.history.pushState) { - $locationProvider.html5Mode({ - enabled: true, - requireBase: false - }); - } - } else { - $locationProvider.html5Mode(false); - } -} - -/***/ }), - -/***/ "./app/assets/javascripts/services/alertService.js": -/*!*********************************************************!*\ - !*** ./app/assets/javascripts/services/alertService.js ***! - \*********************************************************/ -/*! exports provided: AlertService */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AlertService", function() { return AlertService; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var sn_stylekit__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! sn-stylekit */ "./node_modules/sn-stylekit/dist/stylekit.js"); -/* harmony import */ var sn_stylekit__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(sn_stylekit__WEBPACK_IMPORTED_MODULE_8__); - - - - - - - - -/* eslint-disable prefer-promise-reject-errors */ - - -var AlertService = /*#__PURE__*/function (_SNAlertService) { - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6___default()(AlertService, _SNAlertService); - - function AlertService() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, AlertService); - - return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(AlertService).apply(this, arguments)); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(AlertService, [{ - key: "alert", - value: function () { - var _alert = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var _this = this; - - var _ref, - title, - text, - _ref$closeButtonText, - closeButtonText, - onClose, - _args2 = arguments; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _ref = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, title = _ref.title, text = _ref.text, _ref$closeButtonText = _ref.closeButtonText, closeButtonText = _ref$closeButtonText === void 0 ? "OK" : _ref$closeButtonText, onClose = _ref.onClose; - return _context2.abrupt("return", new Promise(function (resolve) { - var buttons = [{ - text: closeButtonText, - style: "neutral", - action: function () { - var _action = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (onClose) { - _this.deviceInterface.timeout(onClose); - } - - resolve(true); - - case 2: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - function action() { - return _action.apply(this, arguments); - } - - return action; - }() - }]; - var alert = new sn_stylekit__WEBPACK_IMPORTED_MODULE_8__["SKAlert"]({ - title: title, - text: text, - buttons: buttons - }); - alert.present(); - })); - - case 2: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - function alert() { - return _alert.apply(this, arguments); - } - - return alert; - }() - }, { - key: "confirm", - value: function () { - var _confirm = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - var _this2 = this; - - var _ref2, - title, - text, - _ref2$confirmButtonTe, - confirmButtonText, - _ref2$cancelButtonTex, - cancelButtonText, - onConfirm, - onCancel, - _ref2$destructive, - destructive, - _args5 = arguments; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - _ref2 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, title = _ref2.title, text = _ref2.text, _ref2$confirmButtonTe = _ref2.confirmButtonText, confirmButtonText = _ref2$confirmButtonTe === void 0 ? "Confirm" : _ref2$confirmButtonTe, _ref2$cancelButtonTex = _ref2.cancelButtonText, cancelButtonText = _ref2$cancelButtonTex === void 0 ? "Cancel" : _ref2$cancelButtonTex, onConfirm = _ref2.onConfirm, onCancel = _ref2.onCancel, _ref2$destructive = _ref2.destructive, destructive = _ref2$destructive === void 0 ? false : _ref2$destructive; - return _context5.abrupt("return", new Promise(function (resolve, reject) { - var buttons = [{ - text: cancelButtonText, - style: "neutral", - action: function () { - var _action2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (onCancel) { - _this2.deviceInterface.timeout(onCancel); - } - - reject(false); - - case 2: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - function action() { - return _action2.apply(this, arguments); - } - - return action; - }() - }, { - text: confirmButtonText, - style: destructive ? "danger" : "info", - action: function () { - var _action3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - if (onConfirm) { - _this2.deviceInterface.timeout(onConfirm); - } - - resolve(true); - - case 2: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - - function action() { - return _action3.apply(this, arguments); - } - - return action; - }() - }]; - var alert = new sn_stylekit__WEBPACK_IMPORTED_MODULE_8__["SKAlert"]({ - title: title, - text: text, - buttons: buttons - }); - alert.present(); - })); - - case 2: - case "end": - return _context5.stop(); - } - } - }, _callee5); - })); - - function confirm() { - return _confirm.apply(this, arguments); - } - - return confirm; - }() - }]); - - return AlertService; -}(snjs__WEBPACK_IMPORTED_MODULE_7__["SNAlertService"]); - -/***/ }), - -/***/ "./app/assets/javascripts/services/archiveManager.js": -/*!***********************************************************!*\ - !*** ./app/assets/javascripts/services/archiveManager.js ***! - \***********************************************************/ -/*! exports provided: ArchiveManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArchiveManager", function() { return ArchiveManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_4__); - - - - - -var ArchiveManager = /*#__PURE__*/function () { - function ArchiveManager(application) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ArchiveManager); - - this.application = application; - } - /** @public */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ArchiveManager, [{ - key: "downloadBackup", - value: function () { - var _downloadBackup = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(encrypted) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", this.downloadBackupOfItems(this.application.modelManager.allItems, encrypted)); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function downloadBackup(_x) { - return _downloadBackup.apply(this, arguments); - } - - return downloadBackup; - }() - /** @public */ - - }, { - key: "downloadBackupOfItems", - value: function () { - var _downloadBackupOfItems = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(items, encrypted) { - var _this = this; - - var run; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - run = /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var intent; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - // download in Standard Notes format - intent = encrypted ? snjs__WEBPACK_IMPORTED_MODULE_4__["EncryptionIntents"].FileEncrypted : snjs__WEBPACK_IMPORTED_MODULE_4__["EncryptionIntents"].FileDecrypted; - - _this.itemsData(items, intent).then(function (data) { - var modifier = encrypted ? "Encrypted" : "Decrypted"; - - _this.downloadData(data, "Standard Notes ".concat(modifier, " Backup - ").concat(_this.formattedDate(), ".txt")); // download as zipped plain text files - - - if (!encrypted) { - _this.downloadZippedItems(items); - } - }); - - case 2: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - return function run() { - return _ref.apply(this, arguments); - }; - }(); - - _context3.next = 3; - return this.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_4__["ProtectedActions"].ManageBackups); - - case 3: - if (!_context3.sent) { - _context3.next = 7; - break; - } - - this.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_4__["ProtectedActions"].ManageBackups, function () { - run(); - }); - _context3.next = 8; - break; - - case 7: - run(); - - case 8: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function downloadBackupOfItems(_x2, _x3) { - return _downloadBackupOfItems.apply(this, arguments); - } - - return downloadBackupOfItems; - }() - /** @private */ - - }, { - key: "formattedDate", - value: function formattedDate() { - var string = "".concat(new Date()); // Match up to the first parenthesis, i.e do not include '(Central Standard Time)' - - var matches = string.match(/^(.*?) \(/); - - if (matches.length >= 2) { - return matches[1]; - } - - return string; - } - /** @private */ - - }, { - key: "itemsData", - value: function () { - var _itemsData = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(items, intent) { - var data, blobData; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.next = 2; - return this.application.createBackupFile({ - subItems: items, - intent: intent - }); - - case 2: - data = _context4.sent; - blobData = new Blob([data], { - type: 'text/json' - }); - return _context4.abrupt("return", blobData); - - case 5: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function itemsData(_x4, _x5) { - return _itemsData.apply(this, arguments); - } - - return itemsData; - }() - /** @private */ - - }, { - key: "loadZip", - value: function () { - var _loadZip = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - var scriptTag, headTag; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - if (!window.zip) { - _context5.next = 2; - break; - } - - return _context5.abrupt("return"); - - case 2: - scriptTag = document.createElement('script'); - scriptTag.src = "/assets/zip/zip.js"; - scriptTag.async = false; - headTag = document.getElementsByTagName('head')[0]; - headTag.appendChild(scriptTag); - return _context5.abrupt("return", new Promise(function (resolve, reject) { - scriptTag.onload = function () { - zip.workerScriptsPath = "assets/zip/"; - resolve(); - }; - })); - - case 8: - case "end": - return _context5.stop(); - } - } - }, _callee5); - })); - - function loadZip() { - return _loadZip.apply(this, arguments); - } - - return loadZip; - }() - /** @private */ - - }, { - key: "downloadZippedItems", - value: function () { - var _downloadZippedItems = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6(items) { - var _this2 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - _context6.next = 2; - return this.loadZip(); - - case 2: - zip.createWriter(new zip.BlobWriter("application/zip"), function (zipWriter) { - var index = 0; - - var nextFile = function nextFile() { - var item = items[index]; - var name, contents; - - if (item.content_type === "Note") { - name = item.content.title; - contents = item.content.text; - } else { - name = item.content_type; - contents = JSON.stringify(item.content, null, 2); - } - - if (!name) { - name = ""; - } - - var blob = new Blob([contents], { - type: 'text/plain' - }); - var filePrefix = name.replace(/\//g, "").replace(/\\+/g, ""); - var fileSuffix = "-".concat(item.uuid.split("-")[0], ".txt"); // Standard max filename length is 255. Slice the note name down to allow filenameEnd - - filePrefix = filePrefix.slice(0, 255 - fileSuffix.length); - var fileName = "".concat(item.content_type, "/").concat(filePrefix).concat(fileSuffix); - zipWriter.add(fileName, new zip.BlobReader(blob), function () { - index++; - - if (index < items.length) { - nextFile(); - } else { - zipWriter.close(function (blob) { - _this2.downloadData(blob, "Standard Notes Backup - ".concat(_this2.formattedDate(), ".zip")); - - zipWriter = null; - }); - } - }); - }; - - nextFile(); - }, onerror); - - case 3: - case "end": - return _context6.stop(); - } - } - }, _callee6, this); - })); - - function downloadZippedItems(_x6) { - return _downloadZippedItems.apply(this, arguments); - } - - return downloadZippedItems; - }() - /** @private */ - - }, { - key: "hrefForData", - value: function hrefForData(data) { - // If we are replacing a previously generated file we need to - // manually revoke the object URL to avoid memory leaks. - if (this.textFile !== null) { - window.URL.revokeObjectURL(this.textFile); - } - - this.textFile = window.URL.createObjectURL(data); // returns a URL you can use as a href - - return this.textFile; - } - /** @private */ - - }, { - key: "downloadData", - value: function downloadData(data, fileName) { - var link = document.createElement('a'); - link.setAttribute('download', fileName); - link.href = this.hrefForData(data); - document.body.appendChild(link); - link.click(); - link.remove(); - } - }]); - - return ArchiveManager; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/services/desktopManager.js": -/*!***********************************************************!*\ - !*** ./app/assets/javascripts/services/desktopManager.js ***! - \***********************************************************/ -/*! exports provided: DesktopManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DesktopManager", function() { return DesktopManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); - - - - - - - - - -/* eslint-disable camelcase */ -// An interface used by the Desktop app to interact with SN - - -var COMPONENT_DATA_KEY_INSTALL_ERROR = 'installError'; -var COMPONENT_CONTENT_KEY_PACKAGE_INFO = 'package_info'; -var COMPONENT_CONTENT_KEY_LOCAL_URL = 'local_url'; -var DesktopManager = /*#__PURE__*/function (_ApplicationService) { - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(DesktopManager, _ApplicationService); - - function DesktopManager($rootScope, $timeout, application) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, DesktopManager); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(DesktopManager).call(this, application)); - _this.$rootScope = $rootScope; - _this.$timeout = $timeout; - _this.componentActivationObservers = []; - _this.updateObservers = []; - _this.isDesktop = Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isDesktopApplication"])(); - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(DesktopManager, [{ - key: "deinit", - value: function deinit() { - this.componentActivationObservers.length = 0; - this.updateObservers.length = 0; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(DesktopManager.prototype), "deinit", this).call(this); - } - /** @override */ - - }, { - key: "onAppEvent", - value: function onAppEvent(eventName) { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(DesktopManager.prototype), "onAppEvent", this).call(this, eventName); - - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_9__["ApplicationEvents"].LocalDataLoaded) { - this.dataLoaded = true; - - if (this.dataLoadHandler) { - this.dataLoadHandler(); - } - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_9__["ApplicationEvents"].MajorDataChange) { - if (this.majorDataChangeHandler) { - this.majorDataChangeHandler(); - } - } - } - }, { - key: "saveBackup", - value: function saveBackup() { - this.majorDataChangeHandler && this.majorDataChangeHandler(); - } - }, { - key: "getExtServerHost", - value: function getExtServerHost() { - console.assert(this.extServerHost, 'extServerHost is null'); - return this.extServerHost; - } - /** - * Sending a component in its raw state is really slow for the desktop app - * Keys are not passed into ItemParams, so the result is not encrypted - */ - - }, { - key: "convertComponentForTransmission", - value: function () { - var _convertComponentForTransmission = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(component) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", this.application.protocolService.payloadByEncryptingPayload({ - payload: component.payloadRepresentation(), - intent: snjs__WEBPACK_IMPORTED_MODULE_9__["EncryptionIntents"].FileDecrypted - })); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function convertComponentForTransmission(_x) { - return _convertComponentForTransmission.apply(this, arguments); - } - - return convertComponentForTransmission; - }() // All `components` should be installed - - }, { - key: "syncComponentsInstallation", - value: function syncComponentsInstallation(components) { - var _this2 = this; - - if (!this.isDesktop) { - return; - } - - Promise.all(components.map(function (component) { - return _this2.convertComponentForTransmission(component); - })).then(function (data) { - _this2.installationSyncHandler(data); - }); - } - }, { - key: "installComponent", - value: function () { - var _installComponent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(component) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.t0 = this; - _context2.next = 3; - return this.convertComponentForTransmission(component); - - case 3: - _context2.t1 = _context2.sent; - - _context2.t0.installComponentHandler.call(_context2.t0, _context2.t1); - - case 5: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function installComponent(_x2) { - return _installComponent.apply(this, arguments); - } - - return installComponent; - }() - }, { - key: "registerUpdateObserver", - value: function registerUpdateObserver(callback) { - var _this3 = this; - - var observer = { - callback: callback - }; - this.updateObservers.push(observer); - return function () { - Object(snjs__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(_this3.updateObservers, observer); - }; - } - }, { - key: "searchText", - value: function searchText(text) { - if (!this.isDesktop) { - return; - } - - this.lastSearchedText = text; - this.searchHandler && this.searchHandler(text); - } - }, { - key: "redoSearch", - value: function redoSearch() { - if (this.lastSearchedText) { - this.searchText(this.lastSearchedText); - } - } // Pass null to cancel search - - }, { - key: "desktop_setSearchHandler", - value: function desktop_setSearchHandler(handler) { - this.searchHandler = handler; - } - }, { - key: "desktop_windowGainedFocus", - value: function desktop_windowGainedFocus() { - this.$rootScope.$broadcast('window-gained-focus'); - } - }, { - key: "desktop_windowLostFocus", - value: function desktop_windowLostFocus() { - this.$rootScope.$broadcast('window-lost-focus'); - } - }, { - key: "desktop_onComponentInstallationComplete", - value: function () { - var _desktop_onComponentInstallationComplete = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(componentData, error) { - var _this4 = this; - - var component, permissableKeys, _i, _permissableKeys, key; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _context3.next = 2; - return this.application.findItem({ - uuid: componentData.uuid - }); - - case 2: - component = _context3.sent; - - if (component) { - _context3.next = 5; - break; - } - - return _context3.abrupt("return"); - - case 5: - if (error) { - component.setAppDataItem(COMPONENT_DATA_KEY_INSTALL_ERROR, error); - } else { - permissableKeys = [COMPONENT_CONTENT_KEY_PACKAGE_INFO, COMPONENT_CONTENT_KEY_LOCAL_URL]; - - for (_i = 0, _permissableKeys = permissableKeys; _i < _permissableKeys.length; _i++) { - key = _permissableKeys[_i]; - component[key] = componentData.content[key]; - } - - component.setAppDataItem(COMPONENT_DATA_KEY_INSTALL_ERROR, null); - } - - this.application.saveItem({ - item: component - }); - this.$timeout(function () { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = _this4.updateObservers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var observer = _step.value; - observer.callback(component); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - }); - - case 8: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function desktop_onComponentInstallationComplete(_x3, _x4) { - return _desktop_onComponentInstallationComplete.apply(this, arguments); - } - - return desktop_onComponentInstallationComplete; - }() - }, { - key: "desktop_registerComponentActivationObserver", - value: function desktop_registerComponentActivationObserver(callback) { - var observer = { - id: Math.random, - callback: callback - }; - this.componentActivationObservers.push(observer); - return observer; - } - }, { - key: "desktop_deregisterComponentActivationObserver", - value: function desktop_deregisterComponentActivationObserver(observer) { - Object(snjs__WEBPACK_IMPORTED_MODULE_9__["removeFromArray"])(this.componentActivationObservers, observer); - } - /* Notify observers that a component has been registered/activated */ - - }, { - key: "notifyComponentActivation", - value: function () { - var _notifyComponentActivation = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(component) { - var _this5 = this; - - var serializedComponent; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.next = 2; - return this.convertComponentForTransmission(component); - - case 2: - serializedComponent = _context4.sent; - this.$timeout(function () { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = _this5.componentActivationObservers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var observer = _step2.value; - observer.callback(serializedComponent); - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - }); - - case 4: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function notifyComponentActivation(_x5) { - return _notifyComponentActivation.apply(this, arguments); - } - - return notifyComponentActivation; - }() - /* Used to resolve 'sn://' */ - - }, { - key: "desktop_setExtServerHost", - value: function desktop_setExtServerHost(host) { - this.extServerHost = host; - this.application.getAppState().desktopExtensionsReady(); - } - }, { - key: "desktop_setComponentInstallationSyncHandler", - value: function desktop_setComponentInstallationSyncHandler(handler) { - this.installationSyncHandler = handler; - } - }, { - key: "desktop_setInstallComponentHandler", - value: function desktop_setInstallComponentHandler(handler) { - this.installComponentHandler = handler; - } - }, { - key: "desktop_setInitialDataLoadHandler", - value: function desktop_setInitialDataLoadHandler(handler) { - this.dataLoadHandler = handler; - - if (this.dataLoaded) { - this.dataLoadHandler(); - } - } - }, { - key: "desktop_requestBackupFile", - value: function () { - var _desktop_requestBackupFile = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(callback) { - var data; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - _context5.next = 2; - return this.application.createBackupFile({ - returnIfEmpty: true - }); - - case 2: - data = _context5.sent; - callback(data); - - case 4: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function desktop_requestBackupFile(_x6) { - return _desktop_requestBackupFile.apply(this, arguments); - } - - return desktop_requestBackupFile; - }() - }, { - key: "desktop_setMajorDataChangeHandler", - value: function desktop_setMajorDataChangeHandler(handler) { - this.majorDataChangeHandler = handler; - } - }, { - key: "desktop_didBeginBackup", - value: function desktop_didBeginBackup() { - this.application.getAppState().beganBackupDownload(); - } - }, { - key: "desktop_didFinishBackup", - value: function desktop_didFinishBackup(success) { - this.application.getAppState().endedBackupDownload({ - success: success - }); - } - }]); - - return DesktopManager; -}(snjs__WEBPACK_IMPORTED_MODULE_9__["ApplicationService"]); - -/***/ }), - -/***/ "./app/assets/javascripts/services/index.js": -/*!**************************************************!*\ - !*** ./app/assets/javascripts/services/index.js ***! - \**************************************************/ -/*! exports provided: AlertService, ArchiveManager, DesktopManager, KeyboardManager, LockManager, NativeExtManager, PreferencesManager, StatusManager, ThemeManager, AppState */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _alertService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./alertService */ "./app/assets/javascripts/services/alertService.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AlertService", function() { return _alertService__WEBPACK_IMPORTED_MODULE_0__["AlertService"]; }); - -/* harmony import */ var _archiveManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./archiveManager */ "./app/assets/javascripts/services/archiveManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArchiveManager", function() { return _archiveManager__WEBPACK_IMPORTED_MODULE_1__["ArchiveManager"]; }); - -/* harmony import */ var _desktopManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./desktopManager */ "./app/assets/javascripts/services/desktopManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DesktopManager", function() { return _desktopManager__WEBPACK_IMPORTED_MODULE_2__["DesktopManager"]; }); - -/* harmony import */ var _keyboardManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./keyboardManager */ "./app/assets/javascripts/services/keyboardManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KeyboardManager", function() { return _keyboardManager__WEBPACK_IMPORTED_MODULE_3__["KeyboardManager"]; }); - -/* harmony import */ var _lockManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lockManager */ "./app/assets/javascripts/services/lockManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LockManager", function() { return _lockManager__WEBPACK_IMPORTED_MODULE_4__["LockManager"]; }); - -/* harmony import */ var _nativeExtManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nativeExtManager */ "./app/assets/javascripts/services/nativeExtManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NativeExtManager", function() { return _nativeExtManager__WEBPACK_IMPORTED_MODULE_5__["NativeExtManager"]; }); - -/* harmony import */ var _preferencesManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./preferencesManager */ "./app/assets/javascripts/services/preferencesManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PreferencesManager", function() { return _preferencesManager__WEBPACK_IMPORTED_MODULE_6__["PreferencesManager"]; }); - -/* harmony import */ var _statusManager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./statusManager */ "./app/assets/javascripts/services/statusManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StatusManager", function() { return _statusManager__WEBPACK_IMPORTED_MODULE_7__["StatusManager"]; }); - -/* harmony import */ var _themeManager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./themeManager */ "./app/assets/javascripts/services/themeManager.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ThemeManager", function() { return _themeManager__WEBPACK_IMPORTED_MODULE_8__["ThemeManager"]; }); - -/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./state */ "./app/assets/javascripts/services/state.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AppState", function() { return _state__WEBPACK_IMPORTED_MODULE_9__["AppState"]; }); - - - - - - - - - - - - -/***/ }), - -/***/ "./app/assets/javascripts/services/keyboardManager.js": -/*!************************************************************!*\ - !*** ./app/assets/javascripts/services/keyboardManager.js ***! - \************************************************************/ -/*! exports provided: KeyboardKeys, KeyboardModifiers, KeyboardManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyboardKeys", function() { return KeyboardKeys; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyboardModifiers", function() { return KeyboardModifiers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyboardManager", function() { return KeyboardManager; }); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__); - - - -/** @public */ -var KeyboardKeys = { - Tab: "Tab", - Backspace: "Backspace", - Up: "ArrowUp", - Down: "ArrowDown" -}; -/** @public */ - -var KeyboardModifiers = { - Shift: "Shift", - Ctrl: "Control", - - /** ⌘ key on Mac, ⊞ key on Windows */ - Meta: "Meta", - Alt: "Alt" -}; -/** @private */ - -var KeyboardKeyEvents = { - Down: "KeyEventDown", - Up: "KeyEventUp" -}; -var KeyboardManager = /*#__PURE__*/function () { - function KeyboardManager() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, KeyboardManager); - - this.observers = []; - this.handleKeyDown = this.handleKeyDown.bind(this); - this.handleKeyUp = this.handleKeyUp.bind(this); - window.addEventListener('keydown', this.handleKeyDown); - window.addEventListener('keyup', this.handleKeyUp); - } - /** @access public */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(KeyboardManager, [{ - key: "deinit", - value: function deinit() { - this.observers.length = 0; - window.removeEventListener('keydown', this.handleKeyDown); - window.removeEventListener('keyup', this.handleKeyUp); - this.handleKeyDown = null; - this.handleKeyUp = null; - } - }, { - key: "modifiersForEvent", - value: function modifiersForEvent(event) { - var allModifiers = Object.keys(KeyboardModifiers).map(function (key) { - return KeyboardModifiers[key]; - }); - var eventModifiers = allModifiers.filter(function (modifier) { - // For a modifier like ctrlKey, must check both event.ctrlKey and event.key. - // That's because on keyup, event.ctrlKey would be false, but event.key == Control would be true. - var matches = (event.ctrlKey || event.key === KeyboardModifiers.Ctrl) && modifier === KeyboardModifiers.Ctrl || (event.metaKey || event.key === KeyboardModifiers.Meta) && modifier === KeyboardModifiers.Meta || (event.altKey || event.key === KeyboardModifiers.Alt) && modifier === KeyboardModifiers.Alt || (event.shiftKey || event.key === KeyboardModifiers.Shift) && modifier === KeyboardModifiers.Shift; - return matches; - }); - return eventModifiers; - } - }, { - key: "eventMatchesKeyAndModifiers", - value: function eventMatchesKeyAndModifiers(event, key) { - var modifiers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - var eventModifiers = this.modifiersForEvent(event); - - if (eventModifiers.length !== modifiers.length) { - return false; - } - - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = modifiers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var modifier = _step.value; - - if (!eventModifiers.includes(modifier)) { - return false; - } - } // Modifers match, check key - - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - - if (!key) { - return true; - } // In the browser, shift + f results in key 'f', but in Electron, shift + f results in 'F' - // In our case we don't differentiate between the two. - - - return key.toLowerCase() === event.key.toLowerCase(); - } - }, { - key: "notifyObserver", - value: function notifyObserver(event, keyEventType) { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = this.observers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var observer = _step2.value; - - if (observer.element && event.target !== observer.element) { - continue; - } - - if (observer.elements && !observer.elements.includes(event.target)) { - continue; - } - - if (observer.notElement && observer.notElement === event.target) { - continue; - } - - if (observer.notElementIds && observer.notElementIds.includes(event.target.id)) { - continue; - } - - if (this.eventMatchesKeyAndModifiers(event, observer.key, observer.modifiers)) { - var callback = keyEventType === KeyboardKeyEvents.Down ? observer.onKeyDown : observer.onKeyUp; - - if (callback) { - callback(event); - } - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - } - }, { - key: "handleKeyDown", - value: function handleKeyDown(event) { - this.notifyObserver(event, KeyboardKeyEvents.Down); - } - }, { - key: "handleKeyUp", - value: function handleKeyUp(event) { - this.notifyObserver(event, KeyboardKeyEvents.Up); - } - }, { - key: "addKeyObserver", - value: function addKeyObserver(_ref) { - var key = _ref.key, - modifiers = _ref.modifiers, - onKeyDown = _ref.onKeyDown, - onKeyUp = _ref.onKeyUp, - element = _ref.element, - elements = _ref.elements, - notElement = _ref.notElement, - notElementIds = _ref.notElementIds; - var observer = { - key: key, - modifiers: modifiers, - onKeyDown: onKeyDown, - onKeyUp: onKeyUp, - element: element, - elements: elements, - notElement: notElement, - notElementIds: notElementIds - }; - this.observers.push(observer); - return observer; - } - }, { - key: "removeKeyObserver", - value: function removeKeyObserver(observer) { - this.observers.splice(this.observers.indexOf(observer), 1); - } - }]); - - return KeyboardManager; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/services/lockManager.js": -/*!********************************************************!*\ - !*** ./app/assets/javascripts/services/lockManager.js ***! - \********************************************************/ -/*! exports provided: LockManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(setImmediate) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LockManager", function() { return LockManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); - - - - - - -var MILLISECONDS_PER_SECOND = 1000; -var FOCUS_POLL_INTERVAL = 1 * MILLISECONDS_PER_SECOND; -var LOCK_INTERVAL_NONE = 0; -var LOCK_INTERVAL_IMMEDIATE = 1; -var LOCK_INTERVAL_ONE_MINUTE = 60 * MILLISECONDS_PER_SECOND; -var LOCK_INTERVAL_FIVE_MINUTES = 300 * MILLISECONDS_PER_SECOND; -var LOCK_INTERVAL_ONE_HOUR = 3600 * MILLISECONDS_PER_SECOND; -var STORAGE_KEY_AUTOLOCK_INTERVAL = "AutoLockIntervalKey"; -var LockManager = /*#__PURE__*/function () { - function LockManager(application) { - var _this = this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, LockManager); - - this.application = application; - setImmediate(function () { - _this.observeVisibility(); - }); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(LockManager, [{ - key: "observeVisibility", - value: function observeVisibility() { - var _this2 = this; - - this.unsubState = this.application.getAppState().addObserver(function (eventName) { - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_5__["AppStateEvents"].WindowDidBlur) { - _this2.documentVisibilityChanged(false); - } else if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_5__["AppStateEvents"].WindowDidFocus) { - _this2.documentVisibilityChanged(true); - } - }); - - if (!Object(_utils__WEBPACK_IMPORTED_MODULE_4__["isDesktopApplication"])()) { - this.beginWebFocusPolling(); - } - } - }, { - key: "deinit", - value: function deinit() { - this.unsubState(); - - if (this.pollFocusInterval) { - clearInterval(this.pollFocusInterval); - } - } - }, { - key: "setAutoLockInterval", - value: function () { - var _setAutoLockInterval = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(interval) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", this.application.setValue(STORAGE_KEY_AUTOLOCK_INTERVAL, interval)); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function setAutoLockInterval(_x) { - return _setAutoLockInterval.apply(this, arguments); - } - - return setAutoLockInterval; - }() - }, { - key: "getAutoLockInterval", - value: function () { - var _getAutoLockInterval = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var interval; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.application.getValue(STORAGE_KEY_AUTOLOCK_INTERVAL); - - case 2: - interval = _context2.sent; - - if (!interval) { - _context2.next = 7; - break; - } - - return _context2.abrupt("return", interval); - - case 7: - return _context2.abrupt("return", LOCK_INTERVAL_NONE); - - case 8: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function getAutoLockInterval() { - return _getAutoLockInterval.apply(this, arguments); - } - - return getAutoLockInterval; - }() - /** - * Verify document is in focus every so often as visibilitychange event is - * not triggered on a typical window blur event but rather on tab changes. - */ - - }, { - key: "beginWebFocusPolling", - value: function beginWebFocusPolling() { - var _this3 = this; - - this.pollFocusInterval = setInterval(function () { - var hasFocus = document.hasFocus(); - - if (hasFocus && _this3.lastFocusState === 'hidden') { - _this3.documentVisibilityChanged(true); - } else if (!hasFocus && _this3.lastFocusState === 'visible') { - _this3.documentVisibilityChanged(false); - } - /* Save this to compare against next time around */ - - - _this3.lastFocusState = hasFocus ? 'visible' : 'hidden'; - }, FOCUS_POLL_INTERVAL); - } - }, { - key: "getAutoLockIntervalOptions", - value: function getAutoLockIntervalOptions() { - return [{ - value: LOCK_INTERVAL_NONE, - label: "Off" - }, { - value: LOCK_INTERVAL_IMMEDIATE, - label: "Immediately" - }, { - value: LOCK_INTERVAL_ONE_MINUTE, - label: "1m" - }, { - value: LOCK_INTERVAL_FIVE_MINUTES, - label: "5m" - }, { - value: LOCK_INTERVAL_ONE_HOUR, - label: "1h" - }]; - } - }, { - key: "documentVisibilityChanged", - value: function () { - var _documentVisibilityChanged = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(visible) { - var locked; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - if (!visible) { - _context3.next = 8; - break; - } - - _context3.next = 3; - return this.application.isLocked(); - - case 3: - locked = _context3.sent; - - if (!locked && this.lockAfterDate && new Date() > this.lockAfterDate) { - this.application.lock(); - } - - this.cancelAutoLockTimer(); - _context3.next = 9; - break; - - case 8: - this.beginAutoLockTimer(); - - case 9: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function documentVisibilityChanged(_x2) { - return _documentVisibilityChanged.apply(this, arguments); - } - - return documentVisibilityChanged; - }() - }, { - key: "beginAutoLockTimer", - value: function () { - var _beginAutoLockTimer = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - var _this4 = this; - - var interval, addToNow; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - _context4.next = 2; - return this.getAutoLockInterval(); - - case 2: - interval = _context4.sent; - - if (!(interval === LOCK_INTERVAL_NONE)) { - _context4.next = 5; - break; - } - - return _context4.abrupt("return"); - - case 5: - /** - * Use a timeout if possible, but if the computer is put to sleep, timeouts won't - * work. Need to set a date as backup. this.lockAfterDate does not need to be - * persisted, as living in memory is sufficient. If memory is cleared, then the - * application will lock anyway. - */ - addToNow = function addToNow(seconds) { - var date = new Date(); - date.setSeconds(date.getSeconds() + seconds); - return date; - }; - - this.lockAfterDate = addToNow(interval / MILLISECONDS_PER_SECOND); - this.lockTimeout = setTimeout(function () { - _this4.cancelAutoLockTimer(); - - _this4.application.lock(); - - _this4.lockAfterDate = null; - }, interval); - - case 8: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function beginAutoLockTimer() { - return _beginAutoLockTimer.apply(this, arguments); - } - - return beginAutoLockTimer; - }() - }, { - key: "cancelAutoLockTimer", - value: function cancelAutoLockTimer() { - clearTimeout(this.lockTimeout); - this.lockAfterDate = null; - } - }]); - - return LockManager; -}(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) - -/***/ }), - -/***/ "./app/assets/javascripts/services/nativeExtManager.js": -/*!*************************************************************!*\ - !*** ./app/assets/javascripts/services/nativeExtManager.js ***! - \*************************************************************/ -/*! exports provided: NativeExtManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NativeExtManager", function() { return NativeExtManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); - - - - - - - - - - -var STREAM_ITEMS_PERMISSION = 'stream-items'; -/** A class for handling installation of system extensions */ - -var NativeExtManager = /*#__PURE__*/function (_ApplicationService) { - NativeExtManager.$inject = ["application"]; - - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(NativeExtManager, _ApplicationService); - - /* @ngInject */ - function NativeExtManager(application) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, NativeExtManager); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(NativeExtManager).call(this, application)); - _this.extManagerId = 'org.standardnotes.extensions-manager'; - _this.batchManagerId = 'org.standardnotes.batch-manager'; - return _this; - } - /** @override */ - - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(NativeExtManager, [{ - key: "onAppLaunch", - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(NativeExtManager.prototype), "onAppLaunch", this).call(this); - - this.reload(); - } - }, { - key: "reload", - value: function reload() { - this.application.singletonManager.registerPredicate(this.extManagerPred); - this.application.singletonManager.registerPredicate(this.batchManagerPred); - this.resolveExtensionsManager(); - this.resolveBatchManager(); - } - }, { - key: "resolveExtensionsManager", - value: function () { - var _resolveExtensionsManager = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var extensionsManager, needsSync, permission; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this.application.singletonManager.findOrCreateSingleton({ - predicate: this.extManagerPred, - createPayload: this.extensionsManagerTemplatePayload() - }); - - case 2: - extensionsManager = _context.sent; - needsSync = false; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isDesktopApplication"])()) { - if (!extensionsManager.local_url) { - extensionsManager.local_url = window._extensions_manager_location; - needsSync = true; - } - } else { - if (!extensionsManager.hosted_url) { - extensionsManager.hosted_url = window._extensions_manager_location; - needsSync = true; - } - } // Handle addition of SN|ExtensionRepo permission - - - permission = extensionsManager.content.permissions.find(function (p) { - return p.name === STREAM_ITEMS_PERMISSION; - }); - - if (!permission.content_types.includes(snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ExtensionRepo)) { - permission.content_types.push(snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ExtensionRepo); - needsSync = true; - } - - if (needsSync) { - this.application.saveItem({ - item: extensionsManager - }); - } - - case 8: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function resolveExtensionsManager() { - return _resolveExtensionsManager.apply(this, arguments); - } - - return resolveExtensionsManager; - }() - }, { - key: "extensionsManagerTemplatePayload", - value: function extensionsManagerTemplatePayload() { - var url = window._extensions_manager_location; - - if (!url) { - console.error('window._extensions_manager_location must be set.'); - return; - } - - var packageInfo = { - name: 'Extensions', - identifier: this.extManagerId - }; - var content = { - name: packageInfo.name, - area: 'rooms', - package_info: packageInfo, - permissions: [{ - name: STREAM_ITEMS_PERMISSION, - content_types: [snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Component, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Theme, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ServerExtension, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ActionsExtension, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Mfa, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Editor, snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ExtensionRepo] - }] - }; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isDesktopApplication"])()) { - content.local_url = window._extensions_manager_location; - } else { - content.hosted_url = window._extensions_manager_location; - } - - var payload = Object(snjs__WEBPACK_IMPORTED_MODULE_9__["CreateMaxPayloadFromAnyObject"])({ - object: { - content_type: snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Component, - content: content - } - }); - return payload; - } - }, { - key: "batchManagerTemplatePayload", - value: function batchManagerTemplatePayload() { - var url = window._batch_manager_location; - - if (!url) { - console.error('window._batch_manager_location must be set.'); - return; - } - - var packageInfo = { - name: 'Batch Manager', - identifier: this.batchManagerId - }; - var allContentTypes = Object(_utils__WEBPACK_IMPORTED_MODULE_8__["dictToArray"])(snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"]); - var content = { - name: packageInfo.name, - area: 'modal', - package_info: packageInfo, - permissions: [{ - name: STREAM_ITEMS_PERMISSION, - content_types: allContentTypes - }] - }; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isDesktopApplication"])()) { - content.local_url = window._batch_manager_location; - } else { - content.hosted_url = window._batch_manager_location; - } - - var payload = Object(snjs__WEBPACK_IMPORTED_MODULE_9__["CreateMaxPayloadFromAnyObject"])({ - object: { - content_type: snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Component, - content: content - } - }); - return payload; - } - }, { - key: "resolveBatchManager", - value: function () { - var _resolveBatchManager = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var batchManager, needsSync, permission; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.next = 2; - return this.application.singletonManager.findOrCreateSingleton({ - predicate: this.batchManagerPred, - createPayload: this.batchManagerTemplatePayload() - }); - - case 2: - batchManager = _context2.sent; - needsSync = false; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isDesktopApplication"])()) { - if (!batchManager.local_url) { - batchManager.local_url = window._batch_manager_location; - needsSync = true; - } - } else { - if (!batchManager.hosted_url) { - batchManager.hosted_url = window._batch_manager_location; - needsSync = true; - } - } // Handle addition of SN|ExtensionRepo permission - - - permission = batchManager.content.permissions.find(function (p) { - return p.name === STREAM_ITEMS_PERMISSION; - }); - - if (!permission.content_types.includes(snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ExtensionRepo)) { - permission.content_types.push(snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].ExtensionRepo); - needsSync = true; - } - - if (needsSync) { - this.application.saveItem({ - item: batchManager - }); - } - - case 8: - case "end": - return _context2.stop(); - } - } - }, _callee2, this); - })); - - function resolveBatchManager() { - return _resolveBatchManager.apply(this, arguments); - } - - return resolveBatchManager; - }() - }, { - key: "extManagerPred", - get: function get() { - var extManagerId = 'org.standardnotes.extensions-manager'; - return snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"].CompoundPredicate([new snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"]('content_type', '=', snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Component), new snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"]('package_info.identifier', '=', extManagerId)]); - } - }, { - key: "batchManagerPred", - get: function get() { - var batchMgrId = 'org.standardnotes.batch-manager'; - return snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"].CompoundPredicate([new snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"]('content_type', '=', snjs__WEBPACK_IMPORTED_MODULE_9__["ContentTypes"].Component), new snjs__WEBPACK_IMPORTED_MODULE_9__["SNPredicate"]('package_info.identifier', '=', batchMgrId)]); - } - }]); - - return NativeExtManager; -}(snjs__WEBPACK_IMPORTED_MODULE_9__["ApplicationService"]); - -/***/ }), - -/***/ "./app/assets/javascripts/services/preferencesManager.js": -/*!***************************************************************!*\ - !*** ./app/assets/javascripts/services/preferencesManager.js ***! - \***************************************************************/ -/*! exports provided: PrefKeys, PreferencesManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrefKeys", function() { return PrefKeys; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PreferencesManager", function() { return PreferencesManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_8__); - - - - - - - - - -var PrefKeys = { - TagsPanelWidth: 'tagsPanelWidth', - NotesPanelWidth: 'notesPanelWidth', - EditorWidth: 'editorWidth', - EditorLeft: 'editorLeft', - EditorMonospaceEnabled: 'monospaceFont', - EditorSpellcheck: 'spellcheck', - EditorResizersEnabled: 'marginResizersEnabled', - SortNotesBy: 'sortBy', - SortNotesReverse: 'sortReverse', - NotesShowArchived: 'showArchived', - NotesHidePinned: 'hidePinned', - NotesHideNotePreview: 'hideNotePreview', - NotesHideDate: 'hideDate', - NotesHideTags: 'hideTags' -}; -var PreferencesManager = /*#__PURE__*/function (_ApplicationService) { - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(PreferencesManager, _ApplicationService); - - function PreferencesManager() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, PreferencesManager); - - return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(PreferencesManager).apply(this, arguments)); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(PreferencesManager, [{ - key: "onAppLaunch", - - /** @override */ - value: function onAppLaunch() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(PreferencesManager.prototype), "onAppLaunch", this).call(this); - - this.streamPreferences(); - this.loadSingleton(); - } - }, { - key: "streamPreferences", - value: function streamPreferences() { - var _this = this; - - this.application.streamItems({ - contentType: snjs__WEBPACK_IMPORTED_MODULE_8__["ContentTypes"].UserPrefs, - stream: function stream() { - _this.loadSingleton(); - } - }); - } - }, { - key: "loadSingleton", - value: function () { - var _loadSingleton = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var contentType, predicate; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - contentType = snjs__WEBPACK_IMPORTED_MODULE_8__["ContentTypes"].UserPrefs; - predicate = new snjs__WEBPACK_IMPORTED_MODULE_8__["SNPredicate"]('content_type', '=', contentType); - _context.next = 4; - return this.application.singletonManager.findOrCreateSingleton({ - predicate: predicate, - createPayload: Object(snjs__WEBPACK_IMPORTED_MODULE_8__["CreateMaxPayloadFromAnyObject"])({ - object: { - content_type: contentType, - content: {} - } - }) - }); - - case 4: - this.userPreferences = _context.sent; - this.preferencesDidChange(); - - case 6: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - - function loadSingleton() { - return _loadSingleton.apply(this, arguments); - } - - return loadSingleton; - }() - }, { - key: "preferencesDidChange", - value: function preferencesDidChange() { - this.application.getAppState().setUserPreferences(this.userPreferences); - } - }, { - key: "syncUserPreferences", - value: function syncUserPreferences() { - if (this.userPreferences) { - this.application.saveItem({ - item: this.userPreferences - }); - } - } - }, { - key: "getValue", - value: function getValue(key, defaultValue) { - if (!this.userPreferences) { - return defaultValue; - } - - var value = this.userPreferences.getAppDataItem(key); - return value !== undefined && value != null ? value : defaultValue; - } - }, { - key: "setUserPrefValue", - value: function setUserPrefValue(key, value, sync) { - this.userPreferences.setAppDataItem(key, value); - - if (sync) { - this.syncUserPreferences(); - } - } - }]); - - return PreferencesManager; -}(snjs__WEBPACK_IMPORTED_MODULE_8__["ApplicationService"]); - -/***/ }), - -/***/ "./app/assets/javascripts/services/state.js": -/*!**************************************************!*\ - !*** ./app/assets/javascripts/services/state.js ***! - \**************************************************/ -/*! exports provided: AppStateEvents, EventSources, AppState */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppStateEvents", function() { return AppStateEvents; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventSources", function() { return EventSources; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppState", function() { return AppState; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils */ "./app/assets/javascripts/utils.js"); -/* harmony import */ var lodash_pull__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/pull */ "./node_modules/lodash/pull.js"); -/* harmony import */ var lodash_pull__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_pull__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_6__); - - - - - - - -var AppStateEvents = { - TagChanged: 1, - NoteChanged: 2, - PreferencesChanged: 3, - PanelResized: 4, - EditorFocused: 5, - BeganBackupDownload: 6, - EndedBackupDownload: 7, - DesktopExtsReady: 8, - WindowDidFocus: 9, - WindowDidBlur: 10 -}; -var EventSources = { - UserInteraction: 1, - Script: 2 -}; -var AppState = /*#__PURE__*/function () { - AppState.$inject = ["$rootScope", "$timeout", "application"]; - - /* @ngInject */ - function AppState($rootScope, $timeout, application) { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, AppState); - - this.$timeout = $timeout; - this.$rootScope = $rootScope; - this.application = application; - this.observers = []; - this.locked = true; - this.registerVisibilityObservers(); - this.addAppEventObserver(); - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(AppState, [{ - key: "deinit", - value: function deinit() { - this.unsubApp(); - this.unsubApp = null; - this.observers.length = 0; - - if (this.rootScopeCleanup1) { - this.rootScopeCleanup1(); - this.rootScopeCleanup2(); - this.rootScopeCleanup1 = null; - this.rootScopeCleanup2 = null; - } - - document.removeEventListener('visibilitychange', this.onVisibilityChange); - this.onVisibilityChange = null; - } - }, { - key: "addAppEventObserver", - value: function addAppEventObserver() { - var _this = this; - - this.unsubApp = this.application.addEventObserver( /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(eventName) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (eventName === snjs__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].Started) { - _this.locked = true; - } else if (eventName === snjs__WEBPACK_IMPORTED_MODULE_6__["ApplicationEvents"].Launched) { - _this.locked = false; - } - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - return function (_x) { - return _ref.apply(this, arguments); - }; - }()); - } - }, { - key: "isLocked", - value: function isLocked() { - return this.locked; - } - }, { - key: "registerVisibilityObservers", - value: function registerVisibilityObservers() { - var _this2 = this; - - if (Object(_utils__WEBPACK_IMPORTED_MODULE_4__["isDesktopApplication"])()) { - this.rootScopeCleanup1 = this.$rootScope.$on('window-lost-focus', function () { - _this2.notifyEvent(AppStateEvents.WindowDidBlur); - }); - this.rootScopeCleanup2 = this.$rootScope.$on('window-gained-focus', function () { - _this2.notifyEvent(AppStateEvents.WindowDidFocus); - }); - } else { - /* Tab visibility listener, web only */ - this.onVisibilityChange = this.onVisibilityChange.bind(this); - document.addEventListener('visibilitychange', this.onVisibilityChange); - } - } - }, { - key: "onVisibilityChange", - value: function onVisibilityChange() { - var visible = document.visibilityState === "visible"; - var event = visible ? AppStateEvents.WindowDidFocus : AppStateEvents.WindowDidBlur; - this.notifyEvent(event); - } - /** @returns A function that unregisters this observer */ - - }, { - key: "addObserver", - value: function addObserver(callback) { - var _this3 = this; - - this.observers.push(callback); - return function () { - lodash_pull__WEBPACK_IMPORTED_MODULE_5___default()(_this3.observers, callback); - }; - } - }, { - key: "notifyEvent", - value: function () { - var _notifyEvent = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(eventName, data) { - var _this4 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - return _context3.abrupt("return", new Promise(function (resolve) { - _this4.$timeout( /*#__PURE__*/_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, callback; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context2.prev = 3; - _iterator = _this4.observers[Symbol.iterator](); - - case 5: - if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { - _context2.next = 12; - break; - } - - callback = _step.value; - _context2.next = 9; - return callback(eventName, data); - - case 9: - _iteratorNormalCompletion = true; - _context2.next = 5; - break; - - case 12: - _context2.next = 18; - break; - - case 14: - _context2.prev = 14; - _context2.t0 = _context2["catch"](3); - _didIteratorError = true; - _iteratorError = _context2.t0; - - case 18: - _context2.prev = 18; - _context2.prev = 19; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 21: - _context2.prev = 21; - - if (!_didIteratorError) { - _context2.next = 24; - break; - } - - throw _iteratorError; - - case 24: - return _context2.finish(21); - - case 25: - return _context2.finish(18); - - case 26: - resolve(); - - case 27: - case "end": - return _context2.stop(); - } - } - }, _callee2, null, [[3, 14, 18, 26], [19,, 21, 25]]); - }))); - })); - - case 1: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - function notifyEvent(_x2, _x3) { - return _notifyEvent.apply(this, arguments); - } - - return notifyEvent; - }() - }, { - key: "setSelectedTag", - value: function setSelectedTag(tag) { - if (this.selectedTag === tag) { - return; - } - - var previousTag = this.selectedTag; - this.selectedTag = tag; - this.notifyEvent(AppStateEvents.TagChanged, { - tag: tag, - previousTag: previousTag - }); - } - }, { - key: "setSelectedNote", - value: function () { - var _setSelectedNote = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5(note) { - var _this5 = this; - - var run; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - run = /*#__PURE__*/function () { - var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - var previousNote; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - previousNote = _this5.selectedNote; - _this5.selectedNote = note; - _context4.next = 4; - return _this5.notifyEvent(AppStateEvents.NoteChanged, { - previousNote: previousNote - }); - - case 4: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - - return function run() { - return _ref3.apply(this, arguments); - }; - }(); - - _context5.t0 = note && note.content.protected; - - if (!_context5.t0) { - _context5.next = 6; - break; - } - - _context5.next = 5; - return this.application.application.privilegesService.actionRequiresPrivilege(snjs__WEBPACK_IMPORTED_MODULE_6__["ProtectedActions"].ViewProtectedNotes); - - case 5: - _context5.t0 = _context5.sent; - - case 6: - if (!_context5.t0) { - _context5.next = 10; - break; - } - - return _context5.abrupt("return", new Promise(function (resolve) { - _this5.application.presentPrivilegesModal(snjs__WEBPACK_IMPORTED_MODULE_6__["ProtectedActions"].ViewProtectedNotes, function () { - run().then(resolve); - }); - })); - - case 10: - return _context5.abrupt("return", run()); - - case 11: - case "end": - return _context5.stop(); - } - } - }, _callee5, this); - })); - - function setSelectedNote(_x4) { - return _setSelectedNote.apply(this, arguments); - } - - return setSelectedNote; - }() - }, { - key: "getSelectedTag", - value: function getSelectedTag() { - return this.selectedTag; - } - }, { - key: "getSelectedNote", - value: function getSelectedNote() { - return this.selectedNote; - } - }, { - key: "setUserPreferences", - value: function setUserPreferences(preferences) { - this.userPreferences = preferences; - this.notifyEvent(AppStateEvents.PreferencesChanged); - } - }, { - key: "panelDidResize", - value: function panelDidResize(_ref4) { - var name = _ref4.name, - collapsed = _ref4.collapsed; - this.notifyEvent(AppStateEvents.PanelResized, { - panel: name, - collapsed: collapsed - }); - } - }, { - key: "editorDidFocus", - value: function editorDidFocus(eventSource) { - this.notifyEvent(AppStateEvents.EditorFocused, { - eventSource: eventSource - }); - } - }, { - key: "beganBackupDownload", - value: function beganBackupDownload() { - this.notifyEvent(AppStateEvents.BeganBackupDownload); - } - }, { - key: "endedBackupDownload", - value: function endedBackupDownload(_ref5) { - var success = _ref5.success; - this.notifyEvent(AppStateEvents.EndedBackupDownload, { - success: success - }); - } - /** - * When the desktop appplication extension server is ready. - */ - - }, { - key: "desktopExtensionsReady", - value: function desktopExtensionsReady() { - this.notifyEvent(AppStateEvents.DesktopExtsReady); - } - }]); - - return AppState; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/services/statusManager.js": -/*!**********************************************************!*\ - !*** ./app/assets/javascripts/services/statusManager.js ***! - \**********************************************************/ -/*! exports provided: StatusManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StatusManager", function() { return StatusManager; }); -/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); -/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__); - - - - -var StatusManager = /*#__PURE__*/function () { - function StatusManager() { - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, StatusManager); - - this.statuses = []; - this.observers = []; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(StatusManager, [{ - key: "statusFromString", - value: function statusFromString(string) { - return { - string: string - }; - } - }, { - key: "replaceStatusWithString", - value: function replaceStatusWithString(status, string) { - this.removeStatus(status); - return this.addStatusFromString(string); - } - }, { - key: "addStatusFromString", - value: function addStatusFromString(string) { - return this.addStatus(this.statusFromString(string)); - } - }, { - key: "addStatus", - value: function addStatus(status) { - if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(status) !== "object") { - console.error("Attempting to set non-object status", status); - return; - } - - this.statuses.push(status); - this.notifyObservers(); - return status; - } - }, { - key: "removeStatus", - value: function removeStatus(status) { - lodash__WEBPACK_IMPORTED_MODULE_3___default.a.pull(this.statuses, status); - - this.notifyObservers(); - return null; - } - }, { - key: "getStatusString", - value: function getStatusString() { - var result = ""; - this.statuses.forEach(function (status, index) { - if (index > 0) { - result += " "; - } - - result += status.string; - }); - return result; - } - }, { - key: "notifyObservers", - value: function notifyObservers() { - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - - try { - for (var _iterator = this.observers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var observer = _step.value; - observer(this.getStatusString()); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - } - }, { - key: "addStatusObserver", - value: function addStatusObserver(callback) { - this.observers.push(callback); - } - }, { - key: "removeStatusObserver", - value: function removeStatusObserver(callback) { - lodash__WEBPACK_IMPORTED_MODULE_3___default.a.pull(this.statuses, callback); - } - }]); - - return StatusManager; -}(); - -/***/ }), - -/***/ "./app/assets/javascripts/services/themeManager.js": -/*!*********************************************************!*\ - !*** ./app/assets/javascripts/services/themeManager.js ***! - \*********************************************************/ -/*! exports provided: ThemeManager */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(setImmediate) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ThemeManager", function() { return ThemeManager; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _services_state__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/services/state */ "./app/assets/javascripts/services/state.js"); - - - - - - - - - - - -var CACHED_THEMES_KEY = 'cachedThemes'; -var ThemeManager = /*#__PURE__*/function (_ApplicationService) { - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(ThemeManager, _ApplicationService); - - function ThemeManager(application) { - var _this; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, ThemeManager); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ThemeManager).call(this, application)); - _this.activeThemes = []; - setImmediate(function () { - _this.unsubState = _this.application.getAppState().addObserver(function (eventName, data) { - if (eventName === _services_state__WEBPACK_IMPORTED_MODULE_10__["AppStateEvents"].DesktopExtsReady) { - _this.activateCachedThemes(); - } - }); - }); - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(ThemeManager, [{ - key: "deinit", - value: function deinit() { - this.unsubState(); - this.unsubState = null; - this.activeThemes.length = 0; - this.unregisterDesktop(); - this.unregisterComponent(); - this.unregisterDesktop = null; - this.unregisterComponent = null; - - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ThemeManager.prototype), "deinit", this).call(this); - } - /** @override */ - - }, { - key: "onAppStart", - value: function onAppStart() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(ThemeManager.prototype), "onAppStart", this).call(this); - - this.registerObservers(); - - if (!this.application.getDesktopService().isDesktop) { - this.activateCachedThemes(); - } - } - /** @access private */ - - }, { - key: "activateCachedThemes", - value: function () { - var _activateCachedThemes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { - var cachedThemes, writeToCache, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, theme; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return this.getCachedThemes(); - - case 2: - cachedThemes = _context.sent; - writeToCache = false; - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context.prev = 7; - - for (_iterator = cachedThemes[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - theme = _step.value; - this.activateTheme(theme, writeToCache); - } - - _context.next = 15; - break; - - case 11: - _context.prev = 11; - _context.t0 = _context["catch"](7); - _didIteratorError = true; - _iteratorError = _context.t0; - - case 15: - _context.prev = 15; - _context.prev = 16; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 18: - _context.prev = 18; - - if (!_didIteratorError) { - _context.next = 21; - break; - } - - throw _iteratorError; - - case 21: - return _context.finish(18); - - case 22: - return _context.finish(15); - - case 23: - case "end": - return _context.stop(); - } - } - }, _callee, this, [[7, 11, 15, 23], [16,, 18, 22]]); - })); - - function activateCachedThemes() { - return _activateCachedThemes.apply(this, arguments); - } - - return activateCachedThemes; - }() - /** @access private */ - - }, { - key: "registerObservers", - value: function registerObservers() { - var _this2 = this; - - this.unregisterDesktop = this.application.getDesktopService().registerUpdateObserver(function (component) { - if (component.active && component.isTheme()) { - _this2.deactivateTheme(component); - - setTimeout(function () { - _this2.activateTheme(component); - }, 10); - } - }); - this.unregisterComponent = this.application.componentManager.registerHandler({ - identifier: 'themeManager', - areas: ['themes'], - activationHandler: function activationHandler(component) { - if (component.active) { - _this2.activateTheme(component); - } else { - _this2.deactivateTheme(component); - } - } - }); - } - /** @access public */ - - }, { - key: "deactivateAllThemes", - value: function deactivateAllThemes() { - var activeThemes = this.application.componentManager.getActiveThemes(); - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; - - try { - for (var _iterator2 = activeThemes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var theme = _step2.value; - - if (theme) { - var dontSync = true; - this.application.componentManager.deactivateComponent(theme, dontSync); - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - - this.activeThemes = []; - this.decacheThemes(); - } - /** @access private */ - - }, { - key: "activateTheme", - value: function activateTheme(theme) { - var writeToCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - if (this.activeThemes.find(function (t) { - return t.uuid === theme.uuid; - })) { - return; - } - - this.activeThemes.push(theme); - var url = this.application.componentManager.urlForComponent(theme); - var link = document.createElement('link'); - link.href = url; - link.type = 'text/css'; - link.rel = 'stylesheet'; - link.media = 'screen,print'; - link.id = theme.uuid; - document.getElementsByTagName('head')[0].appendChild(link); - - if (writeToCache) { - this.cacheThemes(); - } - } - /** @access private */ - - }, { - key: "deactivateTheme", - value: function deactivateTheme(theme) { - var element = document.getElementById(theme.uuid); - - if (element) { - element.disabled = true; - element.parentNode.removeChild(element); - } - - lodash__WEBPACK_IMPORTED_MODULE_8___default.a.remove(this.activeThemes, { - uuid: theme.uuid - }); - - this.cacheThemes(); - } - /** @access private */ - - }, { - key: "cacheThemes", - value: function () { - var _cacheThemes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() { - var _this3 = this; - - var mapped; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - _context3.next = 2; - return Promise.all(this.activeThemes.map( /*#__PURE__*/function () { - var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(theme) { - var payload, processedPayload; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - payload = theme.payloadRepresentation(); - _context2.next = 3; - return _this3.application.protocolService.payloadByEncryptingPayload({ - payload: payload, - intent: snjs__WEBPACK_IMPORTED_MODULE_9__["EncryptionIntents"].LocalStorageDecrypted - }); - - case 3: - processedPayload = _context2.sent; - return _context2.abrupt("return", processedPayload); - - case 5: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - return function (_x) { - return _ref.apply(this, arguments); - }; - }())); - - case 2: - mapped = _context3.sent; - return _context3.abrupt("return", this.application.setValue(CACHED_THEMES_KEY, mapped, snjs__WEBPACK_IMPORTED_MODULE_9__["StorageValueModes"].Nonwrapped)); - - case 4: - case "end": - return _context3.stop(); - } - } - }, _callee3, this); - })); - - function cacheThemes() { - return _cacheThemes.apply(this, arguments); - } - - return cacheThemes; - }() - /** @access private */ - - }, { - key: "decacheThemes", - value: function () { - var _decacheThemes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - return _context4.abrupt("return", this.application.removeValue(CACHED_THEMES_KEY, snjs__WEBPACK_IMPORTED_MODULE_9__["StorageValueModes"].Nonwrapped)); - - case 1: - case "end": - return _context4.stop(); - } - } - }, _callee4, this); - })); - - function decacheThemes() { - return _decacheThemes.apply(this, arguments); - } - - return decacheThemes; - }() - /** @access private */ - - }, { - key: "getCachedThemes", - value: function () { - var _getCachedThemes = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - var cachedThemes, themes, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, cachedTheme, payload, theme; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - _context5.next = 2; - return this.application.getValue(CACHED_THEMES_KEY, snjs__WEBPACK_IMPORTED_MODULE_9__["StorageValueModes"].Nonwrapped); - - case 2: - cachedThemes = _context5.sent; - - if (!cachedThemes) { - _context5.next = 27; - break; - } - - themes = []; - _iteratorNormalCompletion3 = true; - _didIteratorError3 = false; - _iteratorError3 = undefined; - _context5.prev = 8; - - for (_iterator3 = cachedThemes[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - cachedTheme = _step3.value; - payload = this.application.createPayloadFromObject(cachedTheme); - theme = this.application.createItemFromPayload(payload); - themes.push(theme); - } - - _context5.next = 16; - break; - - case 12: - _context5.prev = 12; - _context5.t0 = _context5["catch"](8); - _didIteratorError3 = true; - _iteratorError3 = _context5.t0; - - case 16: - _context5.prev = 16; - _context5.prev = 17; - - if (!_iteratorNormalCompletion3 && _iterator3.return != null) { - _iterator3.return(); - } - - case 19: - _context5.prev = 19; - - if (!_didIteratorError3) { - _context5.next = 22; - break; - } - - throw _iteratorError3; - - case 22: - return _context5.finish(19); - - case 23: - return _context5.finish(16); - - case 24: - return _context5.abrupt("return", themes); - - case 27: - return _context5.abrupt("return", []); - - case 28: - case "end": - return _context5.stop(); - } - } - }, _callee5, this, [[8, 12, 16, 24], [17,, 19, 23]]); - })); - - function getCachedThemes() { - return _getCachedThemes.apply(this, arguments); - } - - return getCachedThemes; - }() - }]); - - return ThemeManager; -}(snjs__WEBPACK_IMPORTED_MODULE_9__["ApplicationService"]); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) - -/***/ }), - -/***/ "./app/assets/javascripts/strings.js": -/*!*******************************************!*\ - !*** ./app/assets/javascripts/strings.js ***! - \*******************************************/ -/*! exports provided: STRING_SESSION_EXPIRED, STRING_DEFAULT_FILE_ERROR, STRING_GENERIC_SYNC_ERROR, StringSyncException, STRING_NEW_UPDATE_READY, STRING_DELETE_TAG, STRING_DELETED_NOTE, STRING_INVALID_NOTE, STRING_ELLIPSES, STRING_GENERIC_SAVE_ERROR, STRING_DELETE_PLACEHOLDER_ATTEMPT, STRING_DELETE_LOCKED_ATTEMPT, StringDeleteNote, StringEmptyTrash, STRING_ACCOUNT_MENU_UNCHECK_MERGE, STRING_SIGN_OUT_CONFIRMATION, STRING_ERROR_DECRYPTING_IMPORT, STRING_E2E_ENABLED, STRING_LOCAL_ENC_ENABLED, STRING_ENC_NOT_ENABLED, STRING_IMPORT_SUCCESS, STRING_REMOVE_PASSCODE_CONFIRMATION, STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM, STRING_NON_MATCHING_PASSCODES, STRING_NON_MATCHING_PASSWORDS, STRING_GENERATING_LOGIN_KEYS, STRING_GENERATING_REGISTER_KEYS, STRING_INVALID_IMPORT_FILE, StringImportError, STRING_FAILED_PASSWORD_CHANGE */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_SESSION_EXPIRED", function() { return STRING_SESSION_EXPIRED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_DEFAULT_FILE_ERROR", function() { return STRING_DEFAULT_FILE_ERROR; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_GENERIC_SYNC_ERROR", function() { return STRING_GENERIC_SYNC_ERROR; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringSyncException", function() { return StringSyncException; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_NEW_UPDATE_READY", function() { return STRING_NEW_UPDATE_READY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_DELETE_TAG", function() { return STRING_DELETE_TAG; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_DELETED_NOTE", function() { return STRING_DELETED_NOTE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_INVALID_NOTE", function() { return STRING_INVALID_NOTE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_ELLIPSES", function() { return STRING_ELLIPSES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_GENERIC_SAVE_ERROR", function() { return STRING_GENERIC_SAVE_ERROR; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_DELETE_PLACEHOLDER_ATTEMPT", function() { return STRING_DELETE_PLACEHOLDER_ATTEMPT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_DELETE_LOCKED_ATTEMPT", function() { return STRING_DELETE_LOCKED_ATTEMPT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringDeleteNote", function() { return StringDeleteNote; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringEmptyTrash", function() { return StringEmptyTrash; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_ACCOUNT_MENU_UNCHECK_MERGE", function() { return STRING_ACCOUNT_MENU_UNCHECK_MERGE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_SIGN_OUT_CONFIRMATION", function() { return STRING_SIGN_OUT_CONFIRMATION; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_ERROR_DECRYPTING_IMPORT", function() { return STRING_ERROR_DECRYPTING_IMPORT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_E2E_ENABLED", function() { return STRING_E2E_ENABLED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_LOCAL_ENC_ENABLED", function() { return STRING_LOCAL_ENC_ENABLED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_ENC_NOT_ENABLED", function() { return STRING_ENC_NOT_ENABLED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_IMPORT_SUCCESS", function() { return STRING_IMPORT_SUCCESS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_REMOVE_PASSCODE_CONFIRMATION", function() { return STRING_REMOVE_PASSCODE_CONFIRMATION; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM", function() { return STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_NON_MATCHING_PASSCODES", function() { return STRING_NON_MATCHING_PASSCODES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_NON_MATCHING_PASSWORDS", function() { return STRING_NON_MATCHING_PASSWORDS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_GENERATING_LOGIN_KEYS", function() { return STRING_GENERATING_LOGIN_KEYS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_GENERATING_REGISTER_KEYS", function() { return STRING_GENERATING_REGISTER_KEYS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_INVALID_IMPORT_FILE", function() { return STRING_INVALID_IMPORT_FILE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringImportError", function() { return StringImportError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_FAILED_PASSWORD_CHANGE", function() { return STRING_FAILED_PASSWORD_CHANGE; }); -/** @generic */ -var STRING_SESSION_EXPIRED = "Your session has expired. New changes will not be pulled in. Please sign out and sign back in to refresh your session."; -var STRING_DEFAULT_FILE_ERROR = "Please use FileSafe or the Bold Editor to attach images and files. Learn more at standardnotes.org/filesafe."; -var STRING_GENERIC_SYNC_ERROR = "There was an error syncing. Please try again. If all else fails, try signing out and signing back in."; -function StringSyncException(data) { - return "There was an error while trying to save your items. Please contact support and share this message: ".concat(data, "."); -} -/** @footer */ - -var STRING_NEW_UPDATE_READY = "A new update is ready to install. Please use the top-level 'Updates' menu to manage installation."; -/** @tags */ - -var STRING_DELETE_TAG = "Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes."; -/** @editor */ - -var STRING_DELETED_NOTE = "The note you are attempting to edit has been deleted, and is awaiting sync. Changes you make will be disregarded."; -var STRING_INVALID_NOTE = "The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note."; -var STRING_ELLIPSES = "..."; -var STRING_GENERIC_SAVE_ERROR = "There was an error saving your note. Please try again."; -var STRING_DELETE_PLACEHOLDER_ATTEMPT = "This note is a placeholder and cannot be deleted. To remove from your list, simply navigate to a different note."; -var STRING_DELETE_LOCKED_ATTEMPT = "This note is locked. If you'd like to delete it, unlock it, and try again."; -function StringDeleteNote(_ref) { - var title = _ref.title, - permanently = _ref.permanently; - return permanently ? "Are you sure you want to permanently delete ".concat(title, "?") : "Are you sure you want to move ".concat(title, " to the trash?"); -} -function StringEmptyTrash(_ref2) { - var count = _ref2.count; - return "Are you sure you want to permanently delete ".concat(count, " note(s)?"); -} -/** @account */ - -var STRING_ACCOUNT_MENU_UNCHECK_MERGE = "Unchecking this option means any of the notes you have written while you were signed out will be deleted. Are you sure you want to discard these notes?"; -var STRING_SIGN_OUT_CONFIRMATION = "Are you sure you want to end your session? This will delete all local items and extensions."; -var STRING_ERROR_DECRYPTING_IMPORT = "There was an error decrypting your items. Make sure the password you entered is correct and try again."; -var STRING_E2E_ENABLED = "End-to-end encryption is enabled. Your data is encrypted on your device first, then synced to your private cloud."; -var STRING_LOCAL_ENC_ENABLED = "Encryption is enabled. Your data is encrypted using your passcode before it is saved to your device storage."; -var STRING_ENC_NOT_ENABLED = "Encryption is not enabled. Sign in, register, or add a passcode lock to enable encryption."; -var STRING_IMPORT_SUCCESS = "Your data has been successfully imported."; -var STRING_REMOVE_PASSCODE_CONFIRMATION = "Are you sure you want to remove your application passcode?"; -var STRING_REMOVE_PASSCODE_OFFLINE_ADDENDUM = " This will remove encryption from your local data."; -var STRING_NON_MATCHING_PASSCODES = "The two passcodes you entered do not match. Please try again."; -var STRING_NON_MATCHING_PASSWORDS = "The two passwords you entered do not match. Please try again."; -var STRING_GENERATING_LOGIN_KEYS = "Generating Login Keys..."; -var STRING_GENERATING_REGISTER_KEYS = "Generating Account Keys..."; -var STRING_INVALID_IMPORT_FILE = "Unable to open file. Ensure it is a proper JSON file and try again."; -function StringImportError(_ref3) { - var errorCount = _ref3.errorCount; - return "Import complete. ".concat(errorCount, " items were not imported because there was an error decrypting them. Make sure the password is correct and try again."); -} -/** @password_change */ - -var STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup."; - -/***/ }), - -/***/ "./app/assets/javascripts/utils.js": -/*!*****************************************!*\ - !*** ./app/assets/javascripts/utils.js ***! - \*****************************************/ -/*! exports provided: getParameterByName, parametersFromURL, isNullOrUndefined, dictToArray, humanReadableList, getPlatformString, dateToLocalizedString, debounce, isDesktopApplication */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParameterByName", function() { return getParameterByName; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parametersFromURL", function() { return parametersFromURL; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNullOrUndefined", function() { return isNullOrUndefined; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dictToArray", function() { return dictToArray; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "humanReadableList", function() { return humanReadableList; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlatformString", function() { return getPlatformString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateToLocalizedString", function() { return dateToLocalizedString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return debounce; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDesktopApplication", function() { return isDesktopApplication; }); -function getParameterByName(name, url) { - name = name.replace(/[[\]]/g, '\\$&'); - var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); - var results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, ' ')); -} -function parametersFromURL(url) { - url = url.split('?').slice(-1)[0]; - var obj = {}; - url.replace(/([^=&]+)=([^&]*)/g, function (m, key, value) { - obj[decodeURIComponent(key)] = decodeURIComponent(value); - }); - return obj; -} -function isNullOrUndefined(value) { - return value === null || value === undefined; -} -function dictToArray(dict) { - return Object.keys(dict).map(function (key) { - return dict[key]; - }); -} -function humanReadableList(array) { - var addSeparator = function addSeparator(index, length) { - if (index > 0) { - if (index === length - 1) { - if (length === 2) { - return ' and '; - } else { - return ', and '; - } - } else { - return ', '; - } - } - - return ''; - }; - - var result = ''; - - for (var i = 0; i < array.length; i++) { - var value = array[i]; - result += addSeparator(i, array.length); - result += value; - } - - return result; -} -function getPlatformString() { - try { - var platform = navigator.platform.toLowerCase(); - var trimmed = ''; - - if (platform.indexOf('mac') !== -1) { - trimmed = 'mac'; - } else if (platform.indexOf('win') !== -1) { - trimmed = 'windows'; - } - - if (platform.indexOf('linux') !== -1) { - trimmed = 'linux'; - } - - return trimmed + (isDesktopApplication() ? '-desktop' : '-web'); - } catch (e) { - return null; - } -} -var sharedDateFormatter; -function dateToLocalizedString(date) { - if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) { - if (!sharedDateFormatter) { - var locale = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language; - sharedDateFormatter = new Intl.DateTimeFormat(locale, { - year: 'numeric', - month: 'numeric', - day: '2-digit', - hour: '2-digit', - minute: '2-digit' - }); - } - - return sharedDateFormatter.format(date); - } else { - // IE < 11, Safari <= 9.0. - // In English, this generates the string most similar to - // the toLocaleDateString() result above. - return date.toDateString() + ' ' + date.toLocaleTimeString(); - } -} -/** Via https://davidwalsh.name/javascript-debounce-function */ - -function debounce(func, wait, immediate) { - var timeout; - return function () { - var context = this; - var args = arguments; - - var later = function later() { - timeout = null; - if (!immediate) func.apply(context, args); - }; - - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); - }; -} -; -function isDesktopApplication() { - return window.isElectron; -} -/* Use with numbers and strings, not objects */ -// eslint-disable-next-line no-extend-native - -Array.prototype.containsPrimitiveSubset = function (array) { - var _this = this; - - return !array.some(function (val) { - return _this.indexOf(val) === -1; - }); -}; // https://tc39.github.io/ecma262/#sec-array.prototype.includes - - -if (!Array.prototype.includes) { - // eslint-disable-next-line no-extend-native - Object.defineProperty(Array.prototype, 'includes', { - value: function value(searchElement, fromIndex) { - if (this == null) { - throw new TypeError('"this" is null or not defined'); - } // 1. Let O be ? ToObject(this value). - - - var o = Object(this); // 2. Let len be ? ToLength(? Get(O, "length")). - - var len = o.length >>> 0; // 3. If len is 0, return false. - - if (len === 0) { - return false; - } // 4. Let n be ? ToInteger(fromIndex). - // (If fromIndex is undefined, this step produces the value 0.) - - - var n = fromIndex | 0; // 5. If n ≥ 0, then - // a. Let k be n. - // 6. Else n < 0, - // a. Let k be len + n. - // b. If k < 0, let k be 0. - - var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); - - function sameValueZero(x, y) { - return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); - } // 7. Repeat, while k < len - - - while (k < len) { - // a. Let elementK be the result of ? Get(O, ! ToString(k)). - // b. If SameValueZero(searchElement, elementK) is true, return true. - if (sameValueZero(o[k], searchElement)) { - return true; - } // c. Increase k by 1. - - - k++; - } // 8. Return false - - - return false; - } - }); -} - -/***/ }), - -/***/ "./app/assets/javascripts/web_device_interface.js": -/*!********************************************************!*\ - !*** ./app/assets/javascripts/web_device_interface.js ***! - \********************************************************/ -/*! exports provided: WebDeviceInterface */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebDeviceInterface", function() { return WebDeviceInterface; }); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); -/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"); -/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"); -/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"); -/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"); -/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); -/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/get */ "./node_modules/@babel/runtime/helpers/get.js"); -/* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"); -/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! snjs */ "../snjs/dist/snjs.js"); -/* harmony import */ var snjs__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(snjs__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _database__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/database */ "./app/assets/javascripts/database.js"); - - - - - - - - - - -var KEYCHAIN_STORAGE_KEY = 'keychain'; -var WebDeviceInterface = /*#__PURE__*/function (_DeviceInterface) { - _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_7___default()(WebDeviceInterface, _DeviceInterface); - - function WebDeviceInterface() { - var _this; - - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - namespace = _ref.namespace, - timeout = _ref.timeout; - - _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default()(this, WebDeviceInterface); - - _this = _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(WebDeviceInterface).call(this, { - namespace: namespace, - timeout: timeout || setTimeout.bind(Object(snjs__WEBPACK_IMPORTED_MODULE_8__["getGlobalScope"])()), - interval: setInterval.bind(Object(snjs__WEBPACK_IMPORTED_MODULE_8__["getGlobalScope"])()) - })); - - _this.createDatabase(); - - return _this; - } - - _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default()(WebDeviceInterface, [{ - key: "createDatabase", - value: function createDatabase() { - this.database = new _database__WEBPACK_IMPORTED_MODULE_9__["Database"](); - } - }, { - key: "setApplication", - value: function setApplication(application) { - this.database.setApplication(application); - } - /** @override */ - - }, { - key: "deinit", - value: function deinit() { - _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(WebDeviceInterface.prototype), "deinit", this).call(this); - - this.database.deinit(); - } - /** - * @value storage - */ - - }, { - key: "getRawStorageValue", - value: function () { - var _getRawStorageValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(key) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", localStorage.getItem(key)); - - case 1: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - - function getRawStorageValue(_x) { - return _getRawStorageValue.apply(this, arguments); - } - - return getRawStorageValue; - }() - }, { - key: "getAllRawStorageKeyValues", - value: function () { - var _getAllRawStorageKeyValues = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { - var results, _i, _Object$keys, key; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - results = []; - - for (_i = 0, _Object$keys = Object.keys(localStorage); _i < _Object$keys.length; _i++) { - key = _Object$keys[_i]; - results.push({ - key: key, - value: localStorage[key] - }); - } - - return _context2.abrupt("return", results); - - case 3: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })); - - function getAllRawStorageKeyValues() { - return _getAllRawStorageKeyValues.apply(this, arguments); - } - - return getAllRawStorageKeyValues; - }() - }, { - key: "setRawStorageValue", - value: function () { - var _setRawStorageValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(key, value) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - localStorage.setItem(key, value); - - case 1: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - - function setRawStorageValue(_x2, _x3) { - return _setRawStorageValue.apply(this, arguments); - } - - return setRawStorageValue; - }() - }, { - key: "removeRawStorageValue", - value: function () { - var _removeRawStorageValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4(key) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { - while (1) { - switch (_context4.prev = _context4.next) { - case 0: - localStorage.removeItem(key); - - case 1: - case "end": - return _context4.stop(); - } - } - }, _callee4); - })); - - function removeRawStorageValue(_x4) { - return _removeRawStorageValue.apply(this, arguments); - } - - return removeRawStorageValue; - }() - }, { - key: "removeAllRawStorageValues", - value: function () { - var _removeAllRawStorageValues = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee5() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee5$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - localStorage.clear(); - - case 1: - case "end": - return _context5.stop(); - } - } - }, _callee5); - })); - - function removeAllRawStorageValues() { - return _removeAllRawStorageValues.apply(this, arguments); - } - - return removeAllRawStorageValues; - }() - }, { - key: "openDatabase", - value: function () { - var _openDatabase = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee6() { - var _this2 = this; - - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee6$(_context6) { - while (1) { - switch (_context6.prev = _context6.next) { - case 0: - this.database.unlock(); - return _context6.abrupt("return", new Promise(function (resolve, reject) { - _this2.database.openDatabase(function () { - resolve({ - isNewDatabase: true - }); - }).then(function () { - resolve({ - isNewDatabase: false - }); - }).catch(function (error) { - reject(error); - }); - })); - - case 2: - case "end": - return _context6.stop(); - } - } - }, _callee6, this); - })); - - function openDatabase() { - return _openDatabase.apply(this, arguments); - } - - return openDatabase; - }() - /** @private */ - - }, { - key: "getDatabaseKeyPrefix", - value: function getDatabaseKeyPrefix() { - if (this.namespace) { - return "".concat(this.namespace, "-item-"); - } else { - return "item-"; - } - } - /** @private */ - - }, { - key: "keyForPayloadId", - value: function keyForPayloadId(id) { - return "".concat(this.getDatabaseKeyPrefix()).concat(id); - } - }, { - key: "getAllRawDatabasePayloads", - value: function () { - var _getAllRawDatabasePayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee7() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee7$(_context7) { - while (1) { - switch (_context7.prev = _context7.next) { - case 0: - return _context7.abrupt("return", this.database.getAllPayloads()); - - case 1: - case "end": - return _context7.stop(); - } - } - }, _callee7, this); - })); - - function getAllRawDatabasePayloads() { - return _getAllRawDatabasePayloads.apply(this, arguments); - } - - return getAllRawDatabasePayloads; - }() - }, { - key: "saveRawDatabasePayload", - value: function () { - var _saveRawDatabasePayload = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee8(payload) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee8$(_context8) { - while (1) { - switch (_context8.prev = _context8.next) { - case 0: - return _context8.abrupt("return", this.database.savePayload(payload)); - - case 1: - case "end": - return _context8.stop(); - } - } - }, _callee8, this); - })); - - function saveRawDatabasePayload(_x5) { - return _saveRawDatabasePayload.apply(this, arguments); - } - - return saveRawDatabasePayload; - }() - }, { - key: "saveRawDatabasePayloads", - value: function () { - var _saveRawDatabasePayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee9(payloads) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee9$(_context9) { - while (1) { - switch (_context9.prev = _context9.next) { - case 0: - return _context9.abrupt("return", this.database.savePayloads(payloads)); - - case 1: - case "end": - return _context9.stop(); - } - } - }, _callee9, this); - })); - - function saveRawDatabasePayloads(_x6) { - return _saveRawDatabasePayloads.apply(this, arguments); - } - - return saveRawDatabasePayloads; - }() - }, { - key: "removeRawDatabasePayloadWithId", - value: function () { - var _removeRawDatabasePayloadWithId = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee10(id) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee10$(_context10) { - while (1) { - switch (_context10.prev = _context10.next) { - case 0: - return _context10.abrupt("return", this.database.deletePayload(id)); - - case 1: - case "end": - return _context10.stop(); - } - } - }, _callee10, this); - })); - - function removeRawDatabasePayloadWithId(_x7) { - return _removeRawDatabasePayloadWithId.apply(this, arguments); - } - - return removeRawDatabasePayloadWithId; - }() - }, { - key: "removeAllRawDatabasePayloads", - value: function () { - var _removeAllRawDatabasePayloads = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee11() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee11$(_context11) { - while (1) { - switch (_context11.prev = _context11.next) { - case 0: - return _context11.abrupt("return", this.database.clearAllPayloads()); - - case 1: - case "end": - return _context11.stop(); - } - } - }, _callee11, this); - })); - - function removeAllRawDatabasePayloads() { - return _removeAllRawDatabasePayloads.apply(this, arguments); - } - - return removeAllRawDatabasePayloads; - }() - /** @keychian */ - - }, { - key: "getKeychainValue", - value: function () { - var _getKeychainValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee12() { - var value; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee12$(_context12) { - while (1) { - switch (_context12.prev = _context12.next) { - case 0: - value = localStorage.getItem(KEYCHAIN_STORAGE_KEY); - - if (!value) { - _context12.next = 3; - break; - } - - return _context12.abrupt("return", JSON.parse(value)); - - case 3: - case "end": - return _context12.stop(); - } - } - }, _callee12); - })); - - function getKeychainValue() { - return _getKeychainValue.apply(this, arguments); - } - - return getKeychainValue; - }() - }, { - key: "setKeychainValue", - value: function () { - var _setKeychainValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee13(value) { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee13$(_context13) { - while (1) { - switch (_context13.prev = _context13.next) { - case 0: - localStorage.setItem(KEYCHAIN_STORAGE_KEY, JSON.stringify(value)); - - case 1: - case "end": - return _context13.stop(); - } - } - }, _callee13); - })); - - function setKeychainValue(_x8) { - return _setKeychainValue.apply(this, arguments); - } - - return setKeychainValue; - }() - }, { - key: "clearKeychainValue", - value: function () { - var _clearKeychainValue = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee14() { - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee14$(_context14) { - while (1) { - switch (_context14.prev = _context14.next) { - case 0: - localStorage.removeItem(KEYCHAIN_STORAGE_KEY); - - case 1: - case "end": - return _context14.stop(); - } - } - }, _callee14); - })); - - function clearKeychainValue() { - return _clearKeychainValue.apply(this, arguments); - } - - return clearKeychainValue; - }() - /** - * @actions - */ - - }, { - key: "openUrl", - value: function openUrl(url) { - var win = window.open(url, '_blank'); - - if (win) { - win.focus(); - } - } - }]); - - return WebDeviceInterface; -}(snjs__WEBPACK_IMPORTED_MODULE_8__["DeviceInterface"]); - -/***/ }), - -/***/ "./app/assets/stylesheets/index.css.scss": -/*!***********************************************!*\ - !*** ./app/assets/stylesheets/index.css.scss ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// extracted by mini-css-extract-plugin - -/***/ }), - -/***/ "./app/assets/templates/application-view.pug": -/*!***************************************************!*\ - !*** ./app/assets/templates/application-view.pug ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/application-view.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/application-view.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/account-menu.pug": -/*!**********************************************************!*\ - !*** ./app/assets/templates/directives/account-menu.pug ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/account-menu.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/account-menu.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/actions-menu.pug": -/*!**********************************************************!*\ - !*** ./app/assets/templates/directives/actions-menu.pug ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/actions-menu.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/actions-menu.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/challenge-modal.pug": -/*!*************************************************************!*\ - !*** ./app/assets/templates/directives/challenge-modal.pug ***! - \*************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/challenge-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/challenge-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/component-modal.pug": -/*!*************************************************************!*\ - !*** ./app/assets/templates/directives/component-modal.pug ***! - \*************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/component-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/component-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/component-view.pug": -/*!************************************************************!*\ - !*** ./app/assets/templates/directives/component-view.pug ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/component-view.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/component-view.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/conflict-resolution-modal.pug": -/*!***********************************************************************!*\ - !*** ./app/assets/templates/directives/conflict-resolution-modal.pug ***! - \***********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/conflict-resolution-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/conflict-resolution-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/editor-menu.pug": -/*!*********************************************************!*\ - !*** ./app/assets/templates/directives/editor-menu.pug ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/editor-menu.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/editor-menu.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/input-modal.pug": -/*!*********************************************************!*\ - !*** ./app/assets/templates/directives/input-modal.pug ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/input-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/input-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/menu-row.pug": -/*!******************************************************!*\ - !*** ./app/assets/templates/directives/menu-row.pug ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/menu-row.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/menu-row.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/panel-resizer.pug": -/*!***********************************************************!*\ - !*** ./app/assets/templates/directives/panel-resizer.pug ***! - \***********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/panel-resizer.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/panel-resizer.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/password-wizard.pug": -/*!*************************************************************!*\ - !*** ./app/assets/templates/directives/password-wizard.pug ***! - \*************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/password-wizard.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/password-wizard.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/permissions-modal.pug": -/*!***************************************************************!*\ - !*** ./app/assets/templates/directives/permissions-modal.pug ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/permissions-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/permissions-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/privileges-auth-modal.pug": -/*!*******************************************************************!*\ - !*** ./app/assets/templates/directives/privileges-auth-modal.pug ***! - \*******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/privileges-auth-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/privileges-auth-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/privileges-management-modal.pug": -/*!*************************************************************************!*\ - !*** ./app/assets/templates/directives/privileges-management-modal.pug ***! - \*************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/privileges-management-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/privileges-management-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/revision-preview-modal.pug": -/*!********************************************************************!*\ - !*** ./app/assets/templates/directives/revision-preview-modal.pug ***! - \********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/revision-preview-modal.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/revision-preview-modal.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/session-history-menu.pug": -/*!******************************************************************!*\ - !*** ./app/assets/templates/directives/session-history-menu.pug ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/session-history-menu.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/session-history-menu.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/directives/sync-resolution-menu.pug": -/*!******************************************************************!*\ - !*** ./app/assets/templates/directives/sync-resolution-menu.pug ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/directives/sync-resolution-menu.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/directives/sync-resolution-menu.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/editor.pug": -/*!*****************************************!*\ - !*** ./app/assets/templates/editor.pug ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/editor.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/editor.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/footer.pug": -/*!*****************************************!*\ - !*** ./app/assets/templates/footer.pug ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/footer.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/footer.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/notes.pug": -/*!****************************************!*\ - !*** ./app/assets/templates/notes.pug ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/notes.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/notes.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/root.pug": -/*!***************************************!*\ - !*** ./app/assets/templates/root.pug ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/root.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/root.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./app/assets/templates/tags.pug": -/*!***************************************!*\ - !*** ./app/assets/templates/tags.pug ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var req = __webpack_require__(/*! !./node_modules/pug-loader!./app/assets/templates/tags.pug */ "./node_modules/pug-loader/index.js!./app/assets/templates/tags.pug"); -module.exports = (req['default'] || req).apply(req, []) - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! - \**********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -module.exports = _assertThisInitialized; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! - \*****************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} - -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - - _next(undefined); - }); - }; -} - -module.exports = _asyncToGenerator; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -module.exports = _classCallCheck; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/createClass.js": -/*!************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/createClass.js ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -module.exports = _createClass; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/defineProperty.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -module.exports = _defineProperty; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/get.js": -/*!****************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/get.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var superPropBase = __webpack_require__(/*! ./superPropBase */ "./node_modules/@babel/runtime/helpers/superPropBase.js"); - -function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); -} - -module.exports = _get; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -module.exports = _getPrototypeOf; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/inherits.js": -/*!*********************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/inherits.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js"); - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) setPrototypeOf(subClass, superClass); -} - -module.exports = _inherits; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! - \**************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var _typeof = __webpack_require__(/*! ../helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); - -var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); - -function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } - - return assertThisInitialized(self); -} - -module.exports = _possibleConstructorReturn; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -module.exports = _setPrototypeOf; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/superPropBase.js": -/*!**************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/superPropBase.js ***! - \**************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"); - -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; -} - -module.exports = _superPropBase; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/typeof.js": -/*!*******************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); -} - -module.exports = _typeof; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/regenerator/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/@babel/runtime/regenerator/index.js ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js"); - - -/***/ }), - -/***/ "./node_modules/angular/angular.js": -/*!*****************************************!*\ - !*** ./node_modules/angular/angular.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -/** - * @license AngularJS v1.7.9 - * (c) 2010-2018 Google, Inc. http://angularjs.org - * License: MIT - */ -(function(window) {'use strict'; - -/* exported - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth -*/ - -var minErrConfig = { - objectMaxDepth: 5, - urlErrorParamsEnabled: true -}; - -/** - * @ngdoc function - * @name angular.errorHandlingConfig - * @module ng - * @kind function - * - * @description - * Configure several aspects of error handling in AngularJS if used as a setter or return the - * current configuration if used as a getter. The following options are supported: - * - * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages. - * - * Omitted or undefined options will leave the corresponding configuration values unchanged. - * - * @param {Object=} config - The configuration object. May only contain the options that need to be - * updated. Supported keys: - * - * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a - * non-positive or non-numeric value, removes the max depth limit. - * Default: 5 - * - * * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will - * contain the parameters of the thrown error. Disabling the parameters can be useful if the - * generated error url is very long. - * - * Default: true. When used without argument, it returns the current value. - */ -function errorHandlingConfig(config) { - if (isObject(config)) { - if (isDefined(config.objectMaxDepth)) { - minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN; - } - if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) { - minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled; - } - } else { - return minErrConfig; - } -} - -/** - * @private - * @param {Number} maxDepth - * @return {boolean} - */ -function isValidObjectMaxDepth(maxDepth) { - return isNumber(maxDepth) && maxDepth > 0; -} - - -/** - * @description - * - * This object provides a utility for producing rich Error messages within - * AngularJS. It can be called as follows: - * - * var exampleMinErr = minErr('example'); - * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); - * - * The above creates an instance of minErr in the example namespace. The - * resulting error will have a namespaced error code of example.one. The - * resulting error will replace {0} with the value of foo, and {1} with the - * value of bar. The object is not restricted in the number of arguments it can - * take. - * - * If fewer arguments are specified than necessary for interpolation, the extra - * interpolation markers will be preserved in the final string. - * - * Since data will be parsed statically during a build step, some restrictions - * are applied with respect to how minErr instances are created and called. - * Instances should have names of the form namespaceMinErr for a minErr created - * using minErr('namespace') . Error codes, namespaces and template strings - * should all be static strings, not variables or general expressions. - * - * @param {string} module The namespace to use for the new minErr instance. - * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning - * error from returned function, for cases when a particular type of error is useful. - * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance - */ - -function minErr(module, ErrorConstructor) { - ErrorConstructor = ErrorConstructor || Error; - - var url = 'https://errors.angularjs.org/1.7.9/'; - var regex = url.replace('.', '\\.') + '[\\s\\S]*'; - var errRegExp = new RegExp(regex, 'g'); - - return function() { - var code = arguments[0], - template = arguments[1], - message = '[' + (module ? module + ':' : '') + code + '] ', - templateArgs = sliceArgs(arguments, 2).map(function(arg) { - return toDebugString(arg, minErrConfig.objectMaxDepth); - }), - paramPrefix, i; - - // A minErr message has two parts: the message itself and the url that contains the - // encoded message. - // The message's parameters can contain other error messages which also include error urls. - // To prevent the messages from getting too long, we strip the error urls from the parameters. - - message += template.replace(/\{\d+\}/g, function(match) { - var index = +match.slice(1, -1); - - if (index < templateArgs.length) { - return templateArgs[index].replace(errRegExp, ''); - } - - return match; - }); - - message += '\n' + url + (module ? module + '/' : '') + code; - - if (minErrConfig.urlErrorParamsEnabled) { - for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { - message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]); - } - } - - return new ErrorConstructor(message); - }; -} - -/* We need to tell ESLint what variables are being exported */ -/* exported - angular, - msie, - jqLite, - jQuery, - slice, - splice, - push, - toString, - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth, - ngMinErr, - angularModule, - uid, - REGEX_STRING_REGEXP, - VALIDITY_STATE_PROPERTY, - - lowercase, - uppercase, - nodeName_, - isArrayLike, - forEach, - forEachSorted, - reverseParams, - nextUid, - setHashKey, - extend, - toInt, - inherit, - merge, - noop, - identity, - valueFn, - isUndefined, - isDefined, - isObject, - isBlankObject, - isString, - isNumber, - isNumberNaN, - isDate, - isError, - isArray, - isFunction, - isRegExp, - isWindow, - isScope, - isFile, - isFormData, - isBlob, - isBoolean, - isPromiseLike, - trim, - escapeForRegexp, - isElement, - makeMap, - includes, - arrayRemove, - copy, - simpleCompare, - equals, - csp, - jq, - concat, - sliceArgs, - bind, - toJsonReplacer, - toJson, - fromJson, - convertTimezoneToLocal, - timezoneToOffset, - addDateMinutes, - startingTag, - tryDecodeURIComponent, - parseKeyValue, - toKeyValue, - encodeUriSegment, - encodeUriQuery, - angularInit, - bootstrap, - getTestability, - snake_case, - bindJQuery, - assertArg, - assertArgFn, - assertNotHasOwnProperty, - getter, - getBlockNodes, - hasOwnProperty, - createMap, - stringify, - - NODE_TYPE_ELEMENT, - NODE_TYPE_ATTRIBUTE, - NODE_TYPE_TEXT, - NODE_TYPE_COMMENT, - NODE_TYPE_DOCUMENT, - NODE_TYPE_DOCUMENT_FRAGMENT -*/ - -//////////////////////////////////// - -/** - * @ngdoc module - * @name ng - * @module ng - * @installation - * @description - * - * The ng module is loaded by default when an AngularJS application is started. The module itself - * contains the essential components for an AngularJS application to function. The table below - * lists a high level breakdown of each of the services/factories, filters, directives and testing - * components available within this core module. - * - */ - -var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/; - -// The name of a form control's ValidityState property. -// This is used so that it's possible for internal tests to create mock ValidityStates. -var VALIDITY_STATE_PROPERTY = 'validity'; - - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -/** - * @private - * - * @description Converts the specified string to lowercase. - * @param {string} string String to be converted to lowercase. - * @returns {string} Lowercased string. - */ -var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;}; - -/** - * @private - * - * @description Converts the specified string to uppercase. - * @param {string} string String to be converted to uppercase. - * @returns {string} Uppercased string. - */ -var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;}; - - -var - msie, // holds major version number for IE, or NaN if UA is not IE. - jqLite, // delay binding since jQuery could be loaded after us. - jQuery, // delay binding - slice = [].slice, - splice = [].splice, - push = [].push, - toString = Object.prototype.toString, - getPrototypeOf = Object.getPrototypeOf, - ngMinErr = minErr('ng'), - - /** @name angular */ - angular = window.angular || (window.angular = {}), - angularModule, - uid = 0; - -// Support: IE 9-11 only -/** - * documentMode is an IE-only property - * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx - */ -msie = window.document.documentMode; - - -/** - * @private - * @param {*} obj - * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, - * String ...) - */ -function isArrayLike(obj) { - - // `null`, `undefined` and `window` are not array-like - if (obj == null || isWindow(obj)) return false; - - // arrays, strings and jQuery/jqLite objects are array like - // * jqLite is either the jQuery or jqLite constructor function - // * we have to check the existence of jqLite first as this method is called - // via the forEach method when constructing the jqLite object in the first place - if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true; - - // Support: iOS 8.2 (not reproducible in simulator) - // "length" in obj used to prevent JIT error (gh-11508) - var length = 'length' in Object(obj) && obj.length; - - // NodeList objects (with `item` method) and - // other objects with suitable length characteristics are array-like - return isNumber(length) && (length >= 0 && (length - 1) in obj || typeof obj.item === 'function'); - -} - -/** - * @ngdoc function - * @name angular.forEach - * @module ng - * @kind function - * - * @description - * Invokes the `iterator` function once for each item in `obj` collection, which can be either an - * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` - * is the value of an object property or an array element, `key` is the object property key or - * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional. - * - * It is worth noting that `.forEach` does not iterate over inherited properties because it filters - * using the `hasOwnProperty` method. - * - * Unlike ES262's - * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), - * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just - * return the value provided. - * - ```js - var values = {name: 'misko', gender: 'male'}; - var log = []; - angular.forEach(values, function(value, key) { - this.push(key + ': ' + value); - }, log); - expect(log).toEqual(['name: misko', 'gender: male']); - ``` - * - * @param {Object|Array} obj Object to iterate over. - * @param {Function} iterator Iterator function. - * @param {Object=} context Object to become context (`this`) for the iterator function. - * @returns {Object|Array} Reference to `obj`. - */ - -function forEach(obj, iterator, context) { - var key, length; - if (obj) { - if (isFunction(obj)) { - for (key in obj) { - if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (isArray(obj) || isArrayLike(obj)) { - var isPrimitive = typeof obj !== 'object'; - for (key = 0, length = obj.length; key < length; key++) { - if (isPrimitive || key in obj) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (obj.forEach && obj.forEach !== forEach) { - obj.forEach(iterator, context, obj); - } else if (isBlankObject(obj)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in obj) { - iterator.call(context, obj[key], key, obj); - } - } else if (typeof obj.hasOwnProperty === 'function') { - // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed - for (key in obj) { - if (obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else { - // Slow path for objects which do not have a method `hasOwnProperty` - for (key in obj) { - if (hasOwnProperty.call(obj, key)) { - iterator.call(context, obj[key], key, obj); - } - } - } - } - return obj; -} - -function forEachSorted(obj, iterator, context) { - var keys = Object.keys(obj).sort(); - for (var i = 0; i < keys.length; i++) { - iterator.call(context, obj[keys[i]], keys[i]); - } - return keys; -} - - -/** - * when using forEach the params are value, key, but it is often useful to have key, value. - * @param {function(string, *)} iteratorFn - * @returns {function(*, string)} - */ -function reverseParams(iteratorFn) { - return function(value, key) {iteratorFn(key, value);}; -} - -/** - * A consistent way of creating unique IDs in angular. - * - * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before - * we hit number precision issues in JavaScript. - * - * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M - * - * @returns {number} an unique alpha-numeric string - */ -function nextUid() { - return ++uid; -} - - -/** - * Set or clear the hashkey for an object. - * @param obj object - * @param h the hashkey (!truthy to delete the hashkey) - */ -function setHashKey(obj, h) { - if (h) { - obj.$$hashKey = h; - } else { - delete obj.$$hashKey; - } -} - - -function baseExtend(dst, objs, deep) { - var h = dst.$$hashKey; - - for (var i = 0, ii = objs.length; i < ii; ++i) { - var obj = objs[i]; - if (!isObject(obj) && !isFunction(obj)) continue; - var keys = Object.keys(obj); - for (var j = 0, jj = keys.length; j < jj; j++) { - var key = keys[j]; - var src = obj[key]; - - if (deep && isObject(src)) { - if (isDate(src)) { - dst[key] = new Date(src.valueOf()); - } else if (isRegExp(src)) { - dst[key] = new RegExp(src); - } else if (src.nodeName) { - dst[key] = src.cloneNode(true); - } else if (isElement(src)) { - dst[key] = src.clone(); - } else { - if (key !== '__proto__') { - if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {}; - baseExtend(dst[key], [src], true); - } - } - } else { - dst[key] = src; - } - } - } - - setHashKey(dst, h); - return dst; -} - -/** - * @ngdoc function - * @name angular.extend - * @module ng - * @kind function - * - * @description - * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) - * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so - * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. - * - * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use - * {@link angular.merge} for this. - * - * @param {Object} dst Destination object. - * @param {...Object} src Source object(s). - * @returns {Object} Reference to `dst`. - */ -function extend(dst) { - return baseExtend(dst, slice.call(arguments, 1), false); -} - - -/** -* @ngdoc function -* @name angular.merge -* @module ng -* @kind function -* -* @description -* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s) -* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so -* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`. -* -* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source -* objects, performing a deep copy. -* -* @deprecated -* sinceVersion="1.6.5" -* This function is deprecated, but will not be removed in the 1.x lifecycle. -* There are edge cases (see {@link angular.merge#known-issues known issues}) that are not -* supported by this function. We suggest using another, similar library for all-purpose merging, -* such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge). -* -* @knownIssue -* This is a list of (known) object types that are not handled correctly by this function: -* - [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob) -* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) -* - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient) -* - AngularJS {@link $rootScope.Scope scopes}; -* -* `angular.merge` also does not support merging objects with circular references. -* -* @param {Object} dst Destination object. -* @param {...Object} src Source object(s). -* @returns {Object} Reference to `dst`. -*/ -function merge(dst) { - return baseExtend(dst, slice.call(arguments, 1), true); -} - - - -function toInt(str) { - return parseInt(str, 10); -} - -var isNumberNaN = Number.isNaN || function isNumberNaN(num) { - // eslint-disable-next-line no-self-compare - return num !== num; -}; - - -function inherit(parent, extra) { - return extend(Object.create(parent), extra); -} - -/** - * @ngdoc function - * @name angular.noop - * @module ng - * @kind function - * - * @description - * A function that performs no operations. This function can be useful when writing code in the - * functional style. - ```js - function foo(callback) { - var result = calculateResult(); - (callback || angular.noop)(result); - } - ``` - */ -function noop() {} -noop.$inject = []; - - -/** - * @ngdoc function - * @name angular.identity - * @module ng - * @kind function - * - * @description - * A function that returns its first argument. This function is useful when writing code in the - * functional style. - * - ```js - function transformer(transformationFn, value) { - return (transformationFn || angular.identity)(value); - }; - - // E.g. - function getResult(fn, input) { - return (fn || angular.identity)(input); - }; - - getResult(function(n) { return n * 2; }, 21); // returns 42 - getResult(null, 21); // returns 21 - getResult(undefined, 21); // returns 21 - ``` - * - * @param {*} value to be returned. - * @returns {*} the value passed in. - */ -function identity($) {return $;} -identity.$inject = []; - - -function valueFn(value) {return function valueRef() {return value;};} - -function hasCustomToString(obj) { - return isFunction(obj.toString) && obj.toString !== toString; -} - - -/** - * @ngdoc function - * @name angular.isUndefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is undefined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is undefined. - */ -function isUndefined(value) {return typeof value === 'undefined';} - - -/** - * @ngdoc function - * @name angular.isDefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is defined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is defined. - */ -function isDefined(value) {return typeof value !== 'undefined';} - - -/** - * @ngdoc function - * @name angular.isObject - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not - * considered to be objects. Note that JavaScript arrays are objects. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Object` but not `null`. - */ -function isObject(value) { - // http://jsperf.com/isobject4 - return value !== null && typeof value === 'object'; -} - - -/** - * Determine if a value is an object with a null prototype - * - * @returns {boolean} True if `value` is an `Object` with a null prototype - */ -function isBlankObject(value) { - return value !== null && typeof value === 'object' && !getPrototypeOf(value); -} - - -/** - * @ngdoc function - * @name angular.isString - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `String`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `String`. - */ -function isString(value) {return typeof value === 'string';} - - -/** - * @ngdoc function - * @name angular.isNumber - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Number`. - * - * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`. - * - * If you wish to exclude these then you can use the native - * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) - * method. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Number`. - */ -function isNumber(value) {return typeof value === 'number';} - - -/** - * @ngdoc function - * @name angular.isDate - * @module ng - * @kind function - * - * @description - * Determines if a value is a date. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Date`. - */ -function isDate(value) { - return toString.call(value) === '[object Date]'; -} - - -/** - * @ngdoc function - * @name angular.isArray - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Array`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Array`. - */ -function isArray(arr) { - return Array.isArray(arr) || arr instanceof Array; -} - -/** - * @description - * Determines if a reference is an `Error`. - * Loosely based on https://www.npmjs.com/package/iserror - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Error`. - */ -function isError(value) { - var tag = toString.call(value); - switch (tag) { - case '[object Error]': return true; - case '[object Exception]': return true; - case '[object DOMException]': return true; - default: return value instanceof Error; - } -} - -/** - * @ngdoc function - * @name angular.isFunction - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Function`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Function`. - */ -function isFunction(value) {return typeof value === 'function';} - - -/** - * Determines if a value is a regular expression object. - * - * @private - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `RegExp`. - */ -function isRegExp(value) { - return toString.call(value) === '[object RegExp]'; -} - - -/** - * Checks if `obj` is a window object. - * - * @private - * @param {*} obj Object to check - * @returns {boolean} True if `obj` is a window obj. - */ -function isWindow(obj) { - return obj && obj.window === obj; -} - - -function isScope(obj) { - return obj && obj.$evalAsync && obj.$watch; -} - - -function isFile(obj) { - return toString.call(obj) === '[object File]'; -} - - -function isFormData(obj) { - return toString.call(obj) === '[object FormData]'; -} - - -function isBlob(obj) { - return toString.call(obj) === '[object Blob]'; -} - - -function isBoolean(value) { - return typeof value === 'boolean'; -} - - -function isPromiseLike(obj) { - return obj && isFunction(obj.then); -} - - -var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/; -function isTypedArray(value) { - return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value)); -} - -function isArrayBuffer(obj) { - return toString.call(obj) === '[object ArrayBuffer]'; -} - - -var trim = function(value) { - return isString(value) ? value.trim() : value; -}; - -// Copied from: -// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021 -// Prereq: s is a string. -var escapeForRegexp = function(s) { - return s - .replace(/([-()[\]{}+?*.$^|,:#= 0) { - array.splice(index, 1); - } - return index; -} - -/** - * @ngdoc function - * @name angular.copy - * @module ng - * @kind function - * - * @description - * Creates a deep copy of `source`, which should be an object or an array. This functions is used - * internally, mostly in the change-detection code. It is not intended as an all-purpose copy - * function, and has several limitations (see below). - * - * * If no destination is supplied, a copy of the object or array is created. - * * If a destination is provided, all of its elements (for arrays) or properties (for objects) - * are deleted and then all elements/properties from the source are copied to it. - * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned. - * * If `source` is identical to `destination` an exception will be thrown. - * - *
- * - *
- * Only enumerable properties are taken into account. Non-enumerable properties (both on `source` - * and on `destination`) will be ignored. - *
- * - *
- * `angular.copy` does not check if destination and source are of the same type. It's the - * developer's responsibility to make sure they are compatible. - *
- * - * @knownIssue - * This is a non-exhaustive list of object types / features that are not handled correctly by - * `angular.copy`. Note that since this functions is used by the change detection code, this - * means binding or watching objects of these types (or that include these types) might not work - * correctly. - * - [`File`](https://developer.mozilla.org/docs/Web/API/File) - * - [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) - * - [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData) - * - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) - * - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) - * - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) - * - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/ - * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)` - * - * @param {*} source The source that will be used to make a copy. Can be any type, including - * primitives, `null`, and `undefined`. - * @param {(Object|Array)=} destination Destination into which the source is copied. If provided, - * must be of the same type as `source`. - * @returns {*} The copy or updated `destination`, if `destination` was specified. - * - * @example - - -
-
-
-
- Gender: -
- - -
-
form = {{user | json}}
-
leader = {{leader | json}}
-
-
- - // Module: copyExample - angular. - module('copyExample', []). - controller('ExampleController', ['$scope', function($scope) { - $scope.leader = {}; - - $scope.reset = function() { - // Example with 1 argument - $scope.user = angular.copy($scope.leader); - }; - - $scope.update = function(user) { - // Example with 2 arguments - angular.copy(user, $scope.leader); - }; - - $scope.reset(); - }]); - -
- */ -function copy(source, destination, maxDepth) { - var stackSource = []; - var stackDest = []; - maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN; - - if (destination) { - if (isTypedArray(destination) || isArrayBuffer(destination)) { - throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.'); - } - if (source === destination) { - throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.'); - } - - // Empty the destination object - if (isArray(destination)) { - destination.length = 0; - } else { - forEach(destination, function(value, key) { - if (key !== '$$hashKey') { - delete destination[key]; - } - }); - } - - stackSource.push(source); - stackDest.push(destination); - return copyRecurse(source, destination, maxDepth); - } - - return copyElement(source, maxDepth); - - function copyRecurse(source, destination, maxDepth) { - maxDepth--; - if (maxDepth < 0) { - return '...'; - } - var h = destination.$$hashKey; - var key; - if (isArray(source)) { - for (var i = 0, ii = source.length; i < ii; i++) { - destination.push(copyElement(source[i], maxDepth)); - } - } else if (isBlankObject(source)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in source) { - destination[key] = copyElement(source[key], maxDepth); - } - } else if (source && typeof source.hasOwnProperty === 'function') { - // Slow path, which must rely on hasOwnProperty - for (key in source) { - if (source.hasOwnProperty(key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } else { - // Slowest path --- hasOwnProperty can't be called as a method - for (key in source) { - if (hasOwnProperty.call(source, key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } - setHashKey(destination, h); - return destination; - } - - function copyElement(source, maxDepth) { - // Simple values - if (!isObject(source)) { - return source; - } - - // Already copied values - var index = stackSource.indexOf(source); - if (index !== -1) { - return stackDest[index]; - } - - if (isWindow(source) || isScope(source)) { - throw ngMinErr('cpws', - 'Can\'t copy! Making copies of Window or Scope instances is not supported.'); - } - - var needsRecurse = false; - var destination = copyType(source); - - if (destination === undefined) { - destination = isArray(source) ? [] : Object.create(getPrototypeOf(source)); - needsRecurse = true; - } - - stackSource.push(source); - stackDest.push(destination); - - return needsRecurse - ? copyRecurse(source, destination, maxDepth) - : destination; - } - - function copyType(source) { - switch (toString.call(source)) { - case '[object Int8Array]': - case '[object Int16Array]': - case '[object Int32Array]': - case '[object Float32Array]': - case '[object Float64Array]': - case '[object Uint8Array]': - case '[object Uint8ClampedArray]': - case '[object Uint16Array]': - case '[object Uint32Array]': - return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length); - - case '[object ArrayBuffer]': - // Support: IE10 - if (!source.slice) { - // If we're in this case we know the environment supports ArrayBuffer - /* eslint-disable no-undef */ - var copied = new ArrayBuffer(source.byteLength); - new Uint8Array(copied).set(new Uint8Array(source)); - /* eslint-enable */ - return copied; - } - return source.slice(0); - - case '[object Boolean]': - case '[object Number]': - case '[object String]': - case '[object Date]': - return new source.constructor(source.valueOf()); - - case '[object RegExp]': - var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]); - re.lastIndex = source.lastIndex; - return re; - - case '[object Blob]': - return new source.constructor([source], {type: source.type}); - } - - if (isFunction(source.cloneNode)) { - return source.cloneNode(true); - } - } -} - - -// eslint-disable-next-line no-self-compare -function simpleCompare(a, b) { return a === b || (a !== a && b !== b); } - - -/** - * @ngdoc function - * @name angular.equals - * @module ng - * @kind function - * - * @description - * Determines if two objects or two values are equivalent. Supports value types, regular - * expressions, arrays and objects. - * - * Two objects or values are considered equivalent if at least one of the following is true: - * - * * Both objects or values pass `===` comparison. - * * Both objects or values are of the same type and all of their properties are equal by - * comparing them with `angular.equals`. - * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal) - * * Both values represent the same regular expression (In JavaScript, - * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual - * representation matches). - * - * During a property comparison, properties of `function` type and properties with names - * that begin with `$` are ignored. - * - * Scope and DOMWindow objects are being compared only by identify (`===`). - * - * @param {*} o1 Object or value to compare. - * @param {*} o2 Object or value to compare. - * @returns {boolean} True if arguments are equal. - * - * @example - - -
-
-

User 1

- Name: - Age: - -

User 2

- Name: - Age: - -
-
- -
- User 1:
{{user1 | json}}
- User 2:
{{user2 | json}}
- Equal:
{{result}}
-
-
-
- - angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) { - $scope.user1 = {}; - $scope.user2 = {}; - $scope.compare = function() { - $scope.result = angular.equals($scope.user1, $scope.user2); - }; - }]); - -
- */ -function equals(o1, o2) { - if (o1 === o2) return true; - if (o1 === null || o2 === null) return false; - // eslint-disable-next-line no-self-compare - if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN - var t1 = typeof o1, t2 = typeof o2, length, key, keySet; - if (t1 === t2 && t1 === 'object') { - if (isArray(o1)) { - if (!isArray(o2)) return false; - if ((length = o1.length) === o2.length) { - for (key = 0; key < length; key++) { - if (!equals(o1[key], o2[key])) return false; - } - return true; - } - } else if (isDate(o1)) { - if (!isDate(o2)) return false; - return simpleCompare(o1.getTime(), o2.getTime()); - } else if (isRegExp(o1)) { - if (!isRegExp(o2)) return false; - return o1.toString() === o2.toString(); - } else { - if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || - isArray(o2) || isDate(o2) || isRegExp(o2)) return false; - keySet = createMap(); - for (key in o1) { - if (key.charAt(0) === '$' || isFunction(o1[key])) continue; - if (!equals(o1[key], o2[key])) return false; - keySet[key] = true; - } - for (key in o2) { - if (!(key in keySet) && - key.charAt(0) !== '$' && - isDefined(o2[key]) && - !isFunction(o2[key])) return false; - } - return true; - } - } - return false; -} - -var csp = function() { - if (!isDefined(csp.rules)) { - - - var ngCspElement = (window.document.querySelector('[ng-csp]') || - window.document.querySelector('[data-ng-csp]')); - - if (ngCspElement) { - var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || - ngCspElement.getAttribute('data-ng-csp'); - csp.rules = { - noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), - noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) - }; - } else { - csp.rules = { - noUnsafeEval: noUnsafeEval(), - noInlineStyle: false - }; - } - } - - return csp.rules; - - function noUnsafeEval() { - try { - // eslint-disable-next-line no-new, no-new-func - new Function(''); - return false; - } catch (e) { - return true; - } - } -}; - -/** - * @ngdoc directive - * @module ng - * @name ngJq - * - * @element ANY - * @param {string=} ngJq the name of the library available under `window` - * to be used for angular.element - * @description - * Use this directive to force the angular.element library. This should be - * used to force either jqLite by leaving ng-jq blank or setting the name of - * the jquery variable under window (eg. jQuery). - * - * Since AngularJS looks for this directive when it is loaded (doesn't wait for the - * DOMContentLoaded event), it must be placed on an element that comes before the script - * which loads angular. Also, only the first instance of `ng-jq` will be used and all - * others ignored. - * - * @example - * This example shows how to force jqLite using the `ngJq` directive to the `html` tag. - ```html - - - ... - ... - - ``` - * @example - * This example shows how to use a jQuery based library of a different name. - * The library name must be available at the top most 'window'. - ```html - - - ... - ... - - ``` - */ -var jq = function() { - if (isDefined(jq.name_)) return jq.name_; - var el; - var i, ii = ngAttrPrefixes.length, prefix, name; - for (i = 0; i < ii; ++i) { - prefix = ngAttrPrefixes[i]; - el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]'); - if (el) { - name = el.getAttribute(prefix + 'jq'); - break; - } - } - - return (jq.name_ = name); -}; - -function concat(array1, array2, index) { - return array1.concat(slice.call(array2, index)); -} - -function sliceArgs(args, startIndex) { - return slice.call(args, startIndex || 0); -} - - -/** - * @ngdoc function - * @name angular.bind - * @module ng - * @kind function - * - * @description - * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for - * `fn`). You can supply optional `args` that are prebound to the function. This feature is also - * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as - * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application). - * - * @param {Object} self Context which `fn` should be evaluated in. - * @param {function()} fn Function to be bound. - * @param {...*} args Optional arguments to be prebound to the `fn` function call. - * @returns {function()} Function that wraps the `fn` with all the specified bindings. - */ -function bind(self, fn) { - var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; - if (isFunction(fn) && !(fn instanceof RegExp)) { - return curryArgs.length - ? function() { - return arguments.length - ? fn.apply(self, concat(curryArgs, arguments, 0)) - : fn.apply(self, curryArgs); - } - : function() { - return arguments.length - ? fn.apply(self, arguments) - : fn.call(self); - }; - } else { - // In IE, native methods are not functions so they cannot be bound (note: they don't need to be). - return fn; - } -} - - -function toJsonReplacer(key, value) { - var val = value; - - if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { - val = undefined; - } else if (isWindow(value)) { - val = '$WINDOW'; - } else if (value && window.document === value) { - val = '$DOCUMENT'; - } else if (isScope(value)) { - val = '$SCOPE'; - } - - return val; -} - - -/** - * @ngdoc function - * @name angular.toJson - * @module ng - * @kind function - * - * @description - * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be - * stripped since AngularJS uses this notation internally. - * - * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON. - * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace. - * If set to an integer, the JSON output will contain that many spaces per indentation. - * @returns {string|undefined} JSON-ified string representing `obj`. - * @knownIssue - * - * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date` - * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the - * `Date.prototype.toJSON` method as follows: - * - * ``` - * var _DatetoJSON = Date.prototype.toJSON; - * Date.prototype.toJSON = function() { - * try { - * return _DatetoJSON.call(this); - * } catch(e) { - * if (e instanceof RangeError) { - * return null; - * } - * throw e; - * } - * }; - * ``` - * - * See https://github.com/angular/angular.js/pull/14221 for more information. - */ -function toJson(obj, pretty) { - if (isUndefined(obj)) return undefined; - if (!isNumber(pretty)) { - pretty = pretty ? 2 : null; - } - return JSON.stringify(obj, toJsonReplacer, pretty); -} - - -/** - * @ngdoc function - * @name angular.fromJson - * @module ng - * @kind function - * - * @description - * Deserializes a JSON string. - * - * @param {string} json JSON string to deserialize. - * @returns {Object|Array|string|number} Deserialized JSON string. - */ -function fromJson(json) { - return isString(json) - ? JSON.parse(json) - : json; -} - - -var ALL_COLONS = /:/g; -function timezoneToOffset(timezone, fallback) { - // Support: IE 9-11 only, Edge 13-15+ - // IE/Edge do not "understand" colon (`:`) in timezone - timezone = timezone.replace(ALL_COLONS, ''); - var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; - return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; -} - - -function addDateMinutes(date, minutes) { - date = new Date(date.getTime()); - date.setMinutes(date.getMinutes() + minutes); - return date; -} - - -function convertTimezoneToLocal(date, timezone, reverse) { - reverse = reverse ? -1 : 1; - var dateTimezoneOffset = date.getTimezoneOffset(); - var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset)); -} - - -/** - * @returns {string} Returns the string representation of the element. - */ -function startingTag(element) { - element = jqLite(element).clone().empty(); - var elemHtml = jqLite('
').append(element).html(); - try { - return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : - elemHtml. - match(/^(<[^>]+>)/)[1]. - replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);}); - } catch (e) { - return lowercase(elemHtml); - } - -} - - -///////////////////////////////////////////////// - -/** - * Tries to decode the URI component without throwing an exception. - * - * @private - * @param str value potential URI component to check. - * @returns {boolean} True if `value` can be decoded - * with the decodeURIComponent function. - */ -function tryDecodeURIComponent(value) { - try { - return decodeURIComponent(value); - } catch (e) { - // Ignore any invalid uri component. - } -} - - -/** - * Parses an escaped url query string into key-value pairs. - * @returns {Object.} - */ -function parseKeyValue(/**string*/keyValue) { - var obj = {}; - forEach((keyValue || '').split('&'), function(keyValue) { - var splitPoint, key, val; - if (keyValue) { - key = keyValue = keyValue.replace(/\+/g,'%20'); - splitPoint = keyValue.indexOf('='); - if (splitPoint !== -1) { - key = keyValue.substring(0, splitPoint); - val = keyValue.substring(splitPoint + 1); - } - key = tryDecodeURIComponent(key); - if (isDefined(key)) { - val = isDefined(val) ? tryDecodeURIComponent(val) : true; - if (!hasOwnProperty.call(obj, key)) { - obj[key] = val; - } else if (isArray(obj[key])) { - obj[key].push(val); - } else { - obj[key] = [obj[key],val]; - } - } - } - }); - return obj; -} - -function toKeyValue(obj) { - var parts = []; - forEach(obj, function(value, key) { - if (isArray(value)) { - forEach(value, function(arrayValue) { - parts.push(encodeUriQuery(key, true) + - (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true))); - }); - } else { - parts.push(encodeUriQuery(key, true) + - (value === true ? '' : '=' + encodeUriQuery(value, true))); - } - }); - return parts.length ? parts.join('&') : ''; -} - - -/** - * We need our custom method because encodeURIComponent is too aggressive and doesn't follow - * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path - * segments: - * segment = *pchar - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * pct-encoded = "%" HEXDIG HEXDIG - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ -function encodeUriSegment(val) { - return encodeUriQuery(val, true). - replace(/%26/gi, '&'). - replace(/%3D/gi, '='). - replace(/%2B/gi, '+'); -} - - -/** - * This method is intended for encoding *key* or *value* parts of query component. We need a custom - * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be - * encoded per http://tools.ietf.org/html/rfc3986: - * query = *( pchar / "/" / "?" ) - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * pct-encoded = "%" HEXDIG HEXDIG - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ -function encodeUriQuery(val, pctEncodeSpaces) { - return encodeURIComponent(val). - replace(/%40/gi, '@'). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%3B/gi, ';'). - replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); -} - -var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-']; - -function getNgAttribute(element, ngAttr) { - var attr, i, ii = ngAttrPrefixes.length; - for (i = 0; i < ii; ++i) { - attr = ngAttrPrefixes[i] + ngAttr; - if (isString(attr = element.getAttribute(attr))) { - return attr; - } - } - return null; -} - -function allowAutoBootstrap(document) { - var script = document.currentScript; - - if (!script) { - // Support: IE 9-11 only - // IE does not have `document.currentScript` - return true; - } - - // If the `currentScript` property has been clobbered just return false, since this indicates a probable attack - if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) { - return false; - } - - var attributes = script.attributes; - var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')]; - - return srcs.every(function(src) { - if (!src) { - return true; - } - if (!src.value) { - return false; - } - - var link = document.createElement('a'); - link.href = src.value; - - if (document.location.origin === link.origin) { - // Same-origin resources are always allowed, even for non-whitelisted schemes. - return true; - } - // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web. - // This is to prevent angular.js bundled with browser extensions from being used to bypass the - // content security policy in web pages and other browser extensions. - switch (link.protocol) { - case 'http:': - case 'https:': - case 'ftp:': - case 'blob:': - case 'file:': - case 'data:': - return true; - default: - return false; - } - }); -} - -// Cached as it has to run during loading so that document.currentScript is available. -var isAutoBootstrapAllowed = allowAutoBootstrap(window.document); - -/** - * @ngdoc directive - * @name ngApp - * @module ng - * - * @element ANY - * @param {angular.Module} ngApp an optional application - * {@link angular.module module} name to load. - * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be - * created in "strict-di" mode. This means that the application will fail to invoke functions which - * do not use explicit function annotation (and are thus unsuitable for minification), as described - * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in - * tracking down the root of these bugs. - * - * @description - * - * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive - * designates the **root element** of the application and is typically placed near the root element - * of the page - e.g. on the `` or `` tags. - * - * There are a few things to keep in mind when using `ngApp`: - * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` - * found in the document will be used to define the root element to auto-bootstrap as an - * application. To run multiple applications in an HTML document you must manually bootstrap them using - * {@link angular.bootstrap} instead. - * - AngularJS applications cannot be nested within each other. - * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`. - * This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and - * {@link ngRoute.ngView `ngView`}. - * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector}, - * causing animations to stop working and making the injector inaccessible from outside the app. - * - * You can specify an **AngularJS module** to be used as the root module for the application. This - * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It - * should contain the application code needed or have dependencies on other modules that will - * contain the code. See {@link angular.module} for more information. - * - * In the example below if the `ngApp` directive were not placed on the `html` element then the - * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` - * would not be resolved to `3`. - * - * @example - * - * ### Simple Usage - * - * `ngApp` is the easiest, and most common way to bootstrap an application. - * - - -
- I can add: {{a}} + {{b}} = {{ a+b }} -
-
- - angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }); - -
- * - * @example - * - * ### With `ngStrictDi` - * - * Using `ngStrictDi`, you would see something like this: - * - - -
-
- I can add: {{a}} + {{b}} = {{ a+b }} - -

This renders because the controller does not fail to - instantiate, by using explicit annotation style (see - script.js for details) -

-
- -
- Name:
- Hello, {{name}}! - -

This renders because the controller does not fail to - instantiate, by using explicit annotation style - (see script.js for details) -

-
- -
- I can add: {{a}} + {{b}} = {{ a+b }} - -

The controller could not be instantiated, due to relying - on automatic function annotations (which are disabled in - strict mode). As such, the content of this section is not - interpolated, and there should be an error in your web console. -

-
-
-
- - angular.module('ngAppStrictDemo', []) - // BadController will fail to instantiate, due to relying on automatic function annotation, - // rather than an explicit annotation - .controller('BadController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }) - // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated, - // due to using explicit annotations using the array style and $inject property, respectively. - .controller('GoodController1', ['$scope', function($scope) { - $scope.a = 1; - $scope.b = 2; - }]) - .controller('GoodController2', GoodController2); - function GoodController2($scope) { - $scope.name = 'World'; - } - GoodController2.$inject = ['$scope']; - - - div[ng-controller] { - margin-bottom: 1em; - -webkit-border-radius: 4px; - border-radius: 4px; - border: 1px solid; - padding: .5em; - } - div[ng-controller^=Good] { - border-color: #d6e9c6; - background-color: #dff0d8; - color: #3c763d; - } - div[ng-controller^=Bad] { - border-color: #ebccd1; - background-color: #f2dede; - color: #a94442; - margin-bottom: 0; - } - -
- */ -function angularInit(element, bootstrap) { - var appElement, - module, - config = {}; - - // The element `element` has priority over any other element. - forEach(ngAttrPrefixes, function(prefix) { - var name = prefix + 'app'; - - if (!appElement && element.hasAttribute && element.hasAttribute(name)) { - appElement = element; - module = element.getAttribute(name); - } - }); - forEach(ngAttrPrefixes, function(prefix) { - var name = prefix + 'app'; - var candidate; - - if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { - appElement = candidate; - module = candidate.getAttribute(name); - } - }); - if (appElement) { - if (!isAutoBootstrapAllowed) { - window.console.error('AngularJS: disabling automatic bootstrap. - * - * - * - * ``` - * - * @param {DOMElement} element DOM element which is the root of AngularJS application. - * @param {Array=} modules an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - * @param {Object=} config an object for defining configuration options for the application. The - * following keys are supported: - * - * * `strictDi` - disable automatic function annotation for the application. This is meant to - * assist in finding bugs which break minified code. Defaults to `false`. - * - * @returns {auto.$injector} Returns the newly created injector for this app. - */ -function bootstrap(element, modules, config) { - if (!isObject(config)) config = {}; - var defaultConfig = { - strictDi: false - }; - config = extend(defaultConfig, config); - var doBootstrap = function() { - element = jqLite(element); - - if (element.injector()) { - var tag = (element[0] === window.document) ? 'document' : startingTag(element); - // Encode angle brackets to prevent input from being sanitized to empty string #8683. - throw ngMinErr( - 'btstrpd', - 'App already bootstrapped with this element \'{0}\'', - tag.replace(//,'>')); - } - - modules = modules || []; - modules.unshift(['$provide', function($provide) { - $provide.value('$rootElement', element); - }]); - - if (config.debugInfoEnabled) { - // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`. - modules.push(['$compileProvider', function($compileProvider) { - $compileProvider.debugInfoEnabled(true); - }]); - } - - modules.unshift('ng'); - var injector = createInjector(modules, config.strictDi); - injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', - function bootstrapApply(scope, element, compile, injector) { - scope.$apply(function() { - element.data('$injector', injector); - compile(element)(scope); - }); - }] - ); - return injector; - }; - - var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/; - var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; - - if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) { - config.debugInfoEnabled = true; - window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, ''); - } - - if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { - return doBootstrap(); - } - - window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); - angular.resumeBootstrap = function(extraModules) { - forEach(extraModules, function(module) { - modules.push(module); - }); - return doBootstrap(); - }; - - if (isFunction(angular.resumeDeferredBootstrap)) { - angular.resumeDeferredBootstrap(); - } -} - -/** - * @ngdoc function - * @name angular.reloadWithDebugInfo - * @module ng - * @description - * Use this function to reload the current application with debug information turned on. - * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`. - * - * See {@link ng.$compileProvider#debugInfoEnabled} for more. - */ -function reloadWithDebugInfo() { - window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name; - window.location.reload(); -} - -/** - * @name angular.getTestability - * @module ng - * @description - * Get the testability service for the instance of AngularJS on the given - * element. - * @param {DOMElement} element DOM element which is the root of AngularJS application. - */ -function getTestability(rootElement) { - var injector = angular.element(rootElement).injector(); - if (!injector) { - throw ngMinErr('test', - 'no injector found for element argument to getTestability'); - } - return injector.get('$$testability'); -} - -var SNAKE_CASE_REGEXP = /[A-Z]/g; -function snake_case(name, separator) { - separator = separator || '_'; - return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) { - return (pos ? separator : '') + letter.toLowerCase(); - }); -} - -var bindJQueryFired = false; -function bindJQuery() { - var originalCleanData; - - if (bindJQueryFired) { - return; - } - - // bind to jQuery if present; - var jqName = jq(); - jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present) - !jqName ? undefined : // use jqLite - window[jqName]; // use jQuery specified by `ngJq` - - // Use jQuery if it exists with proper functionality, otherwise default to us. - // AngularJS 1.2+ requires jQuery 1.7+ for on()/off() support. - // AngularJS 1.3+ technically requires at least jQuery 2.1+ but it may work with older - // versions. It will not work for sure with jQuery <1.7, though. - if (jQuery && jQuery.fn.on) { - jqLite = jQuery; - extend(jQuery.fn, { - scope: JQLitePrototype.scope, - isolateScope: JQLitePrototype.isolateScope, - controller: /** @type {?} */ (JQLitePrototype).controller, - injector: JQLitePrototype.injector, - inheritedData: JQLitePrototype.inheritedData - }); - } else { - jqLite = JQLite; - } - - // All nodes removed from the DOM via various jqLite/jQuery APIs like .remove() - // are passed through jqLite/jQuery.cleanData. Monkey-patch this method to fire - // the $destroy event on all removed nodes. - originalCleanData = jqLite.cleanData; - jqLite.cleanData = function(elems) { - var events; - for (var i = 0, elem; (elem = elems[i]) != null; i++) { - events = (jqLite._data(elem) || {}).events; - if (events && events.$destroy) { - jqLite(elem).triggerHandler('$destroy'); - } - } - originalCleanData(elems); - }; - - angular.element = jqLite; - - // Prevent double-proxying. - bindJQueryFired = true; -} - -/** - * throw error if the argument is falsy. - */ -function assertArg(arg, name, reason) { - if (!arg) { - throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); - } - return arg; -} - -function assertArgFn(arg, name, acceptArrayAnnotation) { - if (acceptArrayAnnotation && isArray(arg)) { - arg = arg[arg.length - 1]; - } - - assertArg(isFunction(arg), name, 'not a function, got ' + - (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg)); - return arg; -} - -/** - * throw error if the name given is hasOwnProperty - * @param {String} name the name to test - * @param {String} context the context in which the name is used, such as module or directive - */ -function assertNotHasOwnProperty(name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } -} - -/** - * Return the value accessible from the object by path. Any undefined traversals are ignored - * @param {Object} obj starting object - * @param {String} path path to traverse - * @param {boolean} [bindFnToScope=true] - * @returns {Object} value as accessible by path - */ -//TODO(misko): this function needs to be removed -function getter(obj, path, bindFnToScope) { - if (!path) return obj; - var keys = path.split('.'); - var key; - var lastInstance = obj; - var len = keys.length; - - for (var i = 0; i < len; i++) { - key = keys[i]; - if (obj) { - obj = (lastInstance = obj)[key]; - } - } - if (!bindFnToScope && isFunction(obj)) { - return bind(lastInstance, obj); - } - return obj; -} - -/** - * Return the DOM siblings between the first and last node in the given array. - * @param {Array} array like object - * @returns {Array} the inputted object or a jqLite collection containing the nodes - */ -function getBlockNodes(nodes) { - // TODO(perf): update `nodes` instead of creating a new object? - var node = nodes[0]; - var endNode = nodes[nodes.length - 1]; - var blockNodes; - - for (var i = 1; node !== endNode && (node = node.nextSibling); i++) { - if (blockNodes || nodes[i] !== node) { - if (!blockNodes) { - blockNodes = jqLite(slice.call(nodes, 0, i)); - } - blockNodes.push(node); - } - } - - return blockNodes || nodes; -} - - -/** - * Creates a new object without a prototype. This object is useful for lookup without having to - * guard against prototypically inherited properties via hasOwnProperty. - * - * Related micro-benchmarks: - * - http://jsperf.com/object-create2 - * - http://jsperf.com/proto-map-lookup/2 - * - http://jsperf.com/for-in-vs-object-keys2 - * - * @returns {Object} - */ -function createMap() { - return Object.create(null); -} - -function stringify(value) { - if (value == null) { // null || undefined - return ''; - } - switch (typeof value) { - case 'string': - break; - case 'number': - value = '' + value; - break; - default: - if (hasCustomToString(value) && !isArray(value) && !isDate(value)) { - value = value.toString(); - } else { - value = toJson(value); - } - } - - return value; -} - -var NODE_TYPE_ELEMENT = 1; -var NODE_TYPE_ATTRIBUTE = 2; -var NODE_TYPE_TEXT = 3; -var NODE_TYPE_COMMENT = 8; -var NODE_TYPE_DOCUMENT = 9; -var NODE_TYPE_DOCUMENT_FRAGMENT = 11; - -/** - * @ngdoc type - * @name angular.Module - * @module ng - * @description - * - * Interface for configuring AngularJS {@link angular.module modules}. - */ - -function setupModuleLoader(window) { - - var $injectorMinErr = minErr('$injector'); - var ngMinErr = minErr('ng'); - - function ensure(obj, name, factory) { - return obj[name] || (obj[name] = factory()); - } - - var angular = ensure(window, 'angular', Object); - - // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap - angular.$$minErr = angular.$$minErr || minErr; - - return ensure(angular, 'module', function() { - /** @type {Object.} */ - var modules = {}; - - /** - * @ngdoc function - * @name angular.module - * @module ng - * @description - * - * The `angular.module` is a global place for creating, registering and retrieving AngularJS - * modules. - * All modules (AngularJS core or 3rd party) that should be available to an application must be - * registered using this mechanism. - * - * Passing one argument retrieves an existing {@link angular.Module}, - * whereas passing more than one argument creates a new {@link angular.Module} - * - * - * # Module - * - * A module is a collection of services, directives, controllers, filters, and configuration information. - * `angular.module` is used to configure the {@link auto.$injector $injector}. - * - * ```js - * // Create a new module - * var myModule = angular.module('myModule', []); - * - * // register a new service - * myModule.value('appName', 'MyCoolApp'); - * - * // configure existing services inside initialization blocks. - * myModule.config(['$locationProvider', function($locationProvider) { - * // Configure existing providers - * $locationProvider.hashPrefix('!'); - * }]); - * ``` - * - * Then you can create an injector and load your modules like this: - * - * ```js - * var injector = angular.injector(['ng', 'myModule']) - * ``` - * - * However it's more likely that you'll just use - * {@link ng.directive:ngApp ngApp} or - * {@link angular.bootstrap} to simplify this process for you. - * - * @param {!string} name The name of the module to create or retrieve. - * @param {!Array.=} requires If specified then new module is being created. If - * unspecified then the module is being retrieved for further configuration. - * @param {Function=} configFn Optional configuration function for the module. Same as - * {@link angular.Module#config Module#config()}. - * @returns {angular.Module} new module with the {@link angular.Module} api. - */ - return function module(name, requires, configFn) { - - var info = {}; - - var assertNotHasOwnProperty = function(name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } - }; - - assertNotHasOwnProperty(name, 'module'); - if (requires && modules.hasOwnProperty(name)) { - modules[name] = null; - } - return ensure(modules, name, function() { - if (!requires) { - throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' + - 'the module name or forgot to load it. If registering a module ensure that you ' + - 'specify the dependencies as the second argument.', name); - } - - /** @type {!Array.>} */ - var invokeQueue = []; - - /** @type {!Array.} */ - var configBlocks = []; - - /** @type {!Array.} */ - var runBlocks = []; - - var config = invokeLater('$injector', 'invoke', 'push', configBlocks); - - /** @type {angular.Module} */ - var moduleInstance = { - // Private state - _invokeQueue: invokeQueue, - _configBlocks: configBlocks, - _runBlocks: runBlocks, - - /** - * @ngdoc method - * @name angular.Module#info - * @module ng - * - * @param {Object=} info Information about the module - * @returns {Object|Module} The current info object for this module if called as a getter, - * or `this` if called as a setter. - * - * @description - * Read and write custom information about this module. - * For example you could put the version of the module in here. - * - * ```js - * angular.module('myModule', []).info({ version: '1.0.0' }); - * ``` - * - * The version could then be read back out by accessing the module elsewhere: - * - * ``` - * var version = angular.module('myModule').info().version; - * ``` - * - * You can also retrieve this information during runtime via the - * {@link $injector#modules `$injector.modules`} property: - * - * ```js - * var version = $injector.modules['myModule'].info().version; - * ``` - */ - info: function(value) { - if (isDefined(value)) { - if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value'); - info = value; - return this; - } - return info; - }, - - /** - * @ngdoc property - * @name angular.Module#requires - * @module ng - * - * @description - * Holds the list of modules which the injector will load before the current module is - * loaded. - */ - requires: requires, - - /** - * @ngdoc property - * @name angular.Module#name - * @module ng - * - * @description - * Name of the module. - */ - name: name, - - - /** - * @ngdoc method - * @name angular.Module#provider - * @module ng - * @param {string} name service name - * @param {Function} providerType Construction function for creating new instance of the - * service. - * @description - * See {@link auto.$provide#provider $provide.provider()}. - */ - provider: invokeLaterAndSetModuleName('$provide', 'provider'), - - /** - * @ngdoc method - * @name angular.Module#factory - * @module ng - * @param {string} name service name - * @param {Function} providerFunction Function for creating new instance of the service. - * @description - * See {@link auto.$provide#factory $provide.factory()}. - */ - factory: invokeLaterAndSetModuleName('$provide', 'factory'), - - /** - * @ngdoc method - * @name angular.Module#service - * @module ng - * @param {string} name service name - * @param {Function} constructor A constructor function that will be instantiated. - * @description - * See {@link auto.$provide#service $provide.service()}. - */ - service: invokeLaterAndSetModuleName('$provide', 'service'), - - /** - * @ngdoc method - * @name angular.Module#value - * @module ng - * @param {string} name service name - * @param {*} object Service instance object. - * @description - * See {@link auto.$provide#value $provide.value()}. - */ - value: invokeLater('$provide', 'value'), - - /** - * @ngdoc method - * @name angular.Module#constant - * @module ng - * @param {string} name constant name - * @param {*} object Constant value. - * @description - * Because the constants are fixed, they get applied before other provide methods. - * See {@link auto.$provide#constant $provide.constant()}. - */ - constant: invokeLater('$provide', 'constant', 'unshift'), - - /** - * @ngdoc method - * @name angular.Module#decorator - * @module ng - * @param {string} name The name of the service to decorate. - * @param {Function} decorFn This function will be invoked when the service needs to be - * instantiated and should return the decorated service instance. - * @description - * See {@link auto.$provide#decorator $provide.decorator()}. - */ - decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks), - - /** - * @ngdoc method - * @name angular.Module#animation - * @module ng - * @param {string} name animation name - * @param {Function} animationFactory Factory function for creating new instance of an - * animation. - * @description - * - * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. - * - * - * Defines an animation hook that can be later used with - * {@link $animate $animate} service and directives that use this service. - * - * ```js - * module.animation('.animation-name', function($inject1, $inject2) { - * return { - * eventName : function(element, done) { - * //code to run the animation - * //once complete, then run done() - * return function cancellationFunction(element) { - * //code to cancel the animation - * } - * } - * } - * }) - * ``` - * - * See {@link ng.$animateProvider#register $animateProvider.register()} and - * {@link ngAnimate ngAnimate module} for more information. - */ - animation: invokeLaterAndSetModuleName('$animateProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#filter - * @module ng - * @param {string} name Filter name - this must be a valid AngularJS expression identifier - * @param {Function} filterFactory Factory function for creating new instance of filter. - * @description - * See {@link ng.$filterProvider#register $filterProvider.register()}. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- */ - filter: invokeLaterAndSetModuleName('$filterProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#controller - * @module ng - * @param {string|Object} name Controller name, or an object map of controllers where the - * keys are the names and the values are the constructors. - * @param {Function} constructor Controller constructor function. - * @description - * See {@link ng.$controllerProvider#register $controllerProvider.register()}. - */ - controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#directive - * @module ng - * @param {string|Object} name Directive name, or an object map of directives where the - * keys are the names and the values are the factories. - * @param {Function} directiveFactory Factory function for creating new instance of - * directives. - * @description - * See {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'), - - /** - * @ngdoc method - * @name angular.Module#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}) - * - * @description - * See {@link ng.$compileProvider#component $compileProvider.component()}. - */ - component: invokeLaterAndSetModuleName('$compileProvider', 'component'), - - /** - * @ngdoc method - * @name angular.Module#config - * @module ng - * @param {Function} configFn Execute this function on module load. Useful for service - * configuration. - * @description - * Use this method to configure services by injecting their - * {@link angular.Module#provider `providers`}, e.g. for adding routes to the - * {@link ngRoute.$routeProvider $routeProvider}. - * - * Note that you can only inject {@link angular.Module#provider `providers`} and - * {@link angular.Module#constant `constants`} into this function. - * - * For more about how to configure services, see - * {@link providers#provider-recipe Provider Recipe}. - */ - config: config, - - /** - * @ngdoc method - * @name angular.Module#run - * @module ng - * @param {Function} initializationFn Execute this function after injector creation. - * Useful for application initialization. - * @description - * Use this method to register work which should be performed when the injector is done - * loading all modules. - */ - run: function(block) { - runBlocks.push(block); - return this; - } - }; - - if (configFn) { - config(configFn); - } - - return moduleInstance; - - /** - * @param {string} provider - * @param {string} method - * @param {String=} insertMethod - * @returns {angular.Module} - */ - function invokeLater(provider, method, insertMethod, queue) { - if (!queue) queue = invokeQueue; - return function() { - queue[insertMethod || 'push']([provider, method, arguments]); - return moduleInstance; - }; - } - - /** - * @param {string} provider - * @param {string} method - * @returns {angular.Module} - */ - function invokeLaterAndSetModuleName(provider, method, queue) { - if (!queue) queue = invokeQueue; - return function(recipeName, factoryFunction) { - if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name; - queue.push([provider, method, arguments]); - return moduleInstance; - }; - } - }); - }; - }); - -} - -/* global shallowCopy: true */ - -/** - * Creates a shallow copy of an object, an array or a primitive. - * - * Assumes that there are no proto properties for objects. - */ -function shallowCopy(src, dst) { - if (isArray(src)) { - dst = dst || []; - - for (var i = 0, ii = src.length; i < ii; i++) { - dst[i] = src[i]; - } - } else if (isObject(src)) { - dst = dst || {}; - - for (var key in src) { - if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { - dst[key] = src[key]; - } - } - } - - return dst || src; -} - -/* exported toDebugString */ - -function serializeObject(obj, maxDepth) { - var seen = []; - - // There is no direct way to stringify object until reaching a specific depth - // and a very deep object can cause a performance issue, so we copy the object - // based on this specific depth and then stringify it. - if (isValidObjectMaxDepth(maxDepth)) { - // This file is also included in `angular-loader`, so `copy()` might not always be available in - // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed. - obj = angular.copy(obj, null, maxDepth); - } - return JSON.stringify(obj, function(key, val) { - val = toJsonReplacer(key, val); - if (isObject(val)) { - - if (seen.indexOf(val) >= 0) return '...'; - - seen.push(val); - } - return val; - }); -} - -function toDebugString(obj, maxDepth) { - if (typeof obj === 'function') { - return obj.toString().replace(/ \{[\s\S]*$/, ''); - } else if (isUndefined(obj)) { - return 'undefined'; - } else if (typeof obj !== 'string') { - return serializeObject(obj, maxDepth); - } - return obj; -} - -/* global angularModule: true, - version: true, - - $CompileProvider, - - htmlAnchorDirective, - inputDirective, - hiddenInputBrowserCacheDirective, - formDirective, - scriptDirective, - selectDirective, - optionDirective, - ngBindDirective, - ngBindHtmlDirective, - ngBindTemplateDirective, - ngClassDirective, - ngClassEvenDirective, - ngClassOddDirective, - ngCloakDirective, - ngControllerDirective, - ngFormDirective, - ngHideDirective, - ngIfDirective, - ngIncludeDirective, - ngIncludeFillContentDirective, - ngInitDirective, - ngNonBindableDirective, - ngPluralizeDirective, - ngRefDirective, - ngRepeatDirective, - ngShowDirective, - ngStyleDirective, - ngSwitchDirective, - ngSwitchWhenDirective, - ngSwitchDefaultDirective, - ngOptionsDirective, - ngTranscludeDirective, - ngModelDirective, - ngListDirective, - ngChangeDirective, - patternDirective, - patternDirective, - requiredDirective, - requiredDirective, - minlengthDirective, - minlengthDirective, - maxlengthDirective, - maxlengthDirective, - ngValueDirective, - ngModelOptionsDirective, - ngAttributeAliasDirectives, - ngEventDirectives, - - $AnchorScrollProvider, - $AnimateProvider, - $CoreAnimateCssProvider, - $$CoreAnimateJsProvider, - $$CoreAnimateQueueProvider, - $$AnimateRunnerFactoryProvider, - $$AnimateAsyncRunFactoryProvider, - $BrowserProvider, - $CacheFactoryProvider, - $ControllerProvider, - $DateProvider, - $DocumentProvider, - $$IsDocumentHiddenProvider, - $ExceptionHandlerProvider, - $FilterProvider, - $$ForceReflowProvider, - $InterpolateProvider, - $$IntervalFactoryProvider, - $IntervalProvider, - $HttpProvider, - $HttpParamSerializerProvider, - $HttpParamSerializerJQLikeProvider, - $HttpBackendProvider, - $xhrFactoryProvider, - $jsonpCallbacksProvider, - $LocationProvider, - $LogProvider, - $$MapProvider, - $ParseProvider, - $RootScopeProvider, - $QProvider, - $$QProvider, - $$SanitizeUriProvider, - $SceProvider, - $SceDelegateProvider, - $SnifferProvider, - $$TaskTrackerFactoryProvider, - $TemplateCacheProvider, - $TemplateRequestProvider, - $$TestabilityProvider, - $TimeoutProvider, - $$RAFProvider, - $WindowProvider, - $$jqLiteProvider, - $$CookieReaderProvider -*/ - - -/** - * @ngdoc object - * @name angular.version - * @module ng - * @description - * An object that contains information about the current AngularJS version. - * - * This object has the following properties: - * - * - `full` – `{string}` – Full version string, such as "0.9.18". - * - `major` – `{number}` – Major version number, such as "0". - * - `minor` – `{number}` – Minor version number, such as "9". - * - `dot` – `{number}` – Dot version number, such as "18". - * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". - */ -var version = { - // These placeholder strings will be replaced by grunt's `build` task. - // They need to be double- or single-quoted. - full: '1.7.9', - major: 1, - minor: 7, - dot: 9, - codeName: 'pollution-eradication' -}; - - -function publishExternalAPI(angular) { - extend(angular, { - 'errorHandlingConfig': errorHandlingConfig, - 'bootstrap': bootstrap, - 'copy': copy, - 'extend': extend, - 'merge': merge, - 'equals': equals, - 'element': jqLite, - 'forEach': forEach, - 'injector': createInjector, - 'noop': noop, - 'bind': bind, - 'toJson': toJson, - 'fromJson': fromJson, - 'identity': identity, - 'isUndefined': isUndefined, - 'isDefined': isDefined, - 'isString': isString, - 'isFunction': isFunction, - 'isObject': isObject, - 'isNumber': isNumber, - 'isElement': isElement, - 'isArray': isArray, - 'version': version, - 'isDate': isDate, - 'callbacks': {$$counter: 0}, - 'getTestability': getTestability, - 'reloadWithDebugInfo': reloadWithDebugInfo, - '$$minErr': minErr, - '$$csp': csp, - '$$encodeUriSegment': encodeUriSegment, - '$$encodeUriQuery': encodeUriQuery, - '$$lowercase': lowercase, - '$$stringify': stringify, - '$$uppercase': uppercase - }); - - angularModule = setupModuleLoader(window); - - angularModule('ng', ['ngLocale'], ['$provide', - function ngModule($provide) { - // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it. - $provide.provider({ - $$sanitizeUri: $$SanitizeUriProvider - }); - $provide.provider('$compile', $CompileProvider). - directive({ - a: htmlAnchorDirective, - input: inputDirective, - textarea: inputDirective, - form: formDirective, - script: scriptDirective, - select: selectDirective, - option: optionDirective, - ngBind: ngBindDirective, - ngBindHtml: ngBindHtmlDirective, - ngBindTemplate: ngBindTemplateDirective, - ngClass: ngClassDirective, - ngClassEven: ngClassEvenDirective, - ngClassOdd: ngClassOddDirective, - ngCloak: ngCloakDirective, - ngController: ngControllerDirective, - ngForm: ngFormDirective, - ngHide: ngHideDirective, - ngIf: ngIfDirective, - ngInclude: ngIncludeDirective, - ngInit: ngInitDirective, - ngNonBindable: ngNonBindableDirective, - ngPluralize: ngPluralizeDirective, - ngRef: ngRefDirective, - ngRepeat: ngRepeatDirective, - ngShow: ngShowDirective, - ngStyle: ngStyleDirective, - ngSwitch: ngSwitchDirective, - ngSwitchWhen: ngSwitchWhenDirective, - ngSwitchDefault: ngSwitchDefaultDirective, - ngOptions: ngOptionsDirective, - ngTransclude: ngTranscludeDirective, - ngModel: ngModelDirective, - ngList: ngListDirective, - ngChange: ngChangeDirective, - pattern: patternDirective, - ngPattern: patternDirective, - required: requiredDirective, - ngRequired: requiredDirective, - minlength: minlengthDirective, - ngMinlength: minlengthDirective, - maxlength: maxlengthDirective, - ngMaxlength: maxlengthDirective, - ngValue: ngValueDirective, - ngModelOptions: ngModelOptionsDirective - }). - directive({ - ngInclude: ngIncludeFillContentDirective, - input: hiddenInputBrowserCacheDirective - }). - directive(ngAttributeAliasDirectives). - directive(ngEventDirectives); - $provide.provider({ - $anchorScroll: $AnchorScrollProvider, - $animate: $AnimateProvider, - $animateCss: $CoreAnimateCssProvider, - $$animateJs: $$CoreAnimateJsProvider, - $$animateQueue: $$CoreAnimateQueueProvider, - $$AnimateRunner: $$AnimateRunnerFactoryProvider, - $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider, - $browser: $BrowserProvider, - $cacheFactory: $CacheFactoryProvider, - $controller: $ControllerProvider, - $document: $DocumentProvider, - $$isDocumentHidden: $$IsDocumentHiddenProvider, - $exceptionHandler: $ExceptionHandlerProvider, - $filter: $FilterProvider, - $$forceReflow: $$ForceReflowProvider, - $interpolate: $InterpolateProvider, - $interval: $IntervalProvider, - $$intervalFactory: $$IntervalFactoryProvider, - $http: $HttpProvider, - $httpParamSerializer: $HttpParamSerializerProvider, - $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider, - $httpBackend: $HttpBackendProvider, - $xhrFactory: $xhrFactoryProvider, - $jsonpCallbacks: $jsonpCallbacksProvider, - $location: $LocationProvider, - $log: $LogProvider, - $parse: $ParseProvider, - $rootScope: $RootScopeProvider, - $q: $QProvider, - $$q: $$QProvider, - $sce: $SceProvider, - $sceDelegate: $SceDelegateProvider, - $sniffer: $SnifferProvider, - $$taskTrackerFactory: $$TaskTrackerFactoryProvider, - $templateCache: $TemplateCacheProvider, - $templateRequest: $TemplateRequestProvider, - $$testability: $$TestabilityProvider, - $timeout: $TimeoutProvider, - $window: $WindowProvider, - $$rAF: $$RAFProvider, - $$jqLite: $$jqLiteProvider, - $$Map: $$MapProvider, - $$cookieReader: $$CookieReaderProvider - }); - } - ]) - .info({ angularVersion: '1.7.9' }); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* global - JQLitePrototype: true, - BOOLEAN_ATTR: true, - ALIASED_ATTR: true -*/ - -////////////////////////////////// -//JQLite -////////////////////////////////// - -/** - * @ngdoc function - * @name angular.element - * @module ng - * @kind function - * - * @description - * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. - * - * If jQuery is available, `angular.element` is an alias for the - * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` - * delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**. - * - * jqLite is a tiny, API-compatible subset of jQuery that allows - * AngularJS to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most - * commonly needed functionality with the goal of having a very small footprint. - * - * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the - * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a - * specific version of jQuery if multiple versions exist on the page. - * - *
**Note:** All element references in AngularJS are always wrapped with jQuery or - * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.
- * - *
**Note:** Keep in mind that this function will not find elements - * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)` - * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.
- * - * ## AngularJS's jqLite - * jqLite provides only the following jQuery methods: - * - * - [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument - * - [`after()`](http://api.jquery.com/after/) - * - [`append()`](http://api.jquery.com/append/) - Contrary to jQuery, this doesn't clone elements - * so will not work correctly when invoked on a jqLite object containing more than one DOM node - * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters - * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData - * - [`children()`](http://api.jquery.com/children/) - Does not support selectors - * - [`clone()`](http://api.jquery.com/clone/) - * - [`contents()`](http://api.jquery.com/contents/) - * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. - * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing. - * - [`data()`](http://api.jquery.com/data/) - * - [`detach()`](http://api.jquery.com/detach/) - * - [`empty()`](http://api.jquery.com/empty/) - * - [`eq()`](http://api.jquery.com/eq/) - * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name - * - [`hasClass()`](http://api.jquery.com/hasClass/) - * - [`html()`](http://api.jquery.com/html/) - * - [`next()`](http://api.jquery.com/next/) - Does not support selectors - * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData - * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter - * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors - * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors - * - [`prepend()`](http://api.jquery.com/prepend/) - * - [`prop()`](http://api.jquery.com/prop/) - * - [`ready()`](http://api.jquery.com/ready/) (_deprecated_, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`) - * - [`remove()`](http://api.jquery.com/remove/) - * - [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes - * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument - * - [`removeData()`](http://api.jquery.com/removeData/) - * - [`replaceWith()`](http://api.jquery.com/replaceWith/) - * - [`text()`](http://api.jquery.com/text/) - * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument - * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers - * - [`unbind()`](http://api.jquery.com/unbind/) (_deprecated_, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter - * - [`val()`](http://api.jquery.com/val/) - * - [`wrap()`](http://api.jquery.com/wrap/) - * - * ## jQuery/jqLite Extras - * AngularJS also provides the following additional methods and events to both jQuery and jqLite: - * - * ### Events - * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event - * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM - * element before it is removed. - * - * ### Methods - * - `controller(name)` - retrieves the controller of the current element or its parent. By default - * retrieves controller associated with the `ngController` directive. If `name` is provided as - * camelCase directive name, then the controller for this directive will be retrieved (e.g. - * `'ngModel'`). - * - `injector()` - retrieves the injector of the current element or its parent. - * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current - * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to - * be enabled. - * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the - * current element. This getter should be used only on elements that contain a directive which starts a new isolate - * scope. Calling `scope()` on this element always returns the original non-isolate scope. - * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled. - * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top - * parent element is reached. - * - * @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See - * https://github.com/angular/angular.js/issues/14251 for more information. - * - * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. - * @returns {Object} jQuery object. - */ - -JQLite.expando = 'ng339'; - -var jqCache = JQLite.cache = {}, - jqId = 1; - -/* - * !!! This is an undocumented "private" function !!! - */ -JQLite._data = function(node) { - //jQuery always returns an object on cache miss - return this.cache[node[this.expando]] || {}; -}; - -function jqNextId() { return ++jqId; } - - -var DASH_LOWERCASE_REGEXP = /-([a-z])/g; -var MS_HACK_REGEXP = /^-ms-/; -var MOUSE_EVENT_MAP = { mouseleave: 'mouseout', mouseenter: 'mouseover' }; -var jqLiteMinErr = minErr('jqLite'); - -/** - * Converts kebab-case to camelCase. - * There is also a special case for the ms prefix starting with a lowercase letter. - * @param name Name to normalize - */ -function cssKebabToCamel(name) { - return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-')); -} - -function fnCamelCaseReplace(all, letter) { - return letter.toUpperCase(); -} - -/** - * Converts kebab-case to camelCase. - * @param name Name to normalize - */ -function kebabToCamel(name) { - return name - .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace); -} - -var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/; -var HTML_REGEXP = /<|&#?\w+;/; -var TAG_NAME_REGEXP = /<([\w:-]+)/; -var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi; - -var wrapMap = { - 'option': [1, ''], - - 'thead': [1, '', '
'], - 'col': [2, '', '
'], - 'tr': [2, '', '
'], - 'td': [3, '', '
'], - '_default': [0, '', ''] -}; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - - -function jqLiteIsTextNode(html) { - return !HTML_REGEXP.test(html); -} - -function jqLiteAcceptsData(node) { - // The window object can accept data but has no nodeType - // Otherwise we are only interested in elements (1) and documents (9) - var nodeType = node.nodeType; - return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT; -} - -function jqLiteHasData(node) { - for (var key in jqCache[node.ng339]) { - return true; - } - return false; -} - -function jqLiteBuildFragment(html, context) { - var tmp, tag, wrap, - fragment = context.createDocumentFragment(), - nodes = [], i; - - if (jqLiteIsTextNode(html)) { - // Convert non-html into a text node - nodes.push(context.createTextNode(html)); - } else { - // Convert html into DOM nodes - tmp = fragment.appendChild(context.createElement('div')); - tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase(); - wrap = wrapMap[tag] || wrapMap._default; - tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1>') + wrap[2]; - - // Descend through wrappers to the right content - i = wrap[0]; - while (i--) { - tmp = tmp.lastChild; - } - - nodes = concat(nodes, tmp.childNodes); - - tmp = fragment.firstChild; - tmp.textContent = ''; - } - - // Remove wrapper from fragment - fragment.textContent = ''; - fragment.innerHTML = ''; // Clear inner HTML - forEach(nodes, function(node) { - fragment.appendChild(node); - }); - - return fragment; -} - -function jqLiteParseHTML(html, context) { - context = context || window.document; - var parsed; - - if ((parsed = SINGLE_TAG_REGEXP.exec(html))) { - return [context.createElement(parsed[1])]; - } - - if ((parsed = jqLiteBuildFragment(html, context))) { - return parsed.childNodes; - } - - return []; -} - -function jqLiteWrapNode(node, wrapper) { - var parent = node.parentNode; - - if (parent) { - parent.replaceChild(wrapper, node); - } - - wrapper.appendChild(node); -} - - -// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. -var jqLiteContains = window.Node.prototype.contains || /** @this */ function(arg) { - // eslint-disable-next-line no-bitwise - return !!(this.compareDocumentPosition(arg) & 16); -}; - -///////////////////////////////////////////// -function JQLite(element) { - if (element instanceof JQLite) { - return element; - } - - var argIsString; - - if (isString(element)) { - element = trim(element); - argIsString = true; - } - if (!(this instanceof JQLite)) { - if (argIsString && element.charAt(0) !== '<') { - throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); - } - return new JQLite(element); - } - - if (argIsString) { - jqLiteAddNodes(this, jqLiteParseHTML(element)); - } else if (isFunction(element)) { - jqLiteReady(element); - } else { - jqLiteAddNodes(this, element); - } -} - -function jqLiteClone(element) { - return element.cloneNode(true); -} - -function jqLiteDealoc(element, onlyDescendants) { - if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]); - - if (element.querySelectorAll) { - jqLite.cleanData(element.querySelectorAll('*')); - } -} - -function isEmptyObject(obj) { - var name; - - for (name in obj) { - return false; - } - return true; -} - -function removeIfEmptyData(element) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - var events = expandoStore && expandoStore.events; - var data = expandoStore && expandoStore.data; - - if ((!data || isEmptyObject(data)) && (!events || isEmptyObject(events))) { - delete jqCache[expandoId]; - element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it - } -} - -function jqLiteOff(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument'); - - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var handle = expandoStore && expandoStore.handle; - - if (!handle) return; //no listeners registered - - if (!type) { - for (type in events) { - if (type !== '$destroy') { - element.removeEventListener(type, handle); - } - delete events[type]; - } - } else { - - var removeHandler = function(type) { - var listenerFns = events[type]; - if (isDefined(fn)) { - arrayRemove(listenerFns || [], fn); - } - if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) { - element.removeEventListener(type, handle); - delete events[type]; - } - }; - - forEach(type.split(' '), function(type) { - removeHandler(type); - if (MOUSE_EVENT_MAP[type]) { - removeHandler(MOUSE_EVENT_MAP[type]); - } - }); - } - - removeIfEmptyData(element); -} - -function jqLiteRemoveData(element, name) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - if (expandoStore) { - if (name) { - delete expandoStore.data[name]; - } else { - expandoStore.data = {}; - } - - removeIfEmptyData(element); - } -} - - -function jqLiteExpandoStore(element, createIfNecessary) { - var expandoId = element.ng339, - expandoStore = expandoId && jqCache[expandoId]; - - if (createIfNecessary && !expandoStore) { - element.ng339 = expandoId = jqNextId(); - expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined}; - } - - return expandoStore; -} - - -function jqLiteData(element, key, value) { - if (jqLiteAcceptsData(element)) { - var prop; - - var isSimpleSetter = isDefined(value); - var isSimpleGetter = !isSimpleSetter && key && !isObject(key); - var massGetter = !key; - var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter); - var data = expandoStore && expandoStore.data; - - if (isSimpleSetter) { // data('key', value) - data[kebabToCamel(key)] = value; - } else { - if (massGetter) { // data() - return data; - } else { - if (isSimpleGetter) { // data('key') - // don't force creation of expandoStore if it doesn't exist yet - return data && data[kebabToCamel(key)]; - } else { // mass-setter: data({key1: val1, key2: val2}) - for (prop in key) { - data[kebabToCamel(prop)] = key[prop]; - } - } - } - } - } -} - -function jqLiteHasClass(element, selector) { - if (!element.getAttribute) return false; - return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' '). - indexOf(' ' + selector + ' ') > -1); -} - -function jqLiteRemoveClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function(cssClass) { - cssClass = trim(cssClass); - newClasses = newClasses.replace(' ' + cssClass + ' ', ' '); - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } -} - -function jqLiteAddClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function(cssClass) { - cssClass = trim(cssClass); - if (newClasses.indexOf(' ' + cssClass + ' ') === -1) { - newClasses += cssClass + ' '; - } - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } -} - - -function jqLiteAddNodes(root, elements) { - // THIS CODE IS VERY HOT. Don't make changes without benchmarking. - - if (elements) { - - // if a Node (the most common case) - if (elements.nodeType) { - root[root.length++] = elements; - } else { - var length = elements.length; - - // if an Array or NodeList and not a Window - if (typeof length === 'number' && elements.window !== elements) { - if (length) { - for (var i = 0; i < length; i++) { - root[root.length++] = elements[i]; - } - } - } else { - root[root.length++] = elements; - } - } - } -} - - -function jqLiteController(element, name) { - return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller'); -} - -function jqLiteInheritedData(element, name, value) { - // if element is the document object work with the html element instead - // this makes $(document).scope() possible - if (element.nodeType === NODE_TYPE_DOCUMENT) { - element = element.documentElement; - } - var names = isArray(name) ? name : [name]; - - while (element) { - for (var i = 0, ii = names.length; i < ii; i++) { - if (isDefined(value = jqLite.data(element, names[i]))) return value; - } - - // If dealing with a document fragment node with a host element, and no parent, use the host - // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM - // to lookup parent controllers. - element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host); - } -} - -function jqLiteEmpty(element) { - jqLiteDealoc(element, true); - while (element.firstChild) { - element.removeChild(element.firstChild); - } -} - -function jqLiteRemove(element, keepData) { - if (!keepData) jqLiteDealoc(element); - var parent = element.parentNode; - if (parent) parent.removeChild(element); -} - - -function jqLiteDocumentLoaded(action, win) { - win = win || window; - if (win.document.readyState === 'complete') { - // Force the action to be run async for consistent behavior - // from the action's point of view - // i.e. it will definitely not be in a $apply - win.setTimeout(action); - } else { - // No need to unbind this handler as load is only ever called once - jqLite(win).on('load', action); - } -} - -function jqLiteReady(fn) { - function trigger() { - window.document.removeEventListener('DOMContentLoaded', trigger); - window.removeEventListener('load', trigger); - fn(); - } - - // check if document is already loaded - if (window.document.readyState === 'complete') { - window.setTimeout(fn); - } else { - // We can not use jqLite since we are not done loading and jQuery could be loaded later. - - // Works for modern browsers and IE9 - window.document.addEventListener('DOMContentLoaded', trigger); - - // Fallback to window.onload for others - window.addEventListener('load', trigger); - } -} - -////////////////////////////////////////// -// Functions which are declared directly. -////////////////////////////////////////// -var JQLitePrototype = JQLite.prototype = { - ready: jqLiteReady, - toString: function() { - var value = []; - forEach(this, function(e) { value.push('' + e);}); - return '[' + value.join(', ') + ']'; - }, - - eq: function(index) { - return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); - }, - - length: 0, - push: push, - sort: [].sort, - splice: [].splice -}; - -////////////////////////////////////////// -// Functions iterating getter/setters. -// these functions return self on setter and -// value on get. -////////////////////////////////////////// -var BOOLEAN_ATTR = {}; -forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) { - BOOLEAN_ATTR[lowercase(value)] = value; -}); -var BOOLEAN_ELEMENTS = {}; -forEach('input,select,option,textarea,button,form,details'.split(','), function(value) { - BOOLEAN_ELEMENTS[value] = true; -}); -var ALIASED_ATTR = { - 'ngMinlength': 'minlength', - 'ngMaxlength': 'maxlength', - 'ngMin': 'min', - 'ngMax': 'max', - 'ngPattern': 'pattern', - 'ngStep': 'step' -}; - -function getBooleanAttrName(element, name) { - // check dom last since we will most likely fail on name - var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; - - // booleanAttr is here twice to minimize DOM access - return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr; -} - -function getAliasedAttrName(name) { - return ALIASED_ATTR[name]; -} - -forEach({ - data: jqLiteData, - removeData: jqLiteRemoveData, - hasData: jqLiteHasData, - cleanData: function jqLiteCleanData(nodes) { - for (var i = 0, ii = nodes.length; i < ii; i++) { - jqLiteRemoveData(nodes[i]); - jqLiteOff(nodes[i]); - } - } -}, function(fn, name) { - JQLite[name] = fn; -}); - -forEach({ - data: jqLiteData, - inheritedData: jqLiteInheritedData, - - scope: function(element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']); - }, - - isolateScope: function(element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate'); - }, - - controller: jqLiteController, - - injector: function(element) { - return jqLiteInheritedData(element, '$injector'); - }, - - removeAttr: function(element, name) { - element.removeAttribute(name); - }, - - hasClass: jqLiteHasClass, - - css: function(element, name, value) { - name = cssKebabToCamel(name); - - if (isDefined(value)) { - element.style[name] = value; - } else { - return element.style[name]; - } - }, - - attr: function(element, name, value) { - var ret; - var nodeType = element.nodeType; - if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT || - !element.getAttribute) { - return; - } - - var lowercasedName = lowercase(name); - var isBooleanAttr = BOOLEAN_ATTR[lowercasedName]; - - if (isDefined(value)) { - // setter - - if (value === null || (value === false && isBooleanAttr)) { - element.removeAttribute(name); - } else { - element.setAttribute(name, isBooleanAttr ? lowercasedName : value); - } - } else { - // getter - - ret = element.getAttribute(name); - - if (isBooleanAttr && ret !== null) { - ret = lowercasedName; - } - // Normalize non-existing attributes to undefined (as jQuery). - return ret === null ? undefined : ret; - } - }, - - prop: function(element, name, value) { - if (isDefined(value)) { - element[name] = value; - } else { - return element[name]; - } - }, - - text: (function() { - getText.$dv = ''; - return getText; - - function getText(element, value) { - if (isUndefined(value)) { - var nodeType = element.nodeType; - return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : ''; - } - element.textContent = value; - } - })(), - - val: function(element, value) { - if (isUndefined(value)) { - if (element.multiple && nodeName_(element) === 'select') { - var result = []; - forEach(element.options, function(option) { - if (option.selected) { - result.push(option.value || option.text); - } - }); - return result; - } - return element.value; - } - element.value = value; - }, - - html: function(element, value) { - if (isUndefined(value)) { - return element.innerHTML; - } - jqLiteDealoc(element, true); - element.innerHTML = value; - }, - - empty: jqLiteEmpty -}, function(fn, name) { - /** - * Properties: writes return selection, reads return first value - */ - JQLite.prototype[name] = function(arg1, arg2) { - var i, key; - var nodeCount = this.length; - - // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it - // in a way that survives minification. - // jqLiteEmpty takes no arguments but is a setter. - if (fn !== jqLiteEmpty && - (isUndefined((fn.length === 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) { - if (isObject(arg1)) { - - // we are a write, but the object properties are the key/values - for (i = 0; i < nodeCount; i++) { - if (fn === jqLiteData) { - // data() takes the whole object in jQuery - fn(this[i], arg1); - } else { - for (key in arg1) { - fn(this[i], key, arg1[key]); - } - } - } - // return self for chaining - return this; - } else { - // we are a read, so read the first child. - // TODO: do we still need this? - var value = fn.$dv; - // Only if we have $dv do we iterate over all, otherwise it is just the first element. - var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount; - for (var j = 0; j < jj; j++) { - var nodeValue = fn(this[j], arg1, arg2); - value = value ? value + nodeValue : nodeValue; - } - return value; - } - } else { - // we are a write, so apply to all children - for (i = 0; i < nodeCount; i++) { - fn(this[i], arg1, arg2); - } - // return self for chaining - return this; - } - }; -}); - -function createEventHandler(element, events) { - var eventHandler = function(event, type) { - // jQuery specific api - event.isDefaultPrevented = function() { - return event.defaultPrevented; - }; - - var eventFns = events[type || event.type]; - var eventFnsLength = eventFns ? eventFns.length : 0; - - if (!eventFnsLength) return; - - if (isUndefined(event.immediatePropagationStopped)) { - var originalStopImmediatePropagation = event.stopImmediatePropagation; - event.stopImmediatePropagation = function() { - event.immediatePropagationStopped = true; - - if (event.stopPropagation) { - event.stopPropagation(); - } - - if (originalStopImmediatePropagation) { - originalStopImmediatePropagation.call(event); - } - }; - } - - event.isImmediatePropagationStopped = function() { - return event.immediatePropagationStopped === true; - }; - - // Some events have special handlers that wrap the real handler - var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper; - - // Copy event handlers in case event handlers array is modified during execution. - if ((eventFnsLength > 1)) { - eventFns = shallowCopy(eventFns); - } - - for (var i = 0; i < eventFnsLength; i++) { - if (!event.isImmediatePropagationStopped()) { - handlerWrapper(element, event, eventFns[i]); - } - } - }; - - // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all - // events on `element` - eventHandler.elem = element; - return eventHandler; -} - -function defaultHandlerWrapper(element, event, handler) { - handler.call(element, event); -} - -function specialMouseHandlerWrapper(target, event, handler) { - // Refer to jQuery's implementation of mouseenter & mouseleave - // Read about mouseenter and mouseleave: - // http://www.quirksmode.org/js/events_mouse.html#link8 - var related = event.relatedTarget; - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if (!related || (related !== target && !jqLiteContains.call(target, related))) { - handler.call(target, event); - } -} - -////////////////////////////////////////// -// Functions iterating traversal. -// These functions chain results into a single -// selector. -////////////////////////////////////////// -forEach({ - removeData: jqLiteRemoveData, - - on: function jqLiteOn(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); - - // Do not add event handlers to non-elements because they will not be cleaned up. - if (!jqLiteAcceptsData(element)) { - return; - } - - var expandoStore = jqLiteExpandoStore(element, true); - var events = expandoStore.events; - var handle = expandoStore.handle; - - if (!handle) { - handle = expandoStore.handle = createEventHandler(element, events); - } - - // http://jsperf.com/string-indexof-vs-split - var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type]; - var i = types.length; - - var addHandler = function(type, specialHandlerWrapper, noEventListener) { - var eventFns = events[type]; - - if (!eventFns) { - eventFns = events[type] = []; - eventFns.specialHandlerWrapper = specialHandlerWrapper; - if (type !== '$destroy' && !noEventListener) { - element.addEventListener(type, handle); - } - } - - eventFns.push(fn); - }; - - while (i--) { - type = types[i]; - if (MOUSE_EVENT_MAP[type]) { - addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper); - addHandler(type, undefined, true); - } else { - addHandler(type); - } - } - }, - - off: jqLiteOff, - - one: function(element, type, fn) { - element = jqLite(element); - - //add the listener twice so that when it is called - //you can remove the original function and still be - //able to call element.off(ev, fn) normally - element.on(type, function onFn() { - element.off(type, fn); - element.off(type, onFn); - }); - element.on(type, fn); - }, - - replaceWith: function(element, replaceNode) { - var index, parent = element.parentNode; - jqLiteDealoc(element); - forEach(new JQLite(replaceNode), function(node) { - if (index) { - parent.insertBefore(node, index.nextSibling); - } else { - parent.replaceChild(node, element); - } - index = node; - }); - }, - - children: function(element) { - var children = []; - forEach(element.childNodes, function(element) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - children.push(element); - } - }); - return children; - }, - - contents: function(element) { - return element.contentDocument || element.childNodes || []; - }, - - append: function(element, node) { - var nodeType = element.nodeType; - if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return; - - node = new JQLite(node); - - for (var i = 0, ii = node.length; i < ii; i++) { - var child = node[i]; - element.appendChild(child); - } - }, - - prepend: function(element, node) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - var index = element.firstChild; - forEach(new JQLite(node), function(child) { - element.insertBefore(child, index); - }); - } - }, - - wrap: function(element, wrapNode) { - jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]); - }, - - remove: jqLiteRemove, - - detach: function(element) { - jqLiteRemove(element, true); - }, - - after: function(element, newElement) { - var index = element, parent = element.parentNode; - - if (parent) { - newElement = new JQLite(newElement); - - for (var i = 0, ii = newElement.length; i < ii; i++) { - var node = newElement[i]; - parent.insertBefore(node, index.nextSibling); - index = node; - } - } - }, - - addClass: jqLiteAddClass, - removeClass: jqLiteRemoveClass, - - toggleClass: function(element, selector, condition) { - if (selector) { - forEach(selector.split(' '), function(className) { - var classCondition = condition; - if (isUndefined(classCondition)) { - classCondition = !jqLiteHasClass(element, className); - } - (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className); - }); - } - }, - - parent: function(element) { - var parent = element.parentNode; - return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null; - }, - - next: function(element) { - return element.nextElementSibling; - }, - - find: function(element, selector) { - if (element.getElementsByTagName) { - return element.getElementsByTagName(selector); - } else { - return []; - } - }, - - clone: jqLiteClone, - - triggerHandler: function(element, event, extraParameters) { - - var dummyEvent, eventFnsCopy, handlerArgs; - var eventName = event.type || event; - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var eventFns = events && events[eventName]; - - if (eventFns) { - // Create a dummy event to pass to the handlers - dummyEvent = { - preventDefault: function() { this.defaultPrevented = true; }, - isDefaultPrevented: function() { return this.defaultPrevented === true; }, - stopImmediatePropagation: function() { this.immediatePropagationStopped = true; }, - isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; }, - stopPropagation: noop, - type: eventName, - target: element - }; - - // If a custom event was provided then extend our dummy event with it - if (event.type) { - dummyEvent = extend(dummyEvent, event); - } - - // Copy event handlers in case event handlers array is modified during execution. - eventFnsCopy = shallowCopy(eventFns); - handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent]; - - forEach(eventFnsCopy, function(fn) { - if (!dummyEvent.isImmediatePropagationStopped()) { - fn.apply(element, handlerArgs); - } - }); - } - } -}, function(fn, name) { - /** - * chaining functions - */ - JQLite.prototype[name] = function(arg1, arg2, arg3) { - var value; - - for (var i = 0, ii = this.length; i < ii; i++) { - if (isUndefined(value)) { - value = fn(this[i], arg1, arg2, arg3); - if (isDefined(value)) { - // any function which returns a value needs to be wrapped - value = jqLite(value); - } - } else { - jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3)); - } - } - return isDefined(value) ? value : this; - }; -}); - -// bind legacy bind/unbind to on/off -JQLite.prototype.bind = JQLite.prototype.on; -JQLite.prototype.unbind = JQLite.prototype.off; - - -// Provider for private $$jqLite service -/** @this */ -function $$jqLiteProvider() { - this.$get = function $$jqLite() { - return extend(JQLite, { - hasClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteHasClass(node, classes); - }, - addClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteAddClass(node, classes); - }, - removeClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteRemoveClass(node, classes); - } - }); - }; -} - -/** - * Computes a hash of an 'obj'. - * Hash of a: - * string is string - * number is number as string - * object is either result of calling $$hashKey function on the object or uniquely generated id, - * that is also assigned to the $$hashKey property of the object. - * - * @param obj - * @returns {string} hash string such that the same input will have the same hash string. - * The resulting string key is in 'type:hashKey' format. - */ -function hashKey(obj, nextUidFn) { - var key = obj && obj.$$hashKey; - - if (key) { - if (typeof key === 'function') { - key = obj.$$hashKey(); - } - return key; - } - - var objType = typeof obj; - if (objType === 'function' || (objType === 'object' && obj !== null)) { - key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); - } else { - key = objType + ':' + obj; - } - - return key; -} - -// A minimal ES2015 Map implementation. -// Should be bug/feature equivalent to the native implementations of supported browsers -// (for the features required in Angular). -// See https://kangax.github.io/compat-table/es6/#test-Map -var nanKey = Object.create(null); -function NgMapShim() { - this._keys = []; - this._values = []; - this._lastKey = NaN; - this._lastIndex = -1; -} -NgMapShim.prototype = { - _idx: function(key) { - if (key !== this._lastKey) { - this._lastKey = key; - this._lastIndex = this._keys.indexOf(key); - } - return this._lastIndex; - }, - _transformKey: function(key) { - return isNumberNaN(key) ? nanKey : key; - }, - get: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx !== -1) { - return this._values[idx]; - } - }, - has: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - return idx !== -1; - }, - set: function(key, value) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - idx = this._lastIndex = this._keys.length; - } - this._keys[idx] = key; - this._values[idx] = value; - - // Support: IE11 - // Do not `return this` to simulate the partial IE11 implementation - }, - delete: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - return false; - } - this._keys.splice(idx, 1); - this._values.splice(idx, 1); - this._lastKey = NaN; - this._lastIndex = -1; - return true; - } -}; - -// For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations -// are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map` -// implementations get more stable, we can reconsider switching to `window.Map` (when available). -var NgMap = NgMapShim; - -var $$MapProvider = [/** @this */function() { - this.$get = [function() { - return NgMap; - }]; -}]; - -/** - * @ngdoc function - * @module ng - * @name angular.injector - * @kind function - * - * @description - * Creates an injector object that can be used for retrieving services as well as for - * dependency injection (see {@link guide/di dependency injection}). - * - * @param {Array.} modules A list of module functions or their aliases. See - * {@link angular.module}. The `ng` module must be explicitly added. - * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which - * disallows argument name annotation inference. - * @returns {injector} Injector object. See {@link auto.$injector $injector}. - * - * @example - * Typical usage - * ```js - * // create an injector - * var $injector = angular.injector(['ng']); - * - * // use the injector to kick off your application - * // use the type inference to auto inject arguments, or use implicit injection - * $injector.invoke(function($rootScope, $compile, $document) { - * $compile($document)($rootScope); - * $rootScope.$digest(); - * }); - * ``` - * - * Sometimes you want to get access to the injector of a currently running AngularJS app - * from outside AngularJS. Perhaps, you want to inject and compile some markup after the - * application has been bootstrapped. You can do this using the extra `injector()` added - * to JQuery/jqLite elements. See {@link angular.element}. - * - * *This is fairly rare but could be the case if a third party library is injecting the - * markup.* - * - * In the following example a new block of HTML containing a `ng-controller` - * directive is added to the end of the document body by JQuery. We then compile and link - * it into the current AngularJS scope. - * - * ```js - * var $div = $('
{{content.label}}
'); - * $(document.body).append($div); - * - * angular.element(document).injector().invoke(function($compile) { - * var scope = angular.element($div).scope(); - * $compile($div)(scope); - * }); - * ``` - */ - - -/** - * @ngdoc module - * @name auto - * @installation - * @description - * - * Implicit module which gets automatically added to each {@link auto.$injector $injector}. - */ - -var ARROW_ARG = /^([^(]+?)=>/; -var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m; -var FN_ARG_SPLIT = /,/; -var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; -var $injectorMinErr = minErr('$injector'); - -function stringifyFn(fn) { - return Function.prototype.toString.call(fn); -} - -function extractArgs(fn) { - var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''), - args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS); - return args; -} - -function anonFn(fn) { - // For anonymous functions, showing at the very least the function signature can help in - // debugging. - var args = extractArgs(fn); - if (args) { - return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')'; - } - return 'fn'; -} - -function annotate(fn, strictDi, name) { - var $inject, - argDecl, - last; - - if (typeof fn === 'function') { - if (!($inject = fn.$inject)) { - $inject = []; - if (fn.length) { - if (strictDi) { - if (!isString(name) || !name) { - name = fn.name || anonFn(fn); - } - throw $injectorMinErr('strictdi', - '{0} is not using explicit annotation and cannot be invoked in strict mode', name); - } - argDecl = extractArgs(fn); - forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { - arg.replace(FN_ARG, function(all, underscore, name) { - $inject.push(name); - }); - }); - } - fn.$inject = $inject; - } - } else if (isArray(fn)) { - last = fn.length - 1; - assertArgFn(fn[last], 'fn'); - $inject = fn.slice(0, last); - } else { - assertArgFn(fn, 'fn', true); - } - return $inject; -} - -/////////////////////////////////////// - -/** - * @ngdoc service - * @name $injector - * - * @description - * - * `$injector` is used to retrieve object instances as defined by - * {@link auto.$provide provider}, instantiate types, invoke methods, - * and load modules. - * - * The following always holds true: - * - * ```js - * var $injector = angular.injector(); - * expect($injector.get('$injector')).toBe($injector); - * expect($injector.invoke(function($injector) { - * return $injector; - * })).toBe($injector); - * ``` - * - * ## Injection Function Annotation - * - * JavaScript does not have annotations, and annotations are needed for dependency injection. The - * following are all valid ways of annotating function with injection arguments and are equivalent. - * - * ```js - * // inferred (only works if code not minified/obfuscated) - * $injector.invoke(function(serviceA){}); - * - * // annotated - * function explicit(serviceA) {}; - * explicit.$inject = ['serviceA']; - * $injector.invoke(explicit); - * - * // inline - * $injector.invoke(['serviceA', function(serviceA){}]); - * ``` - * - * ### Inference - * - * In JavaScript calling `toString()` on a function returns the function definition. The definition - * can then be parsed and the function arguments can be extracted. This method of discovering - * annotations is disallowed when the injector is in strict mode. - * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the - * argument names. - * - * ### `$inject` Annotation - * By adding an `$inject` property onto a function the injection parameters can be specified. - * - * ### Inline - * As an array of injection names, where the last item in the array is the function to call. - */ - -/** - * @ngdoc property - * @name $injector#modules - * @type {Object} - * @description - * A hash containing all the modules that have been loaded into the - * $injector. - * - * You can use this property to find out information about a module via the - * {@link angular.Module#info `myModule.info(...)`} method. - * - * For example: - * - * ``` - * var info = $injector.modules['ngAnimate'].info(); - * ``` - * - * **Do not use this property to attempt to modify the modules after the application - * has been bootstrapped.** - */ - - -/** - * @ngdoc method - * @name $injector#get - * - * @description - * Return an instance of the service. - * - * @param {string} name The name of the instance to retrieve. - * @param {string=} caller An optional string to provide the origin of the function call for error messages. - * @return {*} The instance. - */ - -/** - * @ngdoc method - * @name $injector#invoke - * - * @description - * Invoke the method and supply the method arguments from the `$injector`. - * - * @param {Function|Array.} fn The injectable function to invoke. Function parameters are - * injected according to the {@link guide/di $inject Annotation} rules. - * @param {Object=} self The `this` for the invoked method. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {*} the value returned by the invoked `fn` function. - */ - -/** - * @ngdoc method - * @name $injector#has - * - * @description - * Allows the user to query if the particular service exists. - * - * @param {string} name Name of the service to query. - * @returns {boolean} `true` if injector has given service. - */ - -/** - * @ngdoc method - * @name $injector#instantiate - * @description - * Create a new instance of JS type. The method takes a constructor function, invokes the new - * operator, and supplies all of the arguments to the constructor function as specified by the - * constructor annotation. - * - * @param {Function} Type Annotated constructor function. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {Object} new instance of `Type`. - */ - -/** - * @ngdoc method - * @name $injector#annotate - * - * @description - * Returns an array of service names which the function is requesting for injection. This API is - * used by the injector to determine which services need to be injected into the function when the - * function is invoked. There are three ways in which the function can be annotated with the needed - * dependencies. - * - * #### Argument names - * - * The simplest form is to extract the dependencies from the arguments of the function. This is done - * by converting the function into a string using `toString()` method and extracting the argument - * names. - * ```js - * // Given - * function MyController($scope, $route) { - * // ... - * } - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * You can disallow this method by using strict injection mode. - * - * This method does not work with code minification / obfuscation. For this reason the following - * annotation strategies are supported. - * - * #### The `$inject` property - * - * If a function has an `$inject` property and its value is an array of strings, then the strings - * represent names of services to be injected into the function. - * ```js - * // Given - * var MyController = function(obfuscatedScope, obfuscatedRoute) { - * // ... - * } - * // Define function dependencies - * MyController['$inject'] = ['$scope', '$route']; - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * #### The array notation - * - * It is often desirable to inline Injected functions and that's when setting the `$inject` property - * is very inconvenient. In these situations using the array notation to specify the dependencies in - * a way that survives minification is a better choice: - * - * ```js - * // We wish to write this (not minification / obfuscation safe) - * injector.invoke(function($compile, $rootScope) { - * // ... - * }); - * - * // We are forced to write break inlining - * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { - * // ... - * }; - * tmpFn.$inject = ['$compile', '$rootScope']; - * injector.invoke(tmpFn); - * - * // To better support inline function the inline annotation is supported - * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { - * // ... - * }]); - * - * // Therefore - * expect(injector.annotate( - * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) - * ).toEqual(['$compile', '$rootScope']); - * ``` - * - * @param {Function|Array.} fn Function for which dependent service names need to - * be retrieved as described above. - * - * @param {boolean=} [strictDi=false] Disallow argument name annotation inference. - * - * @returns {Array.} The names of the services which the function requires. - */ -/** - * @ngdoc method - * @name $injector#loadNewModules - * - * @description - * - * **This is a dangerous API, which you use at your own risk!** - * - * Add the specified modules to the current injector. - * - * This method will add each of the injectables to the injector and execute all of the config and run - * blocks for each module passed to the method. - * - * If a module has already been loaded into the injector then it will not be loaded again. - * - * * The application developer is responsible for loading the code containing the modules; and for - * ensuring that lazy scripts are not downloaded and executed more often that desired. - * * Previously compiled HTML will not be affected by newly loaded directives, filters and components. - * * Modules cannot be unloaded. - * - * You can use {@link $injector#modules `$injector.modules`} to check whether a module has been loaded - * into the injector, which may indicate whether the script has been executed already. - * - * @example - * Here is an example of loading a bundle of modules, with a utility method called `getScript`: - * - * ```javascript - * app.factory('loadModule', function($injector) { - * return function loadModule(moduleName, bundleUrl) { - * return getScript(bundleUrl).then(function() { $injector.loadNewModules([moduleName]); }); - * }; - * }) - * ``` - * - * @param {Array=} mods an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - */ - - -/** - * @ngdoc service - * @name $provide - * - * @description - * - * The {@link auto.$provide $provide} service has a number of methods for registering components - * with the {@link auto.$injector $injector}. Many of these functions are also exposed on - * {@link angular.Module}. - * - * An AngularJS **service** is a singleton object created by a **service factory**. These **service - * factories** are functions which, in turn, are created by a **service provider**. - * The **service providers** are constructor functions. When instantiated they must contain a - * property called `$get`, which holds the **service factory** function. - * - * When you request a service, the {@link auto.$injector $injector} is responsible for finding the - * correct **service provider**, instantiating it and then calling its `$get` **service factory** - * function to get the instance of the **service**. - * - * Often services have no configuration options and there is no need to add methods to the service - * provider. The provider will be no more than a constructor function with a `$get` property. For - * these cases the {@link auto.$provide $provide} service has additional helper methods to register - * services without specifying a provider. - * - * * {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the - * {@link auto.$injector $injector} - * * {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by - * providers and services. - * * {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by - * services, not providers. - * * {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function** - * that will be wrapped in a **service provider** object, whose `$get` property will contain the - * given factory function. - * * {@link auto.$provide#service service(name, Fn)} - registers a **constructor function** - * that will be wrapped in a **service provider** object, whose `$get` property will instantiate - * a new object using the given constructor function. - * * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that - * will be able to modify or replace the implementation of another service. - * - * See the individual methods for more information and examples. - */ - -/** - * @ngdoc method - * @name $provide#provider - * @description - * - * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions - * are constructor functions, whose instances are responsible for "providing" a factory for a - * service. - * - * Service provider names start with the name of the service they provide followed by `Provider`. - * For example, the {@link ng.$log $log} service has a provider called - * {@link ng.$logProvider $logProvider}. - * - * Service provider objects can have additional methods which allow configuration of the provider - * and its service. Importantly, you can configure what kind of service is created by the `$get` - * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a - * method {@link ng.$logProvider#debugEnabled debugEnabled} - * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the - * console or not. - * - * It is possible to inject other providers into the provider function, - * but the injected provider must have been defined before the one that requires it. - * - * @param {string} name The name of the instance. NOTE: the provider will be available under `name + - 'Provider'` key. - * @param {(Object|function())} provider If the provider is: - * - * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using - * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created. - * - `Constructor`: a new instance of the provider will be created using - * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`. - * - * @returns {Object} registered provider instance - - * @example - * - * The following example shows how to create a simple event tracking service and register it using - * {@link auto.$provide#provider $provide.provider()}. - * - * ```js - * // Define the eventTracker provider - * function EventTrackerProvider() { - * var trackingUrl = '/track'; - * - * // A provider method for configuring where the tracked events should been saved - * this.setTrackingUrl = function(url) { - * trackingUrl = url; - * }; - * - * // The service factory function - * this.$get = ['$http', function($http) { - * var trackedEvents = {}; - * return { - * // Call this to track an event - * event: function(event) { - * var count = trackedEvents[event] || 0; - * count += 1; - * trackedEvents[event] = count; - * return count; - * }, - * // Call this to save the tracked events to the trackingUrl - * save: function() { - * $http.post(trackingUrl, trackedEvents); - * } - * }; - * }]; - * } - * - * describe('eventTracker', function() { - * var postSpy; - * - * beforeEach(module(function($provide) { - * // Register the eventTracker provider - * $provide.provider('eventTracker', EventTrackerProvider); - * })); - * - * beforeEach(module(function(eventTrackerProvider) { - * // Configure eventTracker provider - * eventTrackerProvider.setTrackingUrl('/custom-track'); - * })); - * - * it('tracks events', inject(function(eventTracker) { - * expect(eventTracker.event('login')).toEqual(1); - * expect(eventTracker.event('login')).toEqual(2); - * })); - * - * it('saves to the tracking url', inject(function(eventTracker, $http) { - * postSpy = spyOn($http, 'post'); - * eventTracker.event('login'); - * eventTracker.save(); - * expect(postSpy).toHaveBeenCalled(); - * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track'); - * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track'); - * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 }); - * })); - * }); - * ``` - */ - -/** - * @ngdoc method - * @name $provide#factory - * @description - * - * Register a **service factory**, which will be called to return the service instance. - * This is short for registering a service where its provider consists of only a `$get` property, - * which is the given service factory function. - * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to - * configure your service in a provider. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} $getFn The injectable $getFn for the instance creation. - * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service - * ```js - * $provide.factory('ping', ['$http', function($http) { - * return function ping() { - * return $http.send('/ping'); - * }; - * }]); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping(); - * }]); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#service - * @description - * - * Register a **service constructor**, which will be invoked with `new` to create the service - * instance. - * This is short for registering a service where its provider's `$get` property is a factory - * function that returns an instance instantiated by the injector from the service constructor - * function. - * - * Internally it looks a bit like this: - * - * ``` - * { - * $get: function() { - * return $injector.instantiate(constructor); - * } - * } - * ``` - * - * - * You should use {@link auto.$provide#service $provide.service(class)} if you define your service - * as a type/class. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} constructor An injectable class (constructor function) - * that will be instantiated. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service using - * {@link auto.$provide#service $provide.service(class)}. - * ```js - * var Ping = function($http) { - * this.$http = $http; - * }; - * - * Ping.$inject = ['$http']; - * - * Ping.prototype.send = function() { - * return this.$http.get('/ping'); - * }; - * $provide.service('ping', Ping); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping.send(); - * }]); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#value - * @description - * - * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a - * number, an array, an object or a function. This is short for registering a service where its - * provider's `$get` property is a factory function that takes no arguments and returns the **value - * service**. That also means it is not possible to inject other services into a value service. - * - * Value services are similar to constant services, except that they cannot be injected into a - * module configuration function (see {@link angular.Module#config}) but they can be overridden by - * an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the instance. - * @param {*} value The value. - * @returns {Object} registered provider instance - * - * @example - * Here are some examples of creating value services. - * ```js - * $provide.value('ADMIN_USER', 'admin'); - * - * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 }); - * - * $provide.value('halfOf', function(value) { - * return value / 2; - * }); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#constant - * @description - * - * Register a **constant service** with the {@link auto.$injector $injector}, such as a string, - * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not - * possible to inject other services into a constant. - * - * But unlike {@link auto.$provide#value value}, a constant can be - * injected into a module configuration function (see {@link angular.Module#config}) and it cannot - * be overridden by an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the constant. - * @param {*} value The constant value. - * @returns {Object} registered instance - * - * @example - * Here a some examples of creating constants: - * ```js - * $provide.constant('SHARD_HEIGHT', 306); - * - * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']); - * - * $provide.constant('double', function(value) { - * return value * 2; - * }); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#decorator - * @description - * - * Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function - * intercepts the creation of a service, allowing it to override or modify the behavior of the - * service. The return value of the decorator function may be the original service, or a new service - * that replaces (or wraps and delegates to) the original service. - * - * You can find out more about using decorators in the {@link guide/decorators} guide. - * - * @param {string} name The name of the service to decorate. - * @param {Function|Array.} decorator This function will be invoked when the service needs to be - * provided and should return the decorated service instance. The function is called using - * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable. - * Local injection arguments: - * - * * `$delegate` - The original service instance, which can be replaced, monkey patched, configured, - * decorated or delegated to. - * - * @example - * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting - * calls to {@link ng.$log#error $log.warn()}. - * ```js - * $provide.decorator('$log', ['$delegate', function($delegate) { - * $delegate.warn = $delegate.error; - * return $delegate; - * }]); - * ``` - */ - - -function createInjector(modulesToLoad, strictDi) { - strictDi = (strictDi === true); - var INSTANTIATING = {}, - providerSuffix = 'Provider', - path = [], - loadedModules = new NgMap(), - providerCache = { - $provide: { - provider: supportObject(provider), - factory: supportObject(factory), - service: supportObject(service), - value: supportObject(value), - constant: supportObject(constant), - decorator: decorator - } - }, - providerInjector = (providerCache.$injector = - createInternalInjector(providerCache, function(serviceName, caller) { - if (angular.isString(caller)) { - path.push(caller); - } - throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- ')); - })), - instanceCache = {}, - protoInstanceInjector = - createInternalInjector(instanceCache, function(serviceName, caller) { - var provider = providerInjector.get(serviceName + providerSuffix, caller); - return instanceInjector.invoke( - provider.$get, provider, undefined, serviceName); - }), - instanceInjector = protoInstanceInjector; - - providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) }; - instanceInjector.modules = providerInjector.modules = createMap(); - var runBlocks = loadModules(modulesToLoad); - instanceInjector = protoInstanceInjector.get('$injector'); - instanceInjector.strictDi = strictDi; - forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); }); - - instanceInjector.loadNewModules = function(mods) { - forEach(loadModules(mods), function(fn) { if (fn) instanceInjector.invoke(fn); }); - }; - - - return instanceInjector; - - //////////////////////////////////// - // $provider - //////////////////////////////////// - - function supportObject(delegate) { - return function(key, value) { - if (isObject(key)) { - forEach(key, reverseParams(delegate)); - } else { - return delegate(key, value); - } - }; - } - - function provider(name, provider_) { - assertNotHasOwnProperty(name, 'service'); - if (isFunction(provider_) || isArray(provider_)) { - provider_ = providerInjector.instantiate(provider_); - } - if (!provider_.$get) { - throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name); - } - return (providerCache[name + providerSuffix] = provider_); - } - - function enforceReturnValue(name, factory) { - return /** @this */ function enforcedReturnValue() { - var result = instanceInjector.invoke(factory, this); - if (isUndefined(result)) { - throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name); - } - return result; - }; - } - - function factory(name, factoryFn, enforce) { - return provider(name, { - $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn - }); - } - - function service(name, constructor) { - return factory(name, ['$injector', function($injector) { - return $injector.instantiate(constructor); - }]); - } - - function value(name, val) { return factory(name, valueFn(val), false); } - - function constant(name, value) { - assertNotHasOwnProperty(name, 'constant'); - providerCache[name] = value; - instanceCache[name] = value; - } - - function decorator(serviceName, decorFn) { - var origProvider = providerInjector.get(serviceName + providerSuffix), - orig$get = origProvider.$get; - - origProvider.$get = function() { - var origInstance = instanceInjector.invoke(orig$get, origProvider); - return instanceInjector.invoke(decorFn, null, {$delegate: origInstance}); - }; - } - - //////////////////////////////////// - // Module Loading - //////////////////////////////////// - function loadModules(modulesToLoad) { - assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); - var runBlocks = [], moduleFn; - forEach(modulesToLoad, function(module) { - if (loadedModules.get(module)) return; - loadedModules.set(module, true); - - function runInvokeQueue(queue) { - var i, ii; - for (i = 0, ii = queue.length; i < ii; i++) { - var invokeArgs = queue[i], - provider = providerInjector.get(invokeArgs[0]); - - provider[invokeArgs[1]].apply(provider, invokeArgs[2]); - } - } - - try { - if (isString(module)) { - moduleFn = angularModule(module); - instanceInjector.modules[module] = moduleFn; - runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); - runInvokeQueue(moduleFn._invokeQueue); - runInvokeQueue(moduleFn._configBlocks); - } else if (isFunction(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else if (isArray(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else { - assertArgFn(module, 'module'); - } - } catch (e) { - if (isArray(module)) { - module = module[module.length - 1]; - } - if (e.message && e.stack && e.stack.indexOf(e.message) === -1) { - // Safari & FF's stack traces don't contain error.message content - // unlike those of Chrome and IE - // So if stack doesn't contain message, we create a new string that contains both. - // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. - // eslint-disable-next-line no-ex-assign - e = e.message + '\n' + e.stack; - } - throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}', - module, e.stack || e.message || e); - } - }); - return runBlocks; - } - - //////////////////////////////////// - // internal Injector - //////////////////////////////////// - - function createInternalInjector(cache, factory) { - - function getService(serviceName, caller) { - if (cache.hasOwnProperty(serviceName)) { - if (cache[serviceName] === INSTANTIATING) { - throw $injectorMinErr('cdep', 'Circular dependency found: {0}', - serviceName + ' <- ' + path.join(' <- ')); - } - return cache[serviceName]; - } else { - try { - path.unshift(serviceName); - cache[serviceName] = INSTANTIATING; - cache[serviceName] = factory(serviceName, caller); - return cache[serviceName]; - } catch (err) { - if (cache[serviceName] === INSTANTIATING) { - delete cache[serviceName]; - } - throw err; - } finally { - path.shift(); - } - } - } - - - function injectionArgs(fn, locals, serviceName) { - var args = [], - $inject = createInjector.$$annotate(fn, strictDi, serviceName); - - for (var i = 0, length = $inject.length; i < length; i++) { - var key = $inject[i]; - if (typeof key !== 'string') { - throw $injectorMinErr('itkn', - 'Incorrect injection token! Expected service name as string, got {0}', key); - } - args.push(locals && locals.hasOwnProperty(key) ? locals[key] : - getService(key, serviceName)); - } - return args; - } - - function isClass(func) { - // Support: IE 9-11 only - // IE 9-11 do not support classes and IE9 leaks with the code below. - if (msie || typeof func !== 'function') { - return false; - } - var result = func.$$ngIsClass; - if (!isBoolean(result)) { - result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func)); - } - return result; - } - - function invoke(fn, self, locals, serviceName) { - if (typeof locals === 'string') { - serviceName = locals; - locals = null; - } - - var args = injectionArgs(fn, locals, serviceName); - if (isArray(fn)) { - fn = fn[fn.length - 1]; - } - - if (!isClass(fn)) { - // http://jsperf.com/angularjs-invoke-apply-vs-switch - // #5388 - return fn.apply(self, args); - } else { - args.unshift(null); - return new (Function.prototype.bind.apply(fn, args))(); - } - } - - - function instantiate(Type, locals, serviceName) { - // Check if Type is annotated and use just the given function at n-1 as parameter - // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); - var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); - var args = injectionArgs(Type, locals, serviceName); - // Empty object at position 0 is ignored for invocation with `new`, but required. - args.unshift(null); - return new (Function.prototype.bind.apply(ctor, args))(); - } - - - return { - invoke: invoke, - instantiate: instantiate, - get: getService, - annotate: createInjector.$$annotate, - has: function(name) { - return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); - } - }; - } -} - -createInjector.$$annotate = annotate; - -/** - * @ngdoc provider - * @name $anchorScrollProvider - * @this - * - * @description - * Use `$anchorScrollProvider` to disable automatic scrolling whenever - * {@link ng.$location#hash $location.hash()} changes. - */ -function $AnchorScrollProvider() { - - var autoScrollingEnabled = true; - - /** - * @ngdoc method - * @name $anchorScrollProvider#disableAutoScrolling - * - * @description - * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to - * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.
- * Use this method to disable automatic scrolling. - * - * If automatic scrolling is disabled, one must explicitly call - * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the - * current hash. - */ - this.disableAutoScrolling = function() { - autoScrollingEnabled = false; - }; - - /** - * @ngdoc service - * @name $anchorScroll - * @kind function - * @requires $window - * @requires $location - * @requires $rootScope - * - * @description - * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the - * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified - * in the - * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document). - * - * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to - * match any anchor whenever it changes. This can be disabled by calling - * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}. - * - * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a - * vertical scroll-offset (either fixed or dynamic). - * - * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of - * {@link ng.$location#hash $location.hash()} will be used. - * - * @property {(number|function|jqLite)} yOffset - * If set, specifies a vertical scroll-offset. This is often useful when there are fixed - * positioned elements at the top of the page, such as navbars, headers etc. - * - * `yOffset` can be specified in various ways: - * - **number**: A fixed number of pixels to be used as offset.

- * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return - * a number representing the offset (in pixels).

- * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from - * the top of the page to the element's bottom will be used as offset.
- * **Note**: The element will be taken into account only as long as its `position` is set to - * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust - * their height and/or positioning according to the viewport's size. - * - *
- *
- * In order for `yOffset` to work properly, scrolling should take place on the document's root and - * not some child element. - *
- * - * @example - - -
- Go to bottom - You're at the bottom! -
-
- - angular.module('anchorScrollExample', []) - .controller('ScrollController', ['$scope', '$location', '$anchorScroll', - function($scope, $location, $anchorScroll) { - $scope.gotoBottom = function() { - // set the location.hash to the id of - // the element you wish to scroll to. - $location.hash('bottom'); - - // call $anchorScroll() - $anchorScroll(); - }; - }]); - - - #scrollArea { - height: 280px; - overflow: auto; - } - - #bottom { - display: block; - margin-top: 2000px; - } - -
- * - *
- * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value). - * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details. - * - * @example - - - -
- Anchor {{x}} of 5 -
-
- - angular.module('anchorScrollOffsetExample', []) - .run(['$anchorScroll', function($anchorScroll) { - $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels - }]) - .controller('headerCtrl', ['$anchorScroll', '$location', '$scope', - function($anchorScroll, $location, $scope) { - $scope.gotoAnchor = function(x) { - var newHash = 'anchor' + x; - if ($location.hash() !== newHash) { - // set the $location.hash to `newHash` and - // $anchorScroll will automatically scroll to it - $location.hash('anchor' + x); - } else { - // call $anchorScroll() explicitly, - // since $location.hash hasn't changed - $anchorScroll(); - } - }; - } - ]); - - - body { - padding-top: 50px; - } - - .anchor { - border: 2px dashed DarkOrchid; - padding: 10px 10px 200px 10px; - } - - .fixed-header { - background-color: rgba(0, 0, 0, 0.2); - height: 50px; - position: fixed; - top: 0; left: 0; right: 0; - } - - .fixed-header > a { - display: inline-block; - margin: 5px 15px; - } - -
- */ - this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { - var document = $window.document; - - // Helper function to get first anchor from a NodeList - // (using `Array#some()` instead of `angular#forEach()` since it's more performant - // and working in all supported browsers.) - function getFirstAnchor(list) { - var result = null; - Array.prototype.some.call(list, function(element) { - if (nodeName_(element) === 'a') { - result = element; - return true; - } - }); - return result; - } - - function getYOffset() { - - var offset = scroll.yOffset; - - if (isFunction(offset)) { - offset = offset(); - } else if (isElement(offset)) { - var elem = offset[0]; - var style = $window.getComputedStyle(elem); - if (style.position !== 'fixed') { - offset = 0; - } else { - offset = elem.getBoundingClientRect().bottom; - } - } else if (!isNumber(offset)) { - offset = 0; - } - - return offset; - } - - function scrollTo(elem) { - if (elem) { - elem.scrollIntoView(); - - var offset = getYOffset(); - - if (offset) { - // `offset` is the number of pixels we should scroll UP in order to align `elem` properly. - // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the - // top of the viewport. - // - // IF the number of pixels from the top of `elem` to the end of the page's content is less - // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some - // way down the page. - // - // This is often the case for elements near the bottom of the page. - // - // In such cases we do not need to scroll the whole `offset` up, just the difference between - // the top of the element and the offset, which is enough to align the top of `elem` at the - // desired position. - var elemTop = elem.getBoundingClientRect().top; - $window.scrollBy(0, elemTop - offset); - } - } else { - $window.scrollTo(0, 0); - } - } - - function scroll(hash) { - // Allow numeric hashes - hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); - var elm; - - // empty hash, scroll to the top of the page - if (!hash) scrollTo(null); - - // element with given id - else if ((elm = document.getElementById(hash))) scrollTo(elm); - - // first anchor with given name :-D - else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); - - // no element and hash === 'top', scroll to the top of the page - else if (hash === 'top') scrollTo(null); - } - - // does not scroll when user clicks on anchor link that is currently on - // (no url change, no $location.hash() change), browser native does scroll - if (autoScrollingEnabled) { - $rootScope.$watch(function autoScrollWatch() {return $location.hash();}, - function autoScrollWatchAction(newVal, oldVal) { - // skip the initial scroll if $location.hash is empty - if (newVal === oldVal && newVal === '') return; - - jqLiteDocumentLoaded(function() { - $rootScope.$evalAsync(scroll); - }); - }); - } - - return scroll; - }]; -} - -var $animateMinErr = minErr('$animate'); -var ELEMENT_NODE = 1; -var NG_ANIMATE_CLASSNAME = 'ng-animate'; - -function mergeClasses(a,b) { - if (!a && !b) return ''; - if (!a) return b; - if (!b) return a; - if (isArray(a)) a = a.join(' '); - if (isArray(b)) b = b.join(' '); - return a + ' ' + b; -} - -function extractElementNode(element) { - for (var i = 0; i < element.length; i++) { - var elm = element[i]; - if (elm.nodeType === ELEMENT_NODE) { - return elm; - } - } -} - -function splitClasses(classes) { - if (isString(classes)) { - classes = classes.split(' '); - } - - // Use createMap() to prevent class assumptions involving property names in - // Object.prototype - var obj = createMap(); - forEach(classes, function(klass) { - // sometimes the split leaves empty string values - // incase extra spaces were applied to the options - if (klass.length) { - obj[klass] = true; - } - }); - return obj; -} - -// if any other type of options value besides an Object value is -// passed into the $animate.method() animation then this helper code -// will be run which will ignore it. While this patch is not the -// greatest solution to this, a lot of existing plugins depend on -// $animate to either call the callback (< 1.2) or return a promise -// that can be changed. This helper function ensures that the options -// are wiped clean incase a callback function is provided. -function prepareAnimateOptions(options) { - return isObject(options) - ? options - : {}; -} - -var $$CoreAnimateJsProvider = /** @this */ function() { - this.$get = noop; -}; - -// this is prefixed with Core since it conflicts with -// the animateQueueProvider defined in ngAnimate/animateQueue.js -var $$CoreAnimateQueueProvider = /** @this */ function() { - var postDigestQueue = new NgMap(); - var postDigestElements = []; - - this.$get = ['$$AnimateRunner', '$rootScope', - function($$AnimateRunner, $rootScope) { - return { - enabled: noop, - on: noop, - off: noop, - pin: noop, - - push: function(element, event, options, domOperation) { - if (domOperation) { - domOperation(); - } - - options = options || {}; - if (options.from) { - element.css(options.from); - } - if (options.to) { - element.css(options.to); - } - - if (options.addClass || options.removeClass) { - addRemoveClassesPostDigest(element, options.addClass, options.removeClass); - } - - var runner = new $$AnimateRunner(); - - // since there are no animations to run the runner needs to be - // notified that the animation call is complete. - runner.complete(); - return runner; - } - }; - - - function updateData(data, classes, value) { - var changed = false; - if (classes) { - classes = isString(classes) ? classes.split(' ') : - isArray(classes) ? classes : []; - forEach(classes, function(className) { - if (className) { - changed = true; - data[className] = value; - } - }); - } - return changed; - } - - function handleCSSClassChanges() { - forEach(postDigestElements, function(element) { - var data = postDigestQueue.get(element); - if (data) { - var existing = splitClasses(element.attr('class')); - var toAdd = ''; - var toRemove = ''; - forEach(data, function(status, className) { - var hasClass = !!existing[className]; - if (status !== hasClass) { - if (status) { - toAdd += (toAdd.length ? ' ' : '') + className; - } else { - toRemove += (toRemove.length ? ' ' : '') + className; - } - } - }); - - forEach(element, function(elm) { - if (toAdd) { - jqLiteAddClass(elm, toAdd); - } - if (toRemove) { - jqLiteRemoveClass(elm, toRemove); - } - }); - postDigestQueue.delete(element); - } - }); - postDigestElements.length = 0; - } - - - function addRemoveClassesPostDigest(element, add, remove) { - var data = postDigestQueue.get(element) || {}; - - var classesAdded = updateData(data, add, true); - var classesRemoved = updateData(data, remove, false); - - if (classesAdded || classesRemoved) { - - postDigestQueue.set(element, data); - postDigestElements.push(element); - - if (postDigestElements.length === 1) { - $rootScope.$$postDigest(handleCSSClassChanges); - } - } - } - }]; -}; - -/** - * @ngdoc provider - * @name $animateProvider - * - * @description - * Default implementation of $animate that doesn't perform any animations, instead just - * synchronously performs DOM updates and resolves the returned runner promise. - * - * In order to enable animations the `ngAnimate` module has to be loaded. - * - * To see the functional implementation check out `src/ngAnimate/animate.js`. - */ -var $AnimateProvider = ['$provide', /** @this */ function($provide) { - var provider = this; - var classNameFilter = null; - var customFilter = null; - - this.$$registeredAnimations = Object.create(null); - - /** - * @ngdoc method - * @name $animateProvider#register - * - * @description - * Registers a new injectable animation factory function. The factory function produces the - * animation object which contains callback functions for each event that is expected to be - * animated. - * - * * `eventFn`: `function(element, ... , doneFunction, options)` - * The element to animate, the `doneFunction` and the options fed into the animation. Depending - * on the type of animation additional arguments will be injected into the animation function. The - * list below explains the function signatures for the different animation methods: - * - * - setClass: function(element, addedClasses, removedClasses, doneFunction, options) - * - addClass: function(element, addedClasses, doneFunction, options) - * - removeClass: function(element, removedClasses, doneFunction, options) - * - enter, leave, move: function(element, doneFunction, options) - * - animate: function(element, fromStyles, toStyles, doneFunction, options) - * - * Make sure to trigger the `doneFunction` once the animation is fully complete. - * - * ```js - * return { - * //enter, leave, move signature - * eventFn : function(element, done, options) { - * //code to run the animation - * //once complete, then run done() - * return function endFunction(wasCancelled) { - * //code to cancel the animation - * } - * } - * } - * ``` - * - * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to). - * @param {Function} factory The factory function that will be executed to return the animation - * object. - */ - this.register = function(name, factory) { - if (name && name.charAt(0) !== '.') { - throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name); - } - - var key = name + '-animation'; - provider.$$registeredAnimations[name.substr(1)] = key; - $provide.factory(key, factory); - }; - - /** - * @ngdoc method - * @name $animateProvider#customFilter - * - * @description - * Sets and/or returns the custom filter function that is used to "filter" animations, i.e. - * determine if an animation is allowed or not. When no filter is specified (the default), no - * animation will be blocked. Setting the `customFilter` value will only allow animations for - * which the filter function's return value is truthy. - * - * This allows to easily create arbitrarily complex rules for filtering animations, such as - * allowing specific events only, or enabling animations on specific subtrees of the DOM, etc. - * Filtering animations can also boost performance for low-powered devices, as well as - * applications containing a lot of structural operations. - * - *
- * **Best Practice:** - * Keep the filtering function as lean as possible, because it will be called for each DOM - * action (e.g. insertion, removal, class change) performed by "animation-aware" directives. - * See {@link guide/animations#which-directives-support-animations- here} for a list of built-in - * directives that support animations. - * Performing computationally expensive or time-consuming operations on each call of the - * filtering function can make your animations sluggish. - *
- * - * **Note:** If present, `customFilter` will be checked before - * {@link $animateProvider#classNameFilter classNameFilter}. - * - * @param {Function=} filterFn - The filter function which will be used to filter all animations. - * If a falsy value is returned, no animation will be performed. The function will be called - * with the following arguments: - * - **node** `{DOMElement}` - The DOM element to be animated. - * - **event** `{String}` - The name of the animation event (e.g. `enter`, `leave`, `addClass` - * etc). - * - **options** `{Object}` - A collection of options/styles used for the animation. - * @return {Function} The current filter function or `null` if there is none set. - */ - this.customFilter = function(filterFn) { - if (arguments.length === 1) { - customFilter = isFunction(filterFn) ? filterFn : null; - } - - return customFilter; - }; - - /** - * @ngdoc method - * @name $animateProvider#classNameFilter - * - * @description - * Sets and/or returns the CSS class regular expression that is checked when performing - * an animation. Upon bootstrap the classNameFilter value is not set at all and will - * therefore enable $animate to attempt to perform an animation on any element that is triggered. - * When setting the `classNameFilter` value, animations will only be performed on elements - * that successfully match the filter expression. This in turn can boost performance - * for low-powered devices as well as applications containing a lot of structural operations. - * - * **Note:** If present, `classNameFilter` will be checked after - * {@link $animateProvider#customFilter customFilter}. If `customFilter` is present and returns - * false, `classNameFilter` will not be checked. - * - * @param {RegExp=} expression The className expression which will be checked against all animations - * @return {RegExp} The current CSS className expression value. If null then there is no expression value - */ - this.classNameFilter = function(expression) { - if (arguments.length === 1) { - classNameFilter = (expression instanceof RegExp) ? expression : null; - if (classNameFilter) { - var reservedRegex = new RegExp('[(\\s|\\/)]' + NG_ANIMATE_CLASSNAME + '[(\\s|\\/)]'); - if (reservedRegex.test(classNameFilter.toString())) { - classNameFilter = null; - throw $animateMinErr('nongcls', '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME); - } - } - } - return classNameFilter; - }; - - this.$get = ['$$animateQueue', function($$animateQueue) { - function domInsert(element, parentElement, afterElement) { - // if for some reason the previous element was removed - // from the dom sometime before this code runs then let's - // just stick to using the parent element as the anchor - if (afterElement) { - var afterNode = extractElementNode(afterElement); - if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) { - afterElement = null; - } - } - if (afterElement) { - afterElement.after(element); - } else { - parentElement.prepend(element); - } - } - - /** - * @ngdoc service - * @name $animate - * @description The $animate service exposes a series of DOM utility methods that provide support - * for animation hooks. The default behavior is the application of DOM operations, however, - * when an animation is detected (and animations are enabled), $animate will do the heavy lifting - * to ensure that animation runs with the triggered DOM operation. - * - * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't - * included and only when it is active then the animation hooks that `$animate` triggers will be - * functional. Once active then all structural `ng-` directives will trigger animations as they perform - * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`, - * `ngShow`, `ngHide` and `ngMessages` also provide support for animations. - * - * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives. - * - * To learn more about enabling animation support, click here to visit the - * {@link ngAnimate ngAnimate module page}. - */ - return { - // we don't call it directly since non-existant arguments may - // be interpreted as null within the sub enabled function - - /** - * - * @ngdoc method - * @name $animate#on - * @kind function - * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...) - * has fired on the given element or among any of its children. Once the listener is fired, the provided callback - * is fired with the following params: - * - * ```js - * $animate.on('enter', container, - * function callback(element, phase) { - * // cool we detected an enter animation within the container - * } - * ); - * ``` - * - *
- * **Note**: Generally, the events that are fired correspond 1:1 to `$animate` method names, - * e.g. {@link ng.$animate#addClass addClass()} will fire `addClass`, and {@link ng.ngClass} - * will fire `addClass` if classes are added, and `removeClass` if classes are removed. - * However, there are two exceptions: - * - *
    - *
  • if both an {@link ng.$animate#addClass addClass()} and a - * {@link ng.$animate#removeClass removeClass()} action are performed during the same - * animation, the event fired will be `setClass`. This is true even for `ngClass`.
  • - *
  • an {@link ng.$animate#animate animate()} call that adds and removes classes will fire - * the `setClass` event, but if it either removes or adds classes, - * it will fire `animate` instead.
  • - *
- * - *
- * - * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) - * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself - * as well as among its children - * @param {Function} callback the callback function that will be fired when the listener is triggered. - * - * The arguments present in the callback function are: - * * `element` - The captured DOM element that the animation was fired on. - * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends). - * * `data` - an object with these properties: - * * addClass - `{string|null}` - space-separated CSS classes to add to the element - * * removeClass - `{string|null}` - space-separated CSS classes to remove from the element - * * from - `{Object|null}` - CSS properties & values at the beginning of the animation - * * to - `{Object|null}` - CSS properties & values at the end of the animation - * - * Note that the callback does not trigger a scope digest. Wrap your call into a - * {@link $rootScope.Scope#$apply scope.$apply} to propagate changes to the scope. - */ - on: $$animateQueue.on, - - /** - * - * @ngdoc method - * @name $animate#off - * @kind function - * @description Deregisters an event listener based on the event which has been associated with the provided element. This method - * can be used in three different ways depending on the arguments: - * - * ```js - * // remove all the animation event listeners listening for `enter` - * $animate.off('enter'); - * - * // remove listeners for all animation events from the container element - * $animate.off(container); - * - * // remove all the animation event listeners listening for `enter` on the given element and its children - * $animate.off('enter', container); - * - * // remove the event listener function provided by `callback` that is set - * // to listen for `enter` on the given `container` as well as its children - * $animate.off('enter', container, callback); - * ``` - * - * @param {string|DOMElement} event|container the animation event (e.g. enter, leave, move, - * addClass, removeClass, etc...), or the container element. If it is the element, all other - * arguments are ignored. - * @param {DOMElement=} container the container element the event listener was placed on - * @param {Function=} callback the callback function that was registered as the listener - */ - off: $$animateQueue.off, - - /** - * @ngdoc method - * @name $animate#pin - * @kind function - * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists - * outside of the DOM structure of the AngularJS application. By doing so, any animation triggered via `$animate` can be issued on the - * element despite being outside the realm of the application or within another application. Say for example if the application - * was bootstrapped on an element that is somewhere inside of the `` tag, but we wanted to allow for an element to be situated - * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind - * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association. - * - * Note that this feature is only active when the `ngAnimate` module is used. - * - * @param {DOMElement} element the external element that will be pinned - * @param {DOMElement} parentElement the host parent element that will be associated with the external element - */ - pin: $$animateQueue.pin, - - /** - * - * @ngdoc method - * @name $animate#enabled - * @kind function - * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This - * function can be called in four ways: - * - * ```js - * // returns true or false - * $animate.enabled(); - * - * // changes the enabled state for all animations - * $animate.enabled(false); - * $animate.enabled(true); - * - * // returns true or false if animations are enabled for an element - * $animate.enabled(element); - * - * // changes the enabled state for an element and its children - * $animate.enabled(element, true); - * $animate.enabled(element, false); - * ``` - * - * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state - * @param {boolean=} enabled whether or not the animations will be enabled for the element - * - * @return {boolean} whether or not animations are enabled - */ - enabled: $$animateQueue.enabled, - - /** - * @ngdoc method - * @name $animate#cancel - * @kind function - * @description Cancels the provided animation and applies the end state of the animation. - * Note that this does not cancel the underlying operation, e.g. the setting of classes or - * adding the element to the DOM. - * - * @param {animationRunner} animationRunner An animation runner returned by an $animate function. - * - * @example - - - angular.module('animationExample', ['ngAnimate']).component('cancelExample', { - templateUrl: 'template.html', - controller: function($element, $animate) { - this.runner = null; - - this.addClass = function() { - this.runner = $animate.addClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.removeClass = function() { - this.runner = $animate.removeClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.cancel = function() { - $animate.cancel(this.runner); - }; - } - }); - - -

- - -
- -
-

CSS-Animated Text
-

-
- - - - - .red-add, .red-remove { - transition: all 4s cubic-bezier(0.250, 0.460, 0.450, 0.940); - } - - .red, - .red-add.red-add-active { - color: #FF0000; - font-size: 40px; - } - - .red-remove.red-remove-active { - font-size: 10px; - color: black; - } - - -
- */ - cancel: function(runner) { - if (runner.cancel) { - runner.cancel(); - } - }, - - /** - * - * @ngdoc method - * @name $animate#enter - * @kind function - * @description Inserts the element into the DOM either after the `after` element (if provided) or - * as the first child within the `parent` element and then triggers an animation. - * A promise is returned that will be resolved during the next digest once the animation - * has completed. - * - * @param {DOMElement} element the element which will be inserted into the DOM - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - enter: function(element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options)); - }, - - /** - * - * @ngdoc method - * @name $animate#move - * @kind function - * @description Inserts (moves) the element into its new position in the DOM either after - * the `after` element (if provided) or as the first child within the `parent` element - * and then triggers an animation. A promise is returned that will be resolved - * during the next digest once the animation has completed. - * - * @param {DOMElement} element the element which will be moved into the new DOM position - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - move: function(element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'move', prepareAnimateOptions(options)); - }, - - /** - * @ngdoc method - * @name $animate#leave - * @kind function - * @description Triggers an animation and then removes the element from the DOM. - * When the function is called a promise is returned that will be resolved during the next - * digest once the animation has completed. - * - * @param {DOMElement} element the element which will be removed from the DOM - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - leave: function(element, options) { - return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() { - element.remove(); - }); - }, - - /** - * @ngdoc method - * @name $animate#addClass - * @kind function - * - * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon - * execution, the addClass operation will only be handled after the next digest and it will not trigger an - * animation if element already contains the CSS class or if the class is removed at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} animationRunner the animation runner - */ - addClass: function(element, className, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addclass, className); - return $$animateQueue.push(element, 'addClass', options); - }, - - /** - * @ngdoc method - * @name $animate#removeClass - * @kind function - * - * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon - * execution, the removeClass operation will only be handled after the next digest and it will not trigger an - * animation if element does not contain the CSS class or if the class is added at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - removeClass: function(element, className, options) { - options = prepareAnimateOptions(options); - options.removeClass = mergeClasses(options.removeClass, className); - return $$animateQueue.push(element, 'removeClass', options); - }, - - /** - * @ngdoc method - * @name $animate#setClass - * @kind function - * - * @description Performs both the addition and removal of a CSS classes on an element and (during the process) - * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and - * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has - * passed. Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - setClass: function(element, add, remove, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addClass, add); - options.removeClass = mergeClasses(options.removeClass, remove); - return $$animateQueue.push(element, 'setClass', options); - }, - - /** - * @ngdoc method - * @name $animate#animate - * @kind function - * - * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element. - * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take - * on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and - * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding - * style in `to`, the style in `from` is applied immediately, and no animation is run. - * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate` - * method (or as part of the `options` parameter): - * - * ```js - * ngModule.animation('.my-inline-animation', function() { - * return { - * animate : function(element, from, to, done, options) { - * //animation - * done(); - * } - * } - * }); - * ``` - * - * @param {DOMElement} element the element which the CSS styles will be applied to - * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation. - * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation. - * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If - * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element. - * (Note that if no animation is detected then this value will not be applied to the element.) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - animate: function(element, from, to, className, options) { - options = prepareAnimateOptions(options); - options.from = options.from ? extend(options.from, from) : from; - options.to = options.to ? extend(options.to, to) : to; - - className = className || 'ng-inline-animate'; - options.tempClasses = mergeClasses(options.tempClasses, className); - return $$animateQueue.push(element, 'animate', options); - } - }; - }]; -}]; - -var $$AnimateAsyncRunFactoryProvider = /** @this */ function() { - this.$get = ['$$rAF', function($$rAF) { - var waitQueue = []; - - function waitForTick(fn) { - waitQueue.push(fn); - if (waitQueue.length > 1) return; - $$rAF(function() { - for (var i = 0; i < waitQueue.length; i++) { - waitQueue[i](); - } - waitQueue = []; - }); - } - - return function() { - var passed = false; - waitForTick(function() { - passed = true; - }); - return function(callback) { - if (passed) { - callback(); - } else { - waitForTick(callback); - } - }; - }; - }]; -}; - -var $$AnimateRunnerFactoryProvider = /** @this */ function() { - this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout', - function($q, $sniffer, $$animateAsyncRun, $$isDocumentHidden, $timeout) { - - var INITIAL_STATE = 0; - var DONE_PENDING_STATE = 1; - var DONE_COMPLETE_STATE = 2; - - AnimateRunner.chain = function(chain, callback) { - var index = 0; - - next(); - function next() { - if (index === chain.length) { - callback(true); - return; - } - - chain[index](function(response) { - if (response === false) { - callback(false); - return; - } - index++; - next(); - }); - } - }; - - AnimateRunner.all = function(runners, callback) { - var count = 0; - var status = true; - forEach(runners, function(runner) { - runner.done(onProgress); - }); - - function onProgress(response) { - status = status && response; - if (++count === runners.length) { - callback(status); - } - } - }; - - function AnimateRunner(host) { - this.setHost(host); - - var rafTick = $$animateAsyncRun(); - var timeoutTick = function(fn) { - $timeout(fn, 0, false); - }; - - this._doneCallbacks = []; - this._tick = function(fn) { - if ($$isDocumentHidden()) { - timeoutTick(fn); - } else { - rafTick(fn); - } - }; - this._state = 0; - } - - AnimateRunner.prototype = { - setHost: function(host) { - this.host = host || {}; - }, - - done: function(fn) { - if (this._state === DONE_COMPLETE_STATE) { - fn(); - } else { - this._doneCallbacks.push(fn); - } - }, - - progress: noop, - - getPromise: function() { - if (!this.promise) { - var self = this; - this.promise = $q(function(resolve, reject) { - self.done(function(status) { - if (status === false) { - reject(); - } else { - resolve(); - } - }); - }); - } - return this.promise; - }, - - then: function(resolveHandler, rejectHandler) { - return this.getPromise().then(resolveHandler, rejectHandler); - }, - - 'catch': function(handler) { - return this.getPromise()['catch'](handler); - }, - - 'finally': function(handler) { - return this.getPromise()['finally'](handler); - }, - - pause: function() { - if (this.host.pause) { - this.host.pause(); - } - }, - - resume: function() { - if (this.host.resume) { - this.host.resume(); - } - }, - - end: function() { - if (this.host.end) { - this.host.end(); - } - this._resolve(true); - }, - - cancel: function() { - if (this.host.cancel) { - this.host.cancel(); - } - this._resolve(false); - }, - - complete: function(response) { - var self = this; - if (self._state === INITIAL_STATE) { - self._state = DONE_PENDING_STATE; - self._tick(function() { - self._resolve(response); - }); - } - }, - - _resolve: function(response) { - if (this._state !== DONE_COMPLETE_STATE) { - forEach(this._doneCallbacks, function(fn) { - fn(response); - }); - this._doneCallbacks.length = 0; - this._state = DONE_COMPLETE_STATE; - } - } - }; - - return AnimateRunner; - }]; -}; - -/* exported $CoreAnimateCssProvider */ - -/** - * @ngdoc service - * @name $animateCss - * @kind object - * @this - * - * @description - * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included, - * then the `$animateCss` service will actually perform animations. - * - * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. - */ -var $CoreAnimateCssProvider = function() { - this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) { - - return function(element, initialOptions) { - // all of the animation functions should create - // a copy of the options data, however, if a - // parent service has already created a copy then - // we should stick to using that - var options = initialOptions || {}; - if (!options.$$prepared) { - options = copy(options); - } - - // there is no point in applying the styles since - // there is no animation that goes on at all in - // this version of $animateCss. - if (options.cleanupStyles) { - options.from = options.to = null; - } - - if (options.from) { - element.css(options.from); - options.from = null; - } - - var closed, runner = new $$AnimateRunner(); - return { - start: run, - end: run - }; - - function run() { - $$rAF(function() { - applyAnimationContents(); - if (!closed) { - runner.complete(); - } - closed = true; - }); - return runner; - } - - function applyAnimationContents() { - if (options.addClass) { - element.addClass(options.addClass); - options.addClass = null; - } - if (options.removeClass) { - element.removeClass(options.removeClass); - options.removeClass = null; - } - if (options.to) { - element.css(options.to); - options.to = null; - } - } - }; - }]; -}; - -/* global getHash: true, stripHash: false */ - -function getHash(url) { - var index = url.indexOf('#'); - return index === -1 ? '' : url.substr(index); -} - -function trimEmptyHash(url) { - return url.replace(/#$/, ''); -} - -/** - * ! This is a private undocumented service ! - * - * @name $browser - * @requires $log - * @description - * This object has two goals: - * - * - hide all the global state in the browser caused by the window object - * - abstract away all the browser specific features and inconsistencies - * - * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` - * service, which can be used for convenient testing of the application without the interaction with - * the real browser apis. - */ -/** - * @param {object} window The global window object. - * @param {object} document jQuery wrapped document. - * @param {object} $log window.console or an object with the same interface. - * @param {object} $sniffer $sniffer service - */ -function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) { - var self = this, - location = window.location, - history = window.history, - setTimeout = window.setTimeout, - clearTimeout = window.clearTimeout, - pendingDeferIds = {}, - taskTracker = $$taskTrackerFactory($log); - - self.isMock = false; - - ////////////////////////////////////////////////////////////// - // Task-tracking API - ////////////////////////////////////////////////////////////// - - // TODO(vojta): remove this temporary api - self.$$completeOutstandingRequest = taskTracker.completeTask; - self.$$incOutstandingRequestCount = taskTracker.incTaskCount; - - // TODO(vojta): prefix this method with $$ ? - self.notifyWhenNoOutstandingRequests = taskTracker.notifyWhenNoPendingTasks; - - ////////////////////////////////////////////////////////////// - // URL API - ////////////////////////////////////////////////////////////// - - var cachedState, lastHistoryState, - lastBrowserUrl = location.href, - baseElement = document.find('base'), - pendingLocation = null, - getCurrentState = !$sniffer.history ? noop : function getCurrentState() { - try { - return history.state; - } catch (e) { - // MSIE can reportedly throw when there is no state (UNCONFIRMED). - } - }; - - cacheState(); - - /** - * @name $browser#url - * - * @description - * GETTER: - * Without any argument, this method just returns current value of `location.href` (with a - * trailing `#` stripped of if the hash is empty). - * - * SETTER: - * With at least one argument, this method sets url to new value. - * If html5 history api supported, `pushState`/`replaceState` is used, otherwise - * `location.href`/`location.replace` is used. - * Returns its own instance to allow chaining. - * - * NOTE: this api is intended for use only by the `$location` service. Please use the - * {@link ng.$location $location service} to change url. - * - * @param {string} url New url (when used as setter) - * @param {boolean=} replace Should new url replace current history record? - * @param {object=} state State object to use with `pushState`/`replaceState` - */ - self.url = function(url, replace, state) { - // In modern browsers `history.state` is `null` by default; treating it separately - // from `undefined` would cause `$browser.url('/foo')` to change `history.state` - // to undefined via `pushState`. Instead, let's change `undefined` to `null` here. - if (isUndefined(state)) { - state = null; - } - - // Android Browser BFCache causes location, history reference to become stale. - if (location !== window.location) location = window.location; - if (history !== window.history) history = window.history; - - // setter - if (url) { - var sameState = lastHistoryState === state; - - // Normalize the inputted URL - url = urlResolve(url).href; - - // Don't change anything if previous and current URLs and states match. This also prevents - // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode. - // See https://github.com/angular/angular.js/commit/ffb2701 - if (lastBrowserUrl === url && (!$sniffer.history || sameState)) { - return self; - } - var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url); - lastBrowserUrl = url; - lastHistoryState = state; - // Don't use history API if only the hash changed - // due to a bug in IE10/IE11 which leads - // to not firing a `hashchange` nor `popstate` event - // in some cases (see #9143). - if ($sniffer.history && (!sameBase || !sameState)) { - history[replace ? 'replaceState' : 'pushState'](state, '', url); - cacheState(); - } else { - if (!sameBase) { - pendingLocation = url; - } - if (replace) { - location.replace(url); - } else if (!sameBase) { - location.href = url; - } else { - location.hash = getHash(url); - } - if (location.href !== url) { - pendingLocation = url; - } - } - if (pendingLocation) { - pendingLocation = url; - } - return self; - // getter - } else { - // - pendingLocation is needed as browsers don't allow to read out - // the new location.href if a reload happened or if there is a bug like in iOS 9 (see - // https://openradar.appspot.com/22186109). - return trimEmptyHash(pendingLocation || location.href); - } - }; - - /** - * @name $browser#state - * - * @description - * This method is a getter. - * - * Return history.state or null if history.state is undefined. - * - * @returns {object} state - */ - self.state = function() { - return cachedState; - }; - - var urlChangeListeners = [], - urlChangeInit = false; - - function cacheStateAndFireUrlChange() { - pendingLocation = null; - fireStateOrUrlChange(); - } - - // This variable should be used *only* inside the cacheState function. - var lastCachedState = null; - function cacheState() { - // This should be the only place in $browser where `history.state` is read. - cachedState = getCurrentState(); - cachedState = isUndefined(cachedState) ? null : cachedState; - - // Prevent callbacks fo fire twice if both hashchange & popstate were fired. - if (equals(cachedState, lastCachedState)) { - cachedState = lastCachedState; - } - - lastCachedState = cachedState; - lastHistoryState = cachedState; - } - - function fireStateOrUrlChange() { - var prevLastHistoryState = lastHistoryState; - cacheState(); - - if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) { - return; - } - - lastBrowserUrl = self.url(); - lastHistoryState = cachedState; - forEach(urlChangeListeners, function(listener) { - listener(self.url(), cachedState); - }); - } - - /** - * @name $browser#onUrlChange - * - * @description - * Register callback function that will be called, when url changes. - * - * It's only called when the url is changed from outside of AngularJS: - * - user types different url into address bar - * - user clicks on history (forward/back) button - * - user clicks on a link - * - * It's not called when url is changed by $browser.url() method - * - * The listener gets called with new url as parameter. - * - * NOTE: this api is intended for use only by the $location service. Please use the - * {@link ng.$location $location service} to monitor url changes in AngularJS apps. - * - * @param {function(string)} listener Listener function to be called when url changes. - * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. - */ - self.onUrlChange = function(callback) { - // TODO(vojta): refactor to use node's syntax for events - if (!urlChangeInit) { - // We listen on both (hashchange/popstate) when available, as some browsers don't - // fire popstate when user changes the address bar and don't fire hashchange when url - // changed by push/replaceState - - // html5 history api - popstate event - if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange); - // hashchange event - jqLite(window).on('hashchange', cacheStateAndFireUrlChange); - - urlChangeInit = true; - } - - urlChangeListeners.push(callback); - return callback; - }; - - /** - * @private - * Remove popstate and hashchange handler from window. - * - * NOTE: this api is intended for use only by $rootScope. - */ - self.$$applicationDestroyed = function() { - jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange); - }; - - /** - * Checks whether the url has changed outside of AngularJS. - * Needs to be exported to be able to check for changes that have been done in sync, - * as hashchange/popstate events fire in async. - */ - self.$$checkUrlChange = fireStateOrUrlChange; - - ////////////////////////////////////////////////////////////// - // Misc API - ////////////////////////////////////////////////////////////// - - /** - * @name $browser#baseHref - * - * @description - * Returns current - * (always relative - without domain) - * - * @returns {string} The current base href - */ - self.baseHref = function() { - var href = baseElement.attr('href'); - return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : ''; - }; - - /** - * @name $browser#defer - * @param {function()} fn A function, who's execution should be deferred. - * @param {number=} [delay=0] Number of milliseconds to defer the function execution. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred. - * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. - * - * @description - * Executes a fn asynchronously via `setTimeout(fn, delay)`. - * - * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using - * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed - * via `$browser.defer.flush()`. - * - */ - self.defer = function(fn, delay, taskType) { - var timeoutId; - - delay = delay || 0; - taskType = taskType || taskTracker.DEFAULT_TASK_TYPE; - - taskTracker.incTaskCount(taskType); - timeoutId = setTimeout(function() { - delete pendingDeferIds[timeoutId]; - taskTracker.completeTask(fn, taskType); - }, delay); - pendingDeferIds[timeoutId] = taskType; - - return timeoutId; - }; - - - /** - * @name $browser#defer.cancel - * - * @description - * Cancels a deferred task identified with `deferId`. - * - * @param {*} deferId Token returned by the `$browser.defer` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - self.defer.cancel = function(deferId) { - if (pendingDeferIds.hasOwnProperty(deferId)) { - var taskType = pendingDeferIds[deferId]; - delete pendingDeferIds[deferId]; - clearTimeout(deferId); - taskTracker.completeTask(noop, taskType); - return true; - } - return false; - }; - -} - -/** @this */ -function $BrowserProvider() { - this.$get = ['$window', '$log', '$sniffer', '$document', '$$taskTrackerFactory', - function($window, $log, $sniffer, $document, $$taskTrackerFactory) { - return new Browser($window, $document, $log, $sniffer, $$taskTrackerFactory); - }]; -} - -/** - * @ngdoc service - * @name $cacheFactory - * @this - * - * @description - * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to - * them. - * - * ```js - * - * var cache = $cacheFactory('cacheId'); - * expect($cacheFactory.get('cacheId')).toBe(cache); - * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined(); - * - * cache.put("key", "value"); - * cache.put("another key", "another value"); - * - * // We've specified no options on creation - * expect(cache.info()).toEqual({id: 'cacheId', size: 2}); - * - * ``` - * - * - * @param {string} cacheId Name or id of the newly created cache. - * @param {object=} options Options object that specifies the cache behavior. Properties: - * - * - `{number=}` `capacity` — turns the cache into LRU cache. - * - * @returns {object} Newly created cache object with the following set of methods: - * - * - `{object}` `info()` — Returns id, size, and options of cache. - * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns - * it. - * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. - * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. - * - `{void}` `removeAll()` — Removes all cached values. - * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. - * - * @example - - -
- - - - -

Cached Values

-
- - : - -
- -

Cache Info

-
- - : - -
-
-
- - angular.module('cacheExampleApp', []). - controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) { - $scope.keys = []; - $scope.cache = $cacheFactory('cacheId'); - $scope.put = function(key, value) { - if (angular.isUndefined($scope.cache.get(key))) { - $scope.keys.push(key); - } - $scope.cache.put(key, angular.isUndefined(value) ? null : value); - }; - }]); - - - p { - margin: 10px 0 3px; - } - -
- */ -function $CacheFactoryProvider() { - - this.$get = function() { - var caches = {}; - - function cacheFactory(cacheId, options) { - if (cacheId in caches) { - throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId); - } - - var size = 0, - stats = extend({}, options, {id: cacheId}), - data = createMap(), - capacity = (options && options.capacity) || Number.MAX_VALUE, - lruHash = createMap(), - freshEnd = null, - staleEnd = null; - - /** - * @ngdoc type - * @name $cacheFactory.Cache - * - * @description - * A cache object used to store and retrieve data, primarily used by - * {@link $templateRequest $templateRequest} and the {@link ng.directive:script script} - * directive to cache templates and other data. - * - * ```js - * angular.module('superCache') - * .factory('superCache', ['$cacheFactory', function($cacheFactory) { - * return $cacheFactory('super-cache'); - * }]); - * ``` - * - * Example test: - * - * ```js - * it('should behave like a cache', inject(function(superCache) { - * superCache.put('key', 'value'); - * superCache.put('another key', 'another value'); - * - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 2 - * }); - * - * superCache.remove('another key'); - * expect(superCache.get('another key')).toBeUndefined(); - * - * superCache.removeAll(); - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 0 - * }); - * })); - * ``` - */ - return (caches[cacheId] = { - - /** - * @ngdoc method - * @name $cacheFactory.Cache#put - * @kind function - * - * @description - * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be - * retrieved later, and incrementing the size of the cache if the key was not already - * present in the cache. If behaving like an LRU cache, it will also remove stale - * entries from the set. - * - * It will not insert undefined values into the cache. - * - * @param {string} key the key under which the cached data is stored. - * @param {*} value the value to store alongside the key. If it is undefined, the key - * will not be stored. - * @returns {*} the value stored. - */ - put: function(key, value) { - if (isUndefined(value)) return; - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); - - refresh(lruEntry); - } - - if (!(key in data)) size++; - data[key] = value; - - if (size > capacity) { - this.remove(staleEnd.key); - } - - return value; - }, - - /** - * @ngdoc method - * @name $cacheFactory.Cache#get - * @kind function - * - * @description - * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the data to be retrieved - * @returns {*} the value stored. - */ - get: function(key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - refresh(lruEntry); - } - - return data[key]; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#remove - * @kind function - * - * @description - * Removes an entry from the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the entry to be removed - */ - remove: function(key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - if (lruEntry === freshEnd) freshEnd = lruEntry.p; - if (lruEntry === staleEnd) staleEnd = lruEntry.n; - link(lruEntry.n,lruEntry.p); - - delete lruHash[key]; - } - - if (!(key in data)) return; - - delete data[key]; - size--; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#removeAll - * @kind function - * - * @description - * Clears the cache object of any entries. - */ - removeAll: function() { - data = createMap(); - size = 0; - lruHash = createMap(); - freshEnd = staleEnd = null; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#destroy - * @kind function - * - * @description - * Destroys the {@link $cacheFactory.Cache Cache} object entirely, - * removing it from the {@link $cacheFactory $cacheFactory} set. - */ - destroy: function() { - data = null; - stats = null; - lruHash = null; - delete caches[cacheId]; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#info - * @kind function - * - * @description - * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}. - * - * @returns {object} an object with the following properties: - *
    - *
  • **id**: the id of the cache instance
  • - *
  • **size**: the number of entries kept in the cache instance
  • - *
  • **...**: any additional properties from the options object when creating the - * cache.
  • - *
- */ - info: function() { - return extend({}, stats, {size: size}); - } - }); - - - /** - * makes the `entry` the freshEnd of the LRU linked list - */ - function refresh(entry) { - if (entry !== freshEnd) { - if (!staleEnd) { - staleEnd = entry; - } else if (staleEnd === entry) { - staleEnd = entry.n; - } - - link(entry.n, entry.p); - link(entry, freshEnd); - freshEnd = entry; - freshEnd.n = null; - } - } - - - /** - * bidirectionally links two entries of the LRU linked list - */ - function link(nextEntry, prevEntry) { - if (nextEntry !== prevEntry) { - if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify - if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify - } - } - } - - - /** - * @ngdoc method - * @name $cacheFactory#info - * - * @description - * Get information about all the caches that have been created - * - * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info` - */ - cacheFactory.info = function() { - var info = {}; - forEach(caches, function(cache, cacheId) { - info[cacheId] = cache.info(); - }); - return info; - }; - - - /** - * @ngdoc method - * @name $cacheFactory#get - * - * @description - * Get access to a cache object by the `cacheId` used when it was created. - * - * @param {string} cacheId Name or id of a cache to access. - * @returns {object} Cache object identified by the cacheId or undefined if no such cache. - */ - cacheFactory.get = function(cacheId) { - return caches[cacheId]; - }; - - - return cacheFactory; - }; -} - -/** - * @ngdoc service - * @name $templateCache - * @this - * - * @description - * `$templateCache` is a {@link $cacheFactory.Cache Cache object} created by the - * {@link ng.$cacheFactory $cacheFactory}. - * - * The first time a template is used, it is loaded in the template cache for quick retrieval. You - * can load templates directly into the cache in a `script` tag, by using {@link $templateRequest}, - * or by consuming the `$templateCache` service directly. - * - * Adding via the `script` tag: - * - * ```html - * - * ``` - * - * **Note:** the `script` tag containing the template does not need to be included in the `head` of - * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (e.g. - * element with {@link ngApp} attribute), otherwise the template will be ignored. - * - * Adding via the `$templateCache` service: - * - * ```js - * var myApp = angular.module('myApp', []); - * myApp.run(function($templateCache) { - * $templateCache.put('templateId.html', 'This is the content of the template'); - * }); - * ``` - * - * To retrieve the template later, simply use it in your component: - * ```js - * myApp.component('myComponent', { - * templateUrl: 'templateId.html' - * }); - * ``` - * - * or get it via the `$templateCache` service: - * ```js - * $templateCache.get('templateId.html') - * ``` - * - */ -function $TemplateCacheProvider() { - this.$get = ['$cacheFactory', function($cacheFactory) { - return $cacheFactory('templates'); - }]; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables like document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! - * - * DOM-related variables: - * - * - "node" - DOM Node - * - "element" - DOM Element or Node - * - "$node" or "$element" - jqLite-wrapped node or element - * - * - * Compiler related stuff: - * - * - "linkFn" - linking fn of a single directive - * - "nodeLinkFn" - function that aggregates all linking fns for a particular node - * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node - * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) - */ - - -/** - * @ngdoc service - * @name $compile - * @kind function - * - * @description - * Compiles an HTML string or DOM into a template and produces a template function, which - * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. - * - * The compilation is a process of walking the DOM tree and matching DOM elements to - * {@link ng.$compileProvider#directive directives}. - * - *
- * **Note:** This document is an in-depth reference of all directive options. - * For a gentle introduction to directives with examples of common use cases, - * see the {@link guide/directive directive guide}. - *
- * - * ## Comprehensive Directive API - * - * There are many different options for a directive. - * - * The difference resides in the return value of the factory function. - * You can either return a {@link $compile#directive-definition-object Directive Definition Object (see below)} - * that defines the directive properties, or just the `postLink` function (all other properties will have - * the default values). - * - *
- * **Best Practice:** It's recommended to use the "directive definition object" form. - *
- * - * Here's an example directive declared with a Directive Definition Object: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * {@link $compile#-priority- priority}: 0, - * {@link $compile#-template- template}: '
', // or // function(tElement, tAttrs) { ... }, - * // or - * // {@link $compile#-templateurl- templateUrl}: 'directive.html', // or // function(tElement, tAttrs) { ... }, - * {@link $compile#-transclude- transclude}: false, - * {@link $compile#-restrict- restrict}: 'A', - * {@link $compile#-templatenamespace- templateNamespace}: 'html', - * {@link $compile#-scope- scope}: false, - * {@link $compile#-controller- controller}: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, - * {@link $compile#-controlleras- controllerAs}: 'stringIdentifier', - * {@link $compile#-bindtocontroller- bindToController}: false, - * {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], - * {@link $compile#-multielement- multiElement}: false, - * {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) { - * return { - * {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * } - * // or - * // return function postLink( ... ) { ... } - * }, - * // or - * // {@link $compile#-link- link}: { - * // {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * // {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * // } - * // or - * // {@link $compile#-link- link}: function postLink( ... ) { ... } - * }; - * return directiveDefinitionObject; - * }); - * ``` - * - *
- * **Note:** Any unspecified options will use the default value. You can see the default values below. - *
- * - * Therefore the above can be simplified as: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * link: function postLink(scope, iElement, iAttrs) { ... } - * }; - * return directiveDefinitionObject; - * // or - * // return function postLink(scope, iElement, iAttrs) { ... } - * }); - * ``` - * - * ### Life-cycle hooks - * Directive controllers can provide the following methods that are called by AngularJS at points in the life-cycle of the - * directive: - * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and - * had their bindings initialized (and before the pre & post linking functions for the directives on - * this element). This is a good place to put initialization code for your controller. - * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The - * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an - * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a - * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will - * also be called when your bindings are initialized. - * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on - * changes. Any actions that you wish to take in response to the changes that you detect must be - * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook - * could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not - * be detected by AngularJS's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; - * if detecting changes, you must store the previous value(s) for comparison to the current values. - * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing - * external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in - * the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent - * components will have their `$onDestroy()` hook called before child components. - * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link - * function this hook can be used to set up DOM event handlers and do direct DOM manipulation. - * Note that child elements that contain `templateUrl` directives will not have been compiled and linked since - * they are waiting for their template to load asynchronously and their own compilation and linking has been - * suspended until that occurs. - * - * #### Comparison with life-cycle hooks in the new Angular - * The new Angular also uses life-cycle hooks for its components. While the AngularJS life-cycle hooks are similar there are - * some differences that you should be aware of, especially when it comes to moving your code from AngularJS to Angular: - * - * * AngularJS hooks are prefixed with `$`, such as `$onInit`. Angular hooks are prefixed with `ng`, such as `ngOnInit`. - * * AngularJS hooks can be defined on the controller prototype or added to the controller inside its constructor. - * In Angular you can only define hooks on the prototype of the Component class. - * * Due to the differences in change-detection, you may get many more calls to `$doCheck` in AngularJS than you would to - * `ngDoCheck` in Angular. - * * Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be - * propagated throughout the application. - * Angular does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an - * error or do nothing depending upon the state of `enableProdMode()`. - * - * #### Life-cycle hook examples - * - * This example shows how you can check for mutations to a Date object even though the identity of the object - * has not changed. - * - * - * - * angular.module('do-check-module', []) - * .component('app', { - * template: - * 'Month: ' + - * 'Date: {{ $ctrl.date }}' + - * '', - * controller: function() { - * this.date = new Date(); - * this.month = this.date.getMonth(); - * this.updateDate = function() { - * this.date.setMonth(this.month); - * }; - * } - * }) - * .component('test', { - * bindings: { date: '<' }, - * template: - * '
{{ $ctrl.log | json }}
', - * controller: function() { - * var previousValue; - * this.log = []; - * this.$doCheck = function() { - * var currentValue = this.date && this.date.valueOf(); - * if (previousValue !== currentValue) { - * this.log.push('doCheck: date mutated: ' + this.date); - * previousValue = currentValue; - * } - * }; - * } - * }); - *
- * - * - * - *
- * - * This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the - * actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large - * arrays or objects can have a negative impact on your application performance.) - * - * - * - *
- * - * - *
{{ items }}
- * - *
- *
- * - * angular.module('do-check-module', []) - * .component('test', { - * bindings: { items: '<' }, - * template: - * '
{{ $ctrl.log | json }}
', - * controller: function() { - * this.log = []; - * - * this.$doCheck = function() { - * if (this.items_ref !== this.items) { - * this.log.push('doCheck: items changed'); - * this.items_ref = this.items; - * } - * if (!angular.equals(this.items_clone, this.items)) { - * this.log.push('doCheck: items mutated'); - * this.items_clone = angular.copy(this.items); - * } - * }; - * } - * }); - *
- *
- * - * - * ### Directive Definition Object - * - * The directive definition object provides instructions to the {@link ng.$compile - * compiler}. The attributes are: - * - * #### `multiElement` - * When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between - * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them - * together as the directive elements. It is recommended that this feature be used on directives - * which are not strictly behavioral (such as {@link ngClick}), and which - * do not manipulate or replace child nodes (such as {@link ngInclude}). - * - * #### `priority` - * When there are multiple directives defined on a single DOM element, sometimes it - * is necessary to specify the order in which the directives are applied. The `priority` is used - * to sort the directives before their `compile` functions get called. Priority is defined as a - * number. Directives with greater numerical `priority` are compiled first. Pre-link functions - * are also run in priority order, but post-link functions are run in reverse order. The order - * of directives with the same priority is undefined. The default priority is `0`. - * - * #### `terminal` - * If set to true then the current `priority` will be the last set of directives - * which will execute (any directives at the current priority will still execute - * as the order of execution on same `priority` is undefined). Note that expressions - * and other directives used in the directive's template will also be excluded from execution. - * - * #### `scope` - * The scope property can be `false`, `true`, or an object: - * - * * **`false` (default):** No scope will be created for the directive. The directive will use its - * parent's scope. - * - * * **`true`:** A new child scope that prototypically inherits from its parent will be created for - * the directive's element. If multiple directives on the same element request a new scope, - * only one new scope is created. - * - * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template. - * The 'isolate' scope differs from normal scope in that it does not prototypically - * inherit from its parent scope. This is useful when creating reusable components, which should not - * accidentally read or modify data in the parent scope. Note that an isolate scope - * directive without a `template` or `templateUrl` will not apply the isolate scope - * to its children elements. - * - * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the - * directive's element. These local properties are useful for aliasing values for templates. The keys in - * the object hash map to the name of the property on the isolate scope; the values define how the property - * is bound to the parent scope, via matching attributes on the directive's element: - * - * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is - * always a string since DOM attributes are strings. If no `attr` name is specified then the - * attribute name is assumed to be the same as the local name. Given `` and the isolate scope definition `scope: { localName:'@myAttr' }`, - * the directive's scope property `localName` will reflect the interpolated value of `hello - * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's - * scope. The `name` is read from the parent scope (not the directive's scope). - * - * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression - * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. - * If no `attr` name is specified then the attribute name is assumed to be the same as the local - * name. Given `` and the isolate scope definition `scope: { - * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the - * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in - * `localModel` and vice versa. If the binding expression is non-assignable, or if the attribute - * isn't optional and doesn't exist, an exception - * ({@link error/$compile/nonassign `$compile:nonassign`}) will be thrown upon discovering changes - * to the local value, since it will be impossible to sync them back to the parent scope. - * - * By default, the {@link ng.$rootScope.Scope#$watch `$watch`} - * method is used for tracking changes, and the equality check is based on object identity. - * However, if an object literal or an array literal is passed as the binding expression, the - * equality check is done by value (using the {@link angular.equals} function). It's also possible - * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection - * `$watchCollection`}: use `=*` or `=*attr` - * - * * `<` or `` and directive definition of - * `scope: { localModel:'` and the isolate scope definition `scope: { - * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for - * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope - * via an expression to the parent scope. This can be done by passing a map of local variable names - * and values into the expression wrapper fn. For example, if the expression is `increment(amount)` - * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`. - * - * All 4 kinds of bindings (`@`, `=`, `<`, and `&`) can be made optional by adding `?` to the expression. - * The marker must come after the mode and before the attribute name. - * See the {@link error/$compile/iscp Invalid Isolate Scope Definition error} for definition examples. - * This is useful to refine the interface directives provide. - * One subtle difference between optional and non-optional happens **when the binding attribute is not - * set**: - * - the binding is optional: the property will not be defined - * - the binding is not optional: the property is defined - * - * ```js - *app.directive('testDir', function() { - return { - scope: { - notoptional: '=', - optional: '=?', - }, - bindToController: true, - controller: function() { - this.$onInit = function() { - console.log(this.hasOwnProperty('notoptional')) // true - console.log(this.hasOwnProperty('optional')) // false - } - } - } - }) - *``` - * - * - * ##### Combining directives with different scope defintions - * - * In general it's possible to apply more than one directive to one element, but there might be limitations - * depending on the type of scope required by the directives. The following points will help explain these limitations. - * For simplicity only two directives are taken into account, but it is also applicable for several directives: - * - * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope - * * **child scope** + **no scope** => Both directives will share one single child scope - * * **child scope** + **child scope** => Both directives will share one single child scope - * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use - * its parent's scope - * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot - * be applied to the same element. - * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives - * cannot be applied to the same element. - * - * - * #### `bindToController` - * This property is used to bind scope properties directly to the controller. It can be either - * `true` or an object hash with the same format as the `scope` property. - * - * When an isolate scope is used for a directive (see above), `bindToController: true` will - * allow a component to have its properties bound to the controller, rather than to scope. - * - * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller - * properties. You can access these bindings once they have been initialized by providing a controller method called - * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings - * initialized. - * - * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property. - * This will set up the scope bindings to the controller directly. Note that `scope` can still be used - * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate - * scope (useful for component directives). - * - * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`. - * - * - * #### `controller` - * Controller constructor function. The controller is instantiated before the - * pre-linking phase and can be accessed by other directives (see - * `require` attribute). This allows the directives to communicate with each other and augment - * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals: - * - * * `$scope` - Current scope associated with the element - * * `$element` - Current element - * * `$attrs` - Current attributes object for the element - * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: - * `function([scope], cloneLinkingFn, futureParentElement, slotName)`: - * * `scope`: (optional) override the scope. - * * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content. - * * `futureParentElement` (optional): - * * defines the parent to which the `cloneLinkingFn` will add the cloned elements. - * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`. - * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) - * and when the `cloneLinkingFn` is passed, - * as those elements need to created and cloned in a special way when they are defined outside their - * usual containers (e.g. like ``). - * * See also the `directive.templateNamespace` property. - * * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`) - * then the default transclusion is provided. - * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns - * `true` if the specified slot contains content (i.e. one or more DOM nodes). - * - * #### `require` - * Require another directive and inject its controller as the fourth argument to the linking function. The - * `require` property can be a string, an array or an object: - * * a **string** containing the name of the directive to pass to the linking function - * * an **array** containing the names of directives to pass to the linking function. The argument passed to the - * linking function will be an array of controllers in the same order as the names in the `require` property - * * an **object** whose property values are the names of the directives to pass to the linking function. The argument - * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding - * controllers. - * - * If the `require` property is an object and `bindToController` is truthy, then the required controllers are - * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers - * have been constructed but before `$onInit` is called. - * If the name of the required controller is the same as the local name (the key), the name can be - * omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`. - * See the {@link $compileProvider#component} helper for an example of how this can be used. - * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is - * raised (unless no link function is specified and the required controllers are not being bound to the directive - * controller, in which case error checking is skipped). The name can be prefixed with: - * - * * (no prefix) - Locate the required controller on the current element. Throw an error if not found. - * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found. - * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found. - * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found. - * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass - * `null` to the `link` fn if not found. - * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass - * `null` to the `link` fn if not found. - * - * - * #### `controllerAs` - * Identifier name for a reference to the controller in the directive's scope. - * This allows the controller to be referenced from the directive template. This is especially - * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible - * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the - * `controllerAs` reference might overwrite a property that already exists on the parent scope. - * - * - * #### `restrict` - * String of subset of `EACM` which restricts the directive to a specific directive - * declaration style. If omitted, the defaults (elements and attributes) are used. - * - * * `E` - Element name (default): `` - * * `A` - Attribute (default): `
` - * * `C` - Class: `
` - * * `M` - Comment: `` - * - * - * #### `templateNamespace` - * String representing the document type used by the markup in the template. - * AngularJS needs this information as those elements need to be created and cloned - * in a special way when they are defined outside their usual containers like `` and ``. - * - * * `html` - All root nodes in the template are HTML. Root nodes may also be - * top-level elements such as `` or ``. - * * `svg` - The root nodes in the template are SVG elements (excluding ``). - * * `math` - The root nodes in the template are MathML elements (excluding ``). - * - * If no `templateNamespace` is specified, then the namespace is considered to be `html`. - * - * #### `template` - * HTML markup that may: - * * Replace the contents of the directive's element (default). - * * Replace the directive's element itself (if `replace` is true - DEPRECATED). - * * Wrap the contents of the directive's element (if `transclude` is true). - * - * Value may be: - * - * * A string. For example `
{{delete_str}}
`. - * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile` - * function api below) and returns a string value. - * - * - * #### `templateUrl` - * This is similar to `template` but the template is loaded from the specified URL, asynchronously. - * - * Because template loading is asynchronous the compiler will suspend compilation of directives on that element - * for later when the template has been resolved. In the meantime it will continue to compile and link - * sibling and parent elements as though this element had not contained any directives. - * - * The compiler does not suspend the entire compilation to wait for templates to be loaded because this - * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the - * case when only one deeply nested directive has `templateUrl`. - * - * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}. - * - * You can specify `templateUrl` as a string representing the URL or as a function which takes two - * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns - * a string value representing the url. In either case, the template URL is passed through {@link - * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}. - * - * - * #### `replace` - *
- * **Note:** `replace` is deprecated in AngularJS and has been removed in the new Angular (v2+). - *
- * - * Specifies what the template should replace. Defaults to `false`. - * - * * `true` - the template will replace the directive's element. - * * `false` - the template will replace the contents of the directive's element. - * - * The replacement process migrates all of the attributes / classes from the old element to the new - * one. See the {@link guide/directive#template-expanding-directive - * Directives Guide} for an example. - * - * There are very few scenarios where element replacement is required for the application function, - * the main one being reusable custom components that are used within SVG contexts - * (because SVG doesn't work with custom elements in the DOM tree). - * - * #### `transclude` - * Extract the contents of the element where the directive appears and make it available to the directive. - * The contents are compiled and provided to the directive as a **transclusion function**. See the - * {@link $compile#transclusion Transclusion} section below. - * - * - * #### `compile` - * - * ```js - * function compile(tElement, tAttrs, transclude) { ... } - * ``` - * - * The compile function deals with transforming the template DOM. Since most directives do not do - * template transformation, it is not used often. The compile function takes the following arguments: - * - * * `tElement` - template element - The element where the directive has been declared. It is - * safe to do template transformation on the element and child elements only. - * - * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared - * between all directive compile functions. - * - * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)` - * - *
- * **Note:** The template instance and the link instance may be different objects if the template has - * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that - * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration - * should be done in a linking function rather than in a compile function. - *
- - *
- * **Note:** The compile function cannot handle directives that recursively use themselves in their - * own templates or compile functions. Compiling these directives results in an infinite loop and - * stack overflow errors. - * - * This can be avoided by manually using `$compile` in the postLink function to imperatively compile - * a directive's template instead of relying on automatic template compilation via `template` or - * `templateUrl` declaration or manual compilation inside the compile function. - *
- * - *
- * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it - * e.g. does not know about the right outer scope. Please use the transclude function that is passed - * to the link function instead. - *
- - * A compile function can have a return value which can be either a function or an object. - * - * * returning a (post-link) function - is equivalent to registering the linking function via the - * `link` property of the config object when the compile function is empty. - * - * * returning an object with function(s) registered via `pre` and `post` properties - allows you to - * control when a linking function should be called during the linking phase. See info about - * pre-linking and post-linking functions below. - * - * - * #### `link` - * This property is used only if the `compile` property is not defined. - * - * ```js - * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... } - * ``` - * - * The link function is responsible for registering DOM listeners as well as updating the DOM. It is - * executed after the template has been cloned. This is where most of the directive logic will be - * put. - * - * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the - * directive for registering {@link ng.$rootScope.Scope#$watch watches}. - * - * * `iElement` - instance element - The element where the directive is to be used. It is safe to - * manipulate the children of the element only in `postLink` function since the children have - * already been linked. - * - * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared - * between all directive linking functions. - * - * * `controller` - the directive's required controller instance(s) - Instances are shared - * among all directives, which allows the directives to use the controllers as a communication - * channel. The exact value depends on the directive's `require` property: - * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one - * * `string`: the controller instance - * * `array`: array of controller instances - * - * If a required controller cannot be found, and it is optional, the instance is `null`, - * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown. - * - * Note that you can also require the directive's own controller - it will be made available like - * any other controller. - * - * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope. - * This is the same as the `$transclude` parameter of directive controllers, - * see {@link ng.$compile#-controller- the controller section for details}. - * `function([scope], cloneLinkingFn, futureParentElement)`. - * - * #### Pre-linking function - * - * Executed before the child elements are linked. Not safe to do DOM transformation since the - * compiler linking function will fail to locate the correct elements for linking. - * - * #### Post-linking function - * - * Executed after the child elements are linked. - * - * Note that child elements that contain `templateUrl` directives will not have been compiled - * and linked since they are waiting for their template to load asynchronously and their own - * compilation and linking has been suspended until that occurs. - * - * It is safe to do DOM transformation in the post-linking function on elements that are not waiting - * for their async templates to be resolved. - * - * - * ### Transclusion - * - * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and - * copying them to another part of the DOM, while maintaining their connection to the original AngularJS - * scope from where they were taken. - * - * Transclusion is used (often with {@link ngTransclude}) to insert the - * original contents of a directive's element into a specified place in the template of the directive. - * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded - * content has access to the properties on the scope from which it was taken, even if the directive - * has isolated scope. - * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}. - * - * This makes it possible for the widget to have private state for its template, while the transcluded - * content has access to its originating scope. - * - *
- * **Note:** When testing an element transclude directive you must not place the directive at the root of the - * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives - * Testing Transclusion Directives}. - *
- * - * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the - * directive's element, the entire element or multiple parts of the element contents: - * - * * `true` - transclude the content (i.e. the child nodes) of the directive's element. - * * `'element'` - transclude the whole of the directive's element including any directives on this - * element that are defined at a lower priority than this directive. When used, the `template` - * property is ignored. - * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template. - * - * **Multi-slot transclusion** is declared by providing an object for the `transclude` property. - * - * This object is a map where the keys are the name of the slot to fill and the value is an element selector - * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`) - * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc). - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}. - * - * If the element selector is prefixed with a `?` then that slot is optional. - * - * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `` elements to - * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive. - * - * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements - * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call - * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and - * injectable into the directive's controller. - * - * - * #### Transclusion Functions - * - * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion - * function** to the directive's `link` function and `controller`. This transclusion function is a special - * **linking function** that will return the compiled contents linked to a new transclusion scope. - * - *
- * If you are just using {@link ngTransclude} then you don't need to worry about this function, since - * ngTransclude will deal with it for us. - *
- * - * If you want to manually control the insertion and removal of the transcluded content in your directive - * then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery - * object that contains the compiled DOM, which is linked to the correct transclusion scope. - * - * When you call a transclusion function you can pass in a **clone attach function**. This function accepts - * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded - * content and the `scope` is the newly created transclusion scope, which the clone will be linked to. - * - *
- * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function - * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope. - *
- * - * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone - * attach function**: - * - * ```js - * var transcludedContent, transclusionScope; - * - * $transclude(function(clone, scope) { - * element.append(clone); - * transcludedContent = clone; - * transclusionScope = scope; - * }); - * ``` - * - * Later, if you want to remove the transcluded content from your DOM then you should also destroy the - * associated transclusion scope: - * - * ```js - * transcludedContent.remove(); - * transclusionScope.$destroy(); - * ``` - * - *
- * **Best Practice**: if you intend to add and remove transcluded content manually in your directive - * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it), - * then you are also responsible for calling `$destroy` on the transclusion scope. - *
- * - * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat} - * automatically destroy their transcluded clones as necessary so you do not need to worry about this if - * you are simply using {@link ngTransclude} to inject the transclusion into your directive. - * - * - * #### Transclusion Scopes - * - * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion - * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed - * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it - * was taken. - * - * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look - * like this: - * - * ```html - *
- *
- *
- *
- *
- *
- * ``` - * - * The `$parent` scope hierarchy will look like this: - * - ``` - - $rootScope - - isolate - - transclusion - ``` - * - * but the scopes will inherit prototypically from different scopes to their `$parent`. - * - ``` - - $rootScope - - transclusion - - isolate - ``` - * - * - * ### Attributes - * - * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the - * `link()` or `compile()` functions. It has a variety of uses. - * - * * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways: - * `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access - * to the attributes. - * - * * *Directive inter-communication:* All directives share the same instance of the attributes - * object which allows the directives to use the attributes object as inter directive - * communication. - * - * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object - * allowing other directives to read the interpolated value. - * - * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes - * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also - * the only way to easily get the actual value because during the linking phase the interpolation - * hasn't been evaluated yet and so the value is at this time set to `undefined`. - * - * ```js - * function linkingFn(scope, elm, attrs, ctrl) { - * // get the attribute value - * console.log(attrs.ngModel); - * - * // change the attribute - * attrs.$set('ngModel', 'new value'); - * - * // observe changes to interpolated attribute - * attrs.$observe('ngModel', function(value) { - * console.log('ngModel has changed value to ' + value); - * }); - * } - * ``` - * - * ## Example - * - *
- * **Note**: Typically directives are registered with `module.directive`. The example below is - * to illustrate how `$compile` works. - *
- * - - - -
-
-
-
-
-
- - it('should auto compile', function() { - var textarea = $('textarea'); - var output = $('div[compile]'); - // The initial state reads 'Hello AngularJS'. - expect(output.getText()).toBe('Hello AngularJS'); - textarea.clear(); - textarea.sendKeys('{{name}}!'); - expect(output.getText()).toBe('AngularJS!'); - }); - -
- - * - * - * @param {string|DOMElement} element Element or HTML string to compile into a template function. - * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED. - * - *
- * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it - * e.g. will not use the right outer scope. Please pass the transclude function as a - * `parentBoundTranscludeFn` to the link function instead. - *
- * - * @param {number} maxPriority only apply directives lower than given priority (Only effects the - * root element(s), not their children) - * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template - * (a DOM element/tree) to a scope. Where: - * - * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. - * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the - * `template` and call the `cloneAttachFn` function allowing the caller to attach the - * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is - * called as:
`cloneAttachFn(clonedElement, scope)` where: - * - * * `clonedElement` - is a clone of the original `element` passed into the compiler. - * * `scope` - is the current scope with which the linking function is working with. - * - * * `options` - An optional object hash with linking options. If `options` is provided, then the following - * keys may be used to control linking behavior: - * - * * `parentBoundTranscludeFn` - the transclude function made available to - * directives; if given, it will be passed through to the link functions of - * directives found in `element` during compilation. - * * `transcludeControllers` - an object hash with keys that map controller names - * to a hash with the key `instance`, which maps to the controller instance; - * if given, it will make the controllers available to directives on the compileNode: - * ``` - * { - * parent: { - * instance: parentControllerInstance - * } - * } - * ``` - * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add - * the cloned elements; only needed for transcludes that are allowed to contain non HTML - * elements (e.g. SVG elements). See also the `directive.controller` property. - * - * Calling the linking function returns the element of the template. It is either the original - * element passed in, or the clone of the element if the `cloneAttachFn` is provided. - * - * After linking the view is not updated until after a call to `$digest`, which typically is done by - * AngularJS automatically. - * - * If you need access to the bound view, there are two ways to do it: - * - * - If you are not asking the linking function to clone the template, create the DOM element(s) - * before you send them to the compiler and keep this reference around. - * ```js - * var element = angular.element('

{{total}}

'); - * $compile(element)(scope); - * ``` - * - * - if on the other hand, you need the element to be cloned, the view reference from the original - * example would not point to the clone, but rather to the original template that was cloned. In - * this case, you can access the clone either via the `cloneAttachFn` or the value returned by the - * linking function: - * ```js - * var templateElement = angular.element('

{{total}}

'); - * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) { - * // Attach the clone to DOM document at the right place. - * }); - * - * // Now we have reference to the cloned DOM via `clonedElement`. - * // NOTE: The `clonedElement` returned by the linking function is the same as the - * // `clonedElement` passed to `cloneAttachFn`. - * ``` - * - * - * For information on how the compiler works, see the - * {@link guide/compiler AngularJS HTML Compiler} section of the Developer Guide. - * - * @knownIssue - * - * ### Double Compilation - * - Double compilation occurs when an already compiled part of the DOM gets - compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues, - and memory leaks. Refer to the Compiler Guide {@link guide/compiler#double-compilation-and-how-to-avoid-it - section on double compilation} for an in-depth explanation and ways to avoid it. - - * @knownIssue - - ### Issues with `replace: true` - * - *
- * **Note**: {@link $compile#-replace- `replace: true`} is deprecated and not recommended to use, - * mainly due to the issues listed here. It has been completely removed in the new Angular. - *
- * - * #### Attribute values are not merged - * - * When a `replace` directive encounters the same attribute on the original and the replace node, - * it will simply deduplicate the attribute and join the values with a space or with a `;` in case of - * the `style` attribute. - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * That means attributes that contain AngularJS expressions will not be merged correctly, e.g. - * {@link ngShow} or {@link ngClass} will cause a {@link $parse} error: - * - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * See issue [#5695](https://github.com/angular/angular.js/issues/5695). - * - * #### Directives are not deduplicated before compilation - * - * When the original node and the replace template declare the same directive(s), they will be - * {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler - * does not deduplicate them. In many cases, this is not noticable, but e.g. {@link ngModel} will - * attach `$formatters` and `$parsers` twice. - * - * See issue [#2573](https://github.com/angular/angular.js/issues/2573). - * - * #### `transclude: element` in the replace template root can have unexpected effects - * - * When the replace template has a directive at the root node that uses - * {@link $compile#-transclude- `transclude: element`}, e.g. - * {@link ngIf} or {@link ngRepeat}, the DOM structure or scope inheritance can be incorrect. - * See the following issues: - * - * - Incorrect scope on replaced element: - * [#9837](https://github.com/angular/angular.js/issues/9837) - * - Different DOM between `template` and `templateUrl`: - * [#10612](https://github.com/angular/angular.js/issues/14326) - * - */ - -/** - * @ngdoc directive - * @name ngProp - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "propName"): - * - * - * ```html - * - * - * ``` - * - * - * @description - * The `ngProp` directive binds an expression to a DOM element property. - * `ngProp` allows writing to arbitrary properties by including - * the property name in the attribute, e.g. `ng-prop-value="'my value'"` binds 'my value' to - * the `value` property. - * - * Usually, it's not necessary to write to properties in AngularJS, as the built-in directives - * handle the most common use cases (instead of the above example, you would use {@link ngValue}). - * - * However, [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements) - * often use custom properties to hold data, and `ngProp` can be used to provide input to these - * custom elements. - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `innerHTML` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `innerHTML` must be written as `ng-prop-inner_h_t_m_l="expression"` (Note that this is just an - * example, and for binding HTML {@link ngBindHtml} should be used. - * - * ## Security - * - * Binding expressions to arbitrary properties poses a security risk, as properties like `innerHTML` - * can insert potentially dangerous HTML into the application, e.g. script tags that execute - * malicious code. - * For this reason, `ngProp` applies Strict Contextual Escaping with the {@link ng.$sce $sce service}. - * This means vulnerable properties require their content to be "trusted", based on the - * context of the property. For example, the `innerHTML` is in the `HTML` context, and the - * `iframe.src` property is in the `RESOURCE_URL` context, which requires that values written to - * this property are trusted as a `RESOURCE_URL`. - * - * This can be set explicitly by calling $sce.trustAs(type, value) on the value that is - * trusted before passing it to the `ng-prop-*` directive. There are exist shorthand methods for - * each context type in the form of {@link ng.$sce#trustAsResourceUrl $sce.trustAsResourceUrl()} et al. - * - * In some cases you can also rely upon automatic sanitization of untrusted values - see below. - * - * Based on the context, other options may exist to mark a value as trusted / configure the behavior - * of {@link ng.$sce}. For example, to restrict the `RESOURCE_URL` context to specific origins, use - * the {@link $sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist()} - * and {@link $sceDelegateProvider#resourceUrlBlacklist resourceUrlBlacklist()}. - * - * {@link ng.$sce#what-trusted-context-types-are-supported- Find out more about the different context types}. - * - * ### HTML Sanitization - * - * By default, `$sce` will throw an error if it detects untrusted HTML content, and will not bind the - * content. - * However, if you include the {@link ngSanitize ngSanitize module}, it will try to sanitize the - * potentially dangerous HTML, e.g. strip non-whitelisted tags and attributes when binding to - * `innerHTML`. - * - * @example - * ### Binding to different contexts - * - * - * - * angular.module('exampleNgProp', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
- *
- * Binding to a property without security context: - *
- * innerText (safeContent) - *
- * - *
- * "Safe" content that requires a security context will throw because the contents could potentially be dangerous ... - *
- * innerHTML (safeContent) - *
- * - *
- * ... so that actually dangerous content cannot be executed: - *
- * innerHTML (unsafeContent) - *
- * - *
- * ... but unsafe Content that has been trusted explicitly works - only do this if you are 100% sure! - *
- * innerHTML (trustedUnsafeContent) - *
- *
- *
- * - *
- *
- * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
- * - * - * @example - * ### Binding to innerHTML with ngSanitize - * - * - * - * angular.module('exampleNgProp', ['ngSanitize']) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
- *
- * "Safe" content will be sanitized ... - *
- * innerHTML (safeContent) - *
- * - *
- * ... as will dangerous content: - *
- * innerHTML (unsafeContent) - *
- * - *
- * ... and content that has been trusted explicitly works the same as without ngSanitize: - *
- * innerHTML (trustedUnsafeContent) - *
- *
- *
- * - *
- *
- * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
- * - */ - -/** @ngdoc directive - * @name ngOn - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "eventName"): - * - * - * ```html - * - * - * ``` - * - * @description - * The `ngOn` directive adds an event listener to a DOM element via - * {@link angular.element angular.element().on()}, and evaluates an expression when the event is - * fired. - * `ngOn` allows adding listeners for arbitrary events by including - * the event name in the attribute, e.g. `ng-on-drop="onDrop()"` executes the 'onDrop()' expression - * when the `drop` event is fired. - * - * AngularJS provides specific directives for many events, such as {@link ngClick}, so in most - * cases it is not necessary to use `ngOn`. However, AngularJS does not support all events - * (e.g. the `drop` event in the example above), and new events might be introduced in later DOM - * standards. - * - * Another use-case for `ngOn` is listening to - * [custom events](https://developer.mozilla.org/docs/Web/Guide/Events/Creating_and_triggering_events) - * fired by - * [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements). - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `myEvent` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `myEvent` must be written as `ng-on-my_event="expression"`. - * - * @example - * ### Bind to built-in DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.clickCount = 0; - * this.mouseoverCount = 0; - * - * this.loadingState = 0; - * } - * }); - * - * - *
- * This is equivalent to `ngClick` and `ngMouseover`:
- *
- * clickCount: {{$ctrl.clickCount}}
- * mouseover: {{$ctrl.mouseoverCount}} - * - *
- * - * For the `error` and `load` event on images no built-in AngularJS directives exist:
- *
- *
- * Image is loading - * Image load error - * Image loaded successfully - *
- *
- *
- * - *
- *
- *
- * - * - * @example - * ### Bind to custom DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.eventLog = ''; - * - * this.listener = function($event) { - * this.eventLog = 'Event with type "' + $event.type + '" fired at ' + $event.detail; - * }; - * } - * }) - * .component('childComponent', { - * templateUrl: 'child.html', - * controller: function($element) { - * this.fireEvent = function() { - * var event = new CustomEvent('customtype', { detail: new Date()}); - * - * $element[0].dispatchEvent(event); - * }; - * } - * }); - * - * - *
- * Event log: {{$ctrl.eventLog}} - *
- * - - * - * - *
- *
- *
- */ - -var $compileMinErr = minErr('$compile'); - -function UNINITIALIZED_VALUE() {} -var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE(); - -/** - * @ngdoc provider - * @name $compileProvider - * - * @description - */ -$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; -/** @this */ -function $CompileProvider($provide, $$sanitizeUriProvider) { - var hasDirectives = {}, - Suffix = 'Directive', - COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, - CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, - ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), - REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; - - // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes - // The assumption is that future DOM event attribute names will begin with - // 'on' and be composed of only English letters. - var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; - var bindingCache = createMap(); - - function parseIsolateBindings(scope, directiveName, isController) { - var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/; - - var bindings = createMap(); - - forEach(scope, function(definition, scopeName) { - definition = definition.trim(); - - if (definition in bindingCache) { - bindings[scopeName] = bindingCache[definition]; - return; - } - var match = definition.match(LOCAL_REGEXP); - - if (!match) { - throw $compileMinErr('iscp', - 'Invalid {3} for directive \'{0}\'.' + - ' Definition: {... {1}: \'{2}\' ...}', - directiveName, scopeName, definition, - (isController ? 'controller bindings definition' : - 'isolate scope definition')); - } - - bindings[scopeName] = { - mode: match[1][0], - collection: match[2] === '*', - optional: match[3] === '?', - attrName: match[4] || scopeName - }; - if (match[4]) { - bindingCache[definition] = bindings[scopeName]; - } - }); - - return bindings; - } - - function parseDirectiveBindings(directive, directiveName) { - var bindings = { - isolateScope: null, - bindToController: null - }; - if (isObject(directive.scope)) { - if (directive.bindToController === true) { - bindings.bindToController = parseIsolateBindings(directive.scope, - directiveName, true); - bindings.isolateScope = {}; - } else { - bindings.isolateScope = parseIsolateBindings(directive.scope, - directiveName, false); - } - } - if (isObject(directive.bindToController)) { - bindings.bindToController = - parseIsolateBindings(directive.bindToController, directiveName, true); - } - if (bindings.bindToController && !directive.controller) { - // There is no controller - throw $compileMinErr('noctrl', - 'Cannot bind to controller without directive \'{0}\'s controller.', - directiveName); - } - return bindings; - } - - function assertValidDirectiveName(name) { - var letter = name.charAt(0); - if (!letter || letter !== lowercase(letter)) { - throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name); - } - if (name !== name.trim()) { - throw $compileMinErr('baddir', - 'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces', - name); - } - } - - function getDirectiveRequire(directive) { - var require = directive.require || (directive.controller && directive.name); - - if (!isArray(require) && isObject(require)) { - forEach(require, function(value, key) { - var match = value.match(REQUIRE_PREFIX_REGEXP); - var name = value.substring(match[0].length); - if (!name) require[key] = match[0] + key; - }); - } - - return require; - } - - function getDirectiveRestrict(restrict, name) { - if (restrict && !(isString(restrict) && /[EACM]/.test(restrict))) { - throw $compileMinErr('badrestrict', - 'Restrict property \'{0}\' of directive \'{1}\' is invalid', - restrict, - name); - } - - return restrict || 'EA'; - } - - /** - * @ngdoc method - * @name $compileProvider#directive - * @kind function - * - * @description - * Register a new directive with the compiler. - * - * @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match - * as `ng-bind`), or an object map of directives where the keys are the names and the values - * are the factories. - * @param {Function|Array} directiveFactory An injectable directive factory function. See the - * {@link guide/directive directive guide} and the {@link $compile compile API} for more info. - * @returns {ng.$compileProvider} Self for chaining. - */ - this.directive = function registerDirective(name, directiveFactory) { - assertArg(name, 'name'); - assertNotHasOwnProperty(name, 'directive'); - if (isString(name)) { - assertValidDirectiveName(name); - assertArg(directiveFactory, 'directiveFactory'); - if (!hasDirectives.hasOwnProperty(name)) { - hasDirectives[name] = []; - $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', - function($injector, $exceptionHandler) { - var directives = []; - forEach(hasDirectives[name], function(directiveFactory, index) { - try { - var directive = $injector.invoke(directiveFactory); - if (isFunction(directive)) { - directive = { compile: valueFn(directive) }; - } else if (!directive.compile && directive.link) { - directive.compile = valueFn(directive.link); - } - directive.priority = directive.priority || 0; - directive.index = index; - directive.name = directive.name || name; - directive.require = getDirectiveRequire(directive); - directive.restrict = getDirectiveRestrict(directive.restrict, name); - directive.$$moduleName = directiveFactory.$$moduleName; - directives.push(directive); - } catch (e) { - $exceptionHandler(e); - } - }); - return directives; - }]); - } - hasDirectives[name].push(directiveFactory); - } else { - forEach(name, reverseParams(registerDirective)); - } - return this; - }; - - /** - * @ngdoc method - * @name $compileProvider#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}), - * with the following properties (all optional): - * - * - `controller` – `{(string|function()=}` – controller constructor function that should be - * associated with newly created scope or the name of a {@link ng.$compile#-controller- - * registered controller} if passed as a string. An empty `noop` function by default. - * - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope. - * If present, the controller will be published to scope under the `controllerAs` name. - * If not present, this will default to be `$ctrl`. - * - `template` – `{string=|function()=}` – html template as a string or a function that - * returns an html template as a string which should be used as the contents of this component. - * Empty string by default. - * - * If `template` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html - * template that should be used as the contents of this component. - * - * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties. - * Component properties are always bound to the component controller and not to the scope. - * See {@link ng.$compile#-bindtocontroller- `bindToController`}. - * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled. - * Disabled by default. - * - `require` - `{Object=}` - requires the controllers of other directives and binds them to - * this component's controller. The object keys specify the property names under which the required - * controllers (object values) will be bound. See {@link ng.$compile#-require- `require`}. - * - `$...` – additional properties to attach to the directive factory function and the controller - * constructor function. (This is used by the component router to annotate) - * - * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls. - * @description - * Register a **component definition** with the compiler. This is a shorthand for registering a special - * type of directive, which represents a self-contained UI component in your application. Such components - * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`). - * - * Component definitions are very simple and do not require as much configuration as defining general - * directives. Component definitions usually consist only of a template and a controller backing it. - * - * In order to make the definition easier, components enforce best practices like use of `controllerAs`, - * `bindToController`. They always have **isolate scope** and are restricted to elements. - * - * Here are a few examples of how you would usually define components: - * - * ```js - * var myMod = angular.module(...); - * myMod.component('myComp', { - * template: '
My name is {{$ctrl.name}}
', - * controller: function() { - * this.name = 'shahar'; - * } - * }); - * - * myMod.component('myComp', { - * template: '
My name is {{$ctrl.name}}
', - * bindings: {name: '@'} - * }); - * - * myMod.component('myComp', { - * templateUrl: 'views/my-comp.html', - * controller: 'MyCtrl', - * controllerAs: 'ctrl', - * bindings: {name: '@'} - * }); - * - * ``` - * For more examples, and an in-depth guide, see the {@link guide/component component guide}. - * - *
- * See also {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - this.component = function registerComponent(name, options) { - if (!isString(name)) { - forEach(name, reverseParams(bind(this, registerComponent))); - return this; - } - - var controller = options.controller || function() {}; - - function factory($injector) { - function makeInjectable(fn) { - if (isFunction(fn) || isArray(fn)) { - return /** @this */ function(tElement, tAttrs) { - return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs}); - }; - } else { - return fn; - } - } - - var template = (!options.template && !options.templateUrl ? '' : options.template); - var ddo = { - controller: controller, - controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl', - template: makeInjectable(template), - templateUrl: makeInjectable(options.templateUrl), - transclude: options.transclude, - scope: {}, - bindToController: options.bindings || {}, - restrict: 'E', - require: options.require - }; - - // Copy annotations (starting with $) over to the DDO - forEach(options, function(val, key) { - if (key.charAt(0) === '$') ddo[key] = val; - }); - - return ddo; - } - - // TODO(pete) remove the following `forEach` before we release 1.6.0 - // The component-router@0.2.0 looks for the annotations on the controller constructor - // Nothing in AngularJS looks for annotations on the factory function but we can't remove - // it from 1.5.x yet. - - // Copy any annotation properties (starting with $) over to the factory and controller constructor functions - // These could be used by libraries such as the new component router - forEach(options, function(val, key) { - if (key.charAt(0) === '$') { - factory[key] = val; - // Don't try to copy over annotations to named controller - if (isFunction(controller)) controller[key] = val; - } - }); - - factory.$inject = ['$injector']; - - return this.directive(name, factory); - }; - - - /** - * @ngdoc method - * @name $compileProvider#aHrefSanitizationWhitelist - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at preventing XSS attacks via html links. - * - * Any url about to be assigned to a[href] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp); - return this; - } else { - return $$sanitizeUriProvider.aHrefSanitizationWhitelist(); - } - }; - - - /** - * @ngdoc method - * @name $compileProvider#imgSrcSanitizationWhitelist - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via html links. - * - * Any url about to be assigned to img[src] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp); - return this; - } else { - return $$sanitizeUriProvider.imgSrcSanitizationWhitelist(); - } - }; - - /** - * @ngdoc method - * @name $compileProvider#debugInfoEnabled - * - * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the - * current debugInfoEnabled state - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable/disable various debug runtime information in the compiler such as adding - * binding information and a reference to the current scope on to DOM elements. - * If enabled, the compiler will add the following to DOM elements that have been bound to the scope - * * `ng-binding` CSS class - * * `ng-scope` and `ng-isolated-scope` CSS classes - * * `$binding` data property containing an array of the binding expressions - * * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return - * the element's scope. - * * Placeholder comments will contain information about what directive and binding caused the placeholder. - * E.g. ``. - * - * You may want to disable this in production for a significant performance boost. See - * {@link guide/production#disabling-debug-data Disabling Debug Data} for more. - * - * The default value is true. - */ - var debugInfoEnabled = true; - this.debugInfoEnabled = function(enabled) { - if (isDefined(enabled)) { - debugInfoEnabled = enabled; - return this; - } - return debugInfoEnabled; - }; - - /** - * @ngdoc method - * @name $compileProvider#strictComponentBindingsEnabled - * - * @param {boolean=} enabled update the strictComponentBindingsEnabled state if provided, - * otherwise return the current strictComponentBindingsEnabled state. - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable / disable the strict component bindings check. If enabled, the - * compiler will enforce that all scope / controller bindings of a - * {@link $compileProvider#directive directive} / {@link $compileProvider#component component} - * that are not set as optional with `?`, must be provided when the directive is instantiated. - * If not provided, the compiler will throw the - * {@link error/$compile/missingattr $compile:missingattr error}. - * - * The default value is false. - */ - var strictComponentBindingsEnabled = false; - this.strictComponentBindingsEnabled = function(enabled) { - if (isDefined(enabled)) { - strictComponentBindingsEnabled = enabled; - return this; - } - return strictComponentBindingsEnabled; - }; - - var TTL = 10; - /** - * @ngdoc method - * @name $compileProvider#onChangesTtl - * @description - * - * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result - * in several iterations of calls to these hooks. However if an application needs more than the default 10 - * iterations to stabilize then you should investigate what is causing the model to continuously change during - * the `$onChanges` hook execution. - * - * Increasing the TTL could have performance implications, so you should not change it without proper justification. - * - * @param {number} limit The number of `$onChanges` hook iterations. - * @returns {number|object} the current limit (or `this` if called as a setter for chaining) - */ - this.onChangesTtl = function(value) { - if (arguments.length) { - TTL = value; - return this; - } - return TTL; - }; - - var commentDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#commentDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on comments should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on comments for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check comments when looking for directives. - * This should however only be used if you are sure that no comment directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on comments - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.commentDirectivesEnabled = function(value) { - if (arguments.length) { - commentDirectivesEnabledConfig = value; - return this; - } - return commentDirectivesEnabledConfig; - }; - - - var cssClassDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#cssClassDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on element classes should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on element classes for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check element classes when looking for directives. - * This should however only be used if you are sure that no class directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on element classes - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.cssClassDirectivesEnabled = function(value) { - if (arguments.length) { - cssClassDirectivesEnabledConfig = value; - return this; - } - return cssClassDirectivesEnabledConfig; - }; - - - /** - * The security context of DOM Properties. - * @private - */ - var PROP_CONTEXTS = createMap(); - - /** - * @ngdoc method - * @name $compileProvider#addPropertySecurityContext - * @description - * - * Defines the security context for DOM properties bound by ng-prop-*. - * - * @param {string} elementName The element name or '*' to match any element. - * @param {string} propertyName The DOM property name. - * @param {string} ctx The {@link $sce} security context in which this value is safe for use, e.g. `$sce.URL` - * @returns {object} `this` for chaining - */ - this.addPropertySecurityContext = function(elementName, propertyName, ctx) { - var key = (elementName.toLowerCase() + '|' + propertyName.toLowerCase()); - - if (key in PROP_CONTEXTS && PROP_CONTEXTS[key] !== ctx) { - throw $compileMinErr('ctxoverride', 'Property context \'{0}.{1}\' already set to \'{2}\', cannot override to \'{3}\'.', elementName, propertyName, PROP_CONTEXTS[key], ctx); - } - - PROP_CONTEXTS[key] = ctx; - return this; - }; - - /* Default property contexts. - * - * Copy of https://github.com/angular/angular/blob/6.0.6/packages/compiler/src/schema/dom_security_schema.ts#L31-L58 - * Changing: - * - SecurityContext.* => SCE_CONTEXTS/$sce.* - * - STYLE => CSS - * - various URL => MEDIA_URL - * - *|formAction, form|action URL => RESOURCE_URL (like the attribute) - */ - (function registerNativePropertyContexts() { - function registerContext(ctx, values) { - forEach(values, function(v) { PROP_CONTEXTS[v.toLowerCase()] = ctx; }); - } - - registerContext(SCE_CONTEXTS.HTML, [ - 'iframe|srcdoc', - '*|innerHTML', - '*|outerHTML' - ]); - registerContext(SCE_CONTEXTS.CSS, ['*|style']); - registerContext(SCE_CONTEXTS.URL, [ - 'area|href', 'area|ping', - 'a|href', 'a|ping', - 'blockquote|cite', - 'body|background', - 'del|cite', - 'input|src', - 'ins|cite', - 'q|cite' - ]); - registerContext(SCE_CONTEXTS.MEDIA_URL, [ - 'audio|src', - 'img|src', 'img|srcset', - 'source|src', 'source|srcset', - 'track|src', - 'video|src', 'video|poster' - ]); - registerContext(SCE_CONTEXTS.RESOURCE_URL, [ - '*|formAction', - 'applet|code', 'applet|codebase', - 'base|href', - 'embed|src', - 'frame|src', - 'form|action', - 'head|profile', - 'html|manifest', - 'iframe|src', - 'link|href', - 'media|src', - 'object|codebase', 'object|data', - 'script|src' - ]); - })(); - - - this.$get = [ - '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse', - '$controller', '$rootScope', '$sce', '$animate', - function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse, - $controller, $rootScope, $sce, $animate) { - - var SIMPLE_ATTR_NAME = /^\w/; - var specialAttrHolder = window.document.createElement('div'); - - - var commentDirectivesEnabled = commentDirectivesEnabledConfig; - var cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig; - - - var onChangesTtl = TTL; - // The onChanges hooks should all be run together in a single digest - // When changes occur, the call to trigger their hooks will be added to this queue - var onChangesQueue; - - // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest - function flushOnChangesQueue() { - try { - if (!(--onChangesTtl)) { - // We have hit the TTL limit so reset everything - onChangesQueue = undefined; - throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL); - } - // We must run this hook in an apply since the $$postDigest runs outside apply - $rootScope.$apply(function() { - for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) { - try { - onChangesQueue[i](); - } catch (e) { - $exceptionHandler(e); - } - } - // Reset the queue to trigger a new schedule next time there is a change - onChangesQueue = undefined; - }); - } finally { - onChangesTtl++; - } - } - - - function sanitizeSrcset(value, invokeType) { - if (!value) { - return value; - } - if (!isString(value)) { - throw $compileMinErr('srcset', 'Can\'t pass trusted values to `{0}`: "{1}"', invokeType, value.toString()); - } - - // Such values are a bit too complex to handle automatically inside $sce. - // Instead, we sanitize each of the URIs individually, which works, even dynamically. - - // It's not possible to work around this using `$sce.trustAsMediaUrl`. - // If you want to programmatically set explicitly trusted unsafe URLs, you should use - // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the - // `ng-bind-html` directive. - - var result = ''; - - // first check if there are spaces because it's not the same pattern - var trimmedSrcset = trim(value); - // ( 999x ,| 999w ,| ,|, ) - var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; - var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; - - // split srcset into tuple of uri and descriptor except for the last item - var rawUris = trimmedSrcset.split(pattern); - - // for each tuples - var nbrUrisWith2parts = Math.floor(rawUris.length / 2); - for (var i = 0; i < nbrUrisWith2parts; i++) { - var innerIdx = i * 2; - // sanitize the uri - result += $sce.getTrustedMediaUrl(trim(rawUris[innerIdx])); - // add the descriptor - result += ' ' + trim(rawUris[innerIdx + 1]); - } - - // split the last item into uri and descriptor - var lastTuple = trim(rawUris[i * 2]).split(/\s/); - - // sanitize the last uri - result += $sce.getTrustedMediaUrl(trim(lastTuple[0])); - - // and add the last descriptor if any - if (lastTuple.length === 2) { - result += (' ' + trim(lastTuple[1])); - } - return result; - } - - - function Attributes(element, attributesToCopy) { - if (attributesToCopy) { - var keys = Object.keys(attributesToCopy); - var i, l, key; - - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - this[key] = attributesToCopy[key]; - } - } else { - this.$attr = {}; - } - - this.$$element = element; - } - - Attributes.prototype = { - /** - * @ngdoc method - * @name $compile.directive.Attributes#$normalize - * @kind function - * - * @description - * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or - * `data-`) to its normalized, camelCase form. - * - * Also there is special case for Moz prefix starting with upper case letter. - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives} - * - * @param {string} name Name to normalize - */ - $normalize: directiveNormalize, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$addClass - * @kind function - * - * @description - * Adds the CSS class value specified by the classVal parameter to the element. If animations - * are enabled then an animation will be triggered for the class addition. - * - * @param {string} classVal The className value that will be added to the element - */ - $addClass: function(classVal) { - if (classVal && classVal.length > 0) { - $animate.addClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$removeClass - * @kind function - * - * @description - * Removes the CSS class value specified by the classVal parameter from the element. If - * animations are enabled then an animation will be triggered for the class removal. - * - * @param {string} classVal The className value that will be removed from the element - */ - $removeClass: function(classVal) { - if (classVal && classVal.length > 0) { - $animate.removeClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$updateClass - * @kind function - * - * @description - * Adds and removes the appropriate CSS class values to the element based on the difference - * between the new and old CSS class values (specified as newClasses and oldClasses). - * - * @param {string} newClasses The current CSS className value - * @param {string} oldClasses The former CSS className value - */ - $updateClass: function(newClasses, oldClasses) { - var toAdd = tokenDifference(newClasses, oldClasses); - if (toAdd && toAdd.length) { - $animate.addClass(this.$$element, toAdd); - } - - var toRemove = tokenDifference(oldClasses, newClasses); - if (toRemove && toRemove.length) { - $animate.removeClass(this.$$element, toRemove); - } - }, - - /** - * Set a normalized attribute on the element in a way such that all directives - * can share the attribute. This function properly handles boolean attributes. - * @param {string} key Normalized key. (ie ngAttribute) - * @param {string|boolean} value The value to set. If `null` attribute will be deleted. - * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. - * Defaults to true. - * @param {string=} attrName Optional none normalized name. Defaults to key. - */ - $set: function(key, value, writeAttr, attrName) { - // TODO: decide whether or not to throw an error if "class" - // is set through this function since it may cause $updateClass to - // become unstable. - - var node = this.$$element[0], - booleanKey = getBooleanAttrName(node, key), - aliasedKey = getAliasedAttrName(key), - observer = key, - nodeName; - - if (booleanKey) { - this.$$element.prop(key, value); - attrName = booleanKey; - } else if (aliasedKey) { - this[aliasedKey] = value; - observer = aliasedKey; - } - - this[key] = value; - - // translate normalized key to actual key - if (attrName) { - this.$attr[key] = attrName; - } else { - attrName = this.$attr[key]; - if (!attrName) { - this.$attr[key] = attrName = snake_case(key, '-'); - } - } - - nodeName = nodeName_(this.$$element); - - // Sanitize img[srcset] values. - if (nodeName === 'img' && key === 'srcset') { - this[key] = value = sanitizeSrcset(value, '$set(\'srcset\', value)'); - } - - if (writeAttr !== false) { - if (value === null || isUndefined(value)) { - this.$$element.removeAttr(attrName); - } else { - if (SIMPLE_ATTR_NAME.test(attrName)) { - // jQuery skips special boolean attrs treatment in XML nodes for - // historical reasons and hence AngularJS cannot freely call - // `.attr(attrName, false) with such attributes. To avoid issues - // in XHTML, call `removeAttr` in such cases instead. - // See https://github.com/jquery/jquery/issues/4249 - if (booleanKey && value === false) { - this.$$element.removeAttr(attrName); - } else { - this.$$element.attr(attrName, value); - } - } else { - setSpecialAttr(this.$$element[0], attrName, value); - } - } - } - - // fire observers - var $$observers = this.$$observers; - if ($$observers) { - forEach($$observers[observer], function(fn) { - try { - fn(value); - } catch (e) { - $exceptionHandler(e); - } - }); - } - }, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$observe - * @kind function - * - * @description - * Observes an interpolated attribute. - * - * The observer function will be invoked once during the next `$digest` following - * compilation. The observer is then invoked whenever the interpolated value - * changes. - * - * @param {string} key Normalized key. (ie ngAttribute) . - * @param {function(interpolatedValue)} fn Function that will be called whenever - the interpolated value of the attribute changes. - * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation - * guide} for more info. - * @returns {function()} Returns a deregistration function for this observer. - */ - $observe: function(key, fn) { - var attrs = this, - $$observers = (attrs.$$observers || (attrs.$$observers = createMap())), - listeners = ($$observers[key] || ($$observers[key] = [])); - - listeners.push(fn); - $rootScope.$evalAsync(function() { - if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) { - // no one registered attribute interpolation function, so lets call it manually - fn(attrs[key]); - } - }); - - return function() { - arrayRemove(listeners, fn); - }; - } - }; - - function setSpecialAttr(element, attrName, value) { - // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute` - // so we have to jump through some hoops to get such an attribute - // https://github.com/angular/angular.js/pull/13318 - specialAttrHolder.innerHTML = ''; - var attributes = specialAttrHolder.firstChild.attributes; - var attribute = attributes[0]; - // We have to remove the attribute from its container element before we can add it to the destination element - attributes.removeNamedItem(attribute.name); - attribute.value = value; - element.attributes.setNamedItem(attribute); - } - - function safeAddClass($element, className) { - try { - $element.addClass(className); - } catch (e) { - // ignore, since it means that we are trying to set class on - // SVG element, where class name is read-only. - } - } - - - var startSymbol = $interpolate.startSymbol(), - endSymbol = $interpolate.endSymbol(), - denormalizeTemplate = (startSymbol === '{{' && endSymbol === '}}') - ? identity - : function denormalizeTemplate(template) { - return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); - }, - NG_PREFIX_BINDING = /^ng(Attr|Prop|On)([A-Z].*)$/; - var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/; - - compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) { - var bindings = $element.data('$binding') || []; - - if (isArray(binding)) { - bindings = bindings.concat(binding); - } else { - bindings.push(binding); - } - - $element.data('$binding', bindings); - } : noop; - - compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) { - safeAddClass($element, 'ng-binding'); - } : noop; - - compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) { - var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope'; - $element.data(dataName, scope); - } : noop; - - compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) { - safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope'); - } : noop; - - compile.$$createComment = function(directiveName, comment) { - var content = ''; - if (debugInfoEnabled) { - content = ' ' + (directiveName || '') + ': '; - if (comment) content += comment + ' '; - } - return window.document.createComment(content); - }; - - return compile; - - //================================ - - function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, - previousCompileContext) { - if (!($compileNodes instanceof jqLite)) { - // jquery always rewraps, whereas we need to preserve the original selector so that we can - // modify it. - $compileNodes = jqLite($compileNodes); - } - var compositeLinkFn = - compileNodes($compileNodes, transcludeFn, $compileNodes, - maxPriority, ignoreDirective, previousCompileContext); - compile.$$addScopeClass($compileNodes); - var namespace = null; - return function publicLinkFn(scope, cloneConnectFn, options) { - if (!$compileNodes) { - throw $compileMinErr('multilink', 'This element has already been linked.'); - } - assertArg(scope, 'scope'); - - if (previousCompileContext && previousCompileContext.needsNewScope) { - // A parent directive did a replace and a directive on this element asked - // for transclusion, which caused us to lose a layer of element on which - // we could hold the new transclusion scope, so we will create it manually - // here. - scope = scope.$parent.$new(); - } - - options = options || {}; - var parentBoundTranscludeFn = options.parentBoundTranscludeFn, - transcludeControllers = options.transcludeControllers, - futureParentElement = options.futureParentElement; - - // When `parentBoundTranscludeFn` is passed, it is a - // `controllersBoundTransclude` function (it was previously passed - // as `transclude` to directive.link) so we must unwrap it to get - // its `boundTranscludeFn` - if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) { - parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude; - } - - if (!namespace) { - namespace = detectNamespaceForChildElements(futureParentElement); - } - var $linkNode; - if (namespace !== 'html') { - // When using a directive with replace:true and templateUrl the $compileNodes - // (or a child element inside of them) - // might change, so we need to recreate the namespace adapted compileNodes - // for call to the link function. - // Note: This will already clone the nodes... - $linkNode = jqLite( - wrapTemplate(namespace, jqLite('
').append($compileNodes).html()) - ); - } else if (cloneConnectFn) { - // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart - // and sometimes changes the structure of the DOM. - $linkNode = JQLitePrototype.clone.call($compileNodes); - } else { - $linkNode = $compileNodes; - } - - if (transcludeControllers) { - for (var controllerName in transcludeControllers) { - $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance); - } - } - - compile.$$addScopeInfo($linkNode, scope); - - if (cloneConnectFn) cloneConnectFn($linkNode, scope); - if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn); - - if (!cloneConnectFn) { - $compileNodes = compositeLinkFn = null; - } - return $linkNode; - }; - } - - function detectNamespaceForChildElements(parentElement) { - // TODO: Make this detect MathML as well... - var node = parentElement && parentElement[0]; - if (!node) { - return 'html'; - } else { - return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html'; - } - } - - /** - * Compile function matches each node in nodeList against the directives. Once all directives - * for a particular node are collected their compile functions are executed. The compile - * functions return values - the linking functions - are combined into a composite linking - * function, which is the a linking function for the node. - * - * @param {NodeList} nodeList an array of nodes or NodeList to compile - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new child of the transcluded parent scope. - * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then - * the rootElement must be set the jqLite collection of the compile root. This is - * needed so that the jqLite collection items can be replaced with widgets. - * @param {number=} maxPriority Max directive priority. - * @returns {Function} A composite linking function of all of the matched directives or null. - */ - function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, - previousCompileContext) { - var linkFns = [], - // `nodeList` can be either an element's `.childNodes` (live NodeList) - // or a jqLite/jQuery collection or an array - notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), - attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; - - - for (var i = 0; i < nodeList.length; i++) { - attrs = new Attributes(); - - // Support: IE 11 only - // Workaround for #11781 and #14924 - if (msie === 11) { - mergeConsecutiveTextNodes(nodeList, i, notLiveList); - } - - // We must always refer to `nodeList[i]` hereafter, - // since the nodes can be replaced underneath us. - directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, - ignoreDirective); - - nodeLinkFn = (directives.length) - ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, - null, [], [], previousCompileContext) - : null; - - if (nodeLinkFn && nodeLinkFn.scope) { - compile.$$addScopeClass(attrs.$$element); - } - - childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || - !(childNodes = nodeList[i].childNodes) || - !childNodes.length) - ? null - : compileNodes(childNodes, - nodeLinkFn ? ( - (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) - && nodeLinkFn.transclude) : transcludeFn); - - if (nodeLinkFn || childLinkFn) { - linkFns.push(i, nodeLinkFn, childLinkFn); - linkFnFound = true; - nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; - } - - //use the previous context only for the first element in the virtual group - previousCompileContext = null; - } - - // return a linking function if we have found anything, null otherwise - return linkFnFound ? compositeLinkFn : null; - - function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { - var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; - var stableNodeList; - - - if (nodeLinkFnFound) { - // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our - // offsets don't get screwed up - var nodeListLength = nodeList.length; - stableNodeList = new Array(nodeListLength); - - // create a sparse array by only copying the elements which have a linkFn - for (i = 0; i < linkFns.length; i += 3) { - idx = linkFns[i]; - stableNodeList[idx] = nodeList[idx]; - } - } else { - stableNodeList = nodeList; - } - - for (i = 0, ii = linkFns.length; i < ii;) { - node = stableNodeList[linkFns[i++]]; - nodeLinkFn = linkFns[i++]; - childLinkFn = linkFns[i++]; - - if (nodeLinkFn) { - if (nodeLinkFn.scope) { - childScope = scope.$new(); - compile.$$addScopeInfo(jqLite(node), childScope); - } else { - childScope = scope; - } - - if (nodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn( - scope, nodeLinkFn.transclude, parentBoundTranscludeFn); - - } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { - childBoundTranscludeFn = parentBoundTranscludeFn; - - } else if (!parentBoundTranscludeFn && transcludeFn) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); - - } else { - childBoundTranscludeFn = null; - } - - nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); - - } else if (childLinkFn) { - childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); - } - } - } - } - - function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { - var node = nodeList[idx]; - var parent = node.parentNode; - var sibling; - - if (node.nodeType !== NODE_TYPE_TEXT) { - return; - } - - while (true) { - sibling = parent ? node.nextSibling : nodeList[idx + 1]; - if (!sibling || sibling.nodeType !== NODE_TYPE_TEXT) { - break; - } - - node.nodeValue = node.nodeValue + sibling.nodeValue; - - if (sibling.parentNode) { - sibling.parentNode.removeChild(sibling); - } - if (notLiveList && sibling === nodeList[idx + 1]) { - nodeList.splice(idx + 1, 1); - } - } - } - - function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) { - function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) { - - if (!transcludedScope) { - transcludedScope = scope.$new(false, containingScope); - transcludedScope.$$transcluded = true; - } - - return transcludeFn(transcludedScope, cloneFn, { - parentBoundTranscludeFn: previousBoundTranscludeFn, - transcludeControllers: controllers, - futureParentElement: futureParentElement - }); - } - - // We need to attach the transclusion slots onto the `boundTranscludeFn` - // so that they are available inside the `controllersBoundTransclude` function - var boundSlots = boundTranscludeFn.$$slots = createMap(); - for (var slotName in transcludeFn.$$slots) { - if (transcludeFn.$$slots[slotName]) { - boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn); - } else { - boundSlots[slotName] = null; - } - } - - return boundTranscludeFn; - } - - /** - * Looks for directives on the given node and adds them to the directive collection which is - * sorted. - * - * @param node Node to search. - * @param directives An array to which the directives are added to. This array is sorted before - * the function returns. - * @param attrs The shared attrs object which is used to populate the normalized attributes. - * @param {number=} maxPriority Max directive priority. - */ - function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - var nodeType = node.nodeType, - attrsMap = attrs.$attr, - match, - nodeName, - className; - - switch (nodeType) { - case NODE_TYPE_ELEMENT: /* Element */ - - nodeName = nodeName_(node); - - // use the node name: - addDirective(directives, - directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective); - - // iterate over the attributes - for (var attr, name, nName, value, ngPrefixMatch, nAttrs = node.attributes, - j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { - var attrStartName = false; - var attrEndName = false; - - var isNgAttr = false, isNgProp = false, isNgEvent = false; - var multiElementMatch; - - attr = nAttrs[j]; - name = attr.name; - value = attr.value; - - nName = directiveNormalize(name.toLowerCase()); - - // Support ng-attr-*, ng-prop-* and ng-on-* - if ((ngPrefixMatch = nName.match(NG_PREFIX_BINDING))) { - isNgAttr = ngPrefixMatch[1] === 'Attr'; - isNgProp = ngPrefixMatch[1] === 'Prop'; - isNgEvent = ngPrefixMatch[1] === 'On'; - - // Normalize the non-prefixed name - name = name.replace(PREFIX_REGEXP, '') - .toLowerCase() - .substr(4 + ngPrefixMatch[1].length).replace(/_(.)/g, function(match, letter) { - return letter.toUpperCase(); - }); - - // Support *-start / *-end multi element directives - } else if ((multiElementMatch = nName.match(MULTI_ELEMENT_DIR_RE)) && directiveIsMultiElement(multiElementMatch[1])) { - attrStartName = name; - attrEndName = name.substr(0, name.length - 5) + 'end'; - name = name.substr(0, name.length - 6); - } - - if (isNgProp || isNgEvent) { - attrs[nName] = value; - attrsMap[nName] = attr.name; - - if (isNgProp) { - addPropertyDirective(node, directives, nName, name); - } else { - addEventDirective(directives, nName, name); - } - } else { - // Update nName for cases where a prefix was removed - // NOTE: the .toLowerCase() is unnecessary and causes https://github.com/angular/angular.js/issues/16624 for ng-attr-* - nName = directiveNormalize(name.toLowerCase()); - attrsMap[nName] = name; - - if (isNgAttr || !attrs.hasOwnProperty(nName)) { - attrs[nName] = value; - if (getBooleanAttrName(node, nName)) { - attrs[nName] = true; // presence means true - } - } - - addAttrInterpolateDirective(node, directives, value, nName, isNgAttr); - addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName, - attrEndName); - } - } - - if (nodeName === 'input' && node.getAttribute('type') === 'hidden') { - // Hidden input elements can have strange behaviour when navigating back to the page - // This tells the browser not to try to cache and reinstate previous values - node.setAttribute('autocomplete', 'off'); - } - - // use class as directive - if (!cssClassDirectivesEnabled) break; - className = node.className; - if (isObject(className)) { - // Maybe SVGAnimatedString - className = className.animVal; - } - if (isString(className) && className !== '') { - while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) { - nName = directiveNormalize(match[2]); - if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[3]); - } - className = className.substr(match.index + match[0].length); - } - } - break; - case NODE_TYPE_TEXT: /* Text Node */ - addTextInterpolateDirective(directives, node.nodeValue); - break; - case NODE_TYPE_COMMENT: /* Comment */ - if (!commentDirectivesEnabled) break; - collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective); - break; - } - - directives.sort(byPriority); - return directives; - } - - function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - // function created because of performance, try/catch disables - // the optimization of the whole function #14848 - try { - var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); - if (match) { - var nName = directiveNormalize(match[1]); - if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[2]); - } - } - } catch (e) { - // turns out that under some circumstances IE9 throws errors when one attempts to read - // comment's node value. - // Just ignore it and continue. (Can't seem to reproduce in test case.) - } - } - - /** - * Given a node with a directive-start it collects all of the siblings until it finds - * directive-end. - * @param node - * @param attrStart - * @param attrEnd - * @returns {*} - */ - function groupScan(node, attrStart, attrEnd) { - var nodes = []; - var depth = 0; - if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) { - do { - if (!node) { - throw $compileMinErr('uterdir', - 'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.', - attrStart, attrEnd); - } - if (node.nodeType === NODE_TYPE_ELEMENT) { - if (node.hasAttribute(attrStart)) depth++; - if (node.hasAttribute(attrEnd)) depth--; - } - nodes.push(node); - node = node.nextSibling; - } while (depth > 0); - } else { - nodes.push(node); - } - - return jqLite(nodes); - } - - /** - * Wrapper for linking function which converts normal linking function into a grouped - * linking function. - * @param linkFn - * @param attrStart - * @param attrEnd - * @returns {Function} - */ - function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) { - return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) { - element = groupScan(element[0], attrStart, attrEnd); - return linkFn(scope, element, attrs, controllers, transcludeFn); - }; - } - - /** - * A function generator that is used to support both eager and lazy compilation - * linking function. - * @param eager - * @param $compileNodes - * @param transcludeFn - * @param maxPriority - * @param ignoreDirective - * @param previousCompileContext - * @returns {Function} - */ - function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) { - var compiled; - - if (eager) { - return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - } - return /** @this */ function lazyCompilation() { - if (!compiled) { - compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - - // Null out all of these references in order to make them eligible for garbage collection - // since this is a potentially long lived closure - $compileNodes = transcludeFn = previousCompileContext = null; - } - return compiled.apply(this, arguments); - }; - } - - /** - * Once the directives have been collected, their compile functions are executed. This method - * is responsible for inlining directive templates as well as terminating the application - * of the directives if the terminal directive has been reached. - * - * @param {Array} directives Array of collected directives to execute their compile function. - * this needs to be pre-sorted by priority order. - * @param {Node} compileNode The raw DOM node to apply the compile functions to - * @param {Object} templateAttrs The shared attribute function - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new - * child of the transcluded parent scope. - * @param {JQLite} jqCollection If we are working on the root of the compile tree then this - * argument has the root jqLite array so that we can replace nodes - * on it. - * @param {Object=} originalReplaceDirective An optional directive that will be ignored when - * compiling the transclusion. - * @param {Array.} preLinkFns - * @param {Array.} postLinkFns - * @param {Object} previousCompileContext Context used for previous compilation of the current - * node - * @returns {Function} linkFn - */ - function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, - jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, - previousCompileContext) { - previousCompileContext = previousCompileContext || {}; - - var terminalPriority = -Number.MAX_VALUE, - newScopeDirective = previousCompileContext.newScopeDirective, - controllerDirectives = previousCompileContext.controllerDirectives, - newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, - templateDirective = previousCompileContext.templateDirective, - nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, - hasTranscludeDirective = false, - hasTemplate = false, - hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, - $compileNode = templateAttrs.$$element = jqLite(compileNode), - directive, - directiveName, - $template, - replaceDirective = originalReplaceDirective, - childTranscludeFn = transcludeFn, - linkFn, - didScanForMultipleTransclusion = false, - mightHaveMultipleTransclusionError = false, - directiveValue; - - // executes all directives on the current element - for (var i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - var attrStart = directive.$$start; - var attrEnd = directive.$$end; - - // collect multiblock sections - if (attrStart) { - $compileNode = groupScan(compileNode, attrStart, attrEnd); - } - $template = undefined; - - if (terminalPriority > directive.priority) { - break; // prevent further processing of directives - } - - directiveValue = directive.scope; - - if (directiveValue) { - - // skip the check for directives with async templates, we'll check the derived sync - // directive when the template arrives - if (!directive.templateUrl) { - if (isObject(directiveValue)) { - // This directive is trying to add an isolated scope. - // Check that there is no scope of any kind already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, - directive, $compileNode); - newIsolateScopeDirective = directive; - } else { - // This directive is trying to add a child scope. - // Check that there is no isolated scope already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, - $compileNode); - } - } - - newScopeDirective = newScopeDirective || directive; - } - - directiveName = directive.name; - - // If we encounter a condition that can result in transclusion on the directive, - // then scan ahead in the remaining directives for others that may cause a multiple - // transclusion error to be thrown during the compilation process. If a matching directive - // is found, then we know that when we encounter a transcluded directive, we need to eagerly - // compile the `transclude` function rather than doing it lazily in order to throw - // exceptions at the correct time - if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template)) - || (directive.transclude && !directive.$$tlb))) { - var candidateDirective; - - for (var scanningIndex = i + 1; (candidateDirective = directives[scanningIndex++]);) { - if ((candidateDirective.transclude && !candidateDirective.$$tlb) - || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) { - mightHaveMultipleTransclusionError = true; - break; - } - } - - didScanForMultipleTransclusion = true; - } - - if (!directive.templateUrl && directive.controller) { - controllerDirectives = controllerDirectives || createMap(); - assertNoDuplicate('\'' + directiveName + '\' controller', - controllerDirectives[directiveName], directive, $compileNode); - controllerDirectives[directiveName] = directive; - } - - directiveValue = directive.transclude; - - if (directiveValue) { - hasTranscludeDirective = true; - - // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion. - // This option should only be used by directives that know how to safely handle element transclusion, - // where the transcluded nodes are added or replaced after linking. - if (!directive.$$tlb) { - assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode); - nonTlbTranscludeDirective = directive; - } - - if (directiveValue === 'element') { - hasElementTranscludeDirective = true; - terminalPriority = directive.priority; - $template = $compileNode; - $compileNode = templateAttrs.$$element = - jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName])); - compileNode = $compileNode[0]; - replaceWith(jqCollection, sliceArgs($template), compileNode); - - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority, - replaceDirective && replaceDirective.name, { - // Don't pass in: - // - controllerDirectives - otherwise we'll create duplicates controllers - // - newIsolateScopeDirective or templateDirective - combining templates with - // element transclusion doesn't make sense. - // - // We need only nonTlbTranscludeDirective so that we prevent putting transclusion - // on the same element more than once. - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - } else { - - var slots = createMap(); - - if (!isObject(directiveValue)) { - $template = jqLite(jqLiteClone(compileNode)).contents(); - } else { - - // We have transclusion slots, - // collect them up, compile them and store their transclusion functions - $template = window.document.createDocumentFragment(); - - var slotMap = createMap(); - var filledSlots = createMap(); - - // Parse the element selectors - forEach(directiveValue, function(elementSelector, slotName) { - // If an element selector starts with a ? then it is optional - var optional = (elementSelector.charAt(0) === '?'); - elementSelector = optional ? elementSelector.substring(1) : elementSelector; - - slotMap[elementSelector] = slotName; - - // We explicitly assign `null` since this implies that a slot was defined but not filled. - // Later when calling boundTransclusion functions with a slot name we only error if the - // slot is `undefined` - slots[slotName] = null; - - // filledSlots contains `true` for all slots that are either optional or have been - // filled. This is used to check that we have not missed any required slots - filledSlots[slotName] = optional; - }); - - // Add the matching elements into their slot - forEach($compileNode.contents(), function(node) { - var slotName = slotMap[directiveNormalize(nodeName_(node))]; - if (slotName) { - filledSlots[slotName] = true; - slots[slotName] = slots[slotName] || window.document.createDocumentFragment(); - slots[slotName].appendChild(node); - } else { - $template.appendChild(node); - } - }); - - // Check for required slots that were not filled - forEach(filledSlots, function(filled, slotName) { - if (!filled) { - throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName); - } - }); - - for (var slotName in slots) { - if (slots[slotName]) { - // Only define a transclusion function if the slot was filled - var slotCompileNodes = jqLite(slots[slotName].childNodes); - slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slotCompileNodes, transcludeFn); - } - } - - $template = jqLite($template.childNodes); - } - - $compileNode.empty(); // clear contents - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined, - undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope}); - childTranscludeFn.$$slots = slots; - } - } - - if (directive.template) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - directiveValue = (isFunction(directive.template)) - ? directive.template($compileNode, templateAttrs) - : directive.template; - - directiveValue = denormalizeTemplate(directiveValue); - - if (directive.replace) { - replaceDirective = directive; - if (jqLiteIsTextNode(directiveValue)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - directiveName, ''); - } - - replaceWith(jqCollection, $compileNode, compileNode); - - var newTemplateAttrs = {$attr: {}}; - - // combine directives from the original node and from the template: - // - take the array of directives for this element - // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed) - // - collect directives from the template and sort them by priority - // - combine directives as: processed + template + unprocessed - var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs); - var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1)); - - if (newIsolateScopeDirective || newScopeDirective) { - // The original directive caused the current element to be replaced but this element - // also needs to have a new scope, so we need to tell the template directives - // that they would need to get their scope from further up, if they require transclusion - markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective); - } - directives = directives.concat(templateDirectives).concat(unprocessedDirectives); - mergeTemplateAttributes(templateAttrs, newTemplateAttrs); - - ii = directives.length; - } else { - $compileNode.html(directiveValue); - } - } - - if (directive.templateUrl) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - if (directive.replace) { - replaceDirective = directive; - } - - // eslint-disable-next-line no-func-assign - nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, - templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, { - controllerDirectives: controllerDirectives, - newScopeDirective: (newScopeDirective !== directive) && newScopeDirective, - newIsolateScopeDirective: newIsolateScopeDirective, - templateDirective: templateDirective, - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - ii = directives.length; - } else if (directive.compile) { - try { - linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); - var context = directive.$$originalDirective || directive; - if (isFunction(linkFn)) { - addLinkFns(null, bind(context, linkFn), attrStart, attrEnd); - } else if (linkFn) { - addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd); - } - } catch (e) { - $exceptionHandler(e, startingTag($compileNode)); - } - } - - if (directive.terminal) { - nodeLinkFn.terminal = true; - terminalPriority = Math.max(terminalPriority, directive.priority); - } - - } - - nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true; - nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective; - nodeLinkFn.templateOnThisElement = hasTemplate; - nodeLinkFn.transclude = childTranscludeFn; - - previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective; - - // might be normal or delayed nodeLinkFn depending on if templateUrl is present - return nodeLinkFn; - - //////////////////// - - function addLinkFns(pre, post, attrStart, attrEnd) { - if (pre) { - if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd); - pre.require = directive.require; - pre.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - pre = cloneAndAnnotateFn(pre, {isolateScope: true}); - } - preLinkFns.push(pre); - } - if (post) { - if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd); - post.require = directive.require; - post.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - post = cloneAndAnnotateFn(post, {isolateScope: true}); - } - postLinkFns.push(post); - } - } - - function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { - var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element, - attrs, scopeBindingInfo; - - if (compileNode === linkNode) { - attrs = templateAttrs; - $element = templateAttrs.$$element; - } else { - $element = jqLite(linkNode); - attrs = new Attributes($element, templateAttrs); - } - - controllerScope = scope; - if (newIsolateScopeDirective) { - isolateScope = scope.$new(true); - } else if (newScopeDirective) { - controllerScope = scope.$parent; - } - - if (boundTranscludeFn) { - // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn` - // is later passed as `parentBoundTranscludeFn` to `publicLinkFn` - transcludeFn = controllersBoundTransclude; - transcludeFn.$$boundTransclude = boundTranscludeFn; - // expose the slots on the `$transclude` function - transcludeFn.isSlotFilled = function(slotName) { - return !!boundTranscludeFn.$$slots[slotName]; - }; - } - - if (controllerDirectives) { - elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective); - } - - if (newIsolateScopeDirective) { - // Initialize isolate scope bindings for new isolate scope directive. - compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective || - templateDirective === newIsolateScopeDirective.$$originalDirective))); - compile.$$addScopeClass($element, true); - isolateScope.$$isolateBindings = - newIsolateScopeDirective.$$isolateBindings; - scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope, - isolateScope.$$isolateBindings, - newIsolateScopeDirective); - if (scopeBindingInfo.removeWatches) { - isolateScope.$on('$destroy', scopeBindingInfo.removeWatches); - } - } - - // Initialize bindToController bindings - for (var name in elementControllers) { - var controllerDirective = controllerDirectives[name]; - var controller = elementControllers[name]; - var bindings = controllerDirective.$$bindings.bindToController; - - controller.instance = controller(); - $element.data('$' + controllerDirective.name + 'Controller', controller.instance); - controller.bindingInfo = - initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective); - } - - // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy - forEach(controllerDirectives, function(controllerDirective, name) { - var require = controllerDirective.require; - if (controllerDirective.bindToController && !isArray(require) && isObject(require)) { - extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers)); - } - }); - - // Handle the init and destroy lifecycle hooks on all controllers that have them - forEach(elementControllers, function(controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$onChanges)) { - try { - controllerInstance.$onChanges(controller.bindingInfo.initialChanges); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$onInit)) { - try { - controllerInstance.$onInit(); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$doCheck)) { - controllerScope.$watch(function() { controllerInstance.$doCheck(); }); - controllerInstance.$doCheck(); - } - if (isFunction(controllerInstance.$onDestroy)) { - controllerScope.$on('$destroy', function callOnDestroyHook() { - controllerInstance.$onDestroy(); - }); - } - }); - - // PRELINKING - for (i = 0, ii = preLinkFns.length; i < ii; i++) { - linkFn = preLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // RECURSION - // We only pass the isolate scope, if the isolate directive has a template, - // otherwise the child elements do not belong to the isolate directive. - var scopeToChild = scope; - if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { - scopeToChild = isolateScope; - } - if (childLinkFn) { - childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn); - } - - // POSTLINKING - for (i = postLinkFns.length - 1; i >= 0; i--) { - linkFn = postLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // Trigger $postLink lifecycle hooks - forEach(elementControllers, function(controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$postLink)) { - controllerInstance.$postLink(); - } - }); - - // This is the function that is injected as `$transclude`. - // Note: all arguments are optional! - function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) { - var transcludeControllers; - // No scope passed in: - if (!isScope(scope)) { - slotName = futureParentElement; - futureParentElement = cloneAttachFn; - cloneAttachFn = scope; - scope = undefined; - } - - if (hasElementTranscludeDirective) { - transcludeControllers = elementControllers; - } - if (!futureParentElement) { - futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element; - } - if (slotName) { - // slotTranscludeFn can be one of three things: - // * a transclude function - a filled slot - // * `null` - an optional slot that was not filled - // * `undefined` - a slot that was not declared (i.e. invalid) - var slotTranscludeFn = boundTranscludeFn.$$slots[slotName]; - if (slotTranscludeFn) { - return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } else if (isUndefined(slotTranscludeFn)) { - throw $compileMinErr('noslot', - 'No parent directive that requires a transclusion with slot name "{0}". ' + - 'Element: {1}', - slotName, startingTag($element)); - } - } else { - return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } - } - } - } - - function getControllers(directiveName, require, $element, elementControllers) { - var value; - - if (isString(require)) { - var match = require.match(REQUIRE_PREFIX_REGEXP); - var name = require.substring(match[0].length); - var inheritType = match[1] || match[3]; - var optional = match[2] === '?'; - - //If only parents then start at the parent element - if (inheritType === '^^') { - $element = $element.parent(); - //Otherwise attempt getting the controller from elementControllers in case - //the element is transcluded (and has no data) and to avoid .data if possible - } else { - value = elementControllers && elementControllers[name]; - value = value && value.instance; - } - - if (!value) { - var dataName = '$' + name + 'Controller'; - - if (inheritType === '^^' && $element[0] && $element[0].nodeType === NODE_TYPE_DOCUMENT) { - // inheritedData() uses the documentElement when it finds the document, so we would - // require from the element itself. - value = null; - } else { - value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName); - } - } - - if (!value && !optional) { - throw $compileMinErr('ctreq', - 'Controller \'{0}\', required by directive \'{1}\', can\'t be found!', - name, directiveName); - } - } else if (isArray(require)) { - value = []; - for (var i = 0, ii = require.length; i < ii; i++) { - value[i] = getControllers(directiveName, require[i], $element, elementControllers); - } - } else if (isObject(require)) { - value = {}; - forEach(require, function(controller, property) { - value[property] = getControllers(directiveName, controller, $element, elementControllers); - }); - } - - return value || null; - } - - function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) { - var elementControllers = createMap(); - for (var controllerKey in controllerDirectives) { - var directive = controllerDirectives[controllerKey]; - var locals = { - $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, - $element: $element, - $attrs: attrs, - $transclude: transcludeFn - }; - - var controller = directive.controller; - if (controller === '@') { - controller = attrs[directive.name]; - } - - var controllerInstance = $controller(controller, locals, true, directive.controllerAs); - - // For directives with element transclusion the element is a comment. - // In this case .data will not attach any data. - // Instead, we save the controllers for the element in a local hash and attach to .data - // later, once we have the actual element. - elementControllers[directive.name] = controllerInstance; - $element.data('$' + directive.name + 'Controller', controllerInstance.instance); - } - return elementControllers; - } - - // Depending upon the context in which a directive finds itself it might need to have a new isolated - // or child scope created. For instance: - // * if the directive has been pulled into a template because another directive with a higher priority - // asked for element transclusion - // * if the directive itself asks for transclusion but it is at the root of a template and the original - // element was replaced. See https://github.com/angular/angular.js/issues/12936 - function markDirectiveScope(directives, isolateScope, newScope) { - for (var j = 0, jj = directives.length; j < jj; j++) { - directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope}); - } - } - - /** - * looks up the directive and decorates it with exception handling and proper parameters. We - * call this the boundDirective. - * - * @param {string} name name of the directive to look up. - * @param {string} location The directive must be found in specific format. - * String containing any of theses characters: - * - * * `E`: element name - * * `A': attribute - * * `C`: class - * * `M`: comment - * @returns {boolean} true if directive was added. - */ - function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, - endAttrName) { - if (name === ignoreDirective) return null; - var match = null; - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if ((isUndefined(maxPriority) || maxPriority > directive.priority) && - directive.restrict.indexOf(location) !== -1) { - if (startAttrName) { - directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName}); - } - if (!directive.$$bindings) { - var bindings = directive.$$bindings = - parseDirectiveBindings(directive, directive.name); - if (isObject(bindings.isolateScope)) { - directive.$$isolateBindings = bindings.isolateScope; - } - } - tDirectives.push(directive); - match = directive; - } - } - } - return match; - } - - - /** - * looks up the directive and returns true if it is a multi-element directive, - * and therefore requires DOM nodes between -start and -end markers to be grouped - * together. - * - * @param {string} name name of the directive to look up. - * @returns true if directive was registered as multi-element. - */ - function directiveIsMultiElement(name) { - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if (directive.multiElement) { - return true; - } - } - } - return false; - } - - /** - * When the element is replaced with HTML template then the new attributes - * on the template need to be merged with the existing attributes in the DOM. - * The desired effect is to have both of the attributes present. - * - * @param {object} dst destination attributes (original DOM) - * @param {object} src source attributes (from the directive template) - */ - function mergeTemplateAttributes(dst, src) { - var srcAttr = src.$attr, - dstAttr = dst.$attr; - - // reapply the old attributes to the new element - forEach(dst, function(value, key) { - if (key.charAt(0) !== '$') { - if (src[key] && src[key] !== value) { - if (value.length) { - value += (key === 'style' ? ';' : ' ') + src[key]; - } else { - value = src[key]; - } - } - dst.$set(key, value, true, srcAttr[key]); - } - }); - - // copy the new attributes on the old attrs object - forEach(src, function(value, key) { - // Check if we already set this attribute in the loop above. - // `dst` will never contain hasOwnProperty as DOM parser won't let it. - // You will get an "InvalidCharacterError: DOM Exception 5" error if you - // have an attribute like "has-own-property" or "data-has-own-property", etc. - if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') { - dst[key] = value; - - if (key !== 'class' && key !== 'style') { - dstAttr[key] = srcAttr[key]; - } - } - }); - } - - - function compileTemplateUrl(directives, $compileNode, tAttrs, - $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) { - var linkQueue = [], - afterTemplateNodeLinkFn, - afterTemplateChildLinkFn, - beforeTemplateCompileNode = $compileNode[0], - origAsyncDirective = directives.shift(), - derivedSyncDirective = inherit(origAsyncDirective, { - templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective - }), - templateUrl = (isFunction(origAsyncDirective.templateUrl)) - ? origAsyncDirective.templateUrl($compileNode, tAttrs) - : origAsyncDirective.templateUrl, - templateNamespace = origAsyncDirective.templateNamespace; - - $compileNode.empty(); - - $templateRequest(templateUrl) - .then(function(content) { - var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn; - - content = denormalizeTemplate(content); - - if (origAsyncDirective.replace) { - if (jqLiteIsTextNode(content)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(templateNamespace, trim(content))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - origAsyncDirective.name, templateUrl); - } - - tempTemplateAttrs = {$attr: {}}; - replaceWith($rootElement, $compileNode, compileNode); - var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs); - - if (isObject(origAsyncDirective.scope)) { - // the original directive that caused the template to be loaded async required - // an isolate scope - markDirectiveScope(templateDirectives, true); - } - directives = templateDirectives.concat(directives); - mergeTemplateAttributes(tAttrs, tempTemplateAttrs); - } else { - compileNode = beforeTemplateCompileNode; - $compileNode.html(content); - } - - directives.unshift(derivedSyncDirective); - - afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, - childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, - previousCompileContext); - forEach($rootElement, function(node, i) { - if (node === compileNode) { - $rootElement[i] = $compileNode[0]; - } - }); - afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); - - while (linkQueue.length) { - var scope = linkQueue.shift(), - beforeTemplateLinkNode = linkQueue.shift(), - linkRootElement = linkQueue.shift(), - boundTranscludeFn = linkQueue.shift(), - linkNode = $compileNode[0]; - - if (scope.$$destroyed) continue; - - if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { - var oldClasses = beforeTemplateLinkNode.className; - - if (!(previousCompileContext.hasElementTranscludeDirective && - origAsyncDirective.replace)) { - // it was cloned therefore we have to clone as well. - linkNode = jqLiteClone(compileNode); - } - replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); - - // Copy in CSS classes from original node - safeAddClass(jqLite(linkNode), oldClasses); - } - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } else { - childBoundTranscludeFn = boundTranscludeFn; - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, - childBoundTranscludeFn); - } - linkQueue = null; - }).catch(function(error) { - if (isError(error)) { - $exceptionHandler(error); - } - }); - - return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) { - var childBoundTranscludeFn = boundTranscludeFn; - if (scope.$$destroyed) return; - if (linkQueue) { - linkQueue.push(scope, - node, - rootElement, - childBoundTranscludeFn); - } else { - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn); - } - }; - } - - - /** - * Sorting function for bound directives. - */ - function byPriority(a, b) { - var diff = b.priority - a.priority; - if (diff !== 0) return diff; - if (a.name !== b.name) return (a.name < b.name) ? -1 : 1; - return a.index - b.index; - } - - function assertNoDuplicate(what, previousDirective, directive, element) { - - function wrapModuleNameIfDefined(moduleName) { - return moduleName ? - (' (module: ' + moduleName + ')') : - ''; - } - - if (previousDirective) { - throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}', - previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName), - directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element)); - } - } - - - function addTextInterpolateDirective(directives, text) { - var interpolateFn = $interpolate(text, true); - if (interpolateFn) { - directives.push({ - priority: 0, - compile: function textInterpolateCompileFn(templateNode) { - var templateNodeParent = templateNode.parent(), - hasCompileParent = !!templateNodeParent.length; - - // When transcluding a template that has bindings in the root - // we don't have a parent and thus need to add the class during linking fn. - if (hasCompileParent) compile.$$addBindingClass(templateNodeParent); - - return function textInterpolateLinkFn(scope, node) { - var parent = node.parent(); - if (!hasCompileParent) compile.$$addBindingClass(parent); - compile.$$addBindingInfo(parent, interpolateFn.expressions); - scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { - node[0].nodeValue = value; - }); - }; - } - }); - } - } - - - function wrapTemplate(type, template) { - type = lowercase(type || 'html'); - switch (type) { - case 'svg': - case 'math': - var wrapper = window.document.createElement('div'); - wrapper.innerHTML = '<' + type + '>' + template + ''; - return wrapper.childNodes[0].childNodes; - default: - return template; - } - } - - - function getTrustedAttrContext(nodeName, attrNormalizedName) { - if (attrNormalizedName === 'srcdoc') { - return $sce.HTML; - } - // All nodes with src attributes require a RESOURCE_URL value, except for - // img and various html5 media nodes, which require the MEDIA_URL context. - if (attrNormalizedName === 'src' || attrNormalizedName === 'ngSrc') { - if (['img', 'video', 'audio', 'source', 'track'].indexOf(nodeName) === -1) { - return $sce.RESOURCE_URL; - } - return $sce.MEDIA_URL; - } else if (attrNormalizedName === 'xlinkHref') { - // Some xlink:href are okay, most aren't - if (nodeName === 'image') return $sce.MEDIA_URL; - if (nodeName === 'a') return $sce.URL; - return $sce.RESOURCE_URL; - } else if ( - // Formaction - (nodeName === 'form' && attrNormalizedName === 'action') || - // If relative URLs can go where they are not expected to, then - // all sorts of trust issues can arise. - (nodeName === 'base' && attrNormalizedName === 'href') || - // links can be stylesheets or imports, which can run script in the current origin - (nodeName === 'link' && attrNormalizedName === 'href') - ) { - return $sce.RESOURCE_URL; - } else if (nodeName === 'a' && (attrNormalizedName === 'href' || - attrNormalizedName === 'ngHref')) { - return $sce.URL; - } - } - - function getTrustedPropContext(nodeName, propNormalizedName) { - var prop = propNormalizedName.toLowerCase(); - return PROP_CONTEXTS[nodeName + '|' + prop] || PROP_CONTEXTS['*|' + prop]; - } - - function sanitizeSrcsetPropertyValue(value) { - return sanitizeSrcset($sce.valueOf(value), 'ng-prop-srcset'); - } - function addPropertyDirective(node, directives, attrName, propName) { - if (EVENT_HANDLER_ATTR_REGEXP.test(propName)) { - throw $compileMinErr('nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); - } - - var nodeName = nodeName_(node); - var trustedContext = getTrustedPropContext(nodeName, propName); - - var sanitizer = identity; - // Sanitize img[srcset] + source[srcset] values. - if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) { - sanitizer = sanitizeSrcsetPropertyValue; - } else if (trustedContext) { - sanitizer = $sce.getTrusted.bind($sce, trustedContext); - } - - directives.push({ - priority: 100, - compile: function ngPropCompileFn(_, attr) { - var ngPropGetter = $parse(attr[attrName]); - var ngPropWatch = $parse(attr[attrName], function sceValueOf(val) { - // Unwrap the value to compare the actual inner safe value, not the wrapper object. - return $sce.valueOf(val); - }); - - return { - pre: function ngPropPreLinkFn(scope, $element) { - function applyPropValue() { - var propValue = ngPropGetter(scope); - $element[0][propName] = sanitizer(propValue); - } - - applyPropValue(); - scope.$watch(ngPropWatch, applyPropValue); - } - }; - } - }); - } - - function addEventDirective(directives, attrName, eventName) { - directives.push( - createEventDirective($parse, $rootScope, $exceptionHandler, attrName, eventName, /*forceAsync=*/false) - ); - } - - function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) { - var nodeName = nodeName_(node); - var trustedContext = getTrustedAttrContext(nodeName, name); - var mustHaveExpression = !isNgAttr; - var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr; - - var interpolateFn = $interpolate(value, mustHaveExpression, trustedContext, allOrNothing); - - // no interpolation found -> ignore - if (!interpolateFn) return; - - if (name === 'multiple' && nodeName === 'select') { - throw $compileMinErr('selmulti', - 'Binding to the \'multiple\' attribute is not supported. Element: {0}', - startingTag(node)); - } - - if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { - throw $compileMinErr('nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); - } - - directives.push({ - priority: 100, - compile: function() { - return { - pre: function attrInterpolatePreLinkFn(scope, element, attr) { - var $$observers = (attr.$$observers || (attr.$$observers = createMap())); - - // If the attribute has changed since last $interpolate()ed - var newValue = attr[name]; - if (newValue !== value) { - // we need to interpolate again since the attribute value has been updated - // (e.g. by another directive's compile function) - // ensure unset/empty values make interpolateFn falsy - interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing); - value = newValue; - } - - // if attribute was updated so that there is no interpolation going on we don't want to - // register any observers - if (!interpolateFn) return; - - // initialize attr object so that it's ready in case we need the value for isolate - // scope initialization, otherwise the value would not be available from isolate - // directive's linking fn during linking phase - attr[name] = interpolateFn(scope); - - ($$observers[name] || ($$observers[name] = [])).$$inter = true; - (attr.$$observers && attr.$$observers[name].$$scope || scope). - $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) { - //special case for class attribute addition + removal - //so that class changes can tap into the animation - //hooks provided by the $animate service. Be sure to - //skip animations when the first digest occurs (when - //both the new and the old values are the same) since - //the CSS classes are the non-interpolated values - if (name === 'class' && newValue !== oldValue) { - attr.$updateClass(newValue, oldValue); - } else { - attr.$set(name, newValue); - } - }); - } - }; - } - }); - } - - - /** - * This is a special jqLite.replaceWith, which can replace items which - * have no parents, provided that the containing jqLite collection is provided. - * - * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes - * in the root of the tree. - * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep - * the shell, but replace its DOM node reference. - * @param {Node} newNode The new DOM node. - */ - function replaceWith($rootElement, elementsToRemove, newNode) { - var firstElementToRemove = elementsToRemove[0], - removeCount = elementsToRemove.length, - parent = firstElementToRemove.parentNode, - i, ii; - - if ($rootElement) { - for (i = 0, ii = $rootElement.length; i < ii; i++) { - if ($rootElement[i] === firstElementToRemove) { - $rootElement[i++] = newNode; - for (var j = i, j2 = j + removeCount - 1, - jj = $rootElement.length; - j < jj; j++, j2++) { - if (j2 < jj) { - $rootElement[j] = $rootElement[j2]; - } else { - delete $rootElement[j]; - } - } - $rootElement.length -= removeCount - 1; - - // If the replaced element is also the jQuery .context then replace it - // .context is a deprecated jQuery api, so we should set it only when jQuery set it - // http://api.jquery.com/context/ - if ($rootElement.context === firstElementToRemove) { - $rootElement.context = newNode; - } - break; - } - } - } - - if (parent) { - parent.replaceChild(newNode, firstElementToRemove); - } - - // Append all the `elementsToRemove` to a fragment. This will... - // - remove them from the DOM - // - allow them to still be traversed with .nextSibling - // - allow a single fragment.qSA to fetch all elements being removed - var fragment = window.document.createDocumentFragment(); - for (i = 0; i < removeCount; i++) { - fragment.appendChild(elementsToRemove[i]); - } - - if (jqLite.hasData(firstElementToRemove)) { - // Copy over user data (that includes AngularJS's $scope etc.). Don't copy private - // data here because there's no public interface in jQuery to do that and copying over - // event listeners (which is the main use of private data) wouldn't work anyway. - jqLite.data(newNode, jqLite.data(firstElementToRemove)); - - // Remove $destroy event listeners from `firstElementToRemove` - jqLite(firstElementToRemove).off('$destroy'); - } - - // Cleanup any data/listeners on the elements and children. - // This includes invoking the $destroy event on any elements with listeners. - jqLite.cleanData(fragment.querySelectorAll('*')); - - // Update the jqLite collection to only contain the `newNode` - for (i = 1; i < removeCount; i++) { - delete elementsToRemove[i]; - } - elementsToRemove[0] = newNode; - elementsToRemove.length = 1; - } - - - function cloneAndAnnotateFn(fn, annotation) { - return extend(function() { return fn.apply(null, arguments); }, fn, annotation); - } - - - function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) { - try { - linkFn(scope, $element, attrs, controllers, transcludeFn); - } catch (e) { - $exceptionHandler(e, startingTag($element)); - } - } - - function strictBindingsCheck(attrName, directiveName) { - if (strictComponentBindingsEnabled) { - throw $compileMinErr('missingattr', - 'Attribute \'{0}\' of \'{1}\' is non-optional and must be set!', - attrName, directiveName); - } - } - - // Set up $watches for isolate scope and controller bindings. - function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) { - var removeWatchCollection = []; - var initialChanges = {}; - var changes; - - forEach(bindings, function initializeBinding(definition, scopeName) { - var attrName = definition.attrName, - optional = definition.optional, - mode = definition.mode, // @, =, <, or & - lastValue, - parentGet, parentSet, compare, removeWatch; - - switch (mode) { - - case '@': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - destination[scopeName] = attrs[attrName] = undefined; - - } - removeWatch = attrs.$observe(attrName, function(value) { - if (isString(value) || isBoolean(value)) { - var oldValue = destination[scopeName]; - recordChanges(scopeName, value, oldValue); - destination[scopeName] = value; - } - }); - attrs.$$observers[attrName].$$scope = scope; - lastValue = attrs[attrName]; - if (isString(lastValue)) { - // If the attribute has been provided then we trigger an interpolation to ensure - // the value is there for use in the link fn - destination[scopeName] = $interpolate(lastValue)(scope); - } else if (isBoolean(lastValue)) { - // If the attributes is one of the BOOLEAN_ATTR then AngularJS will have converted - // the value to boolean rather than a string, so we special case this situation - destination[scopeName] = lastValue; - } - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - removeWatchCollection.push(removeWatch); - break; - - case '=': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - if (parentGet.literal) { - compare = equals; - } else { - compare = simpleCompare; - } - parentSet = parentGet.assign || function() { - // reset the change, or we will throw this exception on every $digest - lastValue = destination[scopeName] = parentGet(scope); - throw $compileMinErr('nonassign', - 'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!', - attrs[attrName], attrName, directive.name); - }; - lastValue = destination[scopeName] = parentGet(scope); - var parentValueWatch = function parentValueWatch(parentValue) { - if (!compare(parentValue, destination[scopeName])) { - // we are out of sync and need to copy - if (!compare(parentValue, lastValue)) { - // parent changed and it has precedence - destination[scopeName] = parentValue; - } else { - // if the parent can be assigned then do so - parentSet(scope, parentValue = destination[scopeName]); - } - } - lastValue = parentValue; - return lastValue; - }; - parentValueWatch.$stateful = true; - if (definition.collection) { - removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch); - } else { - removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal); - } - removeWatchCollection.push(removeWatch); - break; - - case '<': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - var isLiteral = parentGet.literal; - - var initialValue = destination[scopeName] = parentGet(scope); - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - - removeWatch = scope[definition.collection ? '$watchCollection' : '$watch'](parentGet, function parentValueWatchAction(newValue, oldValue) { - if (oldValue === newValue) { - if (oldValue === initialValue || (isLiteral && equals(oldValue, initialValue))) { - return; - } - oldValue = initialValue; - } - recordChanges(scopeName, newValue, oldValue); - destination[scopeName] = newValue; - }); - - removeWatchCollection.push(removeWatch); - break; - - case '&': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - } - // Don't assign Object.prototype method to scope - parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop; - - // Don't assign noop to destination if expression is not valid - if (parentGet === noop && optional) break; - - destination[scopeName] = function(locals) { - return parentGet(scope, locals); - }; - break; - } - }); - - function recordChanges(key, currentValue, previousValue) { - if (isFunction(destination.$onChanges) && !simpleCompare(currentValue, previousValue)) { - // If we have not already scheduled the top level onChangesQueue handler then do so now - if (!onChangesQueue) { - scope.$$postDigest(flushOnChangesQueue); - onChangesQueue = []; - } - // If we have not already queued a trigger of onChanges for this controller then do so now - if (!changes) { - changes = {}; - onChangesQueue.push(triggerOnChangesHook); - } - // If the has been a change on this property already then we need to reuse the previous value - if (changes[key]) { - previousValue = changes[key].previousValue; - } - // Store this change - changes[key] = new SimpleChange(previousValue, currentValue); - } - } - - function triggerOnChangesHook() { - destination.$onChanges(changes); - // Now clear the changes so that we schedule onChanges when more changes arrive - changes = undefined; - } - - return { - initialChanges: initialChanges, - removeWatches: removeWatchCollection.length && function removeWatches() { - for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) { - removeWatchCollection[i](); - } - } - }; - } - }]; -} - -function SimpleChange(previous, current) { - this.previousValue = previous; - this.currentValue = current; -} -SimpleChange.prototype.isFirstChange = function() { return this.previousValue === _UNINITIALIZED_VALUE; }; - - -var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; -var SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g; - -/** - * Converts all accepted directives format into proper directive name. - * @param name Name to normalize - */ -function directiveNormalize(name) { - return name - .replace(PREFIX_REGEXP, '') - .replace(SPECIAL_CHARS_REGEXP, function(_, letter, offset) { - return offset ? letter.toUpperCase() : letter; - }); -} - -/** - * @ngdoc type - * @name $compile.directive.Attributes - * - * @description - * A shared object between directive compile / linking functions which contains normalized DOM - * element attributes. The values reflect current binding state `{{ }}`. The normalization is - * needed since all of these are treated as equivalent in AngularJS: - * - * ``` - * - * ``` - */ - -/** - * @ngdoc property - * @name $compile.directive.Attributes#$attr - * - * @description - * A map of DOM element attribute names to the normalized name. This is - * needed to do reverse lookup from normalized name back to actual name. - */ - - -/** - * @ngdoc method - * @name $compile.directive.Attributes#$set - * @kind function - * - * @description - * Set DOM element attribute value. - * - * - * @param {string} name Normalized element attribute name of the property to modify. The name is - * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr} - * property to the original name. - * @param {string} value Value to set the attribute to. The value can be an interpolated string. - */ - - - -/** - * Closure compiler type information - */ - -function nodesetLinkingFn( - /* angular.Scope */ scope, - /* NodeList */ nodeList, - /* Element */ rootElement, - /* function(Function) */ boundTranscludeFn -) {} - -function directiveLinkingFn( - /* nodesetLinkingFn */ nodesetLinkingFn, - /* angular.Scope */ scope, - /* Node */ node, - /* Element */ rootElement, - /* function(Function) */ boundTranscludeFn -) {} - -function tokenDifference(str1, str2) { - var values = '', - tokens1 = str1.split(/\s+/), - tokens2 = str2.split(/\s+/); - - outer: - for (var i = 0; i < tokens1.length; i++) { - var token = tokens1[i]; - for (var j = 0; j < tokens2.length; j++) { - if (token === tokens2[j]) continue outer; - } - values += (values.length > 0 ? ' ' : '') + token; - } - return values; -} - -function removeComments(jqNodes) { - jqNodes = jqLite(jqNodes); - var i = jqNodes.length; - - if (i <= 1) { - return jqNodes; - } - - while (i--) { - var node = jqNodes[i]; - if (node.nodeType === NODE_TYPE_COMMENT || - (node.nodeType === NODE_TYPE_TEXT && node.nodeValue.trim() === '')) { - splice.call(jqNodes, i, 1); - } - } - return jqNodes; -} - -var $controllerMinErr = minErr('$controller'); - - -var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/; -function identifierForController(controller, ident) { - if (ident && isString(ident)) return ident; - if (isString(controller)) { - var match = CNTRL_REG.exec(controller); - if (match) return match[3]; - } -} - - -/** - * @ngdoc provider - * @name $controllerProvider - * @this - * - * @description - * The {@link ng.$controller $controller service} is used by AngularJS to create new - * controllers. - * - * This provider allows controller registration via the - * {@link ng.$controllerProvider#register register} method. - */ -function $ControllerProvider() { - var controllers = {}; - - /** - * @ngdoc method - * @name $controllerProvider#has - * @param {string} name Controller name to check. - */ - this.has = function(name) { - return controllers.hasOwnProperty(name); - }; - - /** - * @ngdoc method - * @name $controllerProvider#register - * @param {string|Object} name Controller name, or an object map of controllers where the keys are - * the names and the values are the constructors. - * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI - * annotations in the array notation). - */ - this.register = function(name, constructor) { - assertNotHasOwnProperty(name, 'controller'); - if (isObject(name)) { - extend(controllers, name); - } else { - controllers[name] = constructor; - } - }; - - this.$get = ['$injector', function($injector) { - - /** - * @ngdoc service - * @name $controller - * @requires $injector - * - * @param {Function|string} constructor If called with a function then it's considered to be the - * controller constructor function. Otherwise it's considered to be a string which is used - * to retrieve the controller constructor using the following steps: - * - * * check if a controller with given name is registered via `$controllerProvider` - * * check if evaluating the string on the current scope returns a constructor - * - * The string can use the `controller as property` syntax, where the controller instance is published - * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this - * to work correctly. - * - * @param {Object} locals Injection locals for Controller. - * @return {Object} Instance of given controller. - * - * @description - * `$controller` service is responsible for instantiating controllers. - * - * It's just a simple call to {@link auto.$injector $injector}, but extracted into - * a service, so that one can override this service with [BC version](https://gist.github.com/1649788). - */ - return function $controller(expression, locals, later, ident) { - // PRIVATE API: - // param `later` --- indicates that the controller's constructor is invoked at a later time. - // If true, $controller will allocate the object with the correct - // prototype chain, but will not invoke the controller until a returned - // callback is invoked. - // param `ident` --- An optional label which overrides the label parsed from the controller - // expression, if any. - var instance, match, constructor, identifier; - later = later === true; - if (ident && isString(ident)) { - identifier = ident; - } - - if (isString(expression)) { - match = expression.match(CNTRL_REG); - if (!match) { - throw $controllerMinErr('ctrlfmt', - 'Badly formed controller string \'{0}\'. ' + - 'Must match `__name__ as __id__` or `__name__`.', expression); - } - constructor = match[1]; - identifier = identifier || match[3]; - expression = controllers.hasOwnProperty(constructor) - ? controllers[constructor] - : getter(locals.$scope, constructor, true); - - if (!expression) { - throw $controllerMinErr('ctrlreg', - 'The controller with the name \'{0}\' is not registered.', constructor); - } - - assertArgFn(expression, constructor, true); - } - - if (later) { - // Instantiate controller later: - // This machinery is used to create an instance of the object before calling the - // controller's constructor itself. - // - // This allows properties to be added to the controller before the constructor is - // invoked. Primarily, this is used for isolate scope bindings in $compile. - // - // This feature is not intended for use by applications, and is thus not documented - // publicly. - // Object creation: http://jsperf.com/create-constructor/2 - var controllerPrototype = (isArray(expression) ? - expression[expression.length - 1] : expression).prototype; - instance = Object.create(controllerPrototype || null); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return extend(function $controllerInit() { - var result = $injector.invoke(expression, instance, locals, constructor); - if (result !== instance && (isObject(result) || isFunction(result))) { - instance = result; - if (identifier) { - // If result changed, re-assign controllerAs value to scope. - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - } - return instance; - }, { - instance: instance, - identifier: identifier - }); - } - - instance = $injector.instantiate(expression, locals, constructor); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return instance; - }; - - function addIdentifier(locals, identifier, instance, name) { - if (!(locals && isObject(locals.$scope))) { - throw minErr('$controller')('noscp', - 'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.', - name, identifier); - } - - locals.$scope[identifier] = instance; - } - }]; -} - -/** - * @ngdoc service - * @name $document - * @requires $window - * @this - * - * @description - * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object. - * - * @example - - -
-

$document title:

-

window.document title:

-
-
- - angular.module('documentExample', []) - .controller('ExampleController', ['$scope', '$document', function($scope, $document) { - $scope.title = $document[0].title; - $scope.windowTitle = angular.element(window.document)[0].title; - }]); - -
- */ -function $DocumentProvider() { - this.$get = ['$window', function(window) { - return jqLite(window.document); - }]; -} - - -/** - * @private - * @this - * Listens for document visibility change and makes the current status accessible. - */ -function $$IsDocumentHiddenProvider() { - this.$get = ['$document', '$rootScope', function($document, $rootScope) { - var doc = $document[0]; - var hidden = doc && doc.hidden; - - $document.on('visibilitychange', changeListener); - - $rootScope.$on('$destroy', function() { - $document.off('visibilitychange', changeListener); - }); - - function changeListener() { - hidden = doc.hidden; - } - - return function() { - return hidden; - }; - }]; -} - -/** - * @ngdoc service - * @name $exceptionHandler - * @requires ng.$log - * @this - * - * @description - * Any uncaught exception in AngularJS expressions is delegated to this service. - * The default implementation simply delegates to `$log.error` which logs it into - * the browser console. - * - * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by - * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. - * - * ## Example: - * - * The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught - * errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead - * of `$log.error()`. - * - * ```js - * angular. - * module('exceptionOverwrite', []). - * factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) { - * return function myExceptionHandler(exception, cause) { - * logErrorsToBackend(exception, cause); - * $log.warn(exception, cause); - * }; - * }]); - * ``` - * - *
- * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind` - * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler} - * (unless executed during a digest). - * - * If you wish, you can manually delegate exceptions, e.g. - * `try { ... } catch(e) { $exceptionHandler(e); }` - * - * @param {Error} exception Exception associated with the error. - * @param {string=} cause Optional information about the context in which - * the error was thrown. - * - */ -function $ExceptionHandlerProvider() { - this.$get = ['$log', function($log) { - return function(exception, cause) { - $log.error.apply($log, arguments); - }; - }]; -} - -var $$ForceReflowProvider = /** @this */ function() { - this.$get = ['$document', function($document) { - return function(domNode) { - //the line below will force the browser to perform a repaint so - //that all the animated elements within the animation frame will - //be properly updated and drawn on screen. This is required to - //ensure that the preparation animation is properly flushed so that - //the active state picks up from there. DO NOT REMOVE THIS LINE. - //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH - //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND - //WILL TAKE YEARS AWAY FROM YOUR LIFE. - if (domNode) { - if (!domNode.nodeType && domNode instanceof jqLite) { - domNode = domNode[0]; - } - } else { - domNode = $document[0].body; - } - return domNode.offsetWidth + 1; - }; - }]; -}; - -var APPLICATION_JSON = 'application/json'; -var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'}; -var JSON_START = /^\[|^\{(?!\{)/; -var JSON_ENDS = { - '[': /]$/, - '{': /}$/ -}; -var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/; -var $httpMinErr = minErr('$http'); - -function serializeValue(v) { - if (isObject(v)) { - return isDate(v) ? v.toISOString() : toJson(v); - } - return v; -} - - -/** @this */ -function $HttpParamSerializerProvider() { - /** - * @ngdoc service - * @name $httpParamSerializer - * @description - * - * Default {@link $http `$http`} params serializer that converts objects to strings - * according to the following rules: - * - * * `{'foo': 'bar'}` results in `foo=bar` - * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) - * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) - * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object) - * - * Note that serializer will sort the request parameters alphabetically. - */ - - this.$get = function() { - return function ngParamSerializer(params) { - if (!params) return ''; - var parts = []; - forEachSorted(params, function(value, key) { - if (value === null || isUndefined(value) || isFunction(value)) return; - if (isArray(value)) { - forEach(value, function(v) { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); - }); - } else { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); - } - }); - - return parts.join('&'); - }; - }; -} - -/** @this */ -function $HttpParamSerializerJQLikeProvider() { - /** - * @ngdoc service - * @name $httpParamSerializerJQLike - * - * @description - * - * Alternative {@link $http `$http`} params serializer that follows - * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic. - * The serializer will also sort the params alphabetically. - * - * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property: - * - * ```js - * $http({ - * url: myUrl, - * method: 'GET', - * params: myParams, - * paramSerializer: '$httpParamSerializerJQLike' - * }); - * ``` - * - * It is also possible to set it as the default `paramSerializer` in the - * {@link $httpProvider#defaults `$httpProvider`}. - * - * Additionally, you can inject the serializer and use it explicitly, for example to serialize - * form data for submission: - * - * ```js - * .controller(function($http, $httpParamSerializerJQLike) { - * //... - * - * $http({ - * url: myUrl, - * method: 'POST', - * data: $httpParamSerializerJQLike(myData), - * headers: { - * 'Content-Type': 'application/x-www-form-urlencoded' - * } - * }); - * - * }); - * ``` - * - */ - this.$get = function() { - return function jQueryLikeParamSerializer(params) { - if (!params) return ''; - var parts = []; - serialize(params, '', true); - return parts.join('&'); - - function serialize(toSerialize, prefix, topLevel) { - if (isArray(toSerialize)) { - forEach(toSerialize, function(value, index) { - serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']'); - }); - } else if (isObject(toSerialize) && !isDate(toSerialize)) { - forEachSorted(toSerialize, function(value, key) { - serialize(value, prefix + - (topLevel ? '' : '[') + - key + - (topLevel ? '' : ']')); - }); - } else { - if (isFunction(toSerialize)) { - toSerialize = toSerialize(); - } - parts.push(encodeUriQuery(prefix) + '=' + - (toSerialize == null ? '' : encodeUriQuery(serializeValue(toSerialize)))); - } - } - }; - }; -} - -function defaultHttpResponseTransform(data, headers) { - if (isString(data)) { - // Strip json vulnerability protection prefix and trim whitespace - var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim(); - - if (tempData) { - var contentType = headers('Content-Type'); - var hasJsonContentType = contentType && (contentType.indexOf(APPLICATION_JSON) === 0); - - if (hasJsonContentType || isJsonLike(tempData)) { - try { - data = fromJson(tempData); - } catch (e) { - if (!hasJsonContentType) { - return data; - } - throw $httpMinErr('baddata', 'Data must be a valid JSON object. Received: "{0}". ' + - 'Parse error: "{1}"', data, e); - } - } - } - } - - return data; -} - -function isJsonLike(str) { - var jsonStart = str.match(JSON_START); - return jsonStart && JSON_ENDS[jsonStart[0]].test(str); -} - -/** - * Parse headers into key value object - * - * @param {string} headers Raw headers as a string - * @returns {Object} Parsed headers as key value object - */ -function parseHeaders(headers) { - var parsed = createMap(), i; - - function fillInParsed(key, val) { - if (key) { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - } - - if (isString(headers)) { - forEach(headers.split('\n'), function(line) { - i = line.indexOf(':'); - fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1))); - }); - } else if (isObject(headers)) { - forEach(headers, function(headerVal, headerKey) { - fillInParsed(lowercase(headerKey), trim(headerVal)); - }); - } - - return parsed; -} - - -/** - * Returns a function that provides access to parsed headers. - * - * Headers are lazy parsed when first requested. - * @see parseHeaders - * - * @param {(string|Object)} headers Headers to provide access to. - * @returns {function(string=)} Returns a getter function which if called with: - * - * - if called with an argument returns a single header value or null - * - if called with no arguments returns an object containing all headers. - */ -function headersGetter(headers) { - var headersObj; - - return function(name) { - if (!headersObj) headersObj = parseHeaders(headers); - - if (name) { - var value = headersObj[lowercase(name)]; - if (value === undefined) { - value = null; - } - return value; - } - - return headersObj; - }; -} - - -/** - * Chain all given functions - * - * This function is used for both request and response transforming - * - * @param {*} data Data to transform. - * @param {function(string=)} headers HTTP headers getter fn. - * @param {number} status HTTP status code of the response. - * @param {(Function|Array.)} fns Function or an array of functions. - * @returns {*} Transformed data. - */ -function transformData(data, headers, status, fns) { - if (isFunction(fns)) { - return fns(data, headers, status); - } - - forEach(fns, function(fn) { - data = fn(data, headers, status); - }); - - return data; -} - - -function isSuccess(status) { - return 200 <= status && status < 300; -} - - -/** - * @ngdoc provider - * @name $httpProvider - * @this - * - * @description - * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. - */ -function $HttpProvider() { - /** - * @ngdoc property - * @name $httpProvider#defaults - * @description - * - * Object containing default values for all {@link ng.$http $http} requests. - * - * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses - * by default. See {@link $http#caching $http Caching} for more information. - * - * - **`defaults.headers`** - {Object} - Default headers for all $http requests. - * Refer to {@link ng.$http#setting-http-headers $http} for documentation on - * setting default headers. - * - **`defaults.headers.common`** - * - **`defaults.headers.post`** - * - **`defaults.headers.put`** - * - **`defaults.headers.patch`** - * - * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the - * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the - * {@link $jsonpCallbacks} service. Defaults to `'callback'`. - * - * - **`defaults.paramSerializer`** - `{string|function(Object):string}` - A function - * used to the prepare string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}. - * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}. - * - * - **`defaults.transformRequest`** - - * `{Array|function(data, headersGetter)}` - - * An array of functions (or a single function) which are applied to the request data. - * By default, this is an array with one request transformation function: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * - **`defaults.transformResponse`** - - * `{Array|function(data, headersGetter, status)}` - - * An array of functions (or a single function) which are applied to the response data. By default, - * this is an array which applies one response transformation function that does two things: - * - * - If XSRF prefix is detected, strip it - * (see {@link ng.$http#security-considerations Security Considerations in the $http docs}). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. - * Defaults value is `'XSRF-TOKEN'`. - * - * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the - * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. - * - */ - var defaults = this.defaults = { - // transform incoming response data - transformResponse: [defaultHttpResponseTransform], - - // transform outgoing request data - transformRequest: [function(d) { - return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; - }], - - // default headers - headers: { - common: { - 'Accept': 'application/json, text/plain, */*' - }, - post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) - }, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - paramSerializer: '$httpParamSerializer', - - jsonpCallbackParam: 'callback' - }; - - var useApplyAsync = false; - /** - * @ngdoc method - * @name $httpProvider#useApplyAsync - * @description - * - * Configure $http service to combine processing of multiple http responses received at around - * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in - * significant performance improvement for bigger applications that make many HTTP requests - * concurrently (common during application bootstrap). - * - * Defaults to false. If no value is specified, returns the current configured value. - * - * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred - * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window - * to load and share the same digest cycle. - * - * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. - * otherwise, returns the current configured value. - */ - this.useApplyAsync = function(value) { - if (isDefined(value)) { - useApplyAsync = !!value; - return this; - } - return useApplyAsync; - }; - - /** - * @ngdoc property - * @name $httpProvider#interceptors - * @description - * - * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http} - * pre-processing of request or postprocessing of responses. - * - * These service factories are ordered by request, i.e. they are applied in the same order as the - * array, on request, but reverse order, on response. - * - * {@link ng.$http#interceptors Interceptors detailed info} - */ - var interceptorFactories = this.interceptors = []; - - /** - * @ngdoc property - * @name $httpProvider#xsrfWhitelistedOrigins - * @description - * - * Array containing URLs whose origins are trusted to receive the XSRF token. See the - * {@link ng.$http#security-considerations Security Considerations} sections for more details on - * XSRF. - * - * **Note:** An "origin" consists of the [URI scheme](https://en.wikipedia.org/wiki/URI_scheme), - * the [hostname](https://en.wikipedia.org/wiki/Hostname) and the - * [port number](https://en.wikipedia.org/wiki/Port_(computer_networking). For `http:` and - * `https:`, the port number can be omitted if using th default ports (80 and 443 respectively). - * Examples: `http://example.com`, `https://api.example.com:9876` - * - *
- * It is not possible to whitelist specific URLs/paths. The `path`, `query` and `fragment` parts - * of a URL will be ignored. For example, `https://foo.com/path/bar?query=baz#fragment` will be - * treated as `https://foo.com`, meaning that **all** requests to URLs starting with - * `https://foo.com/` will include the XSRF token. - *
- * - * @example - * - * ```js - * // App served from `https://example.com/`. - * angular. - * module('xsrfWhitelistedOriginsExample', []). - * config(['$httpProvider', function($httpProvider) { - * $httpProvider.xsrfWhitelistedOrigins.push('https://api.example.com'); - * }]). - * run(['$http', function($http) { - * // The XSRF token will be sent. - * $http.get('https://api.example.com/preferences').then(...); - * - * // The XSRF token will NOT be sent. - * $http.get('https://stats.example.com/activity').then(...); - * }]); - * ``` - */ - var xsrfWhitelistedOrigins = this.xsrfWhitelistedOrigins = []; - - this.$get = ['$browser', '$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector', '$sce', - function($browser, $httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector, $sce) { - - var defaultCache = $cacheFactory('$http'); - - /** - * Make sure that default param serializer is exposed as a function - */ - defaults.paramSerializer = isString(defaults.paramSerializer) ? - $injector.get(defaults.paramSerializer) : defaults.paramSerializer; - - /** - * Interceptors stored in reverse order. Inner interceptors before outer interceptors. - * The reversal is needed so that we can build up the interception chain around the - * server request. - */ - var reversedInterceptors = []; - - forEach(interceptorFactories, function(interceptorFactory) { - reversedInterceptors.unshift(isString(interceptorFactory) - ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); - }); - - /** - * A function to check request URLs against a list of allowed origins. - */ - var urlIsAllowedOrigin = urlIsAllowedOriginFactory(xsrfWhitelistedOrigins); - - /** - * @ngdoc service - * @kind function - * @name $http - * @requires ng.$httpBackend - * @requires $cacheFactory - * @requires $rootScope - * @requires $q - * @requires $injector - * - * @description - * The `$http` service is a core AngularJS service that facilitates communication with the remote - * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) - * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP). - * - * For unit testing applications that use `$http` service, see - * {@link ngMock.$httpBackend $httpBackend mock}. - * - * For a higher level of abstraction, please check out the {@link ngResource.$resource - * $resource} service. - * - * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by - * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage - * it is important to familiarize yourself with these APIs and the guarantees they provide. - * - * - * ## General usage - * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} — - * that is used to generate an HTTP request and returns a {@link ng.$q promise} that is - * resolved (request success) or rejected (request failure) with a - * {@link ng.$http#$http-returns response} object. - * - * ```js - * // Simple GET request example: - * $http({ - * method: 'GET', - * url: '/someUrl' - * }).then(function successCallback(response) { - * // this callback will be called asynchronously - * // when the response is available - * }, function errorCallback(response) { - * // called asynchronously if an error occurs - * // or server returns response with an error status. - * }); - * ``` - * - * - * ## Shortcut methods - * - * Shortcut methods are also available. All shortcut methods require passing in the URL, and - * request data must be passed in for POST/PUT requests. An optional config can be passed as the - * last argument. - * - * ```js - * $http.get('/someUrl', config).then(successCallback, errorCallback); - * $http.post('/someUrl', data, config).then(successCallback, errorCallback); - * ``` - * - * Complete list of shortcut methods: - * - * - {@link ng.$http#get $http.get} - * - {@link ng.$http#head $http.head} - * - {@link ng.$http#post $http.post} - * - {@link ng.$http#put $http.put} - * - {@link ng.$http#delete $http.delete} - * - {@link ng.$http#jsonp $http.jsonp} - * - {@link ng.$http#patch $http.patch} - * - * - * ## Writing Unit Tests that use $http - * When unit testing (using {@link ngMock ngMock}), it is necessary to call - * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending - * request using trained responses. - * - * ``` - * $httpBackend.expectGET(...); - * $http.get(...); - * $httpBackend.flush(); - * ``` - * - * ## Setting HTTP Headers - * - * The $http service will automatically add certain HTTP headers to all requests. These defaults - * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration - * object, which currently contains this default configuration: - * - * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): - * - Accept: application/json, text/plain, \*/\* - * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) - * - `Content-Type: application/json` - * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) - * - `Content-Type: application/json` - * - * To add or overwrite these defaults, simply add or remove a property from these configuration - * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object - * with the lowercased HTTP method name as the key, e.g. - * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`. - * - * The defaults can also be set at runtime via the `$http.defaults` object in the same - * fashion. For example: - * - * ``` - * module.run(function($http) { - * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'; - * }); - * ``` - * - * In addition, you can supply a `headers` property in the config object passed when - * calling `$http(config)`, which overrides the defaults without changing them globally. - * - * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis, - * Use the `headers` property, setting the desired header to `undefined`. For example: - * - * ```js - * var req = { - * method: 'POST', - * url: 'http://example.com', - * headers: { - * 'Content-Type': undefined - * }, - * data: { test: 'test' } - * } - * - * $http(req).then(function(){...}, function(){...}); - * ``` - * - * ## Transforming Requests and Responses - * - * Both requests and responses can be transformed using transformation functions: `transformRequest` - * and `transformResponse`. These properties can be a single function that returns - * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions, - * which allows you to `push` or `unshift` a new transformation function into the transformation chain. - * - *
- * **Note:** AngularJS does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline. - * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference). - * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest - * function will be reflected on the scope and in any templates where the object is data-bound. - * To prevent this, transform functions should have no side-effects. - * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return. - *
- * - * ### Default Transformations - * - * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and - * `defaults.transformResponse` properties. If a request does not provide its own transformations - * then these will be applied. - * - * You can augment or replace the default transformations by modifying these properties by adding to or - * replacing the array. - * - * AngularJS provides the following default transformations: - * - * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`) is - * an array with one function that does the following: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`) is - * an array with one function that does the following: - * - * - If XSRF prefix is detected, strip it (see Security Considerations section below). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - * ### Overriding the Default Transformations Per Request - * - * If you wish to override the request/response transformations only for a single request then provide - * `transformRequest` and/or `transformResponse` properties on the configuration object passed - * into `$http`. - * - * Note that if you provide these properties on the config object the default transformations will be - * overwritten. If you wish to augment the default transformations then you must include them in your - * local transformation array. - * - * The following code demonstrates adding a new response transformation to be run after the default response - * transformations have been run. - * - * ```js - * function appendTransform(defaults, transform) { - * - * // We can't guarantee that the default transformation is an array - * defaults = angular.isArray(defaults) ? defaults : [defaults]; - * - * // Append the new transformation to the defaults - * return defaults.concat(transform); - * } - * - * $http({ - * url: '...', - * method: 'GET', - * transformResponse: appendTransform($http.defaults.transformResponse, function(value) { - * return doTransform(value); - * }) - * }); - * ``` - * - * - * ## Caching - * - * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must - * set the config.cache value or the default cache value to TRUE or to a cache object (created - * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes - * precedence over the default cache value. - * - * In order to: - * * cache all responses - set the default cache value to TRUE or to a cache object - * * cache a specific response - set config.cache value to TRUE or to a cache object - * - * If caching is enabled, but neither the default cache nor config.cache are set to a cache object, - * then the default `$cacheFactory("$http")` object is used. - * - * The default cache value can be set by updating the - * {@link ng.$http#defaults `$http.defaults.cache`} property or the - * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property. - * - * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using - * the relevant cache object. The next time the same request is made, the response is returned - * from the cache without sending a request to the server. - * - * Take note that: - * - * * Only GET and JSONP requests are cached. - * * The cache key is the request URL including search parameters; headers are not considered. - * * Cached responses are returned asynchronously, in the same way as responses from the server. - * * If multiple identical requests are made using the same cache, which is not yet populated, - * one request will be made to the server and remaining requests will return the same response. - * * A cache-control header on the response does not affect if or how responses are cached. - * - * - * ## Interceptors - * - * Before you start creating interceptors, be sure to understand the - * {@link ng.$q $q and deferred/promise APIs}. - * - * For purposes of global error handling, authentication, or any kind of synchronous or - * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be - * able to intercept requests before they are handed to the server and - * responses before they are handed over to the application code that - * initiated these requests. The interceptors leverage the {@link ng.$q - * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. - * - * The interceptors are service factories that are registered with the `$httpProvider` by - * adding them to the `$httpProvider.interceptors` array. The factory is called and - * injected with dependencies (if specified) and returns the interceptor. - * - * There are two kinds of interceptors (and two kinds of rejection interceptors): - * - * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to - * modify the `config` object or create a new one. The function needs to return the `config` - * object directly, or a promise containing the `config` or a new `config` object. - * * `requestError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * * `response`: interceptors get called with http `response` object. The function is free to - * modify the `response` object or create a new one. The function needs to return the `response` - * object directly, or as a promise containing the `response` or a new `response` object. - * * `responseError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * - * - * ```js - * // register the interceptor as a service - * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { - * return { - * // optional method - * 'request': function(config) { - * // do something on success - * return config; - * }, - * - * // optional method - * 'requestError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * }, - * - * - * - * // optional method - * 'response': function(response) { - * // do something on success - * return response; - * }, - * - * // optional method - * 'responseError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * } - * }; - * }); - * - * $httpProvider.interceptors.push('myHttpInterceptor'); - * - * - * // alternatively, register the interceptor via an anonymous factory - * $httpProvider.interceptors.push(function($q, dependency1, dependency2) { - * return { - * 'request': function(config) { - * // same as above - * }, - * - * 'response': function(response) { - * // same as above - * } - * }; - * }); - * ``` - * - * ## Security Considerations - * - * When designing web applications, consider security threats from: - * - * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) - * - * Both server and the client must cooperate in order to eliminate these threats. AngularJS comes - * pre-configured with strategies that address these issues, but for this to work backend server - * cooperation is required. - * - * ### JSON Vulnerability Protection - * - * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * allows third party website to turn your JSON resource URL into - * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To - * counter this your server can prefix all JSON requests with following string `")]}',\n"`. - * AngularJS will automatically strip the prefix before processing it as JSON. - * - * For example if your server needs to return: - * ```js - * ['one','two'] - * ``` - * - * which is vulnerable to attack, your server can return: - * ```js - * )]}', - * ['one','two'] - * ``` - * - * AngularJS will strip the prefix, before processing the JSON. - * - * - * ### Cross Site Request Forgery (XSRF) Protection - * - * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by - * which the attacker can trick an authenticated user into unknowingly executing actions on your - * website. AngularJS provides a mechanism to counter XSRF. When performing XHR requests, the - * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP - * header (by default `X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read - * the cookie, your server can be assured that the XHR came from JavaScript running on your - * domain. - * - * To take advantage of this, your server needs to set a token in a JavaScript readable session - * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the - * server can verify that the cookie matches the `X-XSRF-TOKEN` HTTP header, and therefore be - * sure that only JavaScript running on your domain could have sent the request. The token must - * be unique for each user and must be verifiable by the server (to prevent the JavaScript from - * making up its own tokens). We recommend that the token is a digest of your site's - * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) - * for added security. - * - * The header will — by default — **not** be set for cross-domain requests. This - * prevents unauthorized servers (e.g. malicious or compromised 3rd-party APIs) from gaining - * access to your users' XSRF tokens and exposing them to Cross Site Request Forgery. If you - * want to, you can whitelist additional origins to also receive the XSRF token, by adding them - * to {@link ng.$httpProvider#xsrfWhitelistedOrigins xsrfWhitelistedOrigins}. This might be - * useful, for example, if your application, served from `example.com`, needs to access your API - * at `api.example.com`. - * See {@link ng.$httpProvider#xsrfWhitelistedOrigins $httpProvider.xsrfWhitelistedOrigins} for - * more details. - * - *
- * **Warning**
- * Only whitelist origins that you have control over and make sure you understand the - * implications of doing so. - *
- * - * The name of the cookie and the header can be specified using the `xsrfCookieName` and - * `xsrfHeaderName` properties of either `$httpProvider.defaults` at config-time, - * `$http.defaults` at run-time, or the per-request config object. - * - * In order to prevent collisions in environments where multiple AngularJS apps share the - * same domain or subdomain, we recommend that each application uses a unique cookie name. - * - * - * @param {object} config Object describing the request to be made and how it should be - * processed. The object has following properties: - * - * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) - * - **url** – `{string|TrustedObject}` – Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * - **params** – `{Object.}` – Map of strings or objects which will be serialized - * with the `paramSerializer` and appended as GET parameters. - * - **data** – `{string|Object}` – Data to be sent as the request message data. - * - **headers** – `{Object}` – Map of strings or functions which return strings representing - * HTTP headers to send to the server. If the return value of a function is null, the - * header will not be sent. Functions accept a config object as an argument. - * - **eventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest object. - * To bind events to the XMLHttpRequest upload object, use `uploadEventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **uploadEventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest upload - * object. To bind events to the XMLHttpRequest object, use `eventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. - * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. - * - **transformRequest** – - * `{function(data, headersGetter)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * request body and headers and returns its transformed (typically serialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **transformResponse** – - * `{function(data, headersGetter, status)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * response body, headers and status and returns its transformed (typically deserialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **paramSerializer** - `{string|function(Object):string}` - A function used to - * prepare the string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as function registered with the - * {@link $injector $injector}, which means you can create your own serializer - * by registering it as a {@link auto.$provide#service service}. - * The default serializer is the {@link $httpParamSerializer $httpParamSerializer}; - * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike} - * - **cache** – `{boolean|Object}` – A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response. - * See {@link $http#caching $http Caching} for more information. - * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} - * that should abort the request when resolved. - * - * A numerical timeout or a promise returned from {@link ng.$timeout $timeout}, will set - * the `xhrStatus` in the {@link $http#$http-returns response} to "timeout", and any other - * resolved promise will set it to "abort", following standard XMLHttpRequest behavior. - * - * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the - * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials) - * for more information. - * - **responseType** - `{string}` - see - * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype). - * - * @returns {HttpPromise} A {@link ng.$q `Promise}` that will be resolved (request success) - * or rejected (request failure) with a response object. - * - * The response object has these properties: - * - * - **data** – `{string|Object}` – The response body transformed with - * the transform functions. - * - **status** – `{number}` – HTTP status code of the response. - * - **headers** – `{function([headerName])}` – Header getter function. - * - **config** – `{Object}` – The configuration object that was used - * to generate the request. - * - **statusText** – `{string}` – HTTP status text of the response. - * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest - * (`complete`, `error`, `timeout` or `abort`). - * - * - * A response status code between 200 and 299 is considered a success status - * and will result in the success callback being called. Any response status - * code outside of that range is considered an error status and will result - * in the error callback being called. - * Also, status codes less than -1 are normalized to zero. -1 usually means - * the request was aborted, e.g. using a `config.timeout`. More information - * about the status might be available in the `xhrStatus` property. - * - * Note that if the response is a redirect, XMLHttpRequest will transparently - * follow it, meaning that the outcome (success or error) will be determined - * by the final response status code. - * - * - * @property {Array.} pendingRequests Array of config objects for currently pending - * requests. This is primarily meant to be used for debugging purposes. - * - * - * @example - - -
- - -
- - - -
http status code: {{status}}
-
http response data: {{data}}
-
-
- - angular.module('httpExample', []) - .config(['$sceDelegateProvider', function($sceDelegateProvider) { - // We must whitelist the JSONP endpoint that we are using to show that we trust it - $sceDelegateProvider.resourceUrlWhitelist([ - 'self', - 'https://angularjs.org/**' - ]); - }]) - .controller('FetchController', ['$scope', '$http', '$templateCache', - function($scope, $http, $templateCache) { - $scope.method = 'GET'; - $scope.url = 'http-hello.html'; - - $scope.fetch = function() { - $scope.code = null; - $scope.response = null; - - $http({method: $scope.method, url: $scope.url, cache: $templateCache}). - then(function(response) { - $scope.status = response.status; - $scope.data = response.data; - }, function(response) { - $scope.data = response.data || 'Request failed'; - $scope.status = response.status; - }); - }; - - $scope.updateModel = function(method, url) { - $scope.method = method; - $scope.url = url; - }; - }]); - - - Hello, $http! - - - var status = element(by.binding('status')); - var data = element(by.binding('data')); - var fetchBtn = element(by.id('fetchbtn')); - var sampleGetBtn = element(by.id('samplegetbtn')); - var invalidJsonpBtn = element(by.id('invalidjsonpbtn')); - - it('should make an xhr GET request', function() { - sampleGetBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('200'); - expect(data.getText()).toMatch(/Hello, \$http!/); - }); - -// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185 -// it('should make a JSONP request to angularjs.org', function() { -// var sampleJsonpBtn = element(by.id('samplejsonpbtn')); -// sampleJsonpBtn.click(); -// fetchBtn.click(); -// expect(status.getText()).toMatch('200'); -// expect(data.getText()).toMatch(/Super Hero!/); -// }); - - it('should make JSONP request to invalid URL and invoke the error handler', - function() { - invalidJsonpBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('0'); - expect(data.getText()).toMatch('Request failed'); - }); - -
- */ - function $http(requestConfig) { - - if (!isObject(requestConfig)) { - throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig); - } - - if (!isString($sce.valueOf(requestConfig.url))) { - throw minErr('$http')('badreq', 'Http request configuration url must be a string or a $sce trusted object. Received: {0}', requestConfig.url); - } - - var config = extend({ - method: 'get', - transformRequest: defaults.transformRequest, - transformResponse: defaults.transformResponse, - paramSerializer: defaults.paramSerializer, - jsonpCallbackParam: defaults.jsonpCallbackParam - }, requestConfig); - - config.headers = mergeHeaders(requestConfig); - config.method = uppercase(config.method); - config.paramSerializer = isString(config.paramSerializer) ? - $injector.get(config.paramSerializer) : config.paramSerializer; - - $browser.$$incOutstandingRequestCount('$http'); - - var requestInterceptors = []; - var responseInterceptors = []; - var promise = $q.resolve(config); - - // apply interceptors - forEach(reversedInterceptors, function(interceptor) { - if (interceptor.request || interceptor.requestError) { - requestInterceptors.unshift(interceptor.request, interceptor.requestError); - } - if (interceptor.response || interceptor.responseError) { - responseInterceptors.push(interceptor.response, interceptor.responseError); - } - }); - - promise = chainInterceptors(promise, requestInterceptors); - promise = promise.then(serverRequest); - promise = chainInterceptors(promise, responseInterceptors); - promise = promise.finally(completeOutstandingRequest); - - return promise; - - - function chainInterceptors(promise, interceptors) { - for (var i = 0, ii = interceptors.length; i < ii;) { - var thenFn = interceptors[i++]; - var rejectFn = interceptors[i++]; - - promise = promise.then(thenFn, rejectFn); - } - - interceptors.length = 0; - - return promise; - } - - function completeOutstandingRequest() { - $browser.$$completeOutstandingRequest(noop, '$http'); - } - - function executeHeaderFns(headers, config) { - var headerContent, processedHeaders = {}; - - forEach(headers, function(headerFn, header) { - if (isFunction(headerFn)) { - headerContent = headerFn(config); - if (headerContent != null) { - processedHeaders[header] = headerContent; - } - } else { - processedHeaders[header] = headerFn; - } - }); - - return processedHeaders; - } - - function mergeHeaders(config) { - var defHeaders = defaults.headers, - reqHeaders = extend({}, config.headers), - defHeaderName, lowercaseDefHeaderName, reqHeaderName; - - defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]); - - // using for-in instead of forEach to avoid unnecessary iteration after header has been found - defaultHeadersIteration: - for (defHeaderName in defHeaders) { - lowercaseDefHeaderName = lowercase(defHeaderName); - - for (reqHeaderName in reqHeaders) { - if (lowercase(reqHeaderName) === lowercaseDefHeaderName) { - continue defaultHeadersIteration; - } - } - - reqHeaders[defHeaderName] = defHeaders[defHeaderName]; - } - - // execute if header value is a function for merged headers - return executeHeaderFns(reqHeaders, shallowCopy(config)); - } - - function serverRequest(config) { - var headers = config.headers; - var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest); - - // strip content-type if data is undefined - if (isUndefined(reqData)) { - forEach(headers, function(value, header) { - if (lowercase(header) === 'content-type') { - delete headers[header]; - } - }); - } - - if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { - config.withCredentials = defaults.withCredentials; - } - - // send request - return sendReq(config, reqData).then(transformResponse, transformResponse); - } - - function transformResponse(response) { - // make a copy since the response must be cacheable - var resp = extend({}, response); - resp.data = transformData(response.data, response.headers, response.status, - config.transformResponse); - return (isSuccess(response.status)) - ? resp - : $q.reject(resp); - } - } - - $http.pendingRequests = []; - - /** - * @ngdoc method - * @name $http#get - * - * @description - * Shortcut method to perform `GET` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#delete - * - * @description - * Shortcut method to perform `DELETE` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#head - * - * @description - * Shortcut method to perform `HEAD` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#jsonp - * - * @description - * Shortcut method to perform `JSONP` request. - * - * Note that, since JSONP requests are sensitive because the response is given full access to the browser, - * the url must be declared, via {@link $sce} as a trusted resource URL. - * You can trust a URL by adding it to the whitelist via - * {@link $sceDelegateProvider#resourceUrlWhitelist `$sceDelegateProvider.resourceUrlWhitelist`} or - * by explicitly trusting the URL via {@link $sce#trustAsResourceUrl `$sce.trustAsResourceUrl(url)`}. - * - * You should avoid generating the URL for the JSONP request from user provided data. - * Provide additional query parameters via `params` property of the `config` parameter, rather than - * modifying the URL itself. - * - * JSONP requests must specify a callback to be used in the response from the server. This callback - * is passed as a query parameter in the request. You must specify the name of this parameter by - * setting the `jsonpCallbackParam` property on the request config object. - * - * ``` - * $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'}) - * ``` - * - * You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`. - * Initially this is set to `'callback'`. - * - *
- * You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback - * parameter value should go. - *
- * - * If you would like to customise where and how the callbacks are stored then try overriding - * or decorating the {@link $jsonpCallbacks} service. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethods('get', 'delete', 'head', 'jsonp'); - - /** - * @ngdoc method - * @name $http#post - * - * @description - * Shortcut method to perform `POST` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#put - * - * @description - * Shortcut method to perform `PUT` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#patch - * - * @description - * Shortcut method to perform `PATCH` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethodsWithData('post', 'put', 'patch'); - - /** - * @ngdoc property - * @name $http#defaults - * - * @description - * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of - * default headers, withCredentials as well as request and response transformations. - * - * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. - */ - $http.defaults = defaults; - - - return $http; - - - function createShortMethods(names) { - forEach(arguments, function(name) { - $http[name] = function(url, config) { - return $http(extend({}, config || {}, { - method: name, - url: url - })); - }; - }); - } - - - function createShortMethodsWithData(name) { - forEach(arguments, function(name) { - $http[name] = function(url, data, config) { - return $http(extend({}, config || {}, { - method: name, - url: url, - data: data - })); - }; - }); - } - - - /** - * Makes the request. - * - * !!! ACCESSES CLOSURE VARS: - * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests - */ - function sendReq(config, reqData) { - var deferred = $q.defer(), - promise = deferred.promise, - cache, - cachedResp, - reqHeaders = config.headers, - isJsonp = lowercase(config.method) === 'jsonp', - url = config.url; - - if (isJsonp) { - // JSONP is a pretty sensitive operation where we're allowing a script to have full access to - // our DOM and JS space. So we require that the URL satisfies SCE.RESOURCE_URL. - url = $sce.getTrustedResourceUrl(url); - } else if (!isString(url)) { - // If it is not a string then the URL must be a $sce trusted object - url = $sce.valueOf(url); - } - - url = buildUrl(url, config.paramSerializer(config.params)); - - if (isJsonp) { - // Check the url and add the JSONP callback placeholder - url = sanitizeJsonpCallbackParam(url, config.jsonpCallbackParam); - } - - $http.pendingRequests.push(config); - promise.then(removePendingReq, removePendingReq); - - if ((config.cache || defaults.cache) && config.cache !== false && - (config.method === 'GET' || config.method === 'JSONP')) { - cache = isObject(config.cache) ? config.cache - : isObject(/** @type {?} */ (defaults).cache) - ? /** @type {?} */ (defaults).cache - : defaultCache; - } - - if (cache) { - cachedResp = cache.get(url); - if (isDefined(cachedResp)) { - if (isPromiseLike(cachedResp)) { - // cached request has already been sent, but there is no response yet - cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult); - } else { - // serving from cache - if (isArray(cachedResp)) { - resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3], cachedResp[4]); - } else { - resolvePromise(cachedResp, 200, {}, 'OK', 'complete'); - } - } - } else { - // put the promise for the non-transformed response into cache as a placeholder - cache.put(url, promise); - } - } - - - // if we won't have the response in cache, set the xsrf headers and - // send the request to the backend - if (isUndefined(cachedResp)) { - var xsrfValue = urlIsAllowedOrigin(config.url) - ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName] - : undefined; - if (xsrfValue) { - reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; - } - - $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, - config.withCredentials, config.responseType, - createApplyHandlers(config.eventHandlers), - createApplyHandlers(config.uploadEventHandlers)); - } - - return promise; - - function createApplyHandlers(eventHandlers) { - if (eventHandlers) { - var applyHandlers = {}; - forEach(eventHandlers, function(eventHandler, key) { - applyHandlers[key] = function(event) { - if (useApplyAsync) { - $rootScope.$applyAsync(callEventHandler); - } else if ($rootScope.$$phase) { - callEventHandler(); - } else { - $rootScope.$apply(callEventHandler); - } - - function callEventHandler() { - eventHandler(event); - } - }; - }); - return applyHandlers; - } - } - - - /** - * Callback registered to $httpBackend(): - * - caches the response if desired - * - resolves the raw $http promise - * - calls $apply - */ - function done(status, response, headersString, statusText, xhrStatus) { - if (cache) { - if (isSuccess(status)) { - cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); - } else { - // remove promise from the cache - cache.remove(url); - } - } - - function resolveHttpPromise() { - resolvePromise(response, status, headersString, statusText, xhrStatus); - } - - if (useApplyAsync) { - $rootScope.$applyAsync(resolveHttpPromise); - } else { - resolveHttpPromise(); - if (!$rootScope.$$phase) $rootScope.$apply(); - } - } - - - /** - * Resolves the raw $http promise. - */ - function resolvePromise(response, status, headers, statusText, xhrStatus) { - //status: HTTP response status code, 0, -1 (aborted by timeout / promise) - status = status >= -1 ? status : 0; - - (isSuccess(status) ? deferred.resolve : deferred.reject)({ - data: response, - status: status, - headers: headersGetter(headers), - config: config, - statusText: statusText, - xhrStatus: xhrStatus - }); - } - - function resolvePromiseWithResult(result) { - resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText, result.xhrStatus); - } - - function removePendingReq() { - var idx = $http.pendingRequests.indexOf(config); - if (idx !== -1) $http.pendingRequests.splice(idx, 1); - } - } - - - function buildUrl(url, serializedParams) { - if (serializedParams.length > 0) { - url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams; - } - return url; - } - - function sanitizeJsonpCallbackParam(url, cbKey) { - var parts = url.split('?'); - if (parts.length > 2) { - // Throw if the url contains more than one `?` query indicator - throw $httpMinErr('badjsonp', 'Illegal use more than one "?", in url, "{1}"', url); - } - var params = parseKeyValue(parts[1]); - forEach(params, function(value, key) { - if (value === 'JSON_CALLBACK') { - // Throw if the url already contains a reference to JSON_CALLBACK - throw $httpMinErr('badjsonp', 'Illegal use of JSON_CALLBACK in url, "{0}"', url); - } - if (key === cbKey) { - // Throw if the callback param was already provided - throw $httpMinErr('badjsonp', 'Illegal use of callback param, "{0}", in url, "{1}"', cbKey, url); - } - }); - - // Add in the JSON_CALLBACK callback param value - url += ((url.indexOf('?') === -1) ? '?' : '&') + cbKey + '=JSON_CALLBACK'; - - return url; - } - }]; -} - -/** - * @ngdoc service - * @name $xhrFactory - * @this - * - * @description - * Factory function used to create XMLHttpRequest objects. - * - * Replace or decorate this service to create your own custom XMLHttpRequest objects. - * - * ``` - * angular.module('myApp', []) - * .factory('$xhrFactory', function() { - * return function createXhr(method, url) { - * return new window.XMLHttpRequest({mozSystem: true}); - * }; - * }); - * ``` - * - * @param {string} method HTTP method of the request (GET, POST, PUT, ..) - * @param {string} url URL of the request. - */ -function $xhrFactoryProvider() { - this.$get = function() { - return function createXhr() { - return new window.XMLHttpRequest(); - }; - }; -} - -/** - * @ngdoc service - * @name $httpBackend - * @requires $jsonpCallbacks - * @requires $document - * @requires $xhrFactory - * @this - * - * @description - * HTTP backend used by the {@link ng.$http service} that delegates to - * XMLHttpRequest object or JSONP and deals with browser incompatibilities. - * - * You should never need to use this service directly, instead use the higher-level abstractions: - * {@link ng.$http $http} or {@link ngResource.$resource $resource}. - * - * During testing this implementation is swapped with {@link ngMock.$httpBackend mock - * $httpBackend} which can be trained with responses. - */ -function $HttpBackendProvider() { - this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function($browser, $jsonpCallbacks, $document, $xhrFactory) { - return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]); - }]; -} - -function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) { - // TODO(vojta): fix the signature - return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) { - url = url || $browser.url(); - - if (lowercase(method) === 'jsonp') { - var callbackPath = callbacks.createCallback(url); - var jsonpDone = jsonpReq(url, callbackPath, function(status, text) { - // jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING) - var response = (status === 200) && callbacks.getResponse(callbackPath); - completeRequest(callback, status, response, '', text, 'complete'); - callbacks.removeCallback(callbackPath); - }); - } else { - - var xhr = createXhr(method, url); - var abortedByTimeout = false; - - xhr.open(method, url, true); - forEach(headers, function(value, key) { - if (isDefined(value)) { - xhr.setRequestHeader(key, value); - } - }); - - xhr.onload = function requestLoaded() { - var statusText = xhr.statusText || ''; - - // responseText is the old-school way of retrieving response (supported by IE9) - // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) - var response = ('response' in xhr) ? xhr.response : xhr.responseText; - - // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) - var status = xhr.status === 1223 ? 204 : xhr.status; - - // fix status code when it is 0 (0 status is undocumented). - // Occurs when accessing file resources or on Android 4.1 stock browser - // while retrieving files from application cache. - if (status === 0) { - status = response ? 200 : urlResolve(url).protocol === 'file' ? 404 : 0; - } - - completeRequest(callback, - status, - response, - xhr.getAllResponseHeaders(), - statusText, - 'complete'); - }; - - var requestError = function() { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'error'); - }; - - var requestAborted = function() { - completeRequest(callback, -1, null, null, '', abortedByTimeout ? 'timeout' : 'abort'); - }; - - var requestTimeout = function() { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'timeout'); - }; - - xhr.onerror = requestError; - xhr.ontimeout = requestTimeout; - xhr.onabort = requestAborted; - - forEach(eventHandlers, function(value, key) { - xhr.addEventListener(key, value); - }); - - forEach(uploadEventHandlers, function(value, key) { - xhr.upload.addEventListener(key, value); - }); - - if (withCredentials) { - xhr.withCredentials = true; - } - - if (responseType) { - try { - xhr.responseType = responseType; - } catch (e) { - // WebKit added support for the json responseType value on 09/03/2013 - // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are - // known to throw when setting the value "json" as the response type. Other older - // browsers implementing the responseType - // - // The json response type can be ignored if not supported, because JSON payloads are - // parsed on the client-side regardless. - if (responseType !== 'json') { - throw e; - } - } - } - - xhr.send(isUndefined(post) ? null : post); - } - - // Since we are using xhr.abort() when a request times out, we have to set a flag that - // indicates to requestAborted if the request timed out or was aborted. - // - // http.timeout = numerical timeout timeout - // http.timeout = $timeout timeout - // http.timeout = promise abort - // xhr.abort() abort (The xhr object is normally inaccessible, but - // can be exposed with the xhrFactory) - if (timeout > 0) { - var timeoutId = $browserDefer(function() { - timeoutRequest('timeout'); - }, timeout); - } else if (isPromiseLike(timeout)) { - timeout.then(function() { - timeoutRequest(isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); - }); - } - - function timeoutRequest(reason) { - abortedByTimeout = reason === 'timeout'; - if (jsonpDone) { - jsonpDone(); - } - if (xhr) { - xhr.abort(); - } - } - - function completeRequest(callback, status, response, headersString, statusText, xhrStatus) { - // cancel timeout and subsequent timeout promise resolution - if (isDefined(timeoutId)) { - $browserDefer.cancel(timeoutId); - } - jsonpDone = xhr = null; - - callback(status, response, headersString, statusText, xhrStatus); - } - }; - - function jsonpReq(url, callbackPath, done) { - url = url.replace('JSON_CALLBACK', callbackPath); - // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.: - // - fetches local scripts via XHR and evals them - // - adds and immediately removes script elements from the document - var script = rawDocument.createElement('script'), callback = null; - script.type = 'text/javascript'; - script.src = url; - script.async = true; - - callback = function(event) { - script.removeEventListener('load', callback); - script.removeEventListener('error', callback); - rawDocument.body.removeChild(script); - script = null; - var status = -1; - var text = 'unknown'; - - if (event) { - if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) { - event = { type: 'error' }; - } - text = event.type; - status = event.type === 'error' ? 404 : 200; - } - - if (done) { - done(status, text); - } - }; - - script.addEventListener('load', callback); - script.addEventListener('error', callback); - rawDocument.body.appendChild(script); - return callback; - } -} - -var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate'); -$interpolateMinErr.throwNoconcat = function(text) { - throw $interpolateMinErr('noconcat', - 'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' + - 'interpolations that concatenate multiple expressions when a trusted value is ' + - 'required. See http://docs.angularjs.org/api/ng.$sce', text); -}; - -$interpolateMinErr.interr = function(text, err) { - return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString()); -}; - -/** - * @ngdoc provider - * @name $interpolateProvider - * @this - * - * @description - * - * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. - * - *
- * This feature is sometimes used to mix different markup languages, e.g. to wrap an AngularJS - * template within a Python Jinja template (or any other template language). Mixing templating - * languages is **very dangerous**. The embedding template language will not safely escape AngularJS - * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS) - * security bugs! - *
- * - * @example - - - -
- //demo.label// -
-
- - it('should interpolate binding with custom symbols', function() { - expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.'); - }); - -
- */ -function $InterpolateProvider() { - var startSymbol = '{{'; - var endSymbol = '}}'; - - /** - * @ngdoc method - * @name $interpolateProvider#startSymbol - * @description - * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. - * - * @param {string=} value new value to set the starting symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.startSymbol = function(value) { - if (value) { - startSymbol = value; - return this; - } - return startSymbol; - }; - - /** - * @ngdoc method - * @name $interpolateProvider#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * @param {string=} value new value to set the ending symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.endSymbol = function(value) { - if (value) { - endSymbol = value; - return this; - } - return endSymbol; - }; - - - this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) { - var startSymbolLength = startSymbol.length, - endSymbolLength = endSymbol.length, - escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'), - escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g'); - - function escape(ch) { - return '\\\\\\' + ch; - } - - function unescapeText(text) { - return text.replace(escapedStartRegexp, startSymbol). - replace(escapedEndRegexp, endSymbol); - } - - // TODO: this is the same as the constantWatchDelegate in parse.js - function constantWatchDelegate(scope, listener, objectEquality, constantInterp) { - var unwatch = scope.$watch(function constantInterpolateWatch(scope) { - unwatch(); - return constantInterp(scope); - }, listener, objectEquality); - return unwatch; - } - - /** - * @ngdoc service - * @name $interpolate - * @kind function - * - * @requires $parse - * @requires $sce - * - * @description - * - * Compiles a string with markup into an interpolation function. This service is used by the - * HTML {@link ng.$compile $compile} service for data binding. See - * {@link ng.$interpolateProvider $interpolateProvider} for configuring the - * interpolation markup. - * - * - * ```js - * var $interpolate = ...; // injected - * var exp = $interpolate('Hello {{name | uppercase}}!'); - * expect(exp({name:'AngularJS'})).toEqual('Hello ANGULARJS!'); - * ``` - * - * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is - * `true`, the interpolation function will return `undefined` unless all embedded expressions - * evaluate to a value other than `undefined`. - * - * ```js - * var $interpolate = ...; // injected - * var context = {greeting: 'Hello', name: undefined }; - * - * // default "forgiving" mode - * var exp = $interpolate('{{greeting}} {{name}}!'); - * expect(exp(context)).toEqual('Hello !'); - * - * // "allOrNothing" mode - * exp = $interpolate('{{greeting}} {{name}}!', false, null, true); - * expect(exp(context)).toBeUndefined(); - * context.name = 'AngularJS'; - * expect(exp(context)).toEqual('Hello AngularJS!'); - * ``` - * - * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior. - * - * #### Escaped Interpolation - * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers - * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash). - * It will be rendered as a regular start/end marker, and will not be interpreted as an expression - * or binding. - * - * This enables web-servers to prevent script injection attacks and defacing attacks, to some - * degree, while also enabling code examples to work without relying on the - * {@link ng.directive:ngNonBindable ngNonBindable} directive. - * - * **For security purposes, it is strongly encouraged that web servers escape user-supplied data, - * replacing angle brackets (<, >) with &lt; and &gt; respectively, and replacing all - * interpolation start/end markers with their escaped counterparts.** - * - * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered - * output when the $interpolate service processes the text. So, for HTML elements interpolated - * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter - * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such, - * this is typically useful only when user-data is used in rendering a template from the server, or - * when otherwise untrusted data is used by a directive. - * - * - * - *
- *

{{apptitle}}: \{\{ username = "defaced value"; \}\} - *

- *

{{username}} attempts to inject code which will deface the - * application, but fails to accomplish their task, because the server has correctly - * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash) - * characters.

- *

Instead, the result of the attempted script injection is visible, and can be removed - * from the database by an administrator.

- *
- *
- *
- * - * @knownIssue - * It is currently not possible for an interpolated expression to contain the interpolation end - * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e. - * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string. - * - * @knownIssue - * All directives and components must use the standard `{{` `}}` interpolation symbols - * in their templates. If you change the application interpolation symbols the {@link $compile} - * service will attempt to denormalize the standard symbols to the custom symbols. - * The denormalization process is not clever enough to know not to replace instances of the standard - * symbols where they would not normally be treated as interpolation symbols. For example in the following - * code snippet the closing braces of the literal object will get incorrectly denormalized: - * - * ``` - *
- * ``` - * - * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information. - * - * @param {string} text The text with markup to interpolate. - * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have - * embedded expression in order to return an interpolation function. Strings with no - * embedded expression will return null for the interpolation function. - * @param {string=} trustedContext when provided, the returned function passes the interpolated - * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult, - * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that - * provides Strict Contextual Escaping for details. - * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined - * unless all embedded expressions evaluate to a value other than `undefined`. - * @returns {function(context)} an interpolation function which is used to compute the - * interpolated string. The function has these parameters: - * - * - `context`: evaluation context for all expressions embedded in the interpolated text - */ - function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) { - var contextAllowsConcatenation = trustedContext === $sce.URL || trustedContext === $sce.MEDIA_URL; - - // Provide a quick exit and simplified result function for text with no interpolation - if (!text.length || text.indexOf(startSymbol) === -1) { - if (mustHaveExpression) return; - - var unescapedText = unescapeText(text); - if (contextAllowsConcatenation) { - unescapedText = $sce.getTrusted(trustedContext, unescapedText); - } - var constantInterp = valueFn(unescapedText); - constantInterp.exp = text; - constantInterp.expressions = []; - constantInterp.$$watchDelegate = constantWatchDelegate; - - return constantInterp; - } - - allOrNothing = !!allOrNothing; - var startIndex, - endIndex, - index = 0, - expressions = [], - parseFns, - textLength = text.length, - exp, - concat = [], - expressionPositions = [], - singleExpression; - - - while (index < textLength) { - if (((startIndex = text.indexOf(startSymbol, index)) !== -1) && - ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) !== -1)) { - if (index !== startIndex) { - concat.push(unescapeText(text.substring(index, startIndex))); - } - exp = text.substring(startIndex + startSymbolLength, endIndex); - expressions.push(exp); - index = endIndex + endSymbolLength; - expressionPositions.push(concat.length); - concat.push(''); // Placeholder that will get replaced with the evaluated expression. - } else { - // we did not find an interpolation, so we have to add the remainder to the separators array - if (index !== textLength) { - concat.push(unescapeText(text.substring(index))); - } - break; - } - } - - singleExpression = concat.length === 1 && expressionPositions.length === 1; - // Intercept expression if we need to stringify concatenated inputs, which may be SCE trusted - // objects rather than simple strings - // (we don't modify the expression if the input consists of only a single trusted input) - var interceptor = contextAllowsConcatenation && singleExpression ? undefined : parseStringifyInterceptor; - parseFns = expressions.map(function(exp) { return $parse(exp, interceptor); }); - - // Concatenating expressions makes it hard to reason about whether some combination of - // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a - // single expression be used for some $sce-managed secure contexts (RESOURCE_URLs mostly), - // we ensure that the value that's used is assigned or constructed by some JS code somewhere - // that is more testable or make it obvious that you bound the value to some user controlled - // value. This helps reduce the load when auditing for XSS issues. - - // Note that URL and MEDIA_URL $sce contexts do not need this, since `$sce` can sanitize the values - // passed to it. In that case, `$sce.getTrusted` will be called on either the single expression - // or on the overall concatenated string (losing trusted types used in the mix, by design). - // Both these methods will sanitize plain strings. Also, HTML could be included, but since it's - // only used in srcdoc attributes, this would not be very useful. - - if (!mustHaveExpression || expressions.length) { - var compute = function(values) { - for (var i = 0, ii = expressions.length; i < ii; i++) { - if (allOrNothing && isUndefined(values[i])) return; - concat[expressionPositions[i]] = values[i]; - } - - if (contextAllowsConcatenation) { - // If `singleExpression` then `concat[0]` might be a "trusted" value or `null`, rather than a string - return $sce.getTrusted(trustedContext, singleExpression ? concat[0] : concat.join('')); - } else if (trustedContext && concat.length > 1) { - // This context does not allow more than one part, e.g. expr + string or exp + exp. - $interpolateMinErr.throwNoconcat(text); - } - // In an unprivileged context or only one part: just concatenate and return. - return concat.join(''); - }; - - return extend(function interpolationFn(context) { - var i = 0; - var ii = expressions.length; - var values = new Array(ii); - - try { - for (; i < ii; i++) { - values[i] = parseFns[i](context); - } - - return compute(values); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - - }, { - // all of these properties are undocumented for now - exp: text, //just for compatibility with regular watchers created via $watch - expressions: expressions, - $$watchDelegate: function(scope, listener) { - var lastValue; - return scope.$watchGroup(parseFns, /** @this */ function interpolateFnWatcher(values, oldValues) { - var currValue = compute(values); - listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope); - lastValue = currValue; - }); - } - }); - } - - function parseStringifyInterceptor(value) { - try { - // In concatenable contexts, getTrusted comes at the end, to avoid sanitizing individual - // parts of a full URL. We don't care about losing the trustedness here. - // In non-concatenable contexts, where there is only one expression, this interceptor is - // not applied to the expression. - value = (trustedContext && !contextAllowsConcatenation) ? - $sce.getTrusted(trustedContext, value) : - $sce.valueOf(value); - return allOrNothing && !isDefined(value) ? value : stringify(value); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - } - } - - - /** - * @ngdoc method - * @name $interpolate#startSymbol - * @description - * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. - * - * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change - * the symbol. - * - * @returns {string} start symbol. - */ - $interpolate.startSymbol = function() { - return startSymbol; - }; - - - /** - * @ngdoc method - * @name $interpolate#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change - * the symbol. - * - * @returns {string} end symbol. - */ - $interpolate.endSymbol = function() { - return endSymbol; - }; - - return $interpolate; - }]; -} - -var $intervalMinErr = minErr('$interval'); - -/** @this */ -function $IntervalProvider() { - this.$get = ['$$intervalFactory', '$window', - function($$intervalFactory, $window) { - var intervals = {}; - var setIntervalFn = function(tick, delay, deferred) { - var id = $window.setInterval(tick, delay); - intervals[id] = deferred; - return id; - }; - var clearIntervalFn = function(id) { - $window.clearInterval(id); - delete intervals[id]; - }; - - /** - * @ngdoc service - * @name $interval - * - * @description - * AngularJS's wrapper for `window.setInterval`. The `fn` function is executed every `delay` - * milliseconds. - * - * The return value of registering an interval function is a promise. This promise will be - * notified upon each tick of the interval, and will be resolved after `count` iterations, or - * run indefinitely if `count` is not defined. The value of the notification will be the - * number of iterations that have run. - * To cancel an interval, call `$interval.cancel(promise)`. - * - * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to - * move forward by `millis` milliseconds and trigger any functions scheduled to run in that - * time. - * - *
- * **Note**: Intervals created by this service must be explicitly destroyed when you are finished - * with them. In particular they are not automatically destroyed when a controller's scope or a - * directive's element are destroyed. - * You should take this into consideration and make sure to always cancel the interval at the - * appropriate moment. See the example below for more details on how and when to do this. - *
- * - * @param {function()} fn A function that should be called repeatedly. If no additional arguments - * are passed (see below), the function is called with the current iteration count. - * @param {number} delay Number of milliseconds between each function call. - * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat - * indefinitely. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {promise} A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete. - * - * @example - * - * - * - * - *
- *
- *
- * Current time is: - *
- * Blood 1 : {{blood_1}} - * Blood 2 : {{blood_2}} - * - * - * - *
- *
- * - *
- *
- */ - var interval = $$intervalFactory(setIntervalFn, clearIntervalFn); - - /** - * @ngdoc method - * @name $interval#cancel - * - * @description - * Cancels a task associated with the `promise`. - * - * @param {Promise=} promise returned by the `$interval` function. - * @returns {boolean} Returns `true` if the task was successfully canceled. - */ - interval.cancel = function(promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$intervalId')) { - throw $intervalMinErr('badprom', - '`$interval.cancel()` called with a promise that was not generated by `$interval()`.'); - } - - if (!intervals.hasOwnProperty(promise.$$intervalId)) return false; - - var id = promise.$$intervalId; - var deferred = intervals[id]; - - // Interval cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - clearIntervalFn(id); - - return true; - }; - - return interval; - }]; -} - -/** @this */ -function $$IntervalFactoryProvider() { - this.$get = ['$browser', '$q', '$$q', '$rootScope', - function($browser, $q, $$q, $rootScope) { - return function intervalFactory(setIntervalFn, clearIntervalFn) { - return function intervalFn(fn, delay, count, invokeApply) { - var hasParams = arguments.length > 4, - args = hasParams ? sliceArgs(arguments, 4) : [], - iteration = 0, - skipApply = isDefined(invokeApply) && !invokeApply, - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise; - - count = isDefined(count) ? count : 0; - - function callback() { - if (!hasParams) { - fn(iteration); - } else { - fn.apply(null, args); - } - } - - function tick() { - if (skipApply) { - $browser.defer(callback); - } else { - $rootScope.$evalAsync(callback); - } - deferred.notify(iteration++); - - if (count > 0 && iteration >= count) { - deferred.resolve(iteration); - clearIntervalFn(promise.$$intervalId); - } - - if (!skipApply) $rootScope.$apply(); - } - - promise.$$intervalId = setIntervalFn(tick, delay, deferred, skipApply); - - return promise; - }; - }; - }]; -} - -/** - * @ngdoc service - * @name $jsonpCallbacks - * @requires $window - * @description - * This service handles the lifecycle of callbacks to handle JSONP requests. - * Override this service if you wish to customise where the callbacks are stored and - * how they vary compared to the requested url. - */ -var $jsonpCallbacksProvider = /** @this */ function() { - this.$get = function() { - var callbacks = angular.callbacks; - var callbackMap = {}; - - function createCallback(callbackId) { - var callback = function(data) { - callback.data = data; - callback.called = true; - }; - callback.id = callbackId; - return callback; - } - - return { - /** - * @ngdoc method - * @name $jsonpCallbacks#createCallback - * @param {string} url the url of the JSONP request - * @returns {string} the callback path to send to the server as part of the JSONP request - * @description - * {@link $httpBackend} calls this method to create a callback and get hold of the path to the callback - * to pass to the server, which will be used to call the callback with its payload in the JSONP response. - */ - createCallback: function(url) { - var callbackId = '_' + (callbacks.$$counter++).toString(36); - var callbackPath = 'angular.callbacks.' + callbackId; - var callback = createCallback(callbackId); - callbackMap[callbackPath] = callbacks[callbackId] = callback; - return callbackPath; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#wasCalled - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {boolean} whether the callback has been called, as a result of the JSONP response - * @description - * {@link $httpBackend} calls this method to find out whether the JSONP response actually called the - * callback that was passed in the request. - */ - wasCalled: function(callbackPath) { - return callbackMap[callbackPath].called; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#getResponse - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {*} the data received from the response via the registered callback - * @description - * {@link $httpBackend} calls this method to get hold of the data that was provided to the callback - * in the JSONP response. - */ - getResponse: function(callbackPath) { - return callbackMap[callbackPath].data; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#removeCallback - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @description - * {@link $httpBackend} calls this method to remove the callback after the JSONP request has - * completed or timed-out. - */ - removeCallback: function(callbackPath) { - var callback = callbackMap[callbackPath]; - delete callbacks[callback.id]; - delete callbackMap[callbackPath]; - } - }; - }; -}; - -/** - * @ngdoc service - * @name $locale - * - * @description - * $locale service provides localization rules for various AngularJS components. As of right now the - * only public api is: - * - * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) - */ - -/* global stripHash: true */ - -var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/, - DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; -var $locationMinErr = minErr('$location'); - - -/** - * Encode path using encodeUriSegment, ignoring forward slashes - * - * @param {string} path Path to encode - * @returns {string} - */ -function encodePath(path) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - // decode forward slashes to prevent them from being double encoded - segments[i] = encodeUriSegment(segments[i].replace(/%2F/g, '/')); - } - - return segments.join('/'); -} - -function decodePath(path, html5Mode) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - segments[i] = decodeURIComponent(segments[i]); - if (html5Mode) { - // encode forward slashes to prevent them from being mistaken for path separators - segments[i] = segments[i].replace(/\//g, '%2F'); - } - } - - return segments.join('/'); -} - -function normalizePath(pathValue, searchValue, hashValue) { - var search = toKeyValue(searchValue), - hash = hashValue ? '#' + encodeUriSegment(hashValue) : '', - path = encodePath(pathValue); - - return path + (search ? '?' + search : '') + hash; -} - -function parseAbsoluteUrl(absoluteUrl, locationObj) { - var parsedUrl = urlResolve(absoluteUrl); - - locationObj.$$protocol = parsedUrl.protocol; - locationObj.$$host = parsedUrl.hostname; - locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null; -} - -var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; -function parseAppUrl(url, locationObj, html5Mode) { - - if (DOUBLE_SLASH_REGEX.test(url)) { - throw $locationMinErr('badpath', 'Invalid url "{0}".', url); - } - - var prefixed = (url.charAt(0) !== '/'); - if (prefixed) { - url = '/' + url; - } - var match = urlResolve(url); - var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; - locationObj.$$path = decodePath(path, html5Mode); - locationObj.$$search = parseKeyValue(match.search); - locationObj.$$hash = decodeURIComponent(match.hash); - - // make sure path starts with '/'; - if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { - locationObj.$$path = '/' + locationObj.$$path; - } -} - -function startsWith(str, search) { - return str.slice(0, search.length) === search; -} - -/** - * - * @param {string} base - * @param {string} url - * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with - * the expected string. - */ -function stripBaseUrl(base, url) { - if (startsWith(url, base)) { - return url.substr(base.length); - } -} - -function stripHash(url) { - var index = url.indexOf('#'); - return index === -1 ? url : url.substr(0, index); -} - -function stripFile(url) { - return url.substr(0, stripHash(url).lastIndexOf('/') + 1); -} - -/* return the server only (scheme://host:port) */ -function serverBase(url) { - return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); -} - - -/** - * LocationHtml5Url represents a URL - * This object is exposed as $location service when HTML5 mode is enabled and supported - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} basePrefix URL path prefix - */ -function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) { - this.$$html5 = true; - basePrefix = basePrefix || ''; - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given HTML5 (regular) URL string into properties - * @param {string} url HTML5 URL - * @private - */ - this.$$parse = function(url) { - var pathUrl = stripBaseUrl(appBaseNoFile, url); - if (!isString(pathUrl)) { - throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url, - appBaseNoFile); - } - - parseAppUrl(pathUrl, this, true); - - if (!this.$$path) { - this.$$path = '/'; - } - - this.$$compose(); - }; - - this.$$normalizeUrl = function(url) { - return appBaseNoFile + url.substr(1); // first char is always '/' - }; - - this.$$parseLinkUrl = function(url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - var appUrl, prevAppUrl; - var rewrittenUrl; - - - if (isDefined(appUrl = stripBaseUrl(appBase, url))) { - prevAppUrl = appUrl; - if (basePrefix && isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) { - rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl); - } else { - rewrittenUrl = appBase + prevAppUrl; - } - } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBaseNoFile + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; -} - - -/** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when developer doesn't opt into html5 mode. - * It also serves as the base class for html5 mode fallback on legacy browsers. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ -function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) { - - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given hashbang URL into properties - * @param {string} url Hashbang URL - * @private - */ - this.$$parse = function(url) { - var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url); - var withoutHashUrl; - - if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') { - - // The rest of the URL starts with a hash so we have - // got either a hashbang path or a plain hash fragment - withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl); - if (isUndefined(withoutHashUrl)) { - // There was no hashbang prefix so we just have a hash fragment - withoutHashUrl = withoutBaseUrl; - } - - } else { - // There was no hashbang path nor hash fragment: - // If we are in HTML5 mode we use what is left as the path; - // Otherwise we ignore what is left - if (this.$$html5) { - withoutHashUrl = withoutBaseUrl; - } else { - withoutHashUrl = ''; - if (isUndefined(withoutBaseUrl)) { - appBase = url; - /** @type {?} */ (this).replace(); - } - } - } - - parseAppUrl(withoutHashUrl, this, false); - - this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase); - - this.$$compose(); - - /* - * In Windows, on an anchor node on documents loaded from - * the filesystem, the browser will return a pathname - * prefixed with the drive name ('/C:/path') when a - * pathname without a drive is set: - * * a.setAttribute('href', '/foo') - * * a.pathname === '/C:/foo' //true - * - * Inside of AngularJS, we're always using pathnames that - * do not include drive names for routing. - */ - function removeWindowsDriveName(path, url, base) { - /* - Matches paths for file protocol on windows, - such as /C:/foo/bar, and captures only /foo/bar. - */ - var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; - - var firstPathSegmentMatch; - - //Get the relative path from the input URL. - if (startsWith(url, base)) { - url = url.replace(base, ''); - } - - // The input URL intentionally contains a first path segment that ends with a colon. - if (windowsFilePathExp.exec(url)) { - return path; - } - - firstPathSegmentMatch = windowsFilePathExp.exec(path); - return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; - } - }; - - this.$$normalizeUrl = function(url) { - return appBase + (url ? hashPrefix + url : ''); - }; - - this.$$parseLinkUrl = function(url, relHref) { - if (stripHash(appBase) === stripHash(url)) { - this.$$parse(url); - return true; - } - return false; - }; -} - - -/** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when html5 history api is enabled but the browser - * does not support it. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ -function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { - this.$$html5 = true; - LocationHashbangUrl.apply(this, arguments); - - this.$$parseLinkUrl = function(url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - - var rewrittenUrl; - var appUrl; - - if (appBase === stripHash(url)) { - rewrittenUrl = url; - } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBase + hashPrefix + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; - - this.$$normalizeUrl = function(url) { - // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' - return appBase + hashPrefix + url; - }; -} - - -var locationPrototype = { - - /** - * Ensure absolute URL is initialized. - * @private - */ - $$absUrl:'', - - /** - * Are we in html5 mode? - * @private - */ - $$html5: false, - - /** - * Has any change been replacing? - * @private - */ - $$replace: false, - - /** - * Compose url and update `url` and `absUrl` property - * @private - */ - $$compose: function() { - this.$$url = normalizePath(this.$$path, this.$$search, this.$$hash); - this.$$absUrl = this.$$normalizeUrl(this.$$url); - this.$$urlUpdatedByLocation = true; - }, - - /** - * @ngdoc method - * @name $location#absUrl - * - * @description - * This method is getter only. - * - * Return full URL representation with all segments encoded according to rules specified in - * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt). - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var absUrl = $location.absUrl(); - * // => "http://example.com/#/some/path?foo=bar&baz=xoxo" - * ``` - * - * @return {string} full URL - */ - absUrl: locationGetter('$$absUrl'), - - /** - * @ngdoc method - * @name $location#url - * - * @description - * This method is getter / setter. - * - * Return URL (e.g. `/path?a=b#hash`) when called without any parameter. - * - * Change path, search and hash, when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var url = $location.url(); - * // => "/some/path?foo=bar&baz=xoxo" - * ``` - * - * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`) - * @return {string} url - */ - url: function(url) { - if (isUndefined(url)) { - return this.$$url; - } - - var match = PATH_MATCH.exec(url); - if (match[1] || url === '') this.path(decodeURIComponent(match[1])); - if (match[2] || match[1] || url === '') this.search(match[3] || ''); - this.hash(match[5] || ''); - - return this; - }, - - /** - * @ngdoc method - * @name $location#protocol - * - * @description - * This method is getter only. - * - * Return protocol of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var protocol = $location.protocol(); - * // => "http" - * ``` - * - * @return {string} protocol of current URL - */ - protocol: locationGetter('$$protocol'), - - /** - * @ngdoc method - * @name $location#host - * - * @description - * This method is getter only. - * - * Return host of current URL. - * - * Note: compared to the non-AngularJS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var host = $location.host(); - * // => "example.com" - * - * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo - * host = $location.host(); - * // => "example.com" - * host = location.host; - * // => "example.com:8080" - * ``` - * - * @return {string} host of current URL. - */ - host: locationGetter('$$host'), - - /** - * @ngdoc method - * @name $location#port - * - * @description - * This method is getter only. - * - * Return port of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var port = $location.port(); - * // => 80 - * ``` - * - * @return {Number} port - */ - port: locationGetter('$$port'), - - /** - * @ngdoc method - * @name $location#path - * - * @description - * This method is getter / setter. - * - * Return path of current URL when called without any parameter. - * - * Change path when called with parameter and return `$location`. - * - * Note: Path should always begin with forward slash (/), this method will add the forward slash - * if it is missing. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var path = $location.path(); - * // => "/some/path" - * ``` - * - * @param {(string|number)=} path New path - * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter - */ - path: locationGetterSetter('$$path', function(path) { - path = path !== null ? path.toString() : ''; - return path.charAt(0) === '/' ? path : '/' + path; - }), - - /** - * @ngdoc method - * @name $location#search - * - * @description - * This method is getter / setter. - * - * Return search part (as object) of current URL when called without any parameter. - * - * Change search part when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var searchObject = $location.search(); - * // => {foo: 'bar', baz: 'xoxo'} - * - * // set foo to 'yipee' - * $location.search('foo', 'yipee'); - * // $location.search() => {foo: 'yipee', baz: 'xoxo'} - * ``` - * - * @param {string|Object.|Object.>} search New search params - string or - * hash object. - * - * When called with a single argument the method acts as a setter, setting the `search` component - * of `$location` to the specified value. - * - * If the argument is a hash object containing an array of values, these values will be encoded - * as duplicate search parameters in the URL. - * - * @param {(string|Number|Array|boolean)=} paramValue If `search` is a string or number, then `paramValue` - * will override only a single search property. - * - * If `paramValue` is an array, it will override the property of the `search` component of - * `$location` specified via the first argument. - * - * If `paramValue` is `null`, the property specified via the first argument will be deleted. - * - * If `paramValue` is `true`, the property specified via the first argument will be added with no - * value nor trailing equal sign. - * - * @return {Object} If called with no arguments returns the parsed `search` object. If called with - * one or more arguments returns `$location` object itself. - */ - search: function(search, paramValue) { - switch (arguments.length) { - case 0: - return this.$$search; - case 1: - if (isString(search) || isNumber(search)) { - search = search.toString(); - this.$$search = parseKeyValue(search); - } else if (isObject(search)) { - search = copy(search, {}); - // remove object undefined or null properties - forEach(search, function(value, key) { - if (value == null) delete search[key]; - }); - - this.$$search = search; - } else { - throw $locationMinErr('isrcharg', - 'The first argument of the `$location#search()` call must be a string or an object.'); - } - break; - default: - if (isUndefined(paramValue) || paramValue === null) { - delete this.$$search[search]; - } else { - this.$$search[search] = paramValue; - } - } - - this.$$compose(); - return this; - }, - - /** - * @ngdoc method - * @name $location#hash - * - * @description - * This method is getter / setter. - * - * Returns the hash fragment when called without any parameters. - * - * Changes the hash fragment when called with a parameter and returns `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue - * var hash = $location.hash(); - * // => "hashValue" - * ``` - * - * @param {(string|number)=} hash New hash fragment - * @return {string} hash - */ - hash: locationGetterSetter('$$hash', function(hash) { - return hash !== null ? hash.toString() : ''; - }), - - /** - * @ngdoc method - * @name $location#replace - * - * @description - * If called, all changes to $location during the current `$digest` will replace the current history - * record, instead of adding a new one. - */ - replace: function() { - this.$$replace = true; - return this; - } -}; - -forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) { - Location.prototype = Object.create(locationPrototype); - - /** - * @ngdoc method - * @name $location#state - * - * @description - * This method is getter / setter. - * - * Return the history state object when called without any parameter. - * - * Change the history state object when called with one parameter and return `$location`. - * The state object is later passed to `pushState` or `replaceState`. - * - * NOTE: This method is supported only in HTML5 mode and only in browsers supporting - * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support - * older browsers (like IE9 or Android < 4.0), don't use this method. - * - * @param {object=} state State object for pushState or replaceState - * @return {object} state - */ - Location.prototype.state = function(state) { - if (!arguments.length) { - return this.$$state; - } - - if (Location !== LocationHtml5Url || !this.$$html5) { - throw $locationMinErr('nostate', 'History API state support is available only ' + - 'in HTML5 mode and only in browsers supporting HTML5 History API'); - } - // The user might modify `stateObject` after invoking `$location.state(stateObject)` - // but we're changing the $$state reference to $browser.state() during the $digest - // so the modification window is narrow. - this.$$state = isUndefined(state) ? null : state; - this.$$urlUpdatedByLocation = true; - - return this; - }; -}); - - -function locationGetter(property) { - return /** @this */ function() { - return this[property]; - }; -} - - -function locationGetterSetter(property, preprocess) { - return /** @this */ function(value) { - if (isUndefined(value)) { - return this[property]; - } - - this[property] = preprocess(value); - this.$$compose(); - - return this; - }; -} - - -/** - * @ngdoc service - * @name $location - * - * @requires $rootElement - * - * @description - * The $location service parses the URL in the browser address bar (based on the - * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL - * available to your application. Changes to the URL in the address bar are reflected into - * $location service and changes to $location are reflected into the browser address bar. - * - * **The $location service:** - * - * - Exposes the current URL in the browser address bar, so you can - * - Watch and observe the URL. - * - Change the URL. - * - Synchronizes the URL with the browser when the user - * - Changes the address bar. - * - Clicks the back or forward button (or clicks a History link). - * - Clicks on a link. - * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). - * - * For more information see {@link guide/$location Developer Guide: Using $location} - */ - -/** - * @ngdoc provider - * @name $locationProvider - * @this - * - * @description - * Use the `$locationProvider` to configure how the application deep linking paths are stored. - */ -function $LocationProvider() { - var hashPrefix = '!', - html5Mode = { - enabled: false, - requireBase: true, - rewriteLinks: true - }; - - /** - * @ngdoc method - * @name $locationProvider#hashPrefix - * @description - * The default value for the prefix is `'!'`. - * @param {string=} prefix Prefix for hash part (containing path and search) - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.hashPrefix = function(prefix) { - if (isDefined(prefix)) { - hashPrefix = prefix; - return this; - } else { - return hashPrefix; - } - }; - - /** - * @ngdoc method - * @name $locationProvider#html5Mode - * @description - * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value. - * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported - * properties: - * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to - * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not - * support `pushState`. - * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies - * whether or not a tag is required to be present. If `enabled` and `requireBase` are - * true, and a base tag is not present, an error will be thrown when `$location` is injected. - * See the {@link guide/$location $location guide for more information} - * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled, - * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will - * only happen on links with an attribute that matches the given string. For example, if set - * to `'internal-link'`, then the URL will only be rewritten for `` links. - * Note that [attribute name normalization](guide/directive#normalization) does not apply - * here, so `'internalLink'` will **not** match `'internal-link'`. - * - * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter - */ - this.html5Mode = function(mode) { - if (isBoolean(mode)) { - html5Mode.enabled = mode; - return this; - } else if (isObject(mode)) { - - if (isBoolean(mode.enabled)) { - html5Mode.enabled = mode.enabled; - } - - if (isBoolean(mode.requireBase)) { - html5Mode.requireBase = mode.requireBase; - } - - if (isBoolean(mode.rewriteLinks) || isString(mode.rewriteLinks)) { - html5Mode.rewriteLinks = mode.rewriteLinks; - } - - return this; - } else { - return html5Mode; - } - }; - - /** - * @ngdoc event - * @name $location#$locationChangeStart - * @eventType broadcast on root scope - * @description - * Broadcasted before a URL will change. - * - * This change can be prevented by calling - * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more - * details about event object. Upon successful change - * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - /** - * @ngdoc event - * @name $location#$locationChangeSuccess - * @eventType broadcast on root scope - * @description - * Broadcasted after a URL was changed. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window', - function($rootScope, $browser, $sniffer, $rootElement, $window) { - var $location, - LocationMode, - baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to '' - initialUrl = $browser.url(), - appBase; - - if (html5Mode.enabled) { - if (!baseHref && html5Mode.requireBase) { - throw $locationMinErr('nobase', - '$location in HTML5 mode requires a tag to be present!'); - } - appBase = serverBase(initialUrl) + (baseHref || '/'); - LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; - } else { - appBase = stripHash(initialUrl); - LocationMode = LocationHashbangUrl; - } - var appBaseNoFile = stripFile(appBase); - - $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix); - $location.$$parseLinkUrl(initialUrl, initialUrl); - - $location.$$state = $browser.state(); - - var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i; - - // Determine if two URLs are equal despite potentially having different encoding/normalizing - // such as $location.absUrl() vs $browser.url() - // See https://github.com/angular/angular.js/issues/16592 - function urlsEqual(a, b) { - return a === b || urlResolve(a).href === urlResolve(b).href; - } - - function setBrowserUrlWithFallback(url, replace, state) { - var oldUrl = $location.url(); - var oldState = $location.$$state; - try { - $browser.url(url, replace, state); - - // Make sure $location.state() returns referentially identical (not just deeply equal) - // state object; this makes possible quick checking if the state changed in the digest - // loop. Checking deep equality would be too expensive. - $location.$$state = $browser.state(); - } catch (e) { - // Restore old values if pushState fails - $location.url(oldUrl); - $location.$$state = oldState; - - throw e; - } - } - - $rootElement.on('click', function(event) { - var rewriteLinks = html5Mode.rewriteLinks; - // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) - // currently we open nice url link and redirect then - - if (!rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which === 2 || event.button === 2) return; - - var elm = jqLite(event.target); - - // traverse the DOM up to find first A tag - while (nodeName_(elm[0]) !== 'a') { - // ignore rewriting if no A tag (reached root element, or no parent - removed from document) - if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; - } - - if (isString(rewriteLinks) && isUndefined(elm.attr(rewriteLinks))) return; - - var absHref = elm.prop('href'); - // get the actual href attribute - see - // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx - var relHref = elm.attr('href') || elm.attr('xlink:href'); - - if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') { - // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during - // an animation. - absHref = urlResolve(absHref.animVal).href; - } - - // Ignore when url is started with javascript: or mailto: - if (IGNORE_URI_REGEXP.test(absHref)) return; - - if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) { - if ($location.$$parseLinkUrl(absHref, relHref)) { - // We do a preventDefault for all urls that are part of the AngularJS application, - // in html5mode and also without, so that we are able to abort navigation without - // getting double entries in the location history. - event.preventDefault(); - // update location manually - if ($location.absUrl() !== $browser.url()) { - $rootScope.$apply(); - } - } - } - }); - - - // rewrite hashbang url <> html5 url - if ($location.absUrl() !== initialUrl) { - $browser.url($location.absUrl(), true); - } - - var initializing = true; - - // update $location when $browser url changes - $browser.onUrlChange(function(newUrl, newState) { - - if (!startsWith(newUrl, appBaseNoFile)) { - // If we are navigating outside of the app then force a reload - $window.location.href = newUrl; - return; - } - - $rootScope.$evalAsync(function() { - var oldUrl = $location.absUrl(); - var oldState = $location.$$state; - var defaultPrevented; - $location.$$parse(newUrl); - $location.$$state = newState; - - defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - newState, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - setBrowserUrlWithFallback(oldUrl, false, oldState); - } else { - initializing = false; - afterLocationChange(oldUrl, oldState); - } - }); - if (!$rootScope.$$phase) $rootScope.$digest(); - }); - - // update browser - $rootScope.$watch(function $locationWatch() { - if (initializing || $location.$$urlUpdatedByLocation) { - $location.$$urlUpdatedByLocation = false; - - var oldUrl = $browser.url(); - var newUrl = $location.absUrl(); - var oldState = $browser.state(); - var currentReplace = $location.$$replace; - var urlOrStateChanged = !urlsEqual(oldUrl, newUrl) || - ($location.$$html5 && $sniffer.history && oldState !== $location.$$state); - - if (initializing || urlOrStateChanged) { - initializing = false; - - $rootScope.$evalAsync(function() { - var newUrl = $location.absUrl(); - var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - $location.$$state, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - } else { - if (urlOrStateChanged) { - setBrowserUrlWithFallback(newUrl, currentReplace, - oldState === $location.$$state ? null : $location.$$state); - } - afterLocationChange(oldUrl, oldState); - } - }); - } - } - - $location.$$replace = false; - - // we don't need to return anything because $evalAsync will make the digest loop dirty when - // there is a change - }); - - return $location; - - function afterLocationChange(oldUrl, oldState) { - $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl, - $location.$$state, oldState); - } -}]; -} - -/** - * @ngdoc service - * @name $log - * @requires $window - * - * @description - * Simple service for logging. Default implementation safely writes the message - * into the browser's console (if present). - * - * The main purpose of this service is to simplify debugging and troubleshooting. - * - * To reveal the location of the calls to `$log` in the JavaScript console, - * you can "blackbox" the AngularJS source in your browser: - * - * [Mozilla description of blackboxing](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Black_box_a_source). - * [Chrome description of blackboxing](https://developer.chrome.com/devtools/docs/blackboxing). - * - * Note: Not all browsers support blackboxing. - * - * The default is to log `debug` messages. You can use - * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. - * - * @example - - - angular.module('logExample', []) - .controller('LogController', ['$scope', '$log', function($scope, $log) { - $scope.$log = $log; - $scope.message = 'Hello World!'; - }]); - - -
-

Reload this page with open console, enter text and hit the log button...

- - - - - - -
-
-
- */ - -/** - * @ngdoc provider - * @name $logProvider - * @this - * - * @description - * Use the `$logProvider` to configure how the application logs messages - */ -function $LogProvider() { - var debug = true, - self = this; - - /** - * @ngdoc method - * @name $logProvider#debugEnabled - * @description - * @param {boolean=} flag enable or disable debug level messages - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.debugEnabled = function(flag) { - if (isDefined(flag)) { - debug = flag; - return this; - } else { - return debug; - } - }; - - this.$get = ['$window', function($window) { - // Support: IE 9-11, Edge 12-14+ - // IE/Edge display errors in such a way that it requires the user to click in 4 places - // to see the stack trace. There is no way to feature-detect it so there's a chance - // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't - // break apps. Other browsers display errors in a sensible way and some of them map stack - // traces along source maps if available so it makes sense to let browsers display it - // as they want. - var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent); - - return { - /** - * @ngdoc method - * @name $log#log - * - * @description - * Write a log message - */ - log: consoleLog('log'), - - /** - * @ngdoc method - * @name $log#info - * - * @description - * Write an information message - */ - info: consoleLog('info'), - - /** - * @ngdoc method - * @name $log#warn - * - * @description - * Write a warning message - */ - warn: consoleLog('warn'), - - /** - * @ngdoc method - * @name $log#error - * - * @description - * Write an error message - */ - error: consoleLog('error'), - - /** - * @ngdoc method - * @name $log#debug - * - * @description - * Write a debug message - */ - debug: (function() { - var fn = consoleLog('debug'); - - return function() { - if (debug) { - fn.apply(self, arguments); - } - }; - })() - }; - - function formatError(arg) { - if (isError(arg)) { - if (arg.stack && formatStackTrace) { - arg = (arg.message && arg.stack.indexOf(arg.message) === -1) - ? 'Error: ' + arg.message + '\n' + arg.stack - : arg.stack; - } else if (arg.sourceURL) { - arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; - } - } - return arg; - } - - function consoleLog(type) { - var console = $window.console || {}, - logFn = console[type] || console.log || noop; - - return function() { - var args = []; - forEach(arguments, function(arg) { - args.push(formatError(arg)); - }); - // Support: IE 9 only - // console methods don't inherit from Function.prototype in IE 9 so we can't - // call `logFn.apply(console, args)` directly. - return Function.prototype.apply.call(logFn, console, args); - }; - } - }]; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -var $parseMinErr = minErr('$parse'); - -var objectValueOf = {}.constructor.prototype.valueOf; - -// Sandboxing AngularJS Expressions -// ------------------------------ -// AngularJS expressions are no longer sandboxed. So it is now even easier to access arbitrary JS code by -// various means such as obtaining a reference to native JS functions like the Function constructor. -// -// As an example, consider the following AngularJS expression: -// -// {}.toString.constructor('alert("evil JS code")') -// -// It is important to realize that if you create an expression from a string that contains user provided -// content then it is possible that your application contains a security vulnerability to an XSS style attack. -// -// See https://docs.angularjs.org/guide/security - - -function getStringValue(name) { - // Property names must be strings. This means that non-string objects cannot be used - // as keys in an object. Any non-string object, including a number, is typecasted - // into a string via the toString method. - // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names - // - // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it - // to a string. It's not always possible. If `name` is an object and its `toString` method is - // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown: - // - // TypeError: Cannot convert object to primitive value - // - // For performance reasons, we don't catch this error here and allow it to propagate up the call - // stack. Note that you'll get the same error in JavaScript if you try to access a property using - // such a 'broken' object as a key. - return name + ''; -} - - -var OPERATORS = createMap(); -forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; }); -var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'"'}; - - -///////////////////////////////////////// - - -/** - * @constructor - */ -var Lexer = function Lexer(options) { - this.options = options; -}; - -Lexer.prototype = { - constructor: Lexer, - - lex: function(text) { - this.text = text; - this.index = 0; - this.tokens = []; - - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - if (ch === '"' || ch === '\'') { - this.readString(ch); - } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) { - this.readNumber(); - } else if (this.isIdentifierStart(this.peekMultichar())) { - this.readIdent(); - } else if (this.is(ch, '(){}[].,;:?')) { - this.tokens.push({index: this.index, text: ch}); - this.index++; - } else if (this.isWhitespace(ch)) { - this.index++; - } else { - var ch2 = ch + this.peek(); - var ch3 = ch2 + this.peek(2); - var op1 = OPERATORS[ch]; - var op2 = OPERATORS[ch2]; - var op3 = OPERATORS[ch3]; - if (op1 || op2 || op3) { - var token = op3 ? ch3 : (op2 ? ch2 : ch); - this.tokens.push({index: this.index, text: token, operator: true}); - this.index += token.length; - } else { - this.throwError('Unexpected next character ', this.index, this.index + 1); - } - } - } - return this.tokens; - }, - - is: function(ch, chars) { - return chars.indexOf(ch) !== -1; - }, - - peek: function(i) { - var num = i || 1; - return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false; - }, - - isNumber: function(ch) { - return ('0' <= ch && ch <= '9') && typeof ch === 'string'; - }, - - isWhitespace: function(ch) { - // IE treats non-breaking space as \u00A0 - return (ch === ' ' || ch === '\r' || ch === '\t' || - ch === '\n' || ch === '\v' || ch === '\u00A0'); - }, - - isIdentifierStart: function(ch) { - return this.options.isIdentifierStart ? - this.options.isIdentifierStart(ch, this.codePointAt(ch)) : - this.isValidIdentifierStart(ch); - }, - - isValidIdentifierStart: function(ch) { - return ('a' <= ch && ch <= 'z' || - 'A' <= ch && ch <= 'Z' || - '_' === ch || ch === '$'); - }, - - isIdentifierContinue: function(ch) { - return this.options.isIdentifierContinue ? - this.options.isIdentifierContinue(ch, this.codePointAt(ch)) : - this.isValidIdentifierContinue(ch); - }, - - isValidIdentifierContinue: function(ch, cp) { - return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch); - }, - - codePointAt: function(ch) { - if (ch.length === 1) return ch.charCodeAt(0); - // eslint-disable-next-line no-bitwise - return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00; - }, - - peekMultichar: function() { - var ch = this.text.charAt(this.index); - var peek = this.peek(); - if (!peek) { - return ch; - } - var cp1 = ch.charCodeAt(0); - var cp2 = peek.charCodeAt(0); - if (cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF) { - return ch + peek; - } - return ch; - }, - - isExpOperator: function(ch) { - return (ch === '-' || ch === '+' || this.isNumber(ch)); - }, - - throwError: function(error, start, end) { - end = end || this.index; - var colStr = (isDefined(start) - ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']' - : ' ' + end); - throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].', - error, colStr, this.text); - }, - - readNumber: function() { - var number = ''; - var start = this.index; - while (this.index < this.text.length) { - var ch = lowercase(this.text.charAt(this.index)); - if (ch === '.' || this.isNumber(ch)) { - number += ch; - } else { - var peekCh = this.peek(); - if (ch === 'e' && this.isExpOperator(peekCh)) { - number += ch; - } else if (this.isExpOperator(ch) && - peekCh && this.isNumber(peekCh) && - number.charAt(number.length - 1) === 'e') { - number += ch; - } else if (this.isExpOperator(ch) && - (!peekCh || !this.isNumber(peekCh)) && - number.charAt(number.length - 1) === 'e') { - this.throwError('Invalid exponent'); - } else { - break; - } - } - this.index++; - } - this.tokens.push({ - index: start, - text: number, - constant: true, - value: Number(number) - }); - }, - - readIdent: function() { - var start = this.index; - this.index += this.peekMultichar().length; - while (this.index < this.text.length) { - var ch = this.peekMultichar(); - if (!this.isIdentifierContinue(ch)) { - break; - } - this.index += ch.length; - } - this.tokens.push({ - index: start, - text: this.text.slice(start, this.index), - identifier: true - }); - }, - - readString: function(quote) { - var start = this.index; - this.index++; - var string = ''; - var rawString = quote; - var escape = false; - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - rawString += ch; - if (escape) { - if (ch === 'u') { - var hex = this.text.substring(this.index + 1, this.index + 5); - if (!hex.match(/[\da-f]{4}/i)) { - this.throwError('Invalid unicode escape [\\u' + hex + ']'); - } - this.index += 4; - string += String.fromCharCode(parseInt(hex, 16)); - } else { - var rep = ESCAPE[ch]; - string = string + (rep || ch); - } - escape = false; - } else if (ch === '\\') { - escape = true; - } else if (ch === quote) { - this.index++; - this.tokens.push({ - index: start, - text: rawString, - constant: true, - value: string - }); - return; - } else { - string += ch; - } - this.index++; - } - this.throwError('Unterminated quote', start); - } -}; - -var AST = function AST(lexer, options) { - this.lexer = lexer; - this.options = options; -}; - -AST.Program = 'Program'; -AST.ExpressionStatement = 'ExpressionStatement'; -AST.AssignmentExpression = 'AssignmentExpression'; -AST.ConditionalExpression = 'ConditionalExpression'; -AST.LogicalExpression = 'LogicalExpression'; -AST.BinaryExpression = 'BinaryExpression'; -AST.UnaryExpression = 'UnaryExpression'; -AST.CallExpression = 'CallExpression'; -AST.MemberExpression = 'MemberExpression'; -AST.Identifier = 'Identifier'; -AST.Literal = 'Literal'; -AST.ArrayExpression = 'ArrayExpression'; -AST.Property = 'Property'; -AST.ObjectExpression = 'ObjectExpression'; -AST.ThisExpression = 'ThisExpression'; -AST.LocalsExpression = 'LocalsExpression'; - -// Internal use only -AST.NGValueParameter = 'NGValueParameter'; - -AST.prototype = { - ast: function(text) { - this.text = text; - this.tokens = this.lexer.lex(text); - - var value = this.program(); - - if (this.tokens.length !== 0) { - this.throwError('is an unexpected token', this.tokens[0]); - } - - return value; - }, - - program: function() { - var body = []; - while (true) { - if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']')) - body.push(this.expressionStatement()); - if (!this.expect(';')) { - return { type: AST.Program, body: body}; - } - } - }, - - expressionStatement: function() { - return { type: AST.ExpressionStatement, expression: this.filterChain() }; - }, - - filterChain: function() { - var left = this.expression(); - while (this.expect('|')) { - left = this.filter(left); - } - return left; - }, - - expression: function() { - return this.assignment(); - }, - - assignment: function() { - var result = this.ternary(); - if (this.expect('=')) { - if (!isAssignable(result)) { - throw $parseMinErr('lval', 'Trying to assign a value to a non l-value'); - } - - result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='}; - } - return result; - }, - - ternary: function() { - var test = this.logicalOR(); - var alternate; - var consequent; - if (this.expect('?')) { - alternate = this.expression(); - if (this.consume(':')) { - consequent = this.expression(); - return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent}; - } - } - return test; - }, - - logicalOR: function() { - var left = this.logicalAND(); - while (this.expect('||')) { - left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() }; - } - return left; - }, - - logicalAND: function() { - var left = this.equality(); - while (this.expect('&&')) { - left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()}; - } - return left; - }, - - equality: function() { - var left = this.relational(); - var token; - while ((token = this.expect('==','!=','===','!=='))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() }; - } - return left; - }, - - relational: function() { - var left = this.additive(); - var token; - while ((token = this.expect('<', '>', '<=', '>='))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() }; - } - return left; - }, - - additive: function() { - var left = this.multiplicative(); - var token; - while ((token = this.expect('+','-'))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() }; - } - return left; - }, - - multiplicative: function() { - var left = this.unary(); - var token; - while ((token = this.expect('*','/','%'))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() }; - } - return left; - }, - - unary: function() { - var token; - if ((token = this.expect('+', '-', '!'))) { - return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() }; - } else { - return this.primary(); - } - }, - - primary: function() { - var primary; - if (this.expect('(')) { - primary = this.filterChain(); - this.consume(')'); - } else if (this.expect('[')) { - primary = this.arrayDeclaration(); - } else if (this.expect('{')) { - primary = this.object(); - } else if (this.selfReferential.hasOwnProperty(this.peek().text)) { - primary = copy(this.selfReferential[this.consume().text]); - } else if (this.options.literals.hasOwnProperty(this.peek().text)) { - primary = { type: AST.Literal, value: this.options.literals[this.consume().text]}; - } else if (this.peek().identifier) { - primary = this.identifier(); - } else if (this.peek().constant) { - primary = this.constant(); - } else { - this.throwError('not a primary expression', this.peek()); - } - - var next; - while ((next = this.expect('(', '[', '.'))) { - if (next.text === '(') { - primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() }; - this.consume(')'); - } else if (next.text === '[') { - primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true }; - this.consume(']'); - } else if (next.text === '.') { - primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false }; - } else { - this.throwError('IMPOSSIBLE'); - } - } - return primary; - }, - - filter: function(baseExpression) { - var args = [baseExpression]; - var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true}; - - while (this.expect(':')) { - args.push(this.expression()); - } - - return result; - }, - - parseArguments: function() { - var args = []; - if (this.peekToken().text !== ')') { - do { - args.push(this.filterChain()); - } while (this.expect(',')); - } - return args; - }, - - identifier: function() { - var token = this.consume(); - if (!token.identifier) { - this.throwError('is not a valid identifier', token); - } - return { type: AST.Identifier, name: token.text }; - }, - - constant: function() { - // TODO check that it is a constant - return { type: AST.Literal, value: this.consume().value }; - }, - - arrayDeclaration: function() { - var elements = []; - if (this.peekToken().text !== ']') { - do { - if (this.peek(']')) { - // Support trailing commas per ES5.1. - break; - } - elements.push(this.expression()); - } while (this.expect(',')); - } - this.consume(']'); - - return { type: AST.ArrayExpression, elements: elements }; - }, - - object: function() { - var properties = [], property; - if (this.peekToken().text !== '}') { - do { - if (this.peek('}')) { - // Support trailing commas per ES5.1. - break; - } - property = {type: AST.Property, kind: 'init'}; - if (this.peek().constant) { - property.key = this.constant(); - property.computed = false; - this.consume(':'); - property.value = this.expression(); - } else if (this.peek().identifier) { - property.key = this.identifier(); - property.computed = false; - if (this.peek(':')) { - this.consume(':'); - property.value = this.expression(); - } else { - property.value = property.key; - } - } else if (this.peek('[')) { - this.consume('['); - property.key = this.expression(); - this.consume(']'); - property.computed = true; - this.consume(':'); - property.value = this.expression(); - } else { - this.throwError('invalid key', this.peek()); - } - properties.push(property); - } while (this.expect(',')); - } - this.consume('}'); - - return {type: AST.ObjectExpression, properties: properties }; - }, - - throwError: function(msg, token) { - throw $parseMinErr('syntax', - 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].', - token.text, msg, (token.index + 1), this.text, this.text.substring(token.index)); - }, - - consume: function(e1) { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - - var token = this.expect(e1); - if (!token) { - this.throwError('is unexpected, expecting [' + e1 + ']', this.peek()); - } - return token; - }, - - peekToken: function() { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - return this.tokens[0]; - }, - - peek: function(e1, e2, e3, e4) { - return this.peekAhead(0, e1, e2, e3, e4); - }, - - peekAhead: function(i, e1, e2, e3, e4) { - if (this.tokens.length > i) { - var token = this.tokens[i]; - var t = token.text; - if (t === e1 || t === e2 || t === e3 || t === e4 || - (!e1 && !e2 && !e3 && !e4)) { - return token; - } - } - return false; - }, - - expect: function(e1, e2, e3, e4) { - var token = this.peek(e1, e2, e3, e4); - if (token) { - this.tokens.shift(); - return token; - } - return false; - }, - - selfReferential: { - 'this': {type: AST.ThisExpression }, - '$locals': {type: AST.LocalsExpression } - } -}; - -function ifDefined(v, d) { - return typeof v !== 'undefined' ? v : d; -} - -function plusFn(l, r) { - if (typeof l === 'undefined') return r; - if (typeof r === 'undefined') return l; - return l + r; -} - -function isStateless($filter, filterName) { - var fn = $filter(filterName); - return !fn.$stateful; -} - -var PURITY_ABSOLUTE = 1; -var PURITY_RELATIVE = 2; - -// Detect nodes which could depend on non-shallow state of objects -function isPure(node, parentIsPure) { - switch (node.type) { - // Computed members might invoke a stateful toString() - case AST.MemberExpression: - if (node.computed) { - return false; - } - break; - - // Unary always convert to primative - case AST.UnaryExpression: - return PURITY_ABSOLUTE; - - // The binary + operator can invoke a stateful toString(). - case AST.BinaryExpression: - return node.operator !== '+' ? PURITY_ABSOLUTE : false; - - // Functions / filters probably read state from within objects - case AST.CallExpression: - return false; - } - - return (undefined === parentIsPure) ? PURITY_RELATIVE : parentIsPure; -} - -function findConstantAndWatchExpressions(ast, $filter, parentIsPure) { - var allConstants; - var argsToWatch; - var isStatelessFilter; - - var astIsPure = ast.isPure = isPure(ast, parentIsPure); - - switch (ast.type) { - case AST.Program: - allConstants = true; - forEach(ast.body, function(expr) { - findConstantAndWatchExpressions(expr.expression, $filter, astIsPure); - allConstants = allConstants && expr.expression.constant; - }); - ast.constant = allConstants; - break; - case AST.Literal: - ast.constant = true; - ast.toWatch = []; - break; - case AST.UnaryExpression: - findConstantAndWatchExpressions(ast.argument, $filter, astIsPure); - ast.constant = ast.argument.constant; - ast.toWatch = ast.argument.toWatch; - break; - case AST.BinaryExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch); - break; - case AST.LogicalExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.ConditionalExpression: - findConstantAndWatchExpressions(ast.test, $filter, astIsPure); - findConstantAndWatchExpressions(ast.alternate, $filter, astIsPure); - findConstantAndWatchExpressions(ast.consequent, $filter, astIsPure); - ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.Identifier: - ast.constant = false; - ast.toWatch = [ast]; - break; - case AST.MemberExpression: - findConstantAndWatchExpressions(ast.object, $filter, astIsPure); - if (ast.computed) { - findConstantAndWatchExpressions(ast.property, $filter, astIsPure); - } - ast.constant = ast.object.constant && (!ast.computed || ast.property.constant); - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.CallExpression: - isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false; - allConstants = isStatelessFilter; - argsToWatch = []; - forEach(ast.arguments, function(expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = isStatelessFilter ? argsToWatch : [ast]; - break; - case AST.AssignmentExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = [ast]; - break; - case AST.ArrayExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.elements, function(expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ObjectExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.properties, function(property) { - findConstantAndWatchExpressions(property.value, $filter, astIsPure); - allConstants = allConstants && property.value.constant; - argsToWatch.push.apply(argsToWatch, property.value.toWatch); - if (property.computed) { - //`{[key]: value}` implicitly does `key.toString()` which may be non-pure - findConstantAndWatchExpressions(property.key, $filter, /*parentIsPure=*/false); - allConstants = allConstants && property.key.constant; - argsToWatch.push.apply(argsToWatch, property.key.toWatch); - } - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ThisExpression: - ast.constant = false; - ast.toWatch = []; - break; - case AST.LocalsExpression: - ast.constant = false; - ast.toWatch = []; - break; - } -} - -function getInputs(body) { - if (body.length !== 1) return; - var lastExpression = body[0].expression; - var candidate = lastExpression.toWatch; - if (candidate.length !== 1) return candidate; - return candidate[0] !== lastExpression ? candidate : undefined; -} - -function isAssignable(ast) { - return ast.type === AST.Identifier || ast.type === AST.MemberExpression; -} - -function assignableAST(ast) { - if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) { - return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='}; - } -} - -function isLiteral(ast) { - return ast.body.length === 0 || - ast.body.length === 1 && ( - ast.body[0].expression.type === AST.Literal || - ast.body[0].expression.type === AST.ArrayExpression || - ast.body[0].expression.type === AST.ObjectExpression); -} - -function isConstant(ast) { - return ast.constant; -} - -function ASTCompiler($filter) { - this.$filter = $filter; -} - -ASTCompiler.prototype = { - compile: function(ast) { - var self = this; - this.state = { - nextId: 0, - filters: {}, - fn: {vars: [], body: [], own: {}}, - assign: {vars: [], body: [], own: {}}, - inputs: [] - }; - findConstantAndWatchExpressions(ast, self.$filter); - var extra = ''; - var assignable; - this.stage = 'assign'; - if ((assignable = assignableAST(ast))) { - this.state.computing = 'assign'; - var result = this.nextId(); - this.recurse(assignable, result); - this.return_(result); - extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l'); - } - var toWatch = getInputs(ast.body); - self.stage = 'inputs'; - forEach(toWatch, function(watch, key) { - var fnKey = 'fn' + key; - self.state[fnKey] = {vars: [], body: [], own: {}}; - self.state.computing = fnKey; - var intoId = self.nextId(); - self.recurse(watch, intoId); - self.return_(intoId); - self.state.inputs.push({name: fnKey, isPure: watch.isPure}); - watch.watchId = key; - }); - this.state.computing = 'fn'; - this.stage = 'main'; - this.recurse(ast); - var fnString = - // The build and minification steps remove the string "use strict" from the code, but this is done using a regex. - // This is a workaround for this until we do a better job at only removing the prefix only when we should. - '"' + this.USE + ' ' + this.STRICT + '";\n' + - this.filterPrefix() + - 'var fn=' + this.generateFunction('fn', 's,l,a,i') + - extra + - this.watchFns() + - 'return fn;'; - - // eslint-disable-next-line no-new-func - var fn = (new Function('$filter', - 'getStringValue', - 'ifDefined', - 'plus', - fnString))( - this.$filter, - getStringValue, - ifDefined, - plusFn); - this.state = this.stage = undefined; - return fn; - }, - - USE: 'use', - - STRICT: 'strict', - - watchFns: function() { - var result = []; - var inputs = this.state.inputs; - var self = this; - forEach(inputs, function(input) { - result.push('var ' + input.name + '=' + self.generateFunction(input.name, 's')); - if (input.isPure) { - result.push(input.name, '.isPure=' + JSON.stringify(input.isPure) + ';'); - } - }); - if (inputs.length) { - result.push('fn.inputs=[' + inputs.map(function(i) { return i.name; }).join(',') + '];'); - } - return result.join(''); - }, - - generateFunction: function(name, params) { - return 'function(' + params + '){' + - this.varsPrefix(name) + - this.body(name) + - '};'; - }, - - filterPrefix: function() { - var parts = []; - var self = this; - forEach(this.state.filters, function(id, filter) { - parts.push(id + '=$filter(' + self.escape(filter) + ')'); - }); - if (parts.length) return 'var ' + parts.join(',') + ';'; - return ''; - }, - - varsPrefix: function(section) { - return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : ''; - }, - - body: function(section) { - return this.state[section].body.join(''); - }, - - recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var left, right, self = this, args, expression, computed; - recursionFn = recursionFn || noop; - if (!skipWatchIdCheck && isDefined(ast.watchId)) { - intoId = intoId || this.nextId(); - this.if_('i', - this.lazyAssign(intoId, this.computedMember('i', ast.watchId)), - this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true) - ); - return; - } - switch (ast.type) { - case AST.Program: - forEach(ast.body, function(expression, pos) { - self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; }); - if (pos !== ast.body.length - 1) { - self.current().body.push(right, ';'); - } else { - self.return_(right); - } - }); - break; - case AST.Literal: - expression = this.escape(ast.value); - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.UnaryExpression: - this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; }); - expression = ast.operator + '(' + this.ifDefined(right, 0) + ')'; - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.BinaryExpression: - this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; }); - this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; }); - if (ast.operator === '+') { - expression = this.plus(left, right); - } else if (ast.operator === '-') { - expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0); - } else { - expression = '(' + left + ')' + ast.operator + '(' + right + ')'; - } - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.LogicalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.left, intoId); - self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId)); - recursionFn(intoId); - break; - case AST.ConditionalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.test, intoId); - self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId)); - recursionFn(intoId); - break; - case AST.Identifier: - intoId = intoId || this.nextId(); - if (nameId) { - nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s'); - nameId.computed = false; - nameId.name = ast.name; - } - self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)), - function() { - self.if_(self.stage === 'inputs' || 's', function() { - if (create && create !== 1) { - self.if_( - self.isNull(self.nonComputedMember('s', ast.name)), - self.lazyAssign(self.nonComputedMember('s', ast.name), '{}')); - } - self.assign(intoId, self.nonComputedMember('s', ast.name)); - }); - }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name)) - ); - recursionFn(intoId); - break; - case AST.MemberExpression: - left = nameId && (nameId.context = this.nextId()) || this.nextId(); - intoId = intoId || this.nextId(); - self.recurse(ast.object, left, undefined, function() { - self.if_(self.notNull(left), function() { - if (ast.computed) { - right = self.nextId(); - self.recurse(ast.property, right); - self.getStringValue(right); - if (create && create !== 1) { - self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}')); - } - expression = self.computedMember(left, right); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = true; - nameId.name = right; - } - } else { - if (create && create !== 1) { - self.if_(self.isNull(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}')); - } - expression = self.nonComputedMember(left, ast.property.name); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = false; - nameId.name = ast.property.name; - } - } - }, function() { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }, !!create); - break; - case AST.CallExpression: - intoId = intoId || this.nextId(); - if (ast.filter) { - right = self.filter(ast.callee.name); - args = []; - forEach(ast.arguments, function(expr) { - var argument = self.nextId(); - self.recurse(expr, argument); - args.push(argument); - }); - expression = right + '(' + args.join(',') + ')'; - self.assign(intoId, expression); - recursionFn(intoId); - } else { - right = self.nextId(); - left = {}; - args = []; - self.recurse(ast.callee, right, left, function() { - self.if_(self.notNull(right), function() { - forEach(ast.arguments, function(expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) { - args.push(argument); - }); - }); - if (left.name) { - expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')'; - } else { - expression = right + '(' + args.join(',') + ')'; - } - self.assign(intoId, expression); - }, function() { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }); - } - break; - case AST.AssignmentExpression: - right = this.nextId(); - left = {}; - this.recurse(ast.left, undefined, left, function() { - self.if_(self.notNull(left.context), function() { - self.recurse(ast.right, right); - expression = self.member(left.context, left.name, left.computed) + ast.operator + right; - self.assign(intoId, expression); - recursionFn(intoId || expression); - }); - }, 1); - break; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function(expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) { - args.push(argument); - }); - }); - expression = '[' + args.join(',') + ']'; - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.ObjectExpression: - args = []; - computed = false; - forEach(ast.properties, function(property) { - if (property.computed) { - computed = true; - } - }); - if (computed) { - intoId = intoId || this.nextId(); - this.assign(intoId, '{}'); - forEach(ast.properties, function(property) { - if (property.computed) { - left = self.nextId(); - self.recurse(property.key, left); - } else { - left = property.key.type === AST.Identifier ? - property.key.name : - ('' + property.key.value); - } - right = self.nextId(); - self.recurse(property.value, right); - self.assign(self.member(intoId, left, property.computed), right); - }); - } else { - forEach(ast.properties, function(property) { - self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function(expr) { - args.push(self.escape( - property.key.type === AST.Identifier ? property.key.name : - ('' + property.key.value)) + - ':' + expr); - }); - }); - expression = '{' + args.join(',') + '}'; - this.assign(intoId, expression); - } - recursionFn(intoId || expression); - break; - case AST.ThisExpression: - this.assign(intoId, 's'); - recursionFn(intoId || 's'); - break; - case AST.LocalsExpression: - this.assign(intoId, 'l'); - recursionFn(intoId || 'l'); - break; - case AST.NGValueParameter: - this.assign(intoId, 'v'); - recursionFn(intoId || 'v'); - break; - } - }, - - getHasOwnProperty: function(element, property) { - var key = element + '.' + property; - var own = this.current().own; - if (!own.hasOwnProperty(key)) { - own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')'); - } - return own[key]; - }, - - assign: function(id, value) { - if (!id) return; - this.current().body.push(id, '=', value, ';'); - return id; - }, - - filter: function(filterName) { - if (!this.state.filters.hasOwnProperty(filterName)) { - this.state.filters[filterName] = this.nextId(true); - } - return this.state.filters[filterName]; - }, - - ifDefined: function(id, defaultValue) { - return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')'; - }, - - plus: function(left, right) { - return 'plus(' + left + ',' + right + ')'; - }, - - return_: function(id) { - this.current().body.push('return ', id, ';'); - }, - - if_: function(test, alternate, consequent) { - if (test === true) { - alternate(); - } else { - var body = this.current().body; - body.push('if(', test, '){'); - alternate(); - body.push('}'); - if (consequent) { - body.push('else{'); - consequent(); - body.push('}'); - } - } - }, - - not: function(expression) { - return '!(' + expression + ')'; - }, - - isNull: function(expression) { - return expression + '==null'; - }, - - notNull: function(expression) { - return expression + '!=null'; - }, - - nonComputedMember: function(left, right) { - var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/; - var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g; - if (SAFE_IDENTIFIER.test(right)) { - return left + '.' + right; - } else { - return left + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]'; - } - }, - - computedMember: function(left, right) { - return left + '[' + right + ']'; - }, - - member: function(left, right, computed) { - if (computed) return this.computedMember(left, right); - return this.nonComputedMember(left, right); - }, - - getStringValue: function(item) { - this.assign(item, 'getStringValue(' + item + ')'); - }, - - lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var self = this; - return function() { - self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck); - }; - }, - - lazyAssign: function(id, value) { - var self = this; - return function() { - self.assign(id, value); - }; - }, - - stringEscapeRegex: /[^ a-zA-Z0-9]/g, - - stringEscapeFn: function(c) { - return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); - }, - - escape: function(value) { - if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\''; - if (isNumber(value)) return value.toString(); - if (value === true) return 'true'; - if (value === false) return 'false'; - if (value === null) return 'null'; - if (typeof value === 'undefined') return 'undefined'; - - throw $parseMinErr('esc', 'IMPOSSIBLE'); - }, - - nextId: function(skip, init) { - var id = 'v' + (this.state.nextId++); - if (!skip) { - this.current().vars.push(id + (init ? '=' + init : '')); - } - return id; - }, - - current: function() { - return this.state[this.state.computing]; - } -}; - - -function ASTInterpreter($filter) { - this.$filter = $filter; -} - -ASTInterpreter.prototype = { - compile: function(ast) { - var self = this; - findConstantAndWatchExpressions(ast, self.$filter); - var assignable; - var assign; - if ((assignable = assignableAST(ast))) { - assign = this.recurse(assignable); - } - var toWatch = getInputs(ast.body); - var inputs; - if (toWatch) { - inputs = []; - forEach(toWatch, function(watch, key) { - var input = self.recurse(watch); - input.isPure = watch.isPure; - watch.input = input; - inputs.push(input); - watch.watchId = key; - }); - } - var expressions = []; - forEach(ast.body, function(expression) { - expressions.push(self.recurse(expression.expression)); - }); - var fn = ast.body.length === 0 ? noop : - ast.body.length === 1 ? expressions[0] : - function(scope, locals) { - var lastValue; - forEach(expressions, function(exp) { - lastValue = exp(scope, locals); - }); - return lastValue; - }; - if (assign) { - fn.assign = function(scope, value, locals) { - return assign(scope, locals, value); - }; - } - if (inputs) { - fn.inputs = inputs; - } - return fn; - }, - - recurse: function(ast, context, create) { - var left, right, self = this, args; - if (ast.input) { - return this.inputs(ast.input, ast.watchId); - } - switch (ast.type) { - case AST.Literal: - return this.value(ast.value, context); - case AST.UnaryExpression: - right = this.recurse(ast.argument); - return this['unary' + ast.operator](right, context); - case AST.BinaryExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.LogicalExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.ConditionalExpression: - return this['ternary?:']( - this.recurse(ast.test), - this.recurse(ast.alternate), - this.recurse(ast.consequent), - context - ); - case AST.Identifier: - return self.identifier(ast.name, context, create); - case AST.MemberExpression: - left = this.recurse(ast.object, false, !!create); - if (!ast.computed) { - right = ast.property.name; - } - if (ast.computed) right = this.recurse(ast.property); - return ast.computed ? - this.computedMember(left, right, context, create) : - this.nonComputedMember(left, right, context, create); - case AST.CallExpression: - args = []; - forEach(ast.arguments, function(expr) { - args.push(self.recurse(expr)); - }); - if (ast.filter) right = this.$filter(ast.callee.name); - if (!ast.filter) right = this.recurse(ast.callee, true); - return ast.filter ? - function(scope, locals, assign, inputs) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - var value = right.apply(undefined, values, inputs); - return context ? {context: undefined, name: undefined, value: value} : value; - } : - function(scope, locals, assign, inputs) { - var rhs = right(scope, locals, assign, inputs); - var value; - if (rhs.value != null) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - value = rhs.value.apply(rhs.context, values); - } - return context ? {value: value} : value; - }; - case AST.AssignmentExpression: - left = this.recurse(ast.left, true, 1); - right = this.recurse(ast.right); - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - lhs.context[lhs.name] = rhs; - return context ? {value: rhs} : rhs; - }; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function(expr) { - args.push(self.recurse(expr)); - }); - return function(scope, locals, assign, inputs) { - var value = []; - for (var i = 0; i < args.length; ++i) { - value.push(args[i](scope, locals, assign, inputs)); - } - return context ? {value: value} : value; - }; - case AST.ObjectExpression: - args = []; - forEach(ast.properties, function(property) { - if (property.computed) { - args.push({key: self.recurse(property.key), - computed: true, - value: self.recurse(property.value) - }); - } else { - args.push({key: property.key.type === AST.Identifier ? - property.key.name : - ('' + property.key.value), - computed: false, - value: self.recurse(property.value) - }); - } - }); - return function(scope, locals, assign, inputs) { - var value = {}; - for (var i = 0; i < args.length; ++i) { - if (args[i].computed) { - value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs); - } else { - value[args[i].key] = args[i].value(scope, locals, assign, inputs); - } - } - return context ? {value: value} : value; - }; - case AST.ThisExpression: - return function(scope) { - return context ? {value: scope} : scope; - }; - case AST.LocalsExpression: - return function(scope, locals) { - return context ? {value: locals} : locals; - }; - case AST.NGValueParameter: - return function(scope, locals, assign) { - return context ? {value: assign} : assign; - }; - } - }, - - 'unary+': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = +arg; - } else { - arg = 0; - } - return context ? {value: arg} : arg; - }; - }, - 'unary-': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = -arg; - } else { - arg = -0; - } - return context ? {value: arg} : arg; - }; - }, - 'unary!': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = !argument(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary+': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = plusFn(lhs, rhs); - return context ? {value: arg} : arg; - }; - }, - 'binary-': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0); - return context ? {value: arg} : arg; - }; - }, - 'binary*': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary/': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary%': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary===': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary!==': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary==': function(left, right, context) { - return function(scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary!=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary<': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary>': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary<=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary>=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary&&': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary||': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'ternary?:': function(test, alternate, consequent, context) { - return function(scope, locals, assign, inputs) { - var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - value: function(value, context) { - return function() { return context ? {context: undefined, name: undefined, value: value} : value; }; - }, - identifier: function(name, context, create) { - return function(scope, locals, assign, inputs) { - var base = locals && (name in locals) ? locals : scope; - if (create && create !== 1 && base && base[name] == null) { - base[name] = {}; - } - var value = base ? base[name] : undefined; - if (context) { - return {context: base, name: name, value: value}; - } else { - return value; - } - }; - }, - computedMember: function(left, right, context, create) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs; - var value; - if (lhs != null) { - rhs = right(scope, locals, assign, inputs); - rhs = getStringValue(rhs); - if (create && create !== 1) { - if (lhs && !(lhs[rhs])) { - lhs[rhs] = {}; - } - } - value = lhs[rhs]; - } - if (context) { - return {context: lhs, name: rhs, value: value}; - } else { - return value; - } - }; - }, - nonComputedMember: function(left, right, context, create) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - if (create && create !== 1) { - if (lhs && lhs[right] == null) { - lhs[right] = {}; - } - } - var value = lhs != null ? lhs[right] : undefined; - if (context) { - return {context: lhs, name: right, value: value}; - } else { - return value; - } - }; - }, - inputs: function(input, watchId) { - return function(scope, value, locals, inputs) { - if (inputs) return inputs[watchId]; - return input(scope, value, locals); - }; - } -}; - -/** - * @constructor - */ -function Parser(lexer, $filter, options) { - this.ast = new AST(lexer, options); - this.astCompiler = options.csp ? new ASTInterpreter($filter) : - new ASTCompiler($filter); -} - -Parser.prototype = { - constructor: Parser, - - parse: function(text) { - var ast = this.getAst(text); - var fn = this.astCompiler.compile(ast.ast); - fn.literal = isLiteral(ast.ast); - fn.constant = isConstant(ast.ast); - fn.oneTime = ast.oneTime; - return fn; - }, - - getAst: function(exp) { - var oneTime = false; - exp = exp.trim(); - - if (exp.charAt(0) === ':' && exp.charAt(1) === ':') { - oneTime = true; - exp = exp.substring(2); - } - return { - ast: this.ast.ast(exp), - oneTime: oneTime - }; - } -}; - -function getValueOf(value) { - return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value); -} - -/////////////////////////////////// - -/** - * @ngdoc service - * @name $parse - * @kind function - * - * @description - * - * Converts AngularJS {@link guide/expression expression} into a function. - * - * ```js - * var getter = $parse('user.name'); - * var setter = getter.assign; - * var context = {user:{name:'AngularJS'}}; - * var locals = {user:{name:'local'}}; - * - * expect(getter(context)).toEqual('AngularJS'); - * setter(context, 'newValue'); - * expect(context.user.name).toEqual('newValue'); - * expect(getter(context, locals)).toEqual('local'); - * ``` - * - * - * @param {string} expression String expression to compile. - * @returns {function(context, locals)} a function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the strings - * are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values in - * `context`. - * - * The returned function also has the following properties: - * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript - * literal. - * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript - * constant literals. - * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be - * set to a function to change its value on the given context. - * - */ - - -/** - * @ngdoc provider - * @name $parseProvider - * @this - * - * @description - * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} - * service. - */ -function $ParseProvider() { - var cache = createMap(); - var literals = { - 'true': true, - 'false': false, - 'null': null, - 'undefined': undefined - }; - var identStart, identContinue; - - /** - * @ngdoc method - * @name $parseProvider#addLiteral - * @description - * - * Configure $parse service to add literal values that will be present as literal at expressions. - * - * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name. - * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`. - * - **/ - this.addLiteral = function(literalName, literalValue) { - literals[literalName] = literalValue; - }; - - /** - * @ngdoc method - * @name $parseProvider#setIdentifierFns - * - * @description - * - * Allows defining the set of characters that are allowed in AngularJS expressions. The function - * `identifierStart` will get called to know if a given character is a valid character to be the - * first character for an identifier. The function `identifierContinue` will get called to know if - * a given character is a valid character to be a follow-up identifier character. The functions - * `identifierStart` and `identifierContinue` will receive as arguments the single character to be - * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in - * mind that the `string` parameter can be two characters long depending on the character - * representation. It is expected for the function to return `true` or `false`, whether that - * character is allowed or not. - * - * Since this function will be called extensively, keep the implementation of these functions fast, - * as the performance of these functions have a direct impact on the expressions parsing speed. - * - * @param {function=} identifierStart The function that will decide whether the given character is - * a valid identifier start character. - * @param {function=} identifierContinue The function that will decide whether the given character is - * a valid identifier continue character. - */ - this.setIdentifierFns = function(identifierStart, identifierContinue) { - identStart = identifierStart; - identContinue = identifierContinue; - return this; - }; - - this.$get = ['$filter', function($filter) { - var noUnsafeEval = csp().noUnsafeEval; - var $parseOptions = { - csp: noUnsafeEval, - literals: copy(literals), - isIdentifierStart: isFunction(identStart) && identStart, - isIdentifierContinue: isFunction(identContinue) && identContinue - }; - $parse.$$getAst = $$getAst; - return $parse; - - function $parse(exp, interceptorFn) { - var parsedExpression, cacheKey; - - switch (typeof exp) { - case 'string': - exp = exp.trim(); - cacheKey = exp; - - parsedExpression = cache[cacheKey]; - - if (!parsedExpression) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - parsedExpression = parser.parse(exp); - - cache[cacheKey] = addWatchDelegate(parsedExpression); - } - return addInterceptor(parsedExpression, interceptorFn); - - case 'function': - return addInterceptor(exp, interceptorFn); - - default: - return addInterceptor(noop, interceptorFn); - } - } - - function $$getAst(exp) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - return parser.getAst(exp).ast; - } - - function expressionInputDirtyCheck(newValue, oldValueOfValue, compareObjectIdentity) { - - if (newValue == null || oldValueOfValue == null) { // null/undefined - return newValue === oldValueOfValue; - } - - if (typeof newValue === 'object') { - - // attempt to convert the value to a primitive type - // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can - // be cheaply dirty-checked - newValue = getValueOf(newValue); - - if (typeof newValue === 'object' && !compareObjectIdentity) { - // objects/arrays are not supported - deep-watching them would be too expensive - return false; - } - - // fall-through to the primitive equality check - } - - //Primitive or NaN - // eslint-disable-next-line no-self-compare - return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue); - } - - function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var inputExpressions = parsedExpression.inputs; - var lastResult; - - if (inputExpressions.length === 1) { - var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails - inputExpressions = inputExpressions[0]; - return scope.$watch(function expressionInputWatch(scope) { - var newInputValue = inputExpressions(scope); - if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf, inputExpressions.isPure)) { - lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]); - oldInputValueOf = newInputValue && getValueOf(newInputValue); - } - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - var oldInputValueOfValues = []; - var oldInputValues = []; - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails - oldInputValues[i] = null; - } - - return scope.$watch(function expressionInputsWatch(scope) { - var changed = false; - - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - var newInputValue = inputExpressions[i](scope); - if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i], inputExpressions[i].isPure))) { - oldInputValues[i] = newInputValue; - oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue); - } - } - - if (changed) { - lastResult = parsedExpression(scope, undefined, undefined, oldInputValues); - } - - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var isDone = parsedExpression.literal ? isAllDefined : isDefined; - var unwatch, lastValue; - - var exp = parsedExpression.$$intercepted || parsedExpression; - var post = parsedExpression.$$interceptor || identity; - - var useInputs = parsedExpression.inputs && !exp.inputs; - - // Propogate the literal/inputs/constant attributes - // ... but not oneTime since we are handling it - oneTimeWatch.literal = parsedExpression.literal; - oneTimeWatch.constant = parsedExpression.constant; - oneTimeWatch.inputs = parsedExpression.inputs; - - // Allow other delegates to run on this wrapped expression - addWatchDelegate(oneTimeWatch); - - unwatch = scope.$watch(oneTimeWatch, listener, objectEquality, prettyPrintExpression); - - return unwatch; - - function unwatchIfDone() { - if (isDone(lastValue)) { - unwatch(); - } - } - - function oneTimeWatch(scope, locals, assign, inputs) { - lastValue = useInputs && inputs ? inputs[0] : exp(scope, locals, assign, inputs); - if (isDone(lastValue)) { - scope.$$postDigest(unwatchIfDone); - } - return post(lastValue); - } - } - - function isAllDefined(value) { - var allDefined = true; - forEach(value, function(val) { - if (!isDefined(val)) allDefined = false; - }); - return allDefined; - } - - function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) { - var unwatch = scope.$watch(function constantWatch(scope) { - unwatch(); - return parsedExpression(scope); - }, listener, objectEquality); - return unwatch; - } - - function addWatchDelegate(parsedExpression) { - if (parsedExpression.constant) { - parsedExpression.$$watchDelegate = constantWatchDelegate; - } else if (parsedExpression.oneTime) { - parsedExpression.$$watchDelegate = oneTimeWatchDelegate; - } else if (parsedExpression.inputs) { - parsedExpression.$$watchDelegate = inputsWatchDelegate; - } - - return parsedExpression; - } - - function chainInterceptors(first, second) { - function chainedInterceptor(value) { - return second(first(value)); - } - chainedInterceptor.$stateful = first.$stateful || second.$stateful; - chainedInterceptor.$$pure = first.$$pure && second.$$pure; - - return chainedInterceptor; - } - - function addInterceptor(parsedExpression, interceptorFn) { - if (!interceptorFn) return parsedExpression; - - // Extract any existing interceptors out of the parsedExpression - // to ensure the original parsedExpression is always the $$intercepted - if (parsedExpression.$$interceptor) { - interceptorFn = chainInterceptors(parsedExpression.$$interceptor, interceptorFn); - parsedExpression = parsedExpression.$$intercepted; - } - - var useInputs = false; - - var fn = function interceptedExpression(scope, locals, assign, inputs) { - var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs); - return interceptorFn(value); - }; - - // Maintain references to the interceptor/intercepted - fn.$$intercepted = parsedExpression; - fn.$$interceptor = interceptorFn; - - // Propogate the literal/oneTime/constant attributes - fn.literal = parsedExpression.literal; - fn.oneTime = parsedExpression.oneTime; - fn.constant = parsedExpression.constant; - - // Treat the interceptor like filters. - // If it is not $stateful then only watch its inputs. - // If the expression itself has no inputs then use the full expression as an input. - if (!interceptorFn.$stateful) { - useInputs = !parsedExpression.inputs; - fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression]; - - if (!interceptorFn.$$pure) { - fn.inputs = fn.inputs.map(function(e) { - // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a - // non-pure interceptor function. - if (e.isPure === PURITY_RELATIVE) { - return function depurifier(s) { return e(s); }; - } - return e; - }); - } - } - - return addWatchDelegate(fn); - } - }]; -} - -/** - * @ngdoc service - * @name $q - * @requires $rootScope - * - * @description - * A service that helps you run functions asynchronously, and use their return values (or exceptions) - * when they are done processing. - * - * This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred - * objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q). - * - * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred - * implementations, and the other which resembles ES6 (ES2015) promises to some degree. - * - * ## $q constructor - * - * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver` - * function as the first argument. This is similar to the native Promise implementation from ES6, - * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). - * - * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are - * available yet. - * - * It can be used like so: - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * // perform some asynchronous operation, resolve or reject the promise when appropriate. - * return $q(function(resolve, reject) { - * setTimeout(function() { - * if (okToGreet(name)) { - * resolve('Hello, ' + name + '!'); - * } else { - * reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * }); - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }); - * ``` - * - * Note: progress/notify callbacks are not currently supported via the ES6-style interface. - * - * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise. - * - * However, the more traditional CommonJS-style usage is still available, and documented below. - * - * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an - * interface for interacting with an object that represents the result of an action that is - * performed asynchronously, and may or may not be finished at any given point in time. - * - * From the perspective of dealing with error handling, deferred and promise APIs are to - * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * var deferred = $q.defer(); - * - * setTimeout(function() { - * deferred.notify('About to greet ' + name + '.'); - * - * if (okToGreet(name)) { - * deferred.resolve('Hello, ' + name + '!'); - * } else { - * deferred.reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * - * return deferred.promise; - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }, function(update) { - * alert('Got notification: ' + update); - * }); - * ``` - * - * At first it might not be obvious why this extra complexity is worth the trouble. The payoff - * comes in the way of guarantees that promise and deferred APIs make, see - * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md. - * - * Additionally the promise api allows for composition that is very hard to do with the - * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. - * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the - * section on serial or parallel joining of promises. - * - * ## The Deferred API - * - * A new instance of deferred is constructed by calling `$q.defer()`. - * - * The purpose of the deferred object is to expose the associated Promise instance as well as APIs - * that can be used for signaling the successful or unsuccessful completion, as well as the status - * of the task. - * - * **Methods** - * - * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection - * constructed via `$q.reject`, the promise will be rejected instead. - * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to - * resolving it with a rejection constructed via `$q.reject`. - * - `notify(value)` - provides updates on the status of the promise's execution. This may be called - * multiple times before the promise is either resolved or rejected. - * - * **Properties** - * - * - promise – `{Promise}` – promise object associated with this deferred. - * - * - * ## The Promise API - * - * A new promise instance is created when a deferred instance is created and can be retrieved by - * calling `deferred.promise`. - * - * The purpose of the promise object is to allow for interested parties to get access to the result - * of the deferred task when it completes. - * - * **Methods** - * - * - `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or - * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously - * as soon as the result is available. The callbacks are called with a single argument: the result - * or rejection reason. Additionally, the notify callback may be called zero or more times to - * provide a progress indication, before the promise is resolved or rejected. - * - * This method *returns a new promise* which is resolved or rejected via the return value of the - * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved - * with the value which is resolved in that promise using - * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)). - * It also notifies via the return value of the `notifyCallback` method. The promise cannot be - * resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback - * arguments are optional. - * - * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` - * - * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise, - * but to do so without modifying the final value. This is useful to release resources or do some - * clean-up that needs to be done whether the promise was rejected or resolved. See the [full - * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for - * more information. - * - * ## Chaining promises - * - * Because calling the `then` method of a promise returns a new derived promise, it is easily - * possible to create a chain of promises: - * - * ```js - * promiseB = promiseA.then(function(result) { - * return result + 1; - * }); - * - * // promiseB will be resolved immediately after promiseA is resolved and its value - * // will be the result of promiseA incremented by 1 - * ``` - * - * It is possible to create chains of any length and since a promise can be resolved with another - * promise (which will defer its resolution further), it is possible to pause/defer resolution of - * the promises at any point in the chain. This makes it possible to implement powerful APIs like - * $http's response interceptors. - * - * - * ## Differences between Kris Kowal's Q and $q - * - * There are two main differences: - * - * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation - * mechanism in AngularJS, which means faster propagation of resolution or rejection into your - * models and avoiding unnecessary browser repaints, which would result in flickering UI. - * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains - * all the important functionality needed for common async tasks. - * - * ## Testing - * - * ```js - * it('should simulate promise', inject(function($q, $rootScope) { - * var deferred = $q.defer(); - * var promise = deferred.promise; - * var resolvedValue; - * - * promise.then(function(value) { resolvedValue = value; }); - * expect(resolvedValue).toBeUndefined(); - * - * // Simulate resolving of promise - * deferred.resolve(123); - * // Note that the 'then' function does not get called synchronously. - * // This is because we want the promise API to always be async, whether or not - * // it got called synchronously or asynchronously. - * expect(resolvedValue).toBeUndefined(); - * - * // Propagate promise resolution to 'then' functions using $apply(). - * $rootScope.$apply(); - * expect(resolvedValue).toEqual(123); - * })); - * ``` - * - * @param {function(function, function)} resolver Function which is responsible for resolving or - * rejecting the newly created promise. The first parameter is a function which resolves the - * promise, the second parameter is a function which rejects the promise. - * - * @returns {Promise} The newly created promise. - */ -/** - * @ngdoc provider - * @name $qProvider - * @this - * - * @description - */ -function $QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { - return qFactory(function(callback) { - $rootScope.$evalAsync(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - /** - * @ngdoc method - * @name $qProvider#errorOnUnhandledRejections - * @kind function - * - * @description - * Retrieves or overrides whether to generate an error when a rejected promise is not handled. - * This feature is enabled by default. - * - * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. - * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for - * chaining otherwise. - */ - this.errorOnUnhandledRejections = function(value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; -} - -/** @this */ -function $$QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) { - return qFactory(function(callback) { - $browser.defer(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - this.errorOnUnhandledRejections = function(value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; -} - -/** - * Constructs a promise manager. - * - * @param {function(function)} nextTick Function for executing functions in the next turn. - * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for - * debugging purposes. - * @param {boolean=} errorOnUnhandledRejections Whether an error should be generated on unhandled - * promises rejections. - * @returns {object} Promise manager. - */ -function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) { - var $qMinErr = minErr('$q', TypeError); - var queueSize = 0; - var checkQueue = []; - - /** - * @ngdoc method - * @name ng.$q#defer - * @kind function - * - * @description - * Creates a `Deferred` object which represents a task which will finish in the future. - * - * @returns {Deferred} Returns a new instance of deferred. - */ - function defer() { - return new Deferred(); - } - - function Deferred() { - var promise = this.promise = new Promise(); - //Non prototype methods necessary to support unbound execution :/ - this.resolve = function(val) { resolvePromise(promise, val); }; - this.reject = function(reason) { rejectPromise(promise, reason); }; - this.notify = function(progress) { notifyPromise(promise, progress); }; - } - - - function Promise() { - this.$$state = { status: 0 }; - } - - extend(Promise.prototype, { - then: function(onFulfilled, onRejected, progressBack) { - if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) { - return this; - } - var result = new Promise(); - - this.$$state.pending = this.$$state.pending || []; - this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]); - if (this.$$state.status > 0) scheduleProcessQueue(this.$$state); - - return result; - }, - - 'catch': function(callback) { - return this.then(null, callback); - }, - - 'finally': function(callback, progressBack) { - return this.then(function(value) { - return handleCallback(value, resolve, callback); - }, function(error) { - return handleCallback(error, reject, callback); - }, progressBack); - } - }); - - function processQueue(state) { - var fn, promise, pending; - - pending = state.pending; - state.processScheduled = false; - state.pending = undefined; - try { - for (var i = 0, ii = pending.length; i < ii; ++i) { - markQStateExceptionHandled(state); - promise = pending[i][0]; - fn = pending[i][state.status]; - try { - if (isFunction(fn)) { - resolvePromise(promise, fn(state.value)); - } else if (state.status === 1) { - resolvePromise(promise, state.value); - } else { - rejectPromise(promise, state.value); - } - } catch (e) { - rejectPromise(promise, e); - // This error is explicitly marked for being passed to the $exceptionHandler - if (e && e.$$passToExceptionHandler === true) { - exceptionHandler(e); - } - } - } - } finally { - --queueSize; - if (errorOnUnhandledRejections && queueSize === 0) { - nextTick(processChecks); - } - } - } - - function processChecks() { - // eslint-disable-next-line no-unmodified-loop-condition - while (!queueSize && checkQueue.length) { - var toCheck = checkQueue.shift(); - if (!isStateExceptionHandled(toCheck)) { - markQStateExceptionHandled(toCheck); - var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value); - if (isError(toCheck.value)) { - exceptionHandler(toCheck.value, errorMessage); - } else { - exceptionHandler(errorMessage); - } - } - } - } - - function scheduleProcessQueue(state) { - if (errorOnUnhandledRejections && !state.pending && state.status === 2 && !isStateExceptionHandled(state)) { - if (queueSize === 0 && checkQueue.length === 0) { - nextTick(processChecks); - } - checkQueue.push(state); - } - if (state.processScheduled || !state.pending) return; - state.processScheduled = true; - ++queueSize; - nextTick(function() { processQueue(state); }); - } - - function resolvePromise(promise, val) { - if (promise.$$state.status) return; - if (val === promise) { - $$reject(promise, $qMinErr( - 'qcycle', - 'Expected promise to be resolved with value other than itself \'{0}\'', - val)); - } else { - $$resolve(promise, val); - } - - } - - function $$resolve(promise, val) { - var then; - var done = false; - try { - if (isObject(val) || isFunction(val)) then = val.then; - if (isFunction(then)) { - promise.$$state.status = -1; - then.call(val, doResolve, doReject, doNotify); - } else { - promise.$$state.value = val; - promise.$$state.status = 1; - scheduleProcessQueue(promise.$$state); - } - } catch (e) { - doReject(e); - } - - function doResolve(val) { - if (done) return; - done = true; - $$resolve(promise, val); - } - function doReject(val) { - if (done) return; - done = true; - $$reject(promise, val); - } - function doNotify(progress) { - notifyPromise(promise, progress); - } - } - - function rejectPromise(promise, reason) { - if (promise.$$state.status) return; - $$reject(promise, reason); - } - - function $$reject(promise, reason) { - promise.$$state.value = reason; - promise.$$state.status = 2; - scheduleProcessQueue(promise.$$state); - } - - function notifyPromise(promise, progress) { - var callbacks = promise.$$state.pending; - - if ((promise.$$state.status <= 0) && callbacks && callbacks.length) { - nextTick(function() { - var callback, result; - for (var i = 0, ii = callbacks.length; i < ii; i++) { - result = callbacks[i][0]; - callback = callbacks[i][3]; - try { - notifyPromise(result, isFunction(callback) ? callback(progress) : progress); - } catch (e) { - exceptionHandler(e); - } - } - }); - } - } - - /** - * @ngdoc method - * @name $q#reject - * @kind function - * - * @description - * Creates a promise that is resolved as rejected with the specified `reason`. This api should be - * used to forward rejection in a chain of promises. If you are dealing with the last promise in - * a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of - * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via - * a promise error callback and you want to forward the error to the promise derived from the - * current promise, you have to "rethrow" the error by returning a rejection constructed via - * `reject`. - * - * ```js - * promiseB = promiseA.then(function(result) { - * // success: do something and resolve promiseB - * // with the old or a new result - * return result; - * }, function(reason) { - * // error: handle the error if possible and - * // resolve promiseB with newPromiseOrValue, - * // otherwise forward the rejection to promiseB - * if (canHandle(reason)) { - * // handle the error and recover - * return newPromiseOrValue; - * } - * return $q.reject(reason); - * }); - * ``` - * - * @param {*} reason Constant, message, exception or an object representing the rejection reason. - * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. - */ - function reject(reason) { - var result = new Promise(); - rejectPromise(result, reason); - return result; - } - - function handleCallback(value, resolver, callback) { - var callbackOutput = null; - try { - if (isFunction(callback)) callbackOutput = callback(); - } catch (e) { - return reject(e); - } - if (isPromiseLike(callbackOutput)) { - return callbackOutput.then(function() { - return resolver(value); - }, reject); - } else { - return resolver(value); - } - } - - /** - * @ngdoc method - * @name $q#when - * @kind function - * - * @description - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. - * This is useful when you are dealing with an object that might or might not be a promise, or if - * the promise comes from a source that can't be trusted. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - - - function when(value, callback, errback, progressBack) { - var result = new Promise(); - resolvePromise(result, value); - return result.then(callback, errback, progressBack); - } - - /** - * @ngdoc method - * @name $q#resolve - * @kind function - * - * @description - * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - var resolve = when; - - /** - * @ngdoc method - * @name $q#all - * @kind function - * - * @description - * Combines multiple promises into a single promise that is resolved when all of the input - * promises are resolved. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, - * each value corresponding to the promise at the same index/key in the `promises` array/hash. - * If any of the promises is resolved with a rejection, this resulting promise will be rejected - * with the same rejection value. - */ - - function all(promises) { - var result = new Promise(), - counter = 0, - results = isArray(promises) ? [] : {}; - - forEach(promises, function(promise, key) { - counter++; - when(promise).then(function(value) { - results[key] = value; - if (!(--counter)) resolvePromise(result, results); - }, function(reason) { - rejectPromise(result, reason); - }); - }); - - if (counter === 0) { - resolvePromise(result, results); - } - - return result; - } - - /** - * @ngdoc method - * @name $q#race - * @kind function - * - * @description - * Returns a promise that resolves or rejects as soon as one of those promises - * resolves or rejects, with the value or reason from that promise. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} a promise that resolves or rejects as soon as one of the `promises` - * resolves or rejects, with the value or reason from that promise. - */ - - function race(promises) { - var deferred = defer(); - - forEach(promises, function(promise) { - when(promise).then(deferred.resolve, deferred.reject); - }); - - return deferred.promise; - } - - function $Q(resolver) { - if (!isFunction(resolver)) { - throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver); - } - - var promise = new Promise(); - - function resolveFn(value) { - resolvePromise(promise, value); - } - - function rejectFn(reason) { - rejectPromise(promise, reason); - } - - resolver(resolveFn, rejectFn); - - return promise; - } - - // Let's make the instanceof operator work for promises, so that - // `new $q(fn) instanceof $q` would evaluate to true. - $Q.prototype = Promise.prototype; - - $Q.defer = defer; - $Q.reject = reject; - $Q.when = when; - $Q.resolve = resolve; - $Q.all = all; - $Q.race = race; - - return $Q; -} - -function isStateExceptionHandled(state) { - return !!state.pur; -} -function markQStateExceptionHandled(state) { - state.pur = true; -} -function markQExceptionHandled(q) { - // Built-in `$q` promises will always have a `$$state` property. This check is to allow - // overwriting `$q` with a different promise library (e.g. Bluebird + angular-bluebird-promises). - // (Currently, this is the only method that might be called with a promise, even if it is not - // created by the built-in `$q`.) - if (q.$$state) { - markQStateExceptionHandled(q.$$state); - } -} - -/** @this */ -function $$RAFProvider() { //rAF - this.$get = ['$window', '$timeout', function($window, $timeout) { - var requestAnimationFrame = $window.requestAnimationFrame || - $window.webkitRequestAnimationFrame; - - var cancelAnimationFrame = $window.cancelAnimationFrame || - $window.webkitCancelAnimationFrame || - $window.webkitCancelRequestAnimationFrame; - - var rafSupported = !!requestAnimationFrame; - var raf = rafSupported - ? function(fn) { - var id = requestAnimationFrame(fn); - return function() { - cancelAnimationFrame(id); - }; - } - : function(fn) { - var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 - return function() { - $timeout.cancel(timer); - }; - }; - - raf.supported = rafSupported; - - return raf; - }]; -} - -/** - * DESIGN NOTES - * - * The design decisions behind the scope are heavily favored for speed and memory consumption. - * - * The typical use of scope is to watch the expressions, which most of the time return the same - * value as last time so we optimize the operation. - * - * Closures construction is expensive in terms of speed as well as memory: - * - No closures, instead use prototypical inheritance for API - * - Internal state needs to be stored on scope directly, which means that private state is - * exposed as $$____ properties - * - * Loop operations are optimized by using while(count--) { ... } - * - This means that in order to keep the same order of execution as addition we have to add - * items to the array at the beginning (unshift) instead of at the end (push) - * - * Child scopes are created and removed often - * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists - * - * There are fewer watches than observers. This is why you don't want the observer to be implemented - * in the same way as watch. Watch requires return of the initialization function which is expensive - * to construct. - */ - - -/** - * @ngdoc provider - * @name $rootScopeProvider - * @description - * - * Provider for the $rootScope service. - */ - -/** - * @ngdoc method - * @name $rootScopeProvider#digestTtl - * @description - * - * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that the dependencies between `$watch`s will result in - * several digest iterations. However if an application needs more than the default 10 digest - * iterations for its model to stabilize then you should investigate what is causing the model to - * continuously change during the digest. - * - * Increasing the TTL could have performance implications, so you should not change it without - * proper justification. - * - * @param {number} limit The number of digest iterations. - */ - - -/** - * @ngdoc service - * @name $rootScope - * @this - * - * @description - * - * Every application has a single root {@link ng.$rootScope.Scope scope}. - * All other scopes are descendant scopes of the root scope. Scopes provide separation - * between the model and the view, via a mechanism for watching the model for changes. - * They also provide event emission/broadcast and subscription facility. See the - * {@link guide/scope developer guide on scopes}. - */ -function $RootScopeProvider() { - var TTL = 10; - var $rootScopeMinErr = minErr('$rootScope'); - var lastDirtyWatch = null; - var applyAsyncId = null; - - this.digestTtl = function(value) { - if (arguments.length) { - TTL = value; - } - return TTL; - }; - - function createChildScopeClass(parent) { - function ChildScope() { - this.$$watchers = this.$$nextSibling = - this.$$childHead = this.$$childTail = null; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$id = nextUid(); - this.$$ChildScope = null; - this.$$suspended = false; - } - ChildScope.prototype = parent; - return ChildScope; - } - - this.$get = ['$exceptionHandler', '$parse', '$browser', - function($exceptionHandler, $parse, $browser) { - - function destroyChildScope($event) { - $event.currentScope.$$destroyed = true; - } - - function cleanUpScope($scope) { - - // Support: IE 9 only - if (msie === 9) { - // There is a memory leak in IE9 if all child scopes are not disconnected - // completely when a scope is destroyed. So this code will recurse up through - // all this scopes children - // - // See issue https://github.com/angular/angular.js/issues/10706 - if ($scope.$$childHead) { - cleanUpScope($scope.$$childHead); - } - if ($scope.$$nextSibling) { - cleanUpScope($scope.$$nextSibling); - } - } - - // The code below works around IE9 and V8's memory leaks - // - // See: - // - https://code.google.com/p/v8/issues/detail?id=2073#c26 - // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 - // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 - - $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = - $scope.$$childTail = $scope.$root = $scope.$$watchers = null; - } - - /** - * @ngdoc type - * @name $rootScope.Scope - * - * @description - * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the - * {@link auto.$injector $injector}. Child scopes are created using the - * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when - * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for - * an in-depth introduction and usage examples. - * - * - * ## Inheritance - * A scope can inherit from a parent scope, as in this example: - * ```js - var parent = $rootScope; - var child = parent.$new(); - - parent.salutation = "Hello"; - expect(child.salutation).toEqual('Hello'); - - child.salutation = "Welcome"; - expect(child.salutation).toEqual('Welcome'); - expect(parent.salutation).toEqual('Hello'); - * ``` - * - * When interacting with `Scope` in tests, additional helper methods are available on the - * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional - * details. - * - * - * @param {Object.=} providers Map of service factory which need to be - * provided for the current scope. Defaults to {@link ng}. - * @param {Object.=} instanceCache Provides pre-instantiated services which should - * append/override services provided by `providers`. This is handy - * when unit-testing and having the need to override a default - * service. - * @returns {Object} Newly created scope. - * - */ - function Scope() { - this.$id = nextUid(); - this.$$phase = this.$parent = this.$$watchers = - this.$$nextSibling = this.$$prevSibling = - this.$$childHead = this.$$childTail = null; - this.$root = this; - this.$$destroyed = false; - this.$$suspended = false; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$$isolateBindings = null; - } - - /** - * @ngdoc property - * @name $rootScope.Scope#$id - * - * @description - * Unique scope ID (monotonically increasing) useful for debugging. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$parent - * - * @description - * Reference to the parent scope. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$root - * - * @description - * Reference to the root scope. - */ - - Scope.prototype = { - constructor: Scope, - /** - * @ngdoc method - * @name $rootScope.Scope#$new - * @kind function - * - * @description - * Creates a new child {@link ng.$rootScope.Scope scope}. - * - * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event. - * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. - * - * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is - * desired for the scope and its child scopes to be permanently detached from the parent and - * thus stop participating in model change detection and listener notification by invoking. - * - * @param {boolean} isolate If true, then the scope does not prototypically inherit from the - * parent scope. The scope is isolated, as it can not see parent scope properties. - * When creating widgets, it is useful for the widget to not accidentally read parent - * state. - * - * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent` - * of the newly created scope. Defaults to `this` scope if not provided. - * This is used when creating a transclude scope to correctly place it - * in the scope hierarchy while maintaining the correct prototypical - * inheritance. - * - * @returns {Object} The newly created child scope. - * - */ - $new: function(isolate, parent) { - var child; - - parent = parent || this; - - if (isolate) { - child = new Scope(); - child.$root = this.$root; - } else { - // Only create a child scope class if somebody asks for one, - // but cache it to allow the VM to optimize lookups. - if (!this.$$ChildScope) { - this.$$ChildScope = createChildScopeClass(this); - } - child = new this.$$ChildScope(); - } - child.$parent = parent; - child.$$prevSibling = parent.$$childTail; - if (parent.$$childHead) { - parent.$$childTail.$$nextSibling = child; - parent.$$childTail = child; - } else { - parent.$$childHead = parent.$$childTail = child; - } - - // When the new scope is not isolated or we inherit from `this`, and - // the parent scope is destroyed, the property `$$destroyed` is inherited - // prototypically. In all other cases, this property needs to be set - // when the parent scope is destroyed. - // The listener needs to be added after the parent is set - if (isolate || parent !== this) child.$on('$destroy', destroyChildScope); - - return child; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watch - * @kind function - * - * @description - * Registers a `listener` callback to be executed whenever the `watchExpression` changes. - * - * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest - * $digest()} and should return the value that will be watched. (`watchExpression` should not change - * its value when executed multiple times with the same input because it may be executed multiple - * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be - * [idempotent](http://en.wikipedia.org/wiki/Idempotence).) - * - The `listener` is called only when the value from the current `watchExpression` and the - * previous call to `watchExpression` are not equal (with the exception of the initial run, - * see below). Inequality is determined according to reference inequality, - * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) - * via the `!==` Javascript operator, unless `objectEquality == true` - * (see next point) - * - When `objectEquality == true`, inequality of the `watchExpression` is determined - * according to the {@link angular.equals} function. To save the value of the object for - * later comparison, the {@link angular.copy} function is used. This therefore means that - * watching complex objects will have adverse memory and performance implications. - * - This should not be used to watch for changes in objects that are (or contain) - * [File](https://developer.mozilla.org/docs/Web/API/File) objects due to limitations with {@link angular.copy `angular.copy`}. - * - The watch `listener` may change the model, which may trigger other `listener`s to fire. - * This is achieved by rerunning the watchers until no changes are detected. The rerun - * iteration limit is 10 to prevent an infinite loop deadlock. - * - * - * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, - * you can register a `watchExpression` function with no `listener`. (Be prepared for - * multiple calls to your `watchExpression` because it will execute multiple times in a - * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.) - * - * After a watcher is registered with the scope, the `listener` fn is called asynchronously - * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the - * watcher. In rare cases, this is undesirable because the listener is called when the result - * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you - * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the - * listener was called due to initialization. - * - * - * - * @example - * ```js - // let's assume that scope was dependency injected as the $rootScope - var scope = $rootScope; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - - - - // Using a function as a watchExpression - var food; - scope.foodCounter = 0; - expect(scope.foodCounter).toEqual(0); - scope.$watch( - // This function returns the value being watched. It is called for each turn of the $digest loop - function() { return food; }, - // This is the change listener, called when the value returned from the above function changes - function(newValue, oldValue) { - if ( newValue !== oldValue ) { - // Only increment the counter if the value changed - scope.foodCounter = scope.foodCounter + 1; - } - } - ); - // No digest has been run so the counter will be zero - expect(scope.foodCounter).toEqual(0); - - // Run the digest but since food has not changed count will still be zero - scope.$digest(); - expect(scope.foodCounter).toEqual(0); - - // Update food and run digest. Now the counter will increment - food = 'cheeseburger'; - scope.$digest(); - expect(scope.foodCounter).toEqual(1); - - * ``` - * - * - * - * @param {(function()|string)} watchExpression Expression that is evaluated on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers - * a call to the `listener`. - * - * - `string`: Evaluated as {@link guide/expression expression} - * - `function(scope)`: called with current `scope` as a parameter. - * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value - * of `watchExpression` changes. - * - * - `newVal` contains the current value of the `watchExpression` - * - `oldVal` contains the previous value of the `watchExpression` - * - `scope` refers to the current scope - * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of - * comparing for reference equality. - * @returns {function()} Returns a deregistration function for this listener. - */ - $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) { - var get = $parse(watchExp); - var fn = isFunction(listener) ? listener : noop; - - if (get.$$watchDelegate) { - return get.$$watchDelegate(this, fn, objectEquality, get, watchExp); - } - var scope = this, - array = scope.$$watchers, - watcher = { - fn: fn, - last: initWatchVal, - get: get, - exp: prettyPrintExpression || watchExp, - eq: !!objectEquality - }; - - lastDirtyWatch = null; - - if (!array) { - array = scope.$$watchers = []; - array.$$digestWatchIndex = -1; - } - // we use unshift since we use a while loop in $digest for speed. - // the while loop reads in reverse order. - array.unshift(watcher); - array.$$digestWatchIndex++; - incrementWatchersCount(this, 1); - - return function deregisterWatch() { - var index = arrayRemove(array, watcher); - if (index >= 0) { - incrementWatchersCount(scope, -1); - if (index < array.$$digestWatchIndex) { - array.$$digestWatchIndex--; - } - } - lastDirtyWatch = null; - }; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchGroup - * @kind function - * - * @description - * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`. - * If any one expression in the collection changes the `listener` is executed. - * - * - The items in the `watchExpressions` array are observed via the standard `$watch` operation. Their return - * values are examined for changes on every call to `$digest`. - * - The `listener` is called whenever any expression in the `watchExpressions` array changes. - * - * @param {Array.} watchExpressions Array of expressions that will be individually - * watched using {@link ng.$rootScope.Scope#$watch $watch()} - * - * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any - * expression in `watchExpressions` changes - * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * The `scope` refers to the current scope. - * @returns {function()} Returns a de-registration function for all listeners. - */ - $watchGroup: function(watchExpressions, listener) { - var oldValues = new Array(watchExpressions.length); - var newValues = new Array(watchExpressions.length); - var deregisterFns = []; - var self = this; - var changeReactionScheduled = false; - var firstRun = true; - - if (!watchExpressions.length) { - // No expressions means we call the listener ASAP - var shouldCall = true; - self.$evalAsync(function() { - if (shouldCall) listener(newValues, newValues, self); - }); - return function deregisterWatchGroup() { - shouldCall = false; - }; - } - - if (watchExpressions.length === 1) { - // Special case size of one - return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) { - newValues[0] = value; - oldValues[0] = oldValue; - listener(newValues, (value === oldValue) ? newValues : oldValues, scope); - }); - } - - forEach(watchExpressions, function(expr, i) { - var unwatchFn = self.$watch(expr, function watchGroupSubAction(value) { - newValues[i] = value; - if (!changeReactionScheduled) { - changeReactionScheduled = true; - self.$evalAsync(watchGroupAction); - } - }); - deregisterFns.push(unwatchFn); - }); - - function watchGroupAction() { - changeReactionScheduled = false; - - try { - if (firstRun) { - firstRun = false; - listener(newValues, newValues, self); - } else { - listener(newValues, oldValues, self); - } - } finally { - for (var i = 0; i < watchExpressions.length; i++) { - oldValues[i] = newValues[i]; - } - } - } - - return function deregisterWatchGroup() { - while (deregisterFns.length) { - deregisterFns.shift()(); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchCollection - * @kind function - * - * @description - * Shallow watches the properties of an object and fires whenever any of the properties change - * (for arrays, this implies watching the array items; for object maps, this implies watching - * the properties). If a change is detected, the `listener` callback is fired. - * - * - The `obj` collection is observed via standard $watch operation and is examined on every - * call to $digest() to see if any items have been added, removed, or moved. - * - The `listener` is called whenever anything within the `obj` has changed. Examples include - * adding, removing, and moving items belonging to an object or array. - * - * - * @example - * ```js - $scope.names = ['igor', 'matias', 'misko', 'james']; - $scope.dataCount = 4; - - $scope.$watchCollection('names', function(newNames, oldNames) { - $scope.dataCount = newNames.length; - }); - - expect($scope.dataCount).toEqual(4); - $scope.$digest(); - - //still at 4 ... no changes - expect($scope.dataCount).toEqual(4); - - $scope.names.pop(); - $scope.$digest(); - - //now there's been a change - expect($scope.dataCount).toEqual(3); - * ``` - * - * - * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The - * expression value should evaluate to an object or an array which is observed on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the - * collection will trigger a call to the `listener`. - * - * @param {function(newCollection, oldCollection, scope)} listener a callback function called - * when a change is detected. - * - The `newCollection` object is the newly modified data obtained from the `obj` expression - * - The `oldCollection` object is a copy of the former collection data. - * Due to performance considerations, the`oldCollection` value is computed only if the - * `listener` function declares two or more arguments. - * - The `scope` argument refers to the current scope. - * - * @returns {function()} Returns a de-registration function for this listener. When the - * de-registration function is executed, the internal watch operation is terminated. - */ - $watchCollection: function(obj, listener) { - // Mark the interceptor as - // ... $$pure when literal since the instance will change when any input changes - $watchCollectionInterceptor.$$pure = $parse(obj).literal; - // ... $stateful when non-literal since we must read the state of the collection - $watchCollectionInterceptor.$stateful = !$watchCollectionInterceptor.$$pure; - - var self = this; - // the current value, updated on each dirty-check run - var newValue; - // a shallow copy of the newValue from the last dirty-check run, - // updated to match newValue during dirty-check run - var oldValue; - // a shallow copy of the newValue from when the last change happened - var veryOldValue; - // only track veryOldValue if the listener is asking for it - var trackVeryOldValue = (listener.length > 1); - var changeDetected = 0; - var changeDetector = $parse(obj, $watchCollectionInterceptor); - var internalArray = []; - var internalObject = {}; - var initRun = true; - var oldLength = 0; - - function $watchCollectionInterceptor(_value) { - newValue = _value; - var newLength, key, bothNaN, newItem, oldItem; - - // If the new value is undefined, then return undefined as the watch may be a one-time watch - if (isUndefined(newValue)) return; - - if (!isObject(newValue)) { // if primitive - if (oldValue !== newValue) { - oldValue = newValue; - changeDetected++; - } - } else if (isArrayLike(newValue)) { - if (oldValue !== internalArray) { - // we are transitioning from something which was not an array into array. - oldValue = internalArray; - oldLength = oldValue.length = 0; - changeDetected++; - } - - newLength = newValue.length; - - if (oldLength !== newLength) { - // if lengths do not match we need to trigger change notification - changeDetected++; - oldValue.length = oldLength = newLength; - } - // copy the items to oldValue and look for changes. - for (var i = 0; i < newLength; i++) { - oldItem = oldValue[i]; - newItem = newValue[i]; - - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[i] = newItem; - } - } - } else { - if (oldValue !== internalObject) { - // we are transitioning from something which was not an object into object. - oldValue = internalObject = {}; - oldLength = 0; - changeDetected++; - } - // copy the items to oldValue and look for changes. - newLength = 0; - for (key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - newLength++; - newItem = newValue[key]; - oldItem = oldValue[key]; - - if (key in oldValue) { - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[key] = newItem; - } - } else { - oldLength++; - oldValue[key] = newItem; - changeDetected++; - } - } - } - if (oldLength > newLength) { - // we used to have more keys, need to find them and destroy them. - changeDetected++; - for (key in oldValue) { - if (!hasOwnProperty.call(newValue, key)) { - oldLength--; - delete oldValue[key]; - } - } - } - } - return changeDetected; - } - - function $watchCollectionAction() { - if (initRun) { - initRun = false; - listener(newValue, newValue, self); - } else { - listener(newValue, veryOldValue, self); - } - - // make a copy for the next time a collection is changed - if (trackVeryOldValue) { - if (!isObject(newValue)) { - //primitive - veryOldValue = newValue; - } else if (isArrayLike(newValue)) { - veryOldValue = new Array(newValue.length); - for (var i = 0; i < newValue.length; i++) { - veryOldValue[i] = newValue[i]; - } - } else { // if object - veryOldValue = {}; - for (var key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - veryOldValue[key] = newValue[key]; - } - } - } - } - } - - return this.$watch(changeDetector, $watchCollectionAction); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$digest - * @kind function - * - * @description - * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and - * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change - * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} - * until no more listeners are firing. This means that it is possible to get into an infinite - * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of - * iterations exceeds 10. - * - * Usually, you don't call `$digest()` directly in - * {@link ng.directive:ngController controllers} or in - * {@link ng.$compileProvider#directive directives}. - * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within - * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`. - * - * If you want to be notified whenever `$digest()` is called, - * you can register a `watchExpression` function with - * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. - * - * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. - * - * @example - * ```js - var scope = ...; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - * ``` - * - */ - $digest: function() { - var watch, value, last, fn, get, - watchers, - dirty, ttl = TTL, - next, current, target = asyncQueue.length ? $rootScope : this, - watchLog = [], - logIdx, asyncTask; - - beginPhase('$digest'); - // Check for changes to browser url that happened in sync before the call to $digest - $browser.$$checkUrlChange(); - - if (this === $rootScope && applyAsyncId !== null) { - // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then - // cancel the scheduled $apply and flush the queue of expressions to be evaluated. - $browser.defer.cancel(applyAsyncId); - flushApplyAsync(); - } - - lastDirtyWatch = null; - - do { // "while dirty" loop - dirty = false; - current = target; - - // It's safe for asyncQueuePosition to be a local variable here because this loop can't - // be reentered recursively. Calling $digest from a function passed to $evalAsync would - // lead to a '$digest already in progress' error. - for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) { - try { - asyncTask = asyncQueue[asyncQueuePosition]; - fn = asyncTask.fn; - fn(asyncTask.scope, asyncTask.locals); - } catch (e) { - $exceptionHandler(e); - } - lastDirtyWatch = null; - } - asyncQueue.length = 0; - - traverseScopesLoop: - do { // "traverse the scopes" loop - if ((watchers = !current.$$suspended && current.$$watchers)) { - // process our watches - watchers.$$digestWatchIndex = watchers.length; - while (watchers.$$digestWatchIndex--) { - try { - watch = watchers[watchers.$$digestWatchIndex]; - // Most common watches are on primitives, in which case we can short - // circuit it with === operator, only when === fails do we use .equals - if (watch) { - get = watch.get; - if ((value = get(current)) !== (last = watch.last) && - !(watch.eq - ? equals(value, last) - : (isNumberNaN(value) && isNumberNaN(last)))) { - dirty = true; - lastDirtyWatch = watch; - watch.last = watch.eq ? copy(value, null) : value; - fn = watch.fn; - fn(value, ((last === initWatchVal) ? value : last), current); - if (ttl < 5) { - logIdx = 4 - ttl; - if (!watchLog[logIdx]) watchLog[logIdx] = []; - watchLog[logIdx].push({ - msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, - newVal: value, - oldVal: last - }); - } - } else if (watch === lastDirtyWatch) { - // If the most recently dirty watcher is now clean, short circuit since the remaining watchers - // have already been tested. - dirty = false; - break traverseScopesLoop; - } - } - } catch (e) { - $exceptionHandler(e); - } - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $broadcast - // (though it differs due to having the extra check for $$suspended and does not - // check $$listenerCount) - if (!(next = ((!current.$$suspended && current.$$watchersCount && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } while ((current = next)); - - // `break traverseScopesLoop;` takes us to here - - if ((dirty || asyncQueue.length) && !(ttl--)) { - clearPhase(); - throw $rootScopeMinErr('infdig', - '{0} $digest() iterations reached. Aborting!\n' + - 'Watchers fired in the last 5 iterations: {1}', - TTL, watchLog); - } - - } while (dirty || asyncQueue.length); - - clearPhase(); - - // postDigestQueuePosition isn't local here because this loop can be reentered recursively. - while (postDigestQueuePosition < postDigestQueue.length) { - try { - postDigestQueue[postDigestQueuePosition++](); - } catch (e) { - $exceptionHandler(e); - } - } - postDigestQueue.length = postDigestQueuePosition = 0; - - // Check for changes to browser url that happened during the $digest - // (for which no event is fired; e.g. via `history.pushState()`) - $browser.$$checkUrlChange(); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$suspend - * @kind function - * - * @description - * Suspend watchers of this scope subtree so that they will not be invoked during digest. - * - * This can be used to optimize your application when you know that running those watchers - * is redundant. - * - * **Warning** - * - * Suspending scopes from the digest cycle can have unwanted and difficult to debug results. - * Only use this approach if you are confident that you know what you are doing and have - * ample tests to ensure that bindings get updated as you expect. - * - * Some of the things to consider are: - * - * * Any external event on a directive/component will not trigger a digest while the hosting - * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`. - * * Transcluded content exists on a scope that inherits from outside a directive but exists - * as a child of the directive's containing scope. If the containing scope is suspended the - * transcluded scope will also be suspended, even if the scope from which the transcluded - * scope inherits is not suspended. - * * Multiple directives trying to manage the suspended status of a scope can confuse each other: - * * A call to `$suspend()` on an already suspended scope is a no-op. - * * A call to `$resume()` on a non-suspended scope is a no-op. - * * If two directives suspend a scope, then one of them resumes the scope, the scope will no - * longer be suspended. This could result in the other directive believing a scope to be - * suspended when it is not. - * * If a parent scope is suspended then all its descendants will be also excluded from future - * digests whether or not they have been suspended themselves. Note that this also applies to - * isolate child scopes. - * * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers - * for that scope and its descendants. When digesting we only check whether the current scope is - * locally suspended, rather than checking whether it has a suspended ancestor. - * * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be - * included in future digests until all its ancestors have been resumed. - * * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()` - * against the `$rootScope` and so will still trigger a global digest even if the promise was - * initiated by a component that lives on a suspended scope. - */ - $suspend: function() { - this.$$suspended = true; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$isSuspended - * @kind function - * - * @description - * Call this method to determine if this scope has been explicitly suspended. It will not - * tell you whether an ancestor has been suspended. - * To determine if this scope will be excluded from a digest triggered at the $rootScope, - * for example, you must check all its ancestors: - * - * ``` - * function isExcludedFromDigest(scope) { - * while(scope) { - * if (scope.$isSuspended()) return true; - * scope = scope.$parent; - * } - * return false; - * ``` - * - * Be aware that a scope may not be included in digests if it has a suspended ancestor, - * even if `$isSuspended()` returns false. - * - * @returns true if the current scope has been suspended. - */ - $isSuspended: function() { - return this.$$suspended; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$resume - * @kind function - * - * @description - * Resume watchers of this scope subtree in case it was suspended. - * - * See {@link $rootScope.Scope#$suspend} for information about the dangers of using this approach. - */ - $resume: function() { - this.$$suspended = false; - }, - - /** - * @ngdoc event - * @name $rootScope.Scope#$destroy - * @eventType broadcast on scope being destroyed - * - * @description - * Broadcasted when a scope and its children are being destroyed. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - - /** - * @ngdoc method - * @name $rootScope.Scope#$destroy - * @kind function - * - * @description - * Removes the current scope (and all of its children) from the parent scope. Removal implies - * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer - * propagate to the current scope and its children. Removal also implies that the current - * scope is eligible for garbage collection. - * - * The `$destroy()` is usually used by directives such as - * {@link ng.directive:ngRepeat ngRepeat} for managing the - * unrolling of the loop. - * - * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. - * Application code can register a `$destroy` event handler that will give it a chance to - * perform any necessary cleanup. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - $destroy: function() { - // We can't destroy a scope that has been already destroyed. - if (this.$$destroyed) return; - var parent = this.$parent; - - this.$broadcast('$destroy'); - this.$$destroyed = true; - - if (this === $rootScope) { - //Remove handlers attached to window when $rootScope is removed - $browser.$$applicationDestroyed(); - } - - incrementWatchersCount(this, -this.$$watchersCount); - for (var eventName in this.$$listenerCount) { - decrementListenerCount(this, this.$$listenerCount[eventName], eventName); - } - - // sever all the references to parent scopes (after this cleanup, the current scope should - // not be retained by any of our references and should be eligible for garbage collection) - if (parent && parent.$$childHead === this) parent.$$childHead = this.$$nextSibling; - if (parent && parent.$$childTail === this) parent.$$childTail = this.$$prevSibling; - if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; - if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; - - // Disable listeners, watchers and apply/digest methods - this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop; - this.$on = this.$watch = this.$watchGroup = function() { return noop; }; - this.$$listeners = {}; - - // Disconnect the next sibling to prevent `cleanUpScope` destroying those too - this.$$nextSibling = null; - cleanUpScope(this); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$eval - * @kind function - * - * @description - * Executes the `expression` on the current scope and returns the result. Any exceptions in - * the expression are propagated (uncaught). This is useful when evaluating AngularJS - * expressions. - * - * @example - * ```js - var scope = ng.$rootScope.Scope(); - scope.a = 1; - scope.b = 2; - - expect(scope.$eval('a+b')).toEqual(3); - expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); - * ``` - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - * @returns {*} The result of evaluating the expression. - */ - $eval: function(expr, locals) { - return $parse(expr)(this, locals); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$evalAsync - * @kind function - * - * @description - * Executes the expression on the current scope at a later point in time. - * - * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only - * that: - * - * - it will execute after the function that scheduled the evaluation (preferably before DOM - * rendering). - * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after - * `expression` execution. - * - * Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle - * will be scheduled. However, it is encouraged to always call code that changes the model - * from within an `$apply` call. That includes code evaluated via `$evalAsync`. - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - */ - $evalAsync: function(expr, locals) { - // if we are outside of an $digest loop and this is the first time we are scheduling async - // task also schedule async auto-flush - if (!$rootScope.$$phase && !asyncQueue.length) { - $browser.defer(function() { - if (asyncQueue.length) { - $rootScope.$digest(); - } - }, null, '$evalAsync'); - } - - asyncQueue.push({scope: this, fn: $parse(expr), locals: locals}); - }, - - $$postDigest: function(fn) { - postDigestQueue.push(fn); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$apply - * @kind function - * - * @description - * `$apply()` is used to execute an expression in AngularJS from outside of the AngularJS - * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). - * Because we are calling into the AngularJS framework we need to perform proper scope life - * cycle of {@link ng.$exceptionHandler exception handling}, - * {@link ng.$rootScope.Scope#$digest executing watches}. - * - * **Life cycle: Pseudo-Code of `$apply()`** - * - * ```js - function $apply(expr) { - try { - return $eval(expr); - } catch (e) { - $exceptionHandler(e); - } finally { - $root.$digest(); - } - } - * ``` - * - * - * Scope's `$apply()` method transitions through the following stages: - * - * 1. The {@link guide/expression expression} is executed using the - * {@link ng.$rootScope.Scope#$eval $eval()} method. - * 2. Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the - * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. - * - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - * - * @returns {*} The result of evaluating the expression. - */ - $apply: function(expr) { - try { - beginPhase('$apply'); - try { - return this.$eval(expr); - } finally { - clearPhase(); - } - } catch (e) { - $exceptionHandler(e); - } finally { - try { - $rootScope.$digest(); - } catch (e) { - $exceptionHandler(e); - // eslint-disable-next-line no-unsafe-finally - throw e; - } - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$applyAsync - * @kind function - * - * @description - * Schedule the invocation of $apply to occur at a later time. The actual time difference - * varies across browsers, but is typically around ~10 milliseconds. - * - * This can be used to queue up multiple expressions which need to be evaluated in the same - * digest. - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - */ - $applyAsync: function(expr) { - var scope = this; - if (expr) { - applyAsyncQueue.push($applyAsyncExpression); - } - expr = $parse(expr); - scheduleApplyAsync(); - - function $applyAsyncExpression() { - scope.$eval(expr); - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$on - * @kind function - * - * @description - * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for - * discussion of event life cycle. - * - * The event listener function format is: `function(event, args...)`. The `event` object - * passed into the listener has the following attributes: - * - * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or - * `$broadcast`-ed. - * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the - * event propagates through the scope hierarchy, this property is set to null. - * - `name` - `{string}`: name of the event. - * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel - * further event propagation (available only for events that were `$emit`-ed). - * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag - * to true. - * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. - * - * @param {string} name Event name to listen on. - * @param {function(event, ...args)} listener Function to call when the event is emitted. - * @returns {function()} Returns a deregistration function for this listener. - */ - $on: function(name, listener) { - var namedListeners = this.$$listeners[name]; - if (!namedListeners) { - this.$$listeners[name] = namedListeners = []; - } - namedListeners.push(listener); - - var current = this; - do { - if (!current.$$listenerCount[name]) { - current.$$listenerCount[name] = 0; - } - current.$$listenerCount[name]++; - } while ((current = current.$parent)); - - var self = this; - return function() { - var indexOfListener = namedListeners.indexOf(listener); - if (indexOfListener !== -1) { - // Use delete in the hope of the browser deallocating the memory for the array entry, - // while not shifting the array indexes of other listeners. - // See issue https://github.com/angular/angular.js/issues/16135 - delete namedListeners[indexOfListener]; - decrementListenerCount(self, 1, name); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$emit - * @kind function - * - * @description - * Dispatches an event `name` upwards through the scope hierarchy notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$emit` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event traverses upwards toward the root scope and calls all - * registered listeners along the way. The event will stop propagating if one of the listeners - * cancels it. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to emit. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). - */ - $emit: function(name, args) { - var empty = [], - namedListeners, - scope = this, - stopPropagation = false, - event = { - name: name, - targetScope: scope, - stopPropagation: function() {stopPropagation = true;}, - preventDefault: function() { - event.defaultPrevented = true; - }, - defaultPrevented: false - }, - listenerArgs = concat([event], arguments, 1), - i, length; - - do { - namedListeners = scope.$$listeners[name] || empty; - event.currentScope = scope; - for (i = 0, length = namedListeners.length; i < length; i++) { - - // if listeners were deregistered, defragment the array - if (!namedListeners[i]) { - namedListeners.splice(i, 1); - i--; - length--; - continue; - } - try { - //allow all listeners attached to the current scope to run - namedListeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - //if any listener on the current scope stops propagation, prevent bubbling - if (stopPropagation) { - break; - } - //traverse upwards - scope = scope.$parent; - } while (scope); - - event.currentScope = null; - - return event; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$broadcast - * @kind function - * - * @description - * Dispatches an event `name` downwards to all child scopes (and their children) notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$broadcast` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event propagates to all direct and indirect scopes of the current - * scope and calls all registered listeners along the way. The event cannot be canceled. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to broadcast. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} - */ - $broadcast: function(name, args) { - var target = this, - current = target, - next = target, - event = { - name: name, - targetScope: target, - preventDefault: function() { - event.defaultPrevented = true; - }, - defaultPrevented: false - }; - - if (!target.$$listenerCount[name]) return event; - - var listenerArgs = concat([event], arguments, 1), - listeners, i, length; - - //down while you can, then up and next sibling or up and next sibling until back at root - while ((current = next)) { - event.currentScope = current; - listeners = current.$$listeners[name] || []; - for (i = 0, length = listeners.length; i < length; i++) { - // if listeners were deregistered, defragment the array - if (!listeners[i]) { - listeners.splice(i, 1); - i--; - length--; - continue; - } - - try { - listeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $digest - // (though it differs due to having the extra check for $$listenerCount and - // does not check $$suspended) - if (!(next = ((current.$$listenerCount[name] && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } - - event.currentScope = null; - return event; - } - }; - - var $rootScope = new Scope(); - - //The internal queues. Expose them on the $rootScope for debugging/testing purposes. - var asyncQueue = $rootScope.$$asyncQueue = []; - var postDigestQueue = $rootScope.$$postDigestQueue = []; - var applyAsyncQueue = $rootScope.$$applyAsyncQueue = []; - - var postDigestQueuePosition = 0; - - return $rootScope; - - - function beginPhase(phase) { - if ($rootScope.$$phase) { - throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase); - } - - $rootScope.$$phase = phase; - } - - function clearPhase() { - $rootScope.$$phase = null; - } - - function incrementWatchersCount(current, count) { - do { - current.$$watchersCount += count; - } while ((current = current.$parent)); - } - - function decrementListenerCount(current, count, name) { - do { - current.$$listenerCount[name] -= count; - - if (current.$$listenerCount[name] === 0) { - delete current.$$listenerCount[name]; - } - } while ((current = current.$parent)); - } - - /** - * function used as an initial value for watchers. - * because it's unique we can easily tell it apart from other values - */ - function initWatchVal() {} - - function flushApplyAsync() { - while (applyAsyncQueue.length) { - try { - applyAsyncQueue.shift()(); - } catch (e) { - $exceptionHandler(e); - } - } - applyAsyncId = null; - } - - function scheduleApplyAsync() { - if (applyAsyncId === null) { - applyAsyncId = $browser.defer(function() { - $rootScope.$apply(flushApplyAsync); - }, null, '$applyAsync'); - } - } - }]; -} - -/** - * @ngdoc service - * @name $rootElement - * - * @description - * The root element of AngularJS application. This is either the element where {@link - * ng.directive:ngApp ngApp} was declared or the element passed into - * {@link angular.bootstrap}. The element represents the root element of application. It is also the - * location where the application's {@link auto.$injector $injector} service gets - * published, and can be retrieved using `$rootElement.injector()`. - */ - - -// the implementation is in angular.bootstrap - -/** - * @this - * @description - * Private service to sanitize uris for links and images. Used by $compile and $sanitize. - */ -function $$SanitizeUriProvider() { - - var aHrefSanitizationWhitelist = /^\s*(https?|s?ftp|mailto|tel|file):/, - imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/; - - /** - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML anchor links. - * - * Any url due to be assigned to an `a[href]` attribute via interpolation is marked as requiring - * the $sce.URL security context. When interpolation occurs a call is made to `$sce.trustAsUrl(url)` - * which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize the potentially malicious URL. - * - * If the URL matches the `aHrefSanitizationWhitelist` regular expression, it is returned unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - aHrefSanitizationWhitelist = regexp; - return this; - } - return aHrefSanitizationWhitelist; - }; - - - /** - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML image src links. - * - * Any URL due to be assigned to an `img[src]` attribute via interpolation is marked as requiring - * the $sce.MEDIA_URL security context. When interpolation occurs a call is made to - * `$sce.trustAsMediaUrl(url)` which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize - * the potentially malicious URL. - * - * If the URL matches the `aImgSanitizationWhitelist` regular expression, it is returned unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - imgSrcSanitizationWhitelist = regexp; - return this; - } - return imgSrcSanitizationWhitelist; - }; - - this.$get = function() { - return function sanitizeUri(uri, isMediaUrl) { - // if (!uri) return uri; - var regex = isMediaUrl ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist; - var normalizedVal = urlResolve(uri && uri.trim()).href; - if (normalizedVal !== '' && !normalizedVal.match(regex)) { - return 'unsafe:' + normalizedVal; - } - return uri; - }; - }; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* exported $SceProvider, $SceDelegateProvider */ - -var $sceMinErr = minErr('$sce'); - -var SCE_CONTEXTS = { - // HTML is used when there's HTML rendered (e.g. ng-bind-html, iframe srcdoc binding). - HTML: 'html', - - // Style statements or stylesheets. Currently unused in AngularJS. - CSS: 'css', - - // An URL used in a context where it refers to the source of media, which are not expected to be run - // as scripts, such as an image, audio, video, etc. - MEDIA_URL: 'mediaUrl', - - // An URL used in a context where it does not refer to a resource that loads code. - // A value that can be trusted as a URL can also trusted as a MEDIA_URL. - URL: 'url', - - // RESOURCE_URL is a subtype of URL used where the referred-to resource could be interpreted as - // code. (e.g. ng-include, script src binding, templateUrl) - // A value that can be trusted as a RESOURCE_URL, can also trusted as a URL and a MEDIA_URL. - RESOURCE_URL: 'resourceUrl', - - // Script. Currently unused in AngularJS. - JS: 'js' -}; - -// Helper functions follow. - -var UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g; - -function snakeToCamel(name) { - return name - .replace(UNDERSCORE_LOWERCASE_REGEXP, fnCamelCaseReplace); -} - -function adjustMatcher(matcher) { - if (matcher === 'self') { - return matcher; - } else if (isString(matcher)) { - // Strings match exactly except for 2 wildcards - '*' and '**'. - // '*' matches any character except those from the set ':/.?&'. - // '**' matches any character (like .* in a RegExp). - // More than 2 *'s raises an error as it's ill defined. - if (matcher.indexOf('***') > -1) { - throw $sceMinErr('iwcard', - 'Illegal sequence *** in string matcher. String: {0}', matcher); - } - matcher = escapeForRegexp(matcher). - replace(/\\\*\\\*/g, '.*'). - replace(/\\\*/g, '[^:/.?&;]*'); - return new RegExp('^' + matcher + '$'); - } else if (isRegExp(matcher)) { - // The only other type of matcher allowed is a Regexp. - // Match entire URL / disallow partial matches. - // Flags are reset (i.e. no global, ignoreCase or multiline) - return new RegExp('^' + matcher.source + '$'); - } else { - throw $sceMinErr('imatcher', - 'Matchers may only be "self", string patterns or RegExp objects'); - } -} - - -function adjustMatchers(matchers) { - var adjustedMatchers = []; - if (isDefined(matchers)) { - forEach(matchers, function(matcher) { - adjustedMatchers.push(adjustMatcher(matcher)); - }); - } - return adjustedMatchers; -} - - -/** - * @ngdoc service - * @name $sceDelegate - * @kind function - * - * @description - * - * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict - * Contextual Escaping (SCE)} services to AngularJS. - * - * For an overview of this service and the functionnality it provides in AngularJS, see the main - * page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how - * SCE works in their application, which shouldn't be needed in most cases. - * - *
- * AngularJS strongly relies on contextual escaping for the security of bindings: disabling or - * modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners, - * changes to this service will also influence users, so be extra careful and document your changes. - *
- * - * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of - * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is - * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to - * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things - * work because `$sce` delegates to `$sceDelegate` for these operations. - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service. - * - * The default instance of `$sceDelegate` should work out of the box with little pain. While you - * can override it completely to change the behavior of `$sce`, the common case would - * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting - * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as - * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist - * $sceDelegateProvider.resourceUrlWhitelist} and {@link - * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} - */ - -/** - * @ngdoc provider - * @name $sceDelegateProvider - * @this - * - * @description - * - * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate - * $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}. - * - * The `$sceDelegateProvider` allows one to get/set the whitelists and blacklists used to ensure - * that the URLs used for sourcing AngularJS templates and other script-running URLs are safe (all - * places that use the `$sce.RESOURCE_URL` context). See - * {@link ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} - * and - * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}, - * - * For the general details about this service in AngularJS, read the main page for {@link ng.$sce - * Strict Contextual Escaping (SCE)}. - * - * **Example**: Consider the following case.
- * - * - your app is hosted at url `http://myapp.example.com/` - * - but some of your templates are hosted on other domains you control such as - * `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc. - * - and you have an open redirect at `http://myapp.example.com/clickThru?...`. - * - * Here is what a secure configuration for this scenario might look like: - * - * ``` - * angular.module('myApp', []).config(function($sceDelegateProvider) { - * $sceDelegateProvider.resourceUrlWhitelist([ - * // Allow same origin resource loads. - * 'self', - * // Allow loading from our assets domain. Notice the difference between * and **. - * 'http://srv*.assets.example.com/**' - * ]); - * - * // The blacklist overrides the whitelist so the open redirect here is blocked. - * $sceDelegateProvider.resourceUrlBlacklist([ - * 'http://myapp.example.com/clickThru**' - * ]); - * }); - * ``` - * Note that an empty whitelist will block every resource URL from being loaded, and will require - * you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates - * requested by {@link ng.$templateRequest $templateRequest} that are present in - * {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism - * to populate your templates in that cache at config time, then it is a good idea to remove 'self' - * from that whitelist. This helps to mitigate the security impact of certain types of issues, like - * for instance attacker-controlled `ng-includes`. - */ - -function $SceDelegateProvider() { - this.SCE_CONTEXTS = SCE_CONTEXTS; - - // Resource URLs can also be trusted by policy. - var resourceUrlWhitelist = ['self'], - resourceUrlBlacklist = []; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlWhitelist - * @kind function - * - * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value - * provided. This must be an array or null. A snapshot of this array is used so further - * changes to the array are ignored. - * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array. - * - * @return {Array} The currently set whitelist array. - * - * @description - * Sets/Gets the whitelist of trusted resource URLs. - * - * The **default value** when no whitelist has been explicitly set is `['self']` allowing only - * same origin resource requests. - * - *
- * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin - * with other apps! It is a good idea to limit it to only your application's directory. - *
- */ - this.resourceUrlWhitelist = function(value) { - if (arguments.length) { - resourceUrlWhitelist = adjustMatchers(value); - } - return resourceUrlWhitelist; - }; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlBlacklist - * @kind function - * - * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value - * provided. This must be an array or null. A snapshot of this array is used so further - * changes to the array are ignored.

- * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array.

- * The typical usage for the blacklist is to **block - * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as - * these would otherwise be trusted but actually return content from the redirected domain. - *

- * Finally, **the blacklist overrides the whitelist** and has the final say. - * - * @return {Array} The currently set blacklist array. - * - * @description - * Sets/Gets the blacklist of trusted resource URLs. - * - * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there - * is no blacklist.) - */ - - this.resourceUrlBlacklist = function(value) { - if (arguments.length) { - resourceUrlBlacklist = adjustMatchers(value); - } - return resourceUrlBlacklist; - }; - - this.$get = ['$injector', '$$sanitizeUri', function($injector, $$sanitizeUri) { - - var htmlSanitizer = function htmlSanitizer(html) { - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - }; - - if ($injector.has('$sanitize')) { - htmlSanitizer = $injector.get('$sanitize'); - } - - - function matchUrl(matcher, parsedUrl) { - if (matcher === 'self') { - return urlIsSameOrigin(parsedUrl) || urlIsSameOriginAsBaseUrl(parsedUrl); - } else { - // definitely a regex. See adjustMatchers() - return !!matcher.exec(parsedUrl.href); - } - } - - function isResourceUrlAllowedByPolicy(url) { - var parsedUrl = urlResolve(url.toString()); - var i, n, allowed = false; - // Ensure that at least one item from the whitelist allows this url. - for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) { - if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) { - allowed = true; - break; - } - } - if (allowed) { - // Ensure that no item from the blacklist blocked this url. - for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) { - if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) { - allowed = false; - break; - } - } - } - return allowed; - } - - function generateHolderType(Base) { - var holderType = function TrustedValueHolderType(trustedValue) { - this.$$unwrapTrustedValue = function() { - return trustedValue; - }; - }; - if (Base) { - holderType.prototype = new Base(); - } - holderType.prototype.valueOf = function sceValueOf() { - return this.$$unwrapTrustedValue(); - }; - holderType.prototype.toString = function sceToString() { - return this.$$unwrapTrustedValue().toString(); - }; - return holderType; - } - - var trustedValueHolderBase = generateHolderType(), - byType = {}; - - byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.MEDIA_URL] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.URL] = generateHolderType(byType[SCE_CONTEXTS.MEDIA_URL]); - byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]); - - /** - * @ngdoc method - * @name $sceDelegate#trustAs - * - * @description - * Returns a trusted representation of the parameter for the specified context. This trusted - * object will later on be used as-is, without any security check, by bindings or directives - * that require this security context. - * For instance, marking a string as trusted for the `$sce.HTML` context will entirely bypass - * the potential `$sanitize` call in corresponding `$sce.HTML` bindings or directives, such as - * `ng-bind-html`. Note that in most cases you won't need to call this function: if you have the - * sanitizer loaded, passing the value itself will render all the HTML that does not pose a - * security risk. - * - * See {@link ng.$sceDelegate#getTrusted getTrusted} for the function that will consume those - * trusted values, and {@link ng.$sce $sce} for general documentation about strict contextual - * escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that should be considered trusted. - * @return {*} A trusted representation of value, that can be used in the given context. - */ - function trustAs(type, trustedValue) { - var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - if (!Constructor) { - throw $sceMinErr('icontext', - 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}', - type, trustedValue); - } - if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') { - return trustedValue; - } - // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting - // mutable objects, we ensure here that the value passed in is actually a string. - if (typeof trustedValue !== 'string') { - throw $sceMinErr('itype', - 'Attempted to trust a non-string value in a content requiring a string: Context: {0}', - type); - } - return new Constructor(trustedValue); - } - - /** - * @ngdoc method - * @name $sceDelegate#valueOf - * - * @description - * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. - * - * If the passed parameter is not a value that had been returned by {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, it must be returned as-is. - * - * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} - * call or anything else. - * @return {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns - * `value` unchanged. - */ - function valueOf(maybeTrusted) { - if (maybeTrusted instanceof trustedValueHolderBase) { - return maybeTrusted.$$unwrapTrustedValue(); - } else { - return maybeTrusted; - } - } - - /** - * @ngdoc method - * @name $sceDelegate#getTrusted - * - * @description - * Given an object and a security context in which to assign it, returns a value that's safe to - * use in this context, which was represented by the parameter. To do so, this function either - * unwraps the safe type it has been given (for instance, a {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} result), or it might try to sanitize the value given, depending on - * the context and sanitizer availablility. - * - * The contexts that can be sanitized are $sce.MEDIA_URL, $sce.URL and $sce.HTML. The first two are available - * by default, and the third one relies on the `$sanitize` service (which may be loaded through - * the `ngSanitize` module). Furthermore, for $sce.RESOURCE_URL context, a plain string may be - * accepted if the resource url policy defined by {@link ng.$sceDelegateProvider#resourceUrlWhitelist - * `$sceDelegateProvider.resourceUrlWhitelist`} and {@link ng.$sceDelegateProvider#resourceUrlBlacklist - * `$sceDelegateProvider.resourceUrlBlacklist`} accepts that resource. - * - * This function will throw if the safe type isn't appropriate for this context, or if the - * value given cannot be accepted in the context (which might be caused by sanitization not - * being available, or the value not being recognized as safe). - * - *

- * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting - * (XSS) vulnerability in your application. - *
- * - * @param {string} type The context in which this value is to be used (such as `$sce.HTML`). - * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - function getTrusted(type, maybeTrusted) { - if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') { - return maybeTrusted; - } - var constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - // If maybeTrusted is a trusted class instance or subclass instance, then unwrap and return - // as-is. - if (constructor && maybeTrusted instanceof constructor) { - return maybeTrusted.$$unwrapTrustedValue(); - } - - // If maybeTrusted is a trusted class instance but not of the correct trusted type - // then unwrap it and allow it to pass through to the rest of the checks - if (isFunction(maybeTrusted.$$unwrapTrustedValue)) { - maybeTrusted = maybeTrusted.$$unwrapTrustedValue(); - } - - // If we get here, then we will either sanitize the value or throw an exception. - if (type === SCE_CONTEXTS.MEDIA_URL || type === SCE_CONTEXTS.URL) { - // we attempt to sanitize non-resource URLs - return $$sanitizeUri(maybeTrusted.toString(), type === SCE_CONTEXTS.MEDIA_URL); - } else if (type === SCE_CONTEXTS.RESOURCE_URL) { - if (isResourceUrlAllowedByPolicy(maybeTrusted)) { - return maybeTrusted; - } else { - throw $sceMinErr('insecurl', - 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}', - maybeTrusted.toString()); - } - } else if (type === SCE_CONTEXTS.HTML) { - // htmlSanitizer throws its own error when no sanitizer is available. - return htmlSanitizer(maybeTrusted); - } - // Default error when the $sce service has no way to make the input safe. - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - } - - return { trustAs: trustAs, - getTrusted: getTrusted, - valueOf: valueOf }; - }]; -} - - -/** - * @ngdoc provider - * @name $sceProvider - * @this - * - * @description - * - * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. - * - enable/disable Strict Contextual Escaping (SCE) in a module - * - override the default implementation with a custom delegate - * - * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}. - */ - -/** - * @ngdoc service - * @name $sce - * @kind function - * - * @description - * - * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. - * - * ## Strict Contextual Escaping - * - * Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render - * trusted values. Its goal is to assist in writing code in a way that (a) is secure by default, and - * (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier. - * - * ### Overview - * - * To systematically block XSS security bugs, AngularJS treats all values as untrusted by default in - * HTML or sensitive URL bindings. When binding untrusted values, AngularJS will automatically - * run security checks on them (sanitizations, whitelists, depending on context), or throw when it - * cannot guarantee the security of the result. That behavior depends strongly on contexts: HTML - * can be sanitized, but template URLs cannot, for instance. - * - * To illustrate this, consider the `ng-bind-html` directive. It renders its value directly as HTML: - * we call that the *context*. When given an untrusted input, AngularJS will attempt to sanitize it - * before rendering if a sanitizer is available, and throw otherwise. To bypass sanitization and - * render the input as-is, you will need to mark it as trusted for that context before attempting - * to bind it. - * - * As of version 1.2, AngularJS ships with SCE enabled by default. - * - * ### In practice - * - * Here's an example of a binding in a privileged context: - * - * ``` - * - *
- * ``` - * - * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE - * disabled, this application allows the user to render arbitrary HTML into the DIV, which would - * be an XSS security bug. In a more realistic example, one may be rendering user comments, blog - * articles, etc. via bindings. (HTML is just one example of a context where rendering user - * controlled input creates security vulnerabilities.) - * - * For the case of HTML, you might use a library, either on the client side, or on the server side, - * to sanitize unsafe HTML before binding to the value and rendering it in the document. - * - * How would you ensure that every place that used these types of bindings was bound to a value that - * was sanitized by your library (or returned as safe for rendering by your server?) How can you - * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some - * properties/fields and forgot to update the binding to the sanitized value? - * - * To be secure by default, AngularJS makes sure bindings go through that sanitization, or - * any similar validation process, unless there's a good reason to trust the given value in this - * context. That trust is formalized with a function call. This means that as a developer, you - * can assume all untrusted bindings are safe. Then, to audit your code for binding security issues, - * you just need to ensure the values you mark as trusted indeed are safe - because they were - * received from your server, sanitized by your library, etc. You can organize your codebase to - * help with this - perhaps allowing only the files in a specific directory to do this. - * Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then - * becomes a more manageable task. - * - * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs} - * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to - * build the trusted versions of your values. - * - * ### How does it work? - * - * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted - * $sce.getTrusted(context, value)} rather than to the value directly. Think of this function as - * a way to enforce the required security context in your data sink. Directives use {@link - * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs - * the {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. Also, - * when binding without directives, AngularJS will understand the context of your bindings - * automatically. - * - * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link - * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly - * simplified): - * - * ``` - * var ngBindHtmlDirective = ['$sce', function($sce) { - * return function(scope, element, attr) { - * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) { - * element.html(value || ''); - * }); - * }; - * }]; - * ``` - * - * ### Impact on loading templates - * - * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as - * `templateUrl`'s specified by {@link guide/directive directives}. - * - * By default, AngularJS only loads templates from the same domain and protocol as the application - * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl - * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or - * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist - * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value. - * - * *Please note*: - * The browser's - * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) - * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) - * policy apply in addition to this and may further restrict whether the template is successfully - * loaded. This means that without the right CORS policy, loading templates from a different domain - * won't work on all browsers. Also, loading templates from `file://` URL does not work on some - * browsers. - * - * ### This feels like too much overhead - * - * It's important to remember that SCE only applies to interpolation expressions. - * - * If your expressions are constant literals, they're automatically trusted and you don't need to - * call `$sce.trustAs` on them (e.g. - * `
`) just works (remember to include the - * `ngSanitize` module). The `$sceDelegate` will also use the `$sanitize` service if it is available - * when binding untrusted values to `$sce.HTML` context. - * AngularJS provides an implementation in `angular-sanitize.js`, and if you - * wish to use it, you will also need to depend on the {@link ngSanitize `ngSanitize`} module in - * your application. - * - * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load - * templates in `ng-include` from your application's domain without having to even know about SCE. - * It blocks loading templates from other domains or loading templates over http from an https - * served document. You can change these by setting your own custom {@link - * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link - * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs. - * - * This significantly reduces the overhead. It is far easier to pay the small overhead and have an - * application that's secure and can be audited to verify that with much more ease than bolting - * security onto an application later. - * - * - * ### What trusted context types are supported? - * - * | Context | Notes | - * |---------------------|----------------| - * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. | - * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | - * | `$sce.MEDIA_URL` | For URLs that are safe to render as media. Is automatically converted from string by sanitizing when needed. | - * | `$sce.URL` | For URLs that are safe to follow as links. Is automatically converted from string by sanitizing when needed. Note that `$sce.URL` makes a stronger statement about the URL than `$sce.MEDIA_URL` does and therefore contexts requiring values trusted for `$sce.URL` can be used anywhere that values trusted for `$sce.MEDIA_URL` are required.| - * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)

Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` or `$sce.MEDIA_URL` do and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` or `$sce.MEDIA_URL` are required.

The {@link $sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider#resourceUrlWhitelist()} and {@link $sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider#resourceUrlBlacklist()} can be used to restrict trusted origins for `RESOURCE_URL` | - * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | - * - * - *
- * Be aware that, before AngularJS 1.7.0, `a[href]` and `img[src]` used to sanitize their - * interpolated values directly rather than rely upon {@link ng.$sce#getTrusted `$sce.getTrusted`}. - * - * **As of 1.7.0, this is no longer the case.** - * - * Now such interpolations are marked as requiring `$sce.URL` (for `a[href]`) or `$sce.MEDIA_URL` - * (for `img[src]`), so that the sanitization happens (via `$sce.getTrusted...`) when the `$interpolate` - * service evaluates the expressions. - *
- * - * There are no CSS or JS context bindings in AngularJS currently, so their corresponding `$sce.trustAs` - * functions aren't useful yet. This might evolve. - * - * ### Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} - * - * Each element in these arrays must be one of the following: - * - * - **'self'** - * - The special **string**, `'self'`, can be used to match against all URLs of the **same - * domain** as the application document using the **same protocol**. - * - **String** (except the special value `'self'`) - * - The string is matched against the full *normalized / absolute URL* of the resource - * being tested (substring matches are not good enough.) - * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters - * match themselves. - * - `*`: matches zero or more occurrences of any character other than one of the following 6 - * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use - * in a whitelist. - * - `**`: matches zero or more occurrences of *any* character. As such, it's not - * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g. - * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might - * not have been the intention.) Its usage at the very end of the path is ok. (e.g. - * http://foo.example.com/templates/**). - * - **RegExp** (*see caveat below*) - * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax - * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to - * accidentally introduce a bug when one updates a complex expression (imho, all regexes should - * have good test coverage). For instance, the use of `.` in the regex is correct only in a - * small number of cases. A `.` character in the regex used when matching the scheme or a - * subdomain could be matched against a `:` or literal `.` that was likely not intended. It - * is highly recommended to use the string patterns and only fall back to regular expressions - * as a last resort. - * - The regular expression must be an instance of RegExp (i.e. not a string.) It is - * matched against the **entire** *normalized / absolute URL* of the resource being tested - * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags - * present on the RegExp (such as multiline, global, ignoreCase) are ignored. - * - If you are generating your JavaScript from some other templating engine (not - * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), - * remember to escape your regular expression (and be aware that you might need more than - * one level of escaping depending on your templating engine and the way you interpolated - * the value.) Do make use of your platform's escaping mechanism as it might be good - * enough before coding your own. E.g. Ruby has - * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) - * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). - * Javascript lacks a similar built in function for escaping. Take a look at Google - * Closure library's [goog.string.regExpEscape(s)]( - * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962). - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example. - * - * ### Show me an example using SCE. - * - * - * - *
- *

- * User comments
- * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when - * $sanitize is available. If $sanitize isn't available, this results in an error instead of an - * exploit. - *
- *
- * {{userComment.name}}: - * - *
- *
- *
- *
- *
- * - * - * angular.module('mySceApp', ['ngSanitize']) - * .controller('AppController', ['$http', '$templateCache', '$sce', - * function AppController($http, $templateCache, $sce) { - * var self = this; - * $http.get('test_data.json', {cache: $templateCache}).then(function(response) { - * self.userComments = response.data; - * }); - * self.explicitlyTrustedHtml = $sce.trustAsHtml( - * 'Hover over this text.'); - * }]); - * - * - * - * [ - * { "name": "Alice", - * "htmlComment": - * "Is anyone reading this?" - * }, - * { "name": "Bob", - * "htmlComment": "Yes! Am I the only other one?" - * } - * ] - * - * - * - * describe('SCE doc demo', function() { - * it('should sanitize untrusted values', function() { - * expect(element.all(by.css('.htmlComment')).first().getAttribute('innerHTML')) - * .toBe('Is anyone reading this?'); - * }); - * - * it('should NOT sanitize explicitly trusted values', function() { - * expect(element(by.id('explicitlyTrustedHtml')).getAttribute('innerHTML')).toBe( - * 'Hover over this text.'); - * }); - * }); - * - *
- * - * - * - * ## Can I disable SCE completely? - * - * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits - * for little coding overhead. It will be much harder to take an SCE disabled application and - * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE - * for cases where you have a lot of existing code that was written before SCE was introduced and - * you're migrating them a module at a time. Also do note that this is an app-wide setting, so if - * you are writing a library, you will cause security bugs applications using it. - * - * That said, here's how you can completely disable SCE: - * - * ``` - * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) { - * // Completely disable SCE. For demonstration purposes only! - * // Do not use in new projects or libraries. - * $sceProvider.enabled(false); - * }); - * ``` - * - */ - -function $SceProvider() { - var enabled = true; - - /** - * @ngdoc method - * @name $sceProvider#enabled - * @kind function - * - * @param {boolean=} value If provided, then enables/disables SCE application-wide. - * @return {boolean} True if SCE is enabled, false otherwise. - * - * @description - * Enables/disables SCE and returns the current value. - */ - this.enabled = function(value) { - if (arguments.length) { - enabled = !!value; - } - return enabled; - }; - - - /* Design notes on the default implementation for SCE. - * - * The API contract for the SCE delegate - * ------------------------------------- - * The SCE delegate object must provide the following 3 methods: - * - * - trustAs(contextEnum, value) - * This method is used to tell the SCE service that the provided value is OK to use in the - * contexts specified by contextEnum. It must return an object that will be accepted by - * getTrusted() for a compatible contextEnum and return this value. - * - * - valueOf(value) - * For values that were not produced by trustAs(), return them as is. For values that were - * produced by trustAs(), return the corresponding input value to trustAs. Basically, if - * trustAs is wrapping the given values into some type, this operation unwraps it when given - * such a value. - * - * - getTrusted(contextEnum, value) - * This function should return the value that is safe to use in the context specified by - * contextEnum or throw and exception otherwise. - * - * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be - * opaque or wrapped in some holder object. That happens to be an implementation detail. For - * instance, an implementation could maintain a registry of all trusted objects by context. In - * such a case, trustAs() would return the same object that was passed in. getTrusted() would - * return the same object passed in if it was found in the registry under a compatible context or - * throw an exception otherwise. An implementation might only wrap values some of the time based - * on some criteria. getTrusted() might return a value and not throw an exception for special - * constants or objects even if not wrapped. All such implementations fulfill this contract. - * - * - * A note on the inheritance model for SCE contexts - * ------------------------------------------------ - * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This - * is purely an implementation details. - * - * The contract is simply this: - * - * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value) - * will also succeed. - * - * Inheritance happens to capture this in a natural way. In some future, we may not use - * inheritance anymore. That is OK because no code outside of sce.js and sceSpecs.js would need to - * be aware of this detail. - */ - - this.$get = ['$parse', '$sceDelegate', function( - $parse, $sceDelegate) { - // Support: IE 9-11 only - // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow - // the "expression(javascript expression)" syntax which is insecure. - if (enabled && msie < 8) { - throw $sceMinErr('iequirks', - 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + - 'mode. You can fix this by adding the text to the top of your HTML ' + - 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); - } - - var sce = shallowCopy(SCE_CONTEXTS); - - /** - * @ngdoc method - * @name $sce#isEnabled - * @kind function - * - * @return {Boolean} True if SCE is enabled, false otherwise. If you want to set the value, you - * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. - * - * @description - * Returns a boolean indicating if SCE is enabled. - */ - sce.isEnabled = function() { - return enabled; - }; - sce.trustAs = $sceDelegate.trustAs; - sce.getTrusted = $sceDelegate.getTrusted; - sce.valueOf = $sceDelegate.valueOf; - - if (!enabled) { - sce.trustAs = sce.getTrusted = function(type, value) { return value; }; - sce.valueOf = identity; - } - - /** - * @ngdoc method - * @name $sce#parseAs - * - * @description - * Converts AngularJS {@link guide/expression expression} into a function. This is like {@link - * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it - * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*, - * *result*)} - * - * @param {string} type The SCE context in which this result will be used. - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - sce.parseAs = function sceParseAs(type, expr) { - var parsed = $parse(expr); - if (parsed.literal && parsed.constant) { - return parsed; - } else { - return $parse(expr, function(value) { - return sce.getTrusted(type, value); - }); - } - }; - - /** - * @ngdoc method - * @name $sce#trustAs - * - * @description - * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, returns a - * wrapped object that represents your value, and the trust you have in its safety for the given - * context. AngularJS can then use that value as-is in bindings of the specified secure context. - * This is used in bindings for `ng-bind-html`, `ng-include`, and most `src` attribute - * interpolations. See {@link ng.$sce $sce} for strict contextual escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that that should be considered trusted. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in the context you specified. - */ - - /** - * @ngdoc method - * @name $sce#trustAsHtml - * - * @description - * Shorthand method. `$sce.trustAsHtml(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.HTML` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.HTML` context (like `ng-bind-html`). - */ - - /** - * @ngdoc method - * @name $sce#trustAsCss - * - * @description - * Shorthand method. `$sce.trustAsCss(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.CSS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.CSS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant - * of your `value` in `$sce.CSS` context. This context is currently unused, so there are - * almost no reasons to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsUrl - * - * @description - * Shorthand method. `$sce.trustAsUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.URL` context. That context is currently unused, so there are almost no reasons - * to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsResourceUrl - * - * @description - * Shorthand method. `$sce.trustAsResourceUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.RESOURCE_URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.RESOURCE_URL` context (template URLs in `ng-include`, most `src` attribute - * bindings, ...) - */ - - /** - * @ngdoc method - * @name $sce#trustAsJs - * - * @description - * Shorthand method. `$sce.trustAsJs(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.JS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.JS` context. That context is currently unused, so there are almost no reasons to - * use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#getTrusted - * - * @description - * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such, - * takes any input, and either returns a value that's safe to use in the specified context, - * or throws an exception. This function is aware of trusted values created by the `trustAs` - * function and its shorthands, and when contexts are appropriate, returns the unwrapped value - * as-is. Finally, this function can also throw when there is no way to turn `maybeTrusted` in a - * safe value (e.g., no sanitization is available or possible.) - * - * @param {string} type The context in which this value is to be used. - * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs - * `$sce.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - - /** - * @ngdoc method - * @name $sce#getTrustedHtml - * - * @description - * Shorthand method. `$sce.getTrustedHtml(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.HTML, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedCss - * - * @description - * Shorthand method. `$sce.getTrustedCss(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.CSS, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedUrl - * - * @description - * Shorthand method. `$sce.getTrustedUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedResourceUrl - * - * @description - * Shorthand method. `$sce.getTrustedResourceUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to pass to `$sceDelegate.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedJs - * - * @description - * Shorthand method. `$sce.getTrustedJs(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.JS, value)` - */ - - /** - * @ngdoc method - * @name $sce#parseAsHtml - * - * @description - * Shorthand method. `$sce.parseAsHtml(expression string)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsCss - * - * @description - * Shorthand method. `$sce.parseAsCss(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsUrl - * - * @description - * Shorthand method. `$sce.parseAsUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsResourceUrl - * - * @description - * Shorthand method. `$sce.parseAsResourceUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsJs - * - * @description - * Shorthand method. `$sce.parseAsJs(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - // Shorthand delegations. - var parse = sce.parseAs, - getTrusted = sce.getTrusted, - trustAs = sce.trustAs; - - forEach(SCE_CONTEXTS, function(enumValue, name) { - var lName = lowercase(name); - sce[snakeToCamel('parse_as_' + lName)] = function(expr) { - return parse(enumValue, expr); - }; - sce[snakeToCamel('get_trusted_' + lName)] = function(value) { - return getTrusted(enumValue, value); - }; - sce[snakeToCamel('trust_as_' + lName)] = function(value) { - return trustAs(enumValue, value); - }; - }); - - return sce; - }]; -} - -/* exported $SnifferProvider */ - -/** - * !!! This is an undocumented "private" service !!! - * - * @name $sniffer - * @requires $window - * @requires $document - * @this - * - * @property {boolean} history Does the browser support html5 history api ? - * @property {boolean} transitions Does the browser support CSS transition events ? - * @property {boolean} animations Does the browser support CSS animation events ? - * - * @description - * This is very simple implementation of testing browser's features. - */ -function $SnifferProvider() { - this.$get = ['$window', '$document', function($window, $document) { - var eventSupport = {}, - // Chrome Packaged Apps are not allowed to access `history.pushState`. - // If not sandboxed, they can be detected by the presence of `chrome.app.runtime` - // (see https://developer.chrome.com/apps/api_index). If sandboxed, they can be detected by - // the presence of an extension runtime ID and the absence of other Chrome runtime APIs - // (see https://developer.chrome.com/apps/manifest/sandbox). - // (NW.js apps have access to Chrome APIs, but do support `history`.) - isNw = $window.nw && $window.nw.process, - isChromePackagedApp = - !isNw && - $window.chrome && - ($window.chrome.app && $window.chrome.app.runtime || - !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id), - hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState, - android = - toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), - boxee = /Boxee/i.test(($window.navigator || {}).userAgent), - document = $document[0] || {}, - bodyStyle = document.body && document.body.style, - transitions = false, - animations = false; - - if (bodyStyle) { - // Support: Android <5, Blackberry Browser 10, default Chrome in Android 4.4.x - // Mentioned browsers need a -webkit- prefix for transitions & animations. - transitions = !!('transition' in bodyStyle || 'webkitTransition' in bodyStyle); - animations = !!('animation' in bodyStyle || 'webkitAnimation' in bodyStyle); - } - - - return { - // Android has history.pushState, but it does not update location correctly - // so let's not use the history API at all. - // http://code.google.com/p/android/issues/detail?id=17471 - // https://github.com/angular/angular.js/issues/904 - - // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has - // so let's not use the history API also - // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined - history: !!(hasHistoryPushState && !(android < 4) && !boxee), - hasEvent: function(event) { - // Support: IE 9-11 only - // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have - // it. In particular the event is not fired when backspace or delete key are pressed or - // when cut operation is performed. - // IE10+ implements 'input' event but it erroneously fires under various situations, - // e.g. when placeholder changes, or a form is focused. - if (event === 'input' && msie) return false; - - if (isUndefined(eventSupport[event])) { - var divElm = document.createElement('div'); - eventSupport[event] = 'on' + event in divElm; - } - - return eventSupport[event]; - }, - csp: csp(), - transitions: transitions, - animations: animations, - android: android - }; - }]; -} - -/** - * ! This is a private undocumented service ! - * - * @name $$taskTrackerFactory - * @description - * A function to create `TaskTracker` instances. - * - * A `TaskTracker` can keep track of pending tasks (grouped by type) and can notify interested - * parties when all pending tasks (or tasks of a specific type) have been completed. - * - * @param {$log} log - A logger instance (such as `$log`). Used to log error during callback - * execution. - * - * @this - */ -function $$TaskTrackerFactoryProvider() { - this.$get = valueFn(function(log) { return new TaskTracker(log); }); -} - -function TaskTracker(log) { - var self = this; - var taskCounts = {}; - var taskCallbacks = []; - - var ALL_TASKS_TYPE = self.ALL_TASKS_TYPE = '$$all$$'; - var DEFAULT_TASK_TYPE = self.DEFAULT_TASK_TYPE = '$$default$$'; - - /** - * Execute the specified function and decrement the appropriate `taskCounts` counter. - * If the counter reaches 0, all corresponding `taskCallbacks` are executed. - * - * @param {Function} fn - The function to execute. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task that is being completed. - */ - self.completeTask = completeTask; - - /** - * Increase the task count for the specified task type (or the default task type if non is - * specified). - * - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task whose count will be increased. - */ - self.incTaskCount = incTaskCount; - - /** - * Execute the specified callback when all pending tasks have been completed. - * - * If there are no pending tasks, the callback is executed immediately. You can optionally limit - * the tasks that will be waited for to a specific type, by passing a `taskType`. - * - * @param {function} callback - The function to call when there are no pending tasks. - * @param {string=} [taskType=ALL_TASKS_TYPE] - The type of tasks that will be waited for. - */ - self.notifyWhenNoPendingTasks = notifyWhenNoPendingTasks; - - function completeTask(fn, taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - - try { - fn(); - } finally { - decTaskCount(taskType); - - var countForType = taskCounts[taskType]; - var countForAll = taskCounts[ALL_TASKS_TYPE]; - - // If at least one of the queues (`ALL_TASKS_TYPE` or `taskType`) is empty, run callbacks. - if (!countForAll || !countForType) { - var getNextCallback = !countForAll ? getLastCallback : getLastCallbackForType; - var nextCb; - - while ((nextCb = getNextCallback(taskType))) { - try { - nextCb(); - } catch (e) { - log.error(e); - } - } - } - } - } - - function decTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - if (taskCounts[taskType]) { - taskCounts[taskType]--; - taskCounts[ALL_TASKS_TYPE]--; - } - } - - function getLastCallback() { - var cbInfo = taskCallbacks.pop(); - return cbInfo && cbInfo.cb; - } - - function getLastCallbackForType(taskType) { - for (var i = taskCallbacks.length - 1; i >= 0; --i) { - var cbInfo = taskCallbacks[i]; - if (cbInfo.type === taskType) { - taskCallbacks.splice(i, 1); - return cbInfo.cb; - } - } - } - - function incTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - taskCounts[taskType] = (taskCounts[taskType] || 0) + 1; - taskCounts[ALL_TASKS_TYPE] = (taskCounts[ALL_TASKS_TYPE] || 0) + 1; - } - - function notifyWhenNoPendingTasks(callback, taskType) { - taskType = taskType || ALL_TASKS_TYPE; - if (!taskCounts[taskType]) { - callback(); - } else { - taskCallbacks.push({type: taskType, cb: callback}); - } - } -} - -var $templateRequestMinErr = minErr('$templateRequest'); - -/** - * @ngdoc provider - * @name $templateRequestProvider - * @this - * - * @description - * Used to configure the options passed to the {@link $http} service when making a template request. - * - * For example, it can be used for specifying the "Accept" header that is sent to the server, when - * requesting a template. - */ -function $TemplateRequestProvider() { - - var httpOptions; - - /** - * @ngdoc method - * @name $templateRequestProvider#httpOptions - * @description - * The options to be passed to the {@link $http} service when making the request. - * You can use this to override options such as the "Accept" header for template requests. - * - * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the - * options if not overridden here. - * - * @param {string=} value new value for the {@link $http} options. - * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter. - */ - this.httpOptions = function(val) { - if (val) { - httpOptions = val; - return this; - } - return httpOptions; - }; - - /** - * @ngdoc service - * @name $templateRequest - * - * @description - * The `$templateRequest` service runs security checks then downloads the provided template using - * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request - * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the - * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the - * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted - * when `tpl` is of type string and `$templateCache` has the matching entry. - * - * If you want to pass custom options to the `$http` service, such as setting the Accept header you - * can configure this via {@link $templateRequestProvider#httpOptions}. - * - * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such - * as {@link ngInclude} to download and cache templates. - * - * 3rd party modules should use `$templateRequest` if their services or directives are loading - * templates. - * - * @param {string|TrustedResourceUrl} tpl The HTTP request template URL - * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty - * - * @return {Promise} a promise for the HTTP response data of the given URL. - * - * @property {number} totalPendingRequests total amount of pending template requests being downloaded. - */ - this.$get = ['$exceptionHandler', '$templateCache', '$http', '$q', '$sce', - function($exceptionHandler, $templateCache, $http, $q, $sce) { - - function handleRequestFn(tpl, ignoreRequestError) { - handleRequestFn.totalPendingRequests++; - - // We consider the template cache holds only trusted templates, so - // there's no need to go through whitelisting again for keys that already - // are included in there. This also makes AngularJS accept any script - // directive, no matter its name. However, we still need to unwrap trusted - // types. - if (!isString(tpl) || isUndefined($templateCache.get(tpl))) { - tpl = $sce.getTrustedResourceUrl(tpl); - } - - var transformResponse = $http.defaults && $http.defaults.transformResponse; - - if (isArray(transformResponse)) { - transformResponse = transformResponse.filter(function(transformer) { - return transformer !== defaultHttpResponseTransform; - }); - } else if (transformResponse === defaultHttpResponseTransform) { - transformResponse = null; - } - - return $http.get(tpl, extend({ - cache: $templateCache, - transformResponse: transformResponse - }, httpOptions)) - .finally(function() { - handleRequestFn.totalPendingRequests--; - }) - .then(function(response) { - return $templateCache.put(tpl, response.data); - }, handleError); - - function handleError(resp) { - if (!ignoreRequestError) { - resp = $templateRequestMinErr('tpload', - 'Failed to load template: {0} (HTTP status: {1} {2})', - tpl, resp.status, resp.statusText); - - $exceptionHandler(resp); - } - - return $q.reject(resp); - } - } - - handleRequestFn.totalPendingRequests = 0; - - return handleRequestFn; - } - ]; -} - -/** @this */ -function $$TestabilityProvider() { - this.$get = ['$rootScope', '$browser', '$location', - function($rootScope, $browser, $location) { - - /** - * @name $testability - * - * @description - * The private $$testability service provides a collection of methods for use when debugging - * or by automated test and debugging tools. - */ - var testability = {}; - - /** - * @name $$testability#findBindings - * - * @description - * Returns an array of elements that are bound (via ng-bind or {{}}) - * to expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The binding expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. Filters and whitespace are ignored. - */ - testability.findBindings = function(element, expression, opt_exactMatch) { - var bindings = element.getElementsByClassName('ng-binding'); - var matches = []; - forEach(bindings, function(binding) { - var dataBinding = angular.element(binding).data('$binding'); - if (dataBinding) { - forEach(dataBinding, function(bindingName) { - if (opt_exactMatch) { - var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); - if (matcher.test(bindingName)) { - matches.push(binding); - } - } else { - if (bindingName.indexOf(expression) !== -1) { - matches.push(binding); - } - } - }); - } - }); - return matches; - }; - - /** - * @name $$testability#findModels - * - * @description - * Returns an array of elements that are two-way found via ng-model to - * expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The model expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. - */ - testability.findModels = function(element, expression, opt_exactMatch) { - var prefixes = ['ng-', 'data-ng-', 'ng\\:']; - for (var p = 0; p < prefixes.length; ++p) { - var attributeEquals = opt_exactMatch ? '=' : '*='; - var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]'; - var elements = element.querySelectorAll(selector); - if (elements.length) { - return elements; - } - } - }; - - /** - * @name $$testability#getLocation - * - * @description - * Shortcut for getting the location in a browser agnostic way. Returns - * the path, search, and hash. (e.g. /path?a=b#hash) - */ - testability.getLocation = function() { - return $location.url(); - }; - - /** - * @name $$testability#setLocation - * - * @description - * Shortcut for navigating to a location without doing a full page reload. - * - * @param {string} url The location url (path, search and hash, - * e.g. /path?a=b#hash) to go to. - */ - testability.setLocation = function(url) { - if (url !== $location.url()) { - $location.url(url); - $rootScope.$digest(); - } - }; - - /** - * @name $$testability#whenStable - * - * @description - * Calls the callback when all pending tasks are completed. - * - * Types of tasks waited for include: - * - Pending timeouts (via {@link $timeout}). - * - Pending HTTP requests (via {@link $http}). - * - In-progress route transitions (via {@link $route}). - * - Pending tasks scheduled via {@link $rootScope#$applyAsync}. - * - Pending tasks scheduled via {@link $rootScope#$evalAsync}. - * These include tasks scheduled via `$evalAsync()` indirectly (such as {@link $q} promises). - * - * @param {function} callback - */ - testability.whenStable = function(callback) { - $browser.notifyWhenNoOutstandingRequests(callback); - }; - - return testability; - }]; -} - -var $timeoutMinErr = minErr('$timeout'); - -/** @this */ -function $TimeoutProvider() { - this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler', - function($rootScope, $browser, $q, $$q, $exceptionHandler) { - - var deferreds = {}; - - - /** - * @ngdoc service - * @name $timeout - * - * @description - * AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch - * block and delegates any exceptions to - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * The return value of calling `$timeout` is a promise, which will be resolved when - * the delay has passed and the timeout function, if provided, is executed. - * - * To cancel a timeout request, call `$timeout.cancel(promise)`. - * - * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to - * synchronously flush the queue of deferred functions. - * - * If you only want a promise that will be resolved after some specified delay - * then you can call `$timeout` without the `fn` function. - * - * @param {function()=} fn A function, whose execution should be delayed. - * @param {number=} [delay=0] Delay in milliseconds. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise - * will be resolved with the return value of the `fn` function. - * - */ - function timeout(fn, delay, invokeApply) { - if (!isFunction(fn)) { - invokeApply = delay; - delay = fn; - fn = noop; - } - - var args = sliceArgs(arguments, 3), - skipApply = (isDefined(invokeApply) && !invokeApply), - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise, - timeoutId; - - timeoutId = $browser.defer(function() { - try { - deferred.resolve(fn.apply(null, args)); - } catch (e) { - deferred.reject(e); - $exceptionHandler(e); - } finally { - delete deferreds[promise.$$timeoutId]; - } - - if (!skipApply) $rootScope.$apply(); - }, delay, '$timeout'); - - promise.$$timeoutId = timeoutId; - deferreds[timeoutId] = deferred; - - return promise; - } - - - /** - * @ngdoc method - * @name $timeout#cancel - * - * @description - * Cancels a task associated with the `promise`. As a result of this, the promise will be - * resolved with a rejection. - * - * @param {Promise=} promise Promise returned by the `$timeout` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - timeout.cancel = function(promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$timeoutId')) { - throw $timeoutMinErr('badprom', - '`$timeout.cancel()` called with a promise that was not generated by `$timeout()`.'); - } - - if (!deferreds.hasOwnProperty(promise.$$timeoutId)) return false; - - var id = promise.$$timeoutId; - var deferred = deferreds[id]; - - // Timeout cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - delete deferreds[id]; - - return $browser.defer.cancel(id); - }; - - return timeout; - }]; -} - -// NOTE: The usage of window and document instead of $window and $document here is -// deliberate. This service depends on the specific behavior of anchor nodes created by the -// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and -// cause us to break tests. In addition, when the browser resolves a URL for XHR, it -// doesn't know about mocked locations and resolves URLs to the real document - which is -// exactly the behavior needed here. There is little value is mocking these out for this -// service. -var urlParsingNode = window.document.createElement('a'); -var originUrl = urlResolve(window.location.href); -var baseUrlParsingNode; - -urlParsingNode.href = 'http://[::1]'; - -// Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview) -// IE/Edge don't wrap IPv6 addresses' hostnames in square brackets -// when parsed out of an anchor element. -var ipv6InBrackets = urlParsingNode.hostname === '[::1]'; - -/** - * - * Implementation Notes for non-IE browsers - * ---------------------------------------- - * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, - * results both in the normalizing and parsing of the URL. Normalizing means that a relative - * URL will be resolved into an absolute URL in the context of the application document. - * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related - * properties are all populated to reflect the normalized URL. This approach has wide - * compatibility - Safari 1+, Mozilla 1+ etc. See - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * - * Implementation Notes for IE - * --------------------------- - * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other - * browsers. However, the parsed components will not be set if the URL assigned did not specify - * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We - * work around that by performing the parsing in a 2nd step by taking a previously normalized - * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the - * properties such as protocol, hostname, port, etc. - * - * References: - * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * http://url.spec.whatwg.org/#urlutils - * https://github.com/angular/angular.js/pull/2902 - * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ - * - * @kind function - * @param {string|object} url The URL to be parsed. If `url` is not a string, it will be returned - * unchanged. - * @description Normalizes and parses a URL. - * @returns {object} Returns the normalized URL as a dictionary. - * - * | member name | Description | - * |---------------|------------------------------------------------------------------------| - * | href | A normalized version of the provided URL if it was not an absolute URL | - * | protocol | The protocol without the trailing colon | - * | host | The host and port (if the port is non-default) of the normalizedUrl | - * | search | The search params, minus the question mark | - * | hash | The hash string, minus the hash symbol | - * | hostname | The hostname | - * | port | The port, without ":" | - * | pathname | The pathname, beginning with "/" | - * - */ -function urlResolve(url) { - if (!isString(url)) return url; - - var href = url; - - // Support: IE 9-11 only - if (msie) { - // Normalize before parse. Refer Implementation Notes on why this is - // done in two steps on IE. - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } - - urlParsingNode.setAttribute('href', href); - - var hostname = urlParsingNode.hostname; - - if (!ipv6InBrackets && hostname.indexOf(':') > -1) { - hostname = '[' + hostname + ']'; - } - - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') - ? urlParsingNode.pathname - : '/' + urlParsingNode.pathname - }; -} - -/** - * Parse a request URL and determine whether this is a same-origin request as the application - * document. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the request is for the same origin as the application document. - */ -function urlIsSameOrigin(requestUrl) { - return urlsAreSameOrigin(requestUrl, originUrl); -} - -/** - * Parse a request URL and determine whether it is same-origin as the current document base URL. - * - * Note: The base URL is usually the same as the document location (`location.href`) but can - * be overriden by using the `` tag. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the URL is same-origin as the document base URL. - */ -function urlIsSameOriginAsBaseUrl(requestUrl) { - return urlsAreSameOrigin(requestUrl, getBaseUrl()); -} - -/** - * Create a function that can check a URL's origin against a list of allowed/whitelisted origins. - * The current location's origin is implicitly trusted. - * - * @param {string[]} whitelistedOriginUrls - A list of URLs (strings), whose origins are trusted. - * - * @returns {Function} - A function that receives a URL (string or parsed URL object) and returns - * whether it is of an allowed origin. - */ -function urlIsAllowedOriginFactory(whitelistedOriginUrls) { - var parsedAllowedOriginUrls = [originUrl].concat(whitelistedOriginUrls.map(urlResolve)); - - /** - * Check whether the specified URL (string or parsed URL object) has an origin that is allowed - * based on a list of whitelisted-origin URLs. The current location's origin is implicitly - * trusted. - * - * @param {string|Object} requestUrl - The URL to be checked (provided as a string that will be - * resolved or a parsed URL object). - * - * @returns {boolean} - Whether the specified URL is of an allowed origin. - */ - return function urlIsAllowedOrigin(requestUrl) { - var parsedUrl = urlResolve(requestUrl); - return parsedAllowedOriginUrls.some(urlsAreSameOrigin.bind(null, parsedUrl)); - }; -} - -/** - * Determine if two URLs share the same origin. - * - * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of - * a dictionary object returned by `urlResolve()`. - * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form - * of a dictionary object returned by `urlResolve()`. - * - * @returns {boolean} - True if both URLs have the same origin, and false otherwise. - */ -function urlsAreSameOrigin(url1, url2) { - url1 = urlResolve(url1); - url2 = urlResolve(url2); - - return (url1.protocol === url2.protocol && - url1.host === url2.host); -} - -/** - * Returns the current document base URL. - * @returns {string} - */ -function getBaseUrl() { - if (window.document.baseURI) { - return window.document.baseURI; - } - - // `document.baseURI` is available everywhere except IE - if (!baseUrlParsingNode) { - baseUrlParsingNode = window.document.createElement('a'); - baseUrlParsingNode.href = '.'; - - // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not - // suitable here because we need to track changes to the base URL. - baseUrlParsingNode = baseUrlParsingNode.cloneNode(false); - } - return baseUrlParsingNode.href; -} - -/** - * @ngdoc service - * @name $window - * @this - * - * @description - * A reference to the browser's `window` object. While `window` - * is globally available in JavaScript, it causes testability problems, because - * it is a global variable. In AngularJS we always refer to it through the - * `$window` service, so it may be overridden, removed or mocked for testing. - * - * Expressions, like the one defined for the `ngClick` directive in the example - * below, are evaluated with respect to the current scope. Therefore, there is - * no risk of inadvertently coding in a dependency on a global value in such an - * expression. - * - * @example - - - -
- - -
-
- - it('should display the greeting in the input box', function() { - element(by.model('greeting')).sendKeys('Hello, E2E Tests'); - // If we click the button it will block the test runner - // element(':button').click(); - }); - -
- */ -function $WindowProvider() { - this.$get = valueFn(window); -} - -/** - * @name $$cookieReader - * @requires $document - * - * @description - * This is a private service for reading cookies used by $http and ngCookies - * - * @return {Object} a key/value map of the current cookies - */ -function $$CookieReader($document) { - var rawDocument = $document[0] || {}; - var lastCookies = {}; - var lastCookieString = ''; - - function safeGetCookie(rawDocument) { - try { - return rawDocument.cookie || ''; - } catch (e) { - return ''; - } - } - - function safeDecodeURIComponent(str) { - try { - return decodeURIComponent(str); - } catch (e) { - return str; - } - } - - return function() { - var cookieArray, cookie, i, index, name; - var currentCookieString = safeGetCookie(rawDocument); - - if (currentCookieString !== lastCookieString) { - lastCookieString = currentCookieString; - cookieArray = lastCookieString.split('; '); - lastCookies = {}; - - for (i = 0; i < cookieArray.length; i++) { - cookie = cookieArray[i]; - index = cookie.indexOf('='); - if (index > 0) { //ignore nameless cookies - name = safeDecodeURIComponent(cookie.substring(0, index)); - // the first value that is seen for a cookie is the most - // specific one. values for the same cookie name that - // follow are for less specific paths. - if (isUndefined(lastCookies[name])) { - lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1)); - } - } - } - } - return lastCookies; - }; -} - -$$CookieReader.$inject = ['$document']; - -/** @this */ -function $$CookieReaderProvider() { - this.$get = $$CookieReader; -} - -/* global currencyFilter: true, - dateFilter: true, - filterFilter: true, - jsonFilter: true, - limitToFilter: true, - lowercaseFilter: true, - numberFilter: true, - orderByFilter: true, - uppercaseFilter: true, - */ - -/** - * @ngdoc provider - * @name $filterProvider - * @description - * - * Filters are just functions which transform input to an output. However filters need to be - * Dependency Injected. To achieve this a filter definition consists of a factory function which is - * annotated with dependencies and is responsible for creating a filter function. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- * - * ```js - * // Filter registration - * function MyModule($provide, $filterProvider) { - * // create a service to demonstrate injection (not always needed) - * $provide.value('greet', function(name){ - * return 'Hello ' + name + '!'; - * }); - * - * // register a filter factory which uses the - * // greet service to demonstrate DI. - * $filterProvider.register('greet', function(greet){ - * // return the filter function which uses the greet service - * // to generate salutation - * return function(text) { - * // filters need to be forgiving so check input validity - * return text && greet(text) || text; - * }; - * }); - * } - * ``` - * - * The filter function is registered with the `$injector` under the filter name suffix with - * `Filter`. - * - * ```js - * it('should be the same instance', inject( - * function($filterProvider) { - * $filterProvider.register('reverse', function(){ - * return ...; - * }); - * }, - * function($filter, reverseFilter) { - * expect($filter('reverse')).toBe(reverseFilter); - * }); - * ``` - * - * - * For more information about how AngularJS filters work, and how to create your own filters, see - * {@link guide/filter Filters} in the AngularJS Developer Guide. - */ - -/** - * @ngdoc service - * @name $filter - * @kind function - * @description - * Filters are used for formatting data displayed to the user. - * - * They can be used in view templates, controllers or services. AngularJS comes - * with a collection of [built-in filters](api/ng/filter), but it is easy to - * define your own as well. - * - * The general syntax in templates is as follows: - * - * ```html - * {{ expression [| filter_name[:parameter_value] ... ] }} - * ``` - * - * @param {String} name Name of the filter function to retrieve - * @return {Function} the filter function - * @example - - -
-

{{ originalText }}

-

{{ filteredText }}

-
-
- - - angular.module('filterExample', []) - .controller('MainCtrl', function($scope, $filter) { - $scope.originalText = 'hello'; - $scope.filteredText = $filter('uppercase')($scope.originalText); - }); - -
- */ -$FilterProvider.$inject = ['$provide']; -/** @this */ -function $FilterProvider($provide) { - var suffix = 'Filter'; - - /** - * @ngdoc method - * @name $filterProvider#register - * @param {string|Object} name Name of the filter function, or an object map of filters where - * the keys are the filter names and the values are the filter factories. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered. - * @returns {Object} Registered filter instance, or if a map of filters was provided then a map - * of the registered filter instances. - */ - function register(name, factory) { - if (isObject(name)) { - var filters = {}; - forEach(name, function(filter, key) { - filters[key] = register(key, filter); - }); - return filters; - } else { - return $provide.factory(name + suffix, factory); - } - } - this.register = register; - - this.$get = ['$injector', function($injector) { - return function(name) { - return $injector.get(name + suffix); - }; - }]; - - //////////////////////////////////////// - - /* global - currencyFilter: false, - dateFilter: false, - filterFilter: false, - jsonFilter: false, - limitToFilter: false, - lowercaseFilter: false, - numberFilter: false, - orderByFilter: false, - uppercaseFilter: false - */ - - register('currency', currencyFilter); - register('date', dateFilter); - register('filter', filterFilter); - register('json', jsonFilter); - register('limitTo', limitToFilter); - register('lowercase', lowercaseFilter); - register('number', numberFilter); - register('orderBy', orderByFilter); - register('uppercase', uppercaseFilter); -} - -/** - * @ngdoc filter - * @name filter - * @kind function - * - * @description - * Selects a subset of items from `array` and returns it as a new array. - * - * @param {Array} array The source array. - *
- * **Note**: If the array contains objects that reference themselves, filtering is not possible. - *
- * @param {string|Object|function()} expression The predicate to be used for selecting items from - * `array`. - * - * Can be one of: - * - * - `string`: The string is used for matching against the contents of the `array`. All strings or - * objects with string properties in `array` that match this string will be returned. This also - * applies to nested object properties. - * The predicate can be negated by prefixing the string with `!`. - * - * - `Object`: A pattern object can be used to filter specific properties on objects contained - * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items - * which have property `name` containing "M" and property `phone` containing "1". A special - * property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match - * against any property of the object or its nested object properties. That's equivalent to the - * simple substring match with a `string` as described above. The special property name can be - * overwritten, using the `anyPropertyKey` parameter. - * The predicate can be negated by prefixing the string with `!`. - * For example `{name: "!M"}` predicate will return an array of items which have property `name` - * not containing "M". - * - * Note that a named property will match properties on the same level only, while the special - * `$` property will match properties on the same level or deeper. E.g. an array item like - * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but - * **will** be matched by `{$: 'John'}`. - * - * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters. - * The function is called for each element of the array, with the element, its index, and - * the entire array itself as arguments. - * - * The final result is an array of those elements that the predicate returned true for. - * - * @param {function(actual, expected)|true|false} [comparator] Comparator which is used in - * determining if values retrieved using `expression` (when it is not a function) should be - * considered a match based on the expected value (from the filter expression) and actual - * value (from the object in the array). - * - * Can be one of: - * - * - `function(actual, expected)`: - * The function will be given the object value and the predicate value to compare and - * should return true if both values should be considered equal. - * - * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`. - * This is essentially strict comparison of expected and actual. - * - * - `false`: A short hand for a function which will look for a substring match in a case - * insensitive way. Primitive values are converted to strings. Objects are not compared against - * primitives, unless they have a custom `toString` method (e.g. `Date` objects). - * - * - * Defaults to `false`. - * - * @param {string} [anyPropertyKey] The special property name that matches against any property. - * By default `$`. - * - * @example - - -
- - - - - - - - -
NamePhone
{{friend.name}}{{friend.phone}}
-
-
-
-
-
- - - - - - -
NamePhone
{{friendObj.name}}{{friendObj.phone}}
-
- - var expectFriendNames = function(expectedNames, key) { - element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) { - arr.forEach(function(wd, i) { - expect(wd.getText()).toMatch(expectedNames[i]); - }); - }); - }; - - it('should search across all fields when filtering with a string', function() { - var searchText = element(by.model('searchText')); - searchText.clear(); - searchText.sendKeys('m'); - expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend'); - - searchText.clear(); - searchText.sendKeys('76'); - expectFriendNames(['John', 'Julie'], 'friend'); - }); - - it('should search in specific fields when filtering with a predicate object', function() { - var searchAny = element(by.model('search.$')); - searchAny.clear(); - searchAny.sendKeys('i'); - expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj'); - }); - it('should use a equal comparison when comparator is true', function() { - var searchName = element(by.model('search.name')); - var strict = element(by.model('strict')); - searchName.clear(); - searchName.sendKeys('Julie'); - strict.click(); - expectFriendNames(['Julie'], 'friendObj'); - }); - -
- */ - -function filterFilter() { - return function(array, expression, comparator, anyPropertyKey) { - if (!isArrayLike(array)) { - if (array == null) { - return array; - } else { - throw minErr('filter')('notarray', 'Expected array but received: {0}', array); - } - } - - anyPropertyKey = anyPropertyKey || '$'; - var expressionType = getTypeForFilter(expression); - var predicateFn; - var matchAgainstAnyProp; - - switch (expressionType) { - case 'function': - predicateFn = expression; - break; - case 'boolean': - case 'null': - case 'number': - case 'string': - matchAgainstAnyProp = true; - // falls through - case 'object': - predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp); - break; - default: - return array; - } - - return Array.prototype.filter.call(array, predicateFn); - }; -} - -// Helper functions for `filterFilter` -function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) { - var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression); - var predicateFn; - - if (comparator === true) { - comparator = equals; - } else if (!isFunction(comparator)) { - comparator = function(actual, expected) { - if (isUndefined(actual)) { - // No substring matching against `undefined` - return false; - } - if ((actual === null) || (expected === null)) { - // No substring matching against `null`; only match against `null` - return actual === expected; - } - if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) { - // Should not compare primitives against objects, unless they have custom `toString` method - return false; - } - - actual = lowercase('' + actual); - expected = lowercase('' + expected); - return actual.indexOf(expected) !== -1; - }; - } - - predicateFn = function(item) { - if (shouldMatchPrimitives && !isObject(item)) { - return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false); - } - return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp); - }; - - return predicateFn; -} - -function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) { - var actualType = getTypeForFilter(actual); - var expectedType = getTypeForFilter(expected); - - if ((expectedType === 'string') && (expected.charAt(0) === '!')) { - return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp); - } else if (isArray(actual)) { - // In case `actual` is an array, consider it a match - // if ANY of it's items matches `expected` - return actual.some(function(item) { - return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp); - }); - } - - switch (actualType) { - case 'object': - var key; - if (matchAgainstAnyProp) { - for (key in actual) { - // Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined - // See: https://github.com/angular/angular.js/issues/15644 - if (key.charAt && (key.charAt(0) !== '$') && - deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) { - return true; - } - } - return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false); - } else if (expectedType === 'object') { - for (key in expected) { - var expectedVal = expected[key]; - if (isFunction(expectedVal) || isUndefined(expectedVal)) { - continue; - } - - var matchAnyProperty = key === anyPropertyKey; - var actualVal = matchAnyProperty ? actual : actual[key]; - if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) { - return false; - } - } - return true; - } else { - return comparator(actual, expected); - } - case 'function': - return false; - default: - return comparator(actual, expected); - } -} - -// Used for easily differentiating between `null` and actual `object` -function getTypeForFilter(val) { - return (val === null) ? 'null' : typeof val; -} - -var MAX_DIGITS = 22; -var DECIMAL_SEP = '.'; -var ZERO_CHAR = '0'; - -/** - * @ngdoc filter - * @name currency - * @kind function - * - * @description - * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default - * symbol for current locale is used. - * - * @param {number} amount Input to filter. - * @param {string=} symbol Currency symbol or identifier to be displayed. - * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale - * @returns {string} Formatted number. - * - * - * @example - - - -
-
- default currency symbol ($): {{amount | currency}}
- custom currency identifier (USD$): {{amount | currency:"USD$"}}
- no fractions (0): {{amount | currency:"USD$":0}} -
-
- - it('should init with 1234.56', function() { - expect(element(by.id('currency-default')).getText()).toBe('$1,234.56'); - expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235'); - }); - it('should update', function() { - if (browser.params.browser === 'safari') { - // Safari does not understand the minus key. See - // https://github.com/angular/protractor/issues/481 - return; - } - element(by.model('amount')).clear(); - element(by.model('amount')).sendKeys('-1234'); - expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00'); - expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234'); - }); - -
- */ -currencyFilter.$inject = ['$locale']; -function currencyFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function(amount, currencySymbol, fractionSize) { - if (isUndefined(currencySymbol)) { - currencySymbol = formats.CURRENCY_SYM; - } - - if (isUndefined(fractionSize)) { - fractionSize = formats.PATTERNS[1].maxFrac; - } - - // If the currency symbol is empty, trim whitespace around the symbol - var currencySymbolRe = !currencySymbol ? /\s*\u00A4\s*/g : /\u00A4/g; - - // if null or undefined pass it through - return (amount == null) - ? amount - : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize). - replace(currencySymbolRe, currencySymbol); - }; -} - -/** - * @ngdoc filter - * @name number - * @kind function - * - * @description - * Formats a number as text. - * - * If the input is null or undefined, it will just be returned. - * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. - * If the input is not a number an empty string is returned. - * - * - * @param {number|string} number Number to format. - * @param {(number|string)=} fractionSize Number of decimal places to round the number to. - * If this is not provided then the fraction size is computed from the current locale's number - * formatting pattern. In the case of the default locale, it will be 3. - * @returns {string} Number rounded to `fractionSize` appropriately formatted based on the current - * locale (e.g., in the en_US locale it will have "." as the decimal separator and - * include "," group separators after each third digit). - * - * @example - - - -
-
- Default formatting: {{val | number}}
- No fractions: {{val | number:0}}
- Negative number: {{-val | number:4}} -
-
- - it('should format numbers', function() { - expect(element(by.id('number-default')).getText()).toBe('1,234.568'); - expect(element(by.binding('val | number:0')).getText()).toBe('1,235'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679'); - }); - - it('should update', function() { - element(by.model('val')).clear(); - element(by.model('val')).sendKeys('3374.333'); - expect(element(by.id('number-default')).getText()).toBe('3,374.333'); - expect(element(by.binding('val | number:0')).getText()).toBe('3,374'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330'); - }); - -
- */ -numberFilter.$inject = ['$locale']; -function numberFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function(number, fractionSize) { - - // if null or undefined pass it through - return (number == null) - ? number - : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, - fractionSize); - }; -} - -/** - * Parse a number (as a string) into three components that can be used - * for formatting the number. - * - * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/) - * - * @param {string} numStr The number to parse - * @return {object} An object describing this number, containing the following keys: - * - d : an array of digits containing leading zeros as necessary - * - i : the number of the digits in `d` that are to the left of the decimal point - * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d` - * - */ -function parse(numStr) { - var exponent = 0, digits, numberOfIntegerDigits; - var i, j, zeros; - - // Decimal point? - if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) { - numStr = numStr.replace(DECIMAL_SEP, ''); - } - - // Exponential form? - if ((i = numStr.search(/e/i)) > 0) { - // Work out the exponent. - if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i; - numberOfIntegerDigits += +numStr.slice(i + 1); - numStr = numStr.substring(0, i); - } else if (numberOfIntegerDigits < 0) { - // There was no decimal point or exponent so it is an integer. - numberOfIntegerDigits = numStr.length; - } - - // Count the number of leading zeros. - for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ } - - if (i === (zeros = numStr.length)) { - // The digits are all zero. - digits = [0]; - numberOfIntegerDigits = 1; - } else { - // Count the number of trailing zeros - zeros--; - while (numStr.charAt(zeros) === ZERO_CHAR) zeros--; - - // Trailing zeros are insignificant so ignore them - numberOfIntegerDigits -= i; - digits = []; - // Convert string to array of digits without leading/trailing zeros. - for (j = 0; i <= zeros; i++, j++) { - digits[j] = +numStr.charAt(i); - } - } - - // If the number overflows the maximum allowed digits then use an exponent. - if (numberOfIntegerDigits > MAX_DIGITS) { - digits = digits.splice(0, MAX_DIGITS - 1); - exponent = numberOfIntegerDigits - 1; - numberOfIntegerDigits = 1; - } - - return { d: digits, e: exponent, i: numberOfIntegerDigits }; -} - -/** - * Round the parsed number to the specified number of decimal places - * This function changed the parsedNumber in-place - */ -function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) { - var digits = parsedNumber.d; - var fractionLen = digits.length - parsedNumber.i; - - // determine fractionSize if it is not specified; `+fractionSize` converts it to a number - fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize; - - // The index of the digit to where rounding is to occur - var roundAt = fractionSize + parsedNumber.i; - var digit = digits[roundAt]; - - if (roundAt > 0) { - // Drop fractional digits beyond `roundAt` - digits.splice(Math.max(parsedNumber.i, roundAt)); - - // Set non-fractional digits beyond `roundAt` to 0 - for (var j = roundAt; j < digits.length; j++) { - digits[j] = 0; - } - } else { - // We rounded to zero so reset the parsedNumber - fractionLen = Math.max(0, fractionLen); - parsedNumber.i = 1; - digits.length = Math.max(1, roundAt = fractionSize + 1); - digits[0] = 0; - for (var i = 1; i < roundAt; i++) digits[i] = 0; - } - - if (digit >= 5) { - if (roundAt - 1 < 0) { - for (var k = 0; k > roundAt; k--) { - digits.unshift(0); - parsedNumber.i++; - } - digits.unshift(1); - parsedNumber.i++; - } else { - digits[roundAt - 1]++; - } - } - - // Pad out with zeros to get the required fraction length - for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0); - - - // Do any carrying, e.g. a digit was rounded up to 10 - var carry = digits.reduceRight(function(carry, d, i, digits) { - d = d + carry; - digits[i] = d % 10; - return Math.floor(d / 10); - }, 0); - if (carry) { - digits.unshift(carry); - parsedNumber.i++; - } -} - -/** - * Format a number into a string - * @param {number} number The number to format - * @param {{ - * minFrac, // the minimum number of digits required in the fraction part of the number - * maxFrac, // the maximum number of digits required in the fraction part of the number - * gSize, // number of digits in each group of separated digits - * lgSize, // number of digits in the last group of digits before the decimal separator - * negPre, // the string to go in front of a negative number (e.g. `-` or `(`)) - * posPre, // the string to go in front of a positive number - * negSuf, // the string to go after a negative number (e.g. `)`) - * posSuf // the string to go after a positive number - * }} pattern - * @param {string} groupSep The string to separate groups of number (e.g. `,`) - * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`) - * @param {[type]} fractionSize The size of the fractional part of the number - * @return {string} The number formatted as a string - */ -function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { - - if (!(isString(number) || isNumber(number)) || isNaN(number)) return ''; - - var isInfinity = !isFinite(number); - var isZero = false; - var numStr = Math.abs(number) + '', - formattedText = '', - parsedNumber; - - if (isInfinity) { - formattedText = '\u221e'; - } else { - parsedNumber = parse(numStr); - - roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac); - - var digits = parsedNumber.d; - var integerLen = parsedNumber.i; - var exponent = parsedNumber.e; - var decimals = []; - isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true); - - // pad zeros for small numbers - while (integerLen < 0) { - digits.unshift(0); - integerLen++; - } - - // extract decimals digits - if (integerLen > 0) { - decimals = digits.splice(integerLen, digits.length); - } else { - decimals = digits; - digits = [0]; - } - - // format the integer digits with grouping separators - var groups = []; - if (digits.length >= pattern.lgSize) { - groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); - } - while (digits.length > pattern.gSize) { - groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); - } - if (digits.length) { - groups.unshift(digits.join('')); - } - formattedText = groups.join(groupSep); - - // append the decimal digits - if (decimals.length) { - formattedText += decimalSep + decimals.join(''); - } - - if (exponent) { - formattedText += 'e+' + exponent; - } - } - if (number < 0 && !isZero) { - return pattern.negPre + formattedText + pattern.negSuf; - } else { - return pattern.posPre + formattedText + pattern.posSuf; - } -} - -function padNumber(num, digits, trim, negWrap) { - var neg = ''; - if (num < 0 || (negWrap && num <= 0)) { - if (negWrap) { - num = -num + 1; - } else { - num = -num; - neg = '-'; - } - } - num = '' + num; - while (num.length < digits) num = ZERO_CHAR + num; - if (trim) { - num = num.substr(num.length - digits); - } - return neg + num; -} - - -function dateGetter(name, size, offset, trim, negWrap) { - offset = offset || 0; - return function(date) { - var value = date['get' + name](); - if (offset > 0 || value > -offset) { - value += offset; - } - if (value === 0 && offset === -12) value = 12; - return padNumber(value, size, trim, negWrap); - }; -} - -function dateStrGetter(name, shortForm, standAlone) { - return function(date, formats) { - var value = date['get' + name](); - var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : ''); - var get = uppercase(propPrefix + name); - - return formats[get][value]; - }; -} - -function timeZoneGetter(date, formats, offset) { - var zone = -1 * offset; - var paddedZone = (zone >= 0) ? '+' : ''; - - paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + - padNumber(Math.abs(zone % 60), 2); - - return paddedZone; -} - -function getFirstThursdayOfYear(year) { - // 0 = index of January - var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay(); - // 4 = index of Thursday (+1 to account for 1st = 5) - // 11 = index of *next* Thursday (+1 account for 1st = 12) - return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst); -} - -function getThursdayThisWeek(datetime) { - return new Date(datetime.getFullYear(), datetime.getMonth(), - // 4 = index of Thursday - datetime.getDate() + (4 - datetime.getDay())); -} - -function weekGetter(size) { - return function(date) { - var firstThurs = getFirstThursdayOfYear(date.getFullYear()), - thisThurs = getThursdayThisWeek(date); - - var diff = +thisThurs - +firstThurs, - result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week - - return padNumber(result, size); - }; -} - -function ampmGetter(date, formats) { - return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; -} - -function eraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1]; -} - -function longEraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1]; -} - -var DATE_FORMATS = { - yyyy: dateGetter('FullYear', 4, 0, false, true), - yy: dateGetter('FullYear', 2, 0, true, true), - y: dateGetter('FullYear', 1, 0, false, true), - MMMM: dateStrGetter('Month'), - MMM: dateStrGetter('Month', true), - MM: dateGetter('Month', 2, 1), - M: dateGetter('Month', 1, 1), - LLLL: dateStrGetter('Month', false, true), - dd: dateGetter('Date', 2), - d: dateGetter('Date', 1), - HH: dateGetter('Hours', 2), - H: dateGetter('Hours', 1), - hh: dateGetter('Hours', 2, -12), - h: dateGetter('Hours', 1, -12), - mm: dateGetter('Minutes', 2), - m: dateGetter('Minutes', 1), - ss: dateGetter('Seconds', 2), - s: dateGetter('Seconds', 1), - // while ISO 8601 requires fractions to be prefixed with `.` or `,` - // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions - sss: dateGetter('Milliseconds', 3), - EEEE: dateStrGetter('Day'), - EEE: dateStrGetter('Day', true), - a: ampmGetter, - Z: timeZoneGetter, - ww: weekGetter(2), - w: weekGetter(1), - G: eraGetter, - GG: eraGetter, - GGG: eraGetter, - GGGG: longEraGetter -}; - -var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/, - NUMBER_STRING = /^-?\d+$/; - -/** - * @ngdoc filter - * @name date - * @kind function - * - * @description - * Formats `date` to a string based on the requested `format`. - * - * `format` string can be composed of the following elements: - * - * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) - * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) - * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) - * * `'MMMM'`: Month in year (January-December) - * * `'MMM'`: Month in year (Jan-Dec) - * * `'MM'`: Month in year, padded (01-12) - * * `'M'`: Month in year (1-12) - * * `'LLLL'`: Stand-alone month in year (January-December) - * * `'dd'`: Day in month, padded (01-31) - * * `'d'`: Day in month (1-31) - * * `'EEEE'`: Day in Week,(Sunday-Saturday) - * * `'EEE'`: Day in Week, (Sun-Sat) - * * `'HH'`: Hour in day, padded (00-23) - * * `'H'`: Hour in day (0-23) - * * `'hh'`: Hour in AM/PM, padded (01-12) - * * `'h'`: Hour in AM/PM, (1-12) - * * `'mm'`: Minute in hour, padded (00-59) - * * `'m'`: Minute in hour (0-59) - * * `'ss'`: Second in minute, padded (00-59) - * * `'s'`: Second in minute (0-59) - * * `'sss'`: Millisecond in second, padded (000-999) - * * `'a'`: AM/PM marker - * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) - * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year - * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year - * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD') - * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini') - * - * `format` string can also be one of the following predefined - * {@link guide/i18n localizable formats}: - * - * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale - * (e.g. Sep 3, 2010 12:05:08 PM) - * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM) - * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale - * (e.g. Friday, September 3, 2010) - * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010) - * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) - * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) - * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM) - * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM) - * - * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g. - * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence - * (e.g. `"h 'o''clock'"`). - * - * Any other characters in the `format` string will be output as-is. - * - * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or - * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its - * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is - * specified in the string input, the time is considered to be in the local timezone. - * @param {string=} format Formatting rules (see Description). If not specified, - * `mediumDate` is used. - * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * @returns {string} Formatted string or the input if input is not recognized as date/millis. - * - * @example - - - {{1288323623006 | date:'medium'}}: - {{1288323623006 | date:'medium'}}
- {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: - {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
- {{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: - {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
- {{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}: - {{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}
-
- - it('should format date', function() { - expect(element(by.binding("1288323623006 | date:'medium'")).getText()). - toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); - expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()). - toMatch(/2010-10-2\d \d{2}:\d{2}:\d{2} (-|\+)?\d{4}/); - expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()). - toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); - expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()). - toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/); - }); - -
- */ -dateFilter.$inject = ['$locale']; -function dateFilter($locale) { - - - var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; - // 1 2 3 4 5 6 7 8 9 10 11 - function jsonStringToDate(string) { - var match; - if ((match = string.match(R_ISO8601_STR))) { - var date = new Date(0), - tzHour = 0, - tzMin = 0, - dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, - timeSetter = match[8] ? date.setUTCHours : date.setHours; - - if (match[9]) { - tzHour = toInt(match[9] + match[10]); - tzMin = toInt(match[9] + match[11]); - } - dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); - var h = toInt(match[4] || 0) - tzHour; - var m = toInt(match[5] || 0) - tzMin; - var s = toInt(match[6] || 0); - var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); - timeSetter.call(date, h, m, s, ms); - return date; - } - return string; - } - - - return function(date, format, timezone) { - var text = '', - parts = [], - fn, match; - - format = format || 'mediumDate'; - format = $locale.DATETIME_FORMATS[format] || format; - if (isString(date)) { - date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date); - } - - if (isNumber(date)) { - date = new Date(date); - } - - if (!isDate(date) || !isFinite(date.getTime())) { - return date; - } - - while (format) { - match = DATE_FORMATS_SPLIT.exec(format); - if (match) { - parts = concat(parts, match, 1); - format = parts.pop(); - } else { - parts.push(format); - format = null; - } - } - - var dateTimezoneOffset = date.getTimezoneOffset(); - if (timezone) { - dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - date = convertTimezoneToLocal(date, timezone, true); - } - forEach(parts, function(value) { - fn = DATE_FORMATS[value]; - text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset) - : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); - }); - - return text; - }; -} - - -/** - * @ngdoc filter - * @name json - * @kind function - * - * @description - * Allows you to convert a JavaScript object into JSON string. - * - * This filter is mostly useful for debugging. When using the double curly {{value}} notation - * the binding is automatically converted to JSON. - * - * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. - * @param {number=} spacing The number of spaces to use per indentation, defaults to 2. - * @returns {string} JSON string. - * - * - * @example - - -
{{ {'name':'value'} | json }}
-
{{ {'name':'value'} | json:4 }}
-
- - it('should jsonify filtered objects', function() { - expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n {2}"name": ?"value"\n}/); - expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n {4}"name": ?"value"\n}/); - }); - -
- * - */ -function jsonFilter() { - return function(object, spacing) { - if (isUndefined(spacing)) { - spacing = 2; - } - return toJson(object, spacing); - }; -} - - -/** - * @ngdoc filter - * @name lowercase - * @kind function - * @description - * Converts string to lowercase. - * - * See the {@link ng.uppercase uppercase filter documentation} for a functionally identical example. - * - * @see angular.lowercase - */ -var lowercaseFilter = valueFn(lowercase); - - -/** - * @ngdoc filter - * @name uppercase - * @kind function - * @description - * Converts string to uppercase. - * @example - - - -
- -

{{title}}

- -

{{title | uppercase}}

-
-
-
- */ -var uppercaseFilter = valueFn(uppercase); - -/** - * @ngdoc filter - * @name limitTo - * @kind function - * - * @description - * Creates a new array or string containing only a specified number of elements. The elements are - * taken from either the beginning or the end of the source array, string or number, as specified by - * the value and sign (positive or negative) of `limit`. Other array-like objects are also supported - * (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, - * it is converted to a string. - * - * @param {Array|ArrayLike|string|number} input - Array/array-like, string or number to be limited. - * @param {string|number} limit - The length of the returned array or string. If the `limit` number - * is positive, `limit` number of items from the beginning of the source array/string are copied. - * If the number is negative, `limit` number of items from the end of the source array/string - * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined, - * the input will be returned unchanged. - * @param {(string|number)=} begin - Index at which to begin limitation. As a negative index, - * `begin` indicates an offset from the end of `input`. Defaults to `0`. - * @returns {Array|string} A new sub-array or substring of length `limit` or less if the input had - * less than `limit` elements. - * - * @example - - - -
- -

Output numbers: {{ numbers | limitTo:numLimit }}

- -

Output letters: {{ letters | limitTo:letterLimit }}

- -

Output long number: {{ longNumber | limitTo:longNumberLimit }}

-
-
- - var numLimitInput = element(by.model('numLimit')); - var letterLimitInput = element(by.model('letterLimit')); - var longNumberLimitInput = element(by.model('longNumberLimit')); - var limitedNumbers = element(by.binding('numbers | limitTo:numLimit')); - var limitedLetters = element(by.binding('letters | limitTo:letterLimit')); - var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit')); - - it('should limit the number array to first three items', function() { - expect(numLimitInput.getAttribute('value')).toBe('3'); - expect(letterLimitInput.getAttribute('value')).toBe('3'); - expect(longNumberLimitInput.getAttribute('value')).toBe('3'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]'); - expect(limitedLetters.getText()).toEqual('Output letters: abc'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 234'); - }); - - // There is a bug in safari and protractor that doesn't like the minus key - // it('should update the output when -3 is entered', function() { - // numLimitInput.clear(); - // numLimitInput.sendKeys('-3'); - // letterLimitInput.clear(); - // letterLimitInput.sendKeys('-3'); - // longNumberLimitInput.clear(); - // longNumberLimitInput.sendKeys('-3'); - // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); - // expect(limitedLetters.getText()).toEqual('Output letters: ghi'); - // expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); - // }); - - it('should not exceed the maximum size of input array', function() { - numLimitInput.clear(); - numLimitInput.sendKeys('100'); - letterLimitInput.clear(); - letterLimitInput.sendKeys('100'); - longNumberLimitInput.clear(); - longNumberLimitInput.sendKeys('100'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]'); - expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342'); - }); - -
-*/ -function limitToFilter() { - return function(input, limit, begin) { - if (Math.abs(Number(limit)) === Infinity) { - limit = Number(limit); - } else { - limit = toInt(limit); - } - if (isNumberNaN(limit)) return input; - - if (isNumber(input)) input = input.toString(); - if (!isArrayLike(input)) return input; - - begin = (!begin || isNaN(begin)) ? 0 : toInt(begin); - begin = (begin < 0) ? Math.max(0, input.length + begin) : begin; - - if (limit >= 0) { - return sliceFn(input, begin, begin + limit); - } else { - if (begin === 0) { - return sliceFn(input, limit, input.length); - } else { - return sliceFn(input, Math.max(0, begin + limit), begin); - } - } - }; -} - -function sliceFn(input, begin, end) { - if (isString(input)) return input.slice(begin, end); - - return slice.call(input, begin, end); -} - -/** - * @ngdoc filter - * @name orderBy - * @kind function - * - * @description - * Returns an array containing the items from the specified `collection`, ordered by a `comparator` - * function based on the values computed using the `expression` predicate. - * - * For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in - * `[{id: 'bar'}, {id: 'foo'}]`. - * - * The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray, - * String, etc). - * - * The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker - * for the preceding one. The `expression` is evaluated against each item and the output is used - * for comparing with other items. - * - * You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in - * ascending order. - * - * The comparison is done using the `comparator` function. If none is specified, a default, built-in - * comparator is used (see below for details - in a nutshell, it compares numbers numerically and - * strings alphabetically). - * - * ### Under the hood - * - * Ordering the specified `collection` happens in two phases: - * - * 1. All items are passed through the predicate (or predicates), and the returned values are saved - * along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed - * through a predicate that extracts the value of the `label` property, would be transformed to: - * ``` - * { - * value: 'foo', - * type: 'string', - * index: ... - * } - * ``` - * **Note:** `null` values use `'null'` as their type. - * 2. The comparator function is used to sort the items, based on the derived values, types and - * indices. - * - * If you use a custom comparator, it will be called with pairs of objects of the form - * `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal - * (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the - * second, or `1` otherwise. - * - * In order to ensure that the sorting will be deterministic across platforms, if none of the - * specified predicates can distinguish between two items, `orderBy` will automatically introduce a - * dummy predicate that returns the item's index as `value`. - * (If you are using a custom comparator, make sure it can handle this predicate as well.) - * - * If a custom comparator still can't distinguish between two items, then they will be sorted based - * on their index using the built-in comparator. - * - * Finally, in an attempt to simplify things, if a predicate returns an object as the extracted - * value for an item, `orderBy` will try to convert that object to a primitive value, before passing - * it to the comparator. The following rules govern the conversion: - * - * 1. If the object has a `valueOf()` method that returns a primitive, its return value will be - * used instead.
- * (If the object has a `valueOf()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that - * returns a primitive, its return value will be used instead.
- * (If the object has a `toString()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 3. No conversion; the object itself is used. - * - * ### The default comparator - * - * The default, built-in comparator should be sufficient for most usecases. In short, it compares - * numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to - * using their index in the original collection, sorts values of different types by type and puts - * `undefined` and `null` values at the end of the sorted list. - * - * More specifically, it follows these steps to determine the relative order of items: - * - * 1. If the compared values are of different types: - * - If one of the values is undefined, consider it "greater than" the other. - * - Else if one of the values is null, consider it "greater than" the other. - * - Else compare the types themselves alphabetically. - * 2. If both values are of type `string`, compare them alphabetically in a case- and - * locale-insensitive way. - * 3. If both values are objects, compare their indices instead. - * 4. Otherwise, return: - * - `0`, if the values are equal (by strict equality comparison, i.e. using `===`). - * - `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator). - * - `1`, otherwise. - * - * **Note:** If you notice numbers not being sorted as expected, make sure they are actually being - * saved as numbers and not strings. - * **Note:** For the purpose of sorting, `null` and `undefined` are considered "greater than" - * any other value (with undefined "greater than" null). This effectively means that `null` - * and `undefined` values end up at the end of a list sorted in ascending order. - * **Note:** `null` values use `'null'` as their type to be able to distinguish them from objects. - * - * @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort. - * @param {(Function|string|Array.)=} expression - A predicate (or list of - * predicates) to be used by the comparator to determine the order of elements. - * - * Can be one of: - * - * - `Function`: A getter function. This function will be called with each item as argument and - * the return value will be used for sorting. - * - `string`: An AngularJS expression. This expression will be evaluated against each item and the - * result will be used for sorting. For example, use `'label'` to sort by a property called - * `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label` - * property.
- * (The result of a constant expression is interpreted as a property name to be used for - * comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a - * property called `special name`.)
- * An expression can be optionally prefixed with `+` or `-` to control the sorting direction, - * ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided, - * (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons. - * - `Array`: An array of function and/or string predicates. If a predicate cannot determine the - * relative order of two items, the next predicate is used as a tie-breaker. - * - * **Note:** If the predicate is missing or empty then it defaults to `'+'`. - * - * @param {boolean=} reverse - If `true`, reverse the sorting order. - * @param {(Function)=} comparator - The comparator function used to determine the relative order of - * value pairs. If omitted, the built-in comparator will be used. - * - * @returns {Array} - The sorted array. - * - * - * @example - * ### Ordering a table with `ngRepeat` - * - * The example below demonstrates a simple {@link ngRepeat ngRepeat}, where the data is sorted by - * age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means - * it defaults to the built-in comparator. - * - - -
- - - - - - - - - - - -
NamePhone NumberAge
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample1', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var names = element.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by age in reverse order', function() { - expect(names.get(0).getText()).toBe('Adam'); - expect(names.get(1).getText()).toBe('Julie'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('John'); - }); - -
- *
- * - * @example - * ### Changing parameters dynamically - * - * All parameters can be changed dynamically. The next example shows how you can make the columns of - * a table sortable, by binding the `expression` and `reverse` parameters to scope properties. - * - - -
-
Sort by = {{propertyName}}; reverse = {{reverse}}
-
- -
- - - - - - - - - - - -
- - - - - - - - -
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample2', []) - .controller('ExampleController', ['$scope', function($scope) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = friends; - - $scope.sortBy = function(propertyName) { - $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false; - $scope.propertyName = propertyName; - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
- *
- * - * @example - * ### Using `orderBy` inside a controller - * - * It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and - * calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory - * and retrieve the `orderBy` filter with `$filter('orderBy')`.) - * - - -
-
Sort by = {{propertyName}}; reverse = {{reverse}}
-
- -
- - - - - - - - - - - -
- - - - - - - - -
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample3', []) - .controller('ExampleController', ['$scope', 'orderByFilter', function($scope, orderBy) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - - $scope.sortBy = function(propertyName) { - $scope.reverse = (propertyName !== null && $scope.propertyName === propertyName) - ? !$scope.reverse : false; - $scope.propertyName = propertyName; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
- *
- * - * @example - * ### Using a custom comparator - * - * If you have very specific requirements about the way items are sorted, you can pass your own - * comparator function. For example, you might need to compare some strings in a locale-sensitive - * way. (When specifying a custom comparator, you also need to pass a value for the `reverse` - * argument - passing `false` retains the default sorting order, i.e. ascending.) - * - - -
-
-

Locale-sensitive Comparator

- - - - - - - - - -
NameFavorite Letter
{{friend.name}}{{friend.favoriteLetter}}
-
-
-

Default Comparator

- - - - - - - - - -
NameFavorite Letter
{{friend.name}}{{friend.favoriteLetter}}
-
-
-
- - angular.module('orderByExample4', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', favoriteLetter: 'Ä'}, - {name: 'Mary', favoriteLetter: 'Ü'}, - {name: 'Mike', favoriteLetter: 'Ö'}, - {name: 'Adam', favoriteLetter: 'H'}, - {name: 'Julie', favoriteLetter: 'Z'} - ]; - - $scope.localeSensitiveComparator = function(v1, v2) { - // If we don't get strings, just compare by index - if (v1.type !== 'string' || v2.type !== 'string') { - return (v1.index < v2.index) ? -1 : 1; - } - - // Compare strings alphabetically, taking locale into account - return v1.value.localeCompare(v2.value); - }; - }]); - - - .friends-container { - display: inline-block; - margin: 0 30px; - } - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var container = element(by.css('.custom-comparator')); - var names = container.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by favorite letter (in correct alphabetical order)', function() { - expect(names.get(0).getText()).toBe('John'); - expect(names.get(1).getText()).toBe('Adam'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('Julie'); - }); - -
- * - */ -orderByFilter.$inject = ['$parse']; -function orderByFilter($parse) { - return function(array, sortPredicate, reverseOrder, compareFn) { - - if (array == null) return array; - if (!isArrayLike(array)) { - throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array); - } - - if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; } - if (sortPredicate.length === 0) { sortPredicate = ['+']; } - - var predicates = processPredicates(sortPredicate); - - var descending = reverseOrder ? -1 : 1; - - // Define the `compare()` function. Use a default comparator if none is specified. - var compare = isFunction(compareFn) ? compareFn : defaultCompare; - - // The next three lines are a version of a Swartzian Transform idiom from Perl - // (sometimes called the Decorate-Sort-Undecorate idiom) - // See https://en.wikipedia.org/wiki/Schwartzian_transform - var compareValues = Array.prototype.map.call(array, getComparisonObject); - compareValues.sort(doComparison); - array = compareValues.map(function(item) { return item.value; }); - - return array; - - function getComparisonObject(value, index) { - // NOTE: We are adding an extra `tieBreaker` value based on the element's index. - // This will be used to keep the sort stable when none of the input predicates can - // distinguish between two elements. - return { - value: value, - tieBreaker: {value: index, type: 'number', index: index}, - predicateValues: predicates.map(function(predicate) { - return getPredicateValue(predicate.get(value), index); - }) - }; - } - - function doComparison(v1, v2) { - for (var i = 0, ii = predicates.length; i < ii; i++) { - var result = compare(v1.predicateValues[i], v2.predicateValues[i]); - if (result) { - return result * predicates[i].descending * descending; - } - } - - return (compare(v1.tieBreaker, v2.tieBreaker) || defaultCompare(v1.tieBreaker, v2.tieBreaker)) * descending; - } - }; - - function processPredicates(sortPredicates) { - return sortPredicates.map(function(predicate) { - var descending = 1, get = identity; - - if (isFunction(predicate)) { - get = predicate; - } else if (isString(predicate)) { - if ((predicate.charAt(0) === '+' || predicate.charAt(0) === '-')) { - descending = predicate.charAt(0) === '-' ? -1 : 1; - predicate = predicate.substring(1); - } - if (predicate !== '') { - get = $parse(predicate); - if (get.constant) { - var key = get(); - get = function(value) { return value[key]; }; - } - } - } - return {get: get, descending: descending}; - }); - } - - function isPrimitive(value) { - switch (typeof value) { - case 'number': /* falls through */ - case 'boolean': /* falls through */ - case 'string': - return true; - default: - return false; - } - } - - function objectValue(value) { - // If `valueOf` is a valid function use that - if (isFunction(value.valueOf)) { - value = value.valueOf(); - if (isPrimitive(value)) return value; - } - // If `toString` is a valid function and not the one from `Object.prototype` use that - if (hasCustomToString(value)) { - value = value.toString(); - if (isPrimitive(value)) return value; - } - - return value; - } - - function getPredicateValue(value, index) { - var type = typeof value; - if (value === null) { - type = 'null'; - } else if (type === 'object') { - value = objectValue(value); - } - return {value: value, type: type, index: index}; - } - - function defaultCompare(v1, v2) { - var result = 0; - var type1 = v1.type; - var type2 = v2.type; - - if (type1 === type2) { - var value1 = v1.value; - var value2 = v2.value; - - if (type1 === 'string') { - // Compare strings case-insensitively - value1 = value1.toLowerCase(); - value2 = value2.toLowerCase(); - } else if (type1 === 'object') { - // For basic objects, use the position of the object - // in the collection instead of the value - if (isObject(value1)) value1 = v1.index; - if (isObject(value2)) value2 = v2.index; - } - - if (value1 !== value2) { - result = value1 < value2 ? -1 : 1; - } - } else { - result = (type1 === 'undefined') ? 1 : - (type2 === 'undefined') ? -1 : - (type1 === 'null') ? 1 : - (type2 === 'null') ? -1 : - (type1 < type2) ? -1 : 1; - } - - return result; - } -} - -function ngDirective(directive) { - if (isFunction(directive)) { - directive = { - link: directive - }; - } - directive.restrict = directive.restrict || 'AC'; - return valueFn(directive); -} - -/** - * @ngdoc directive - * @name a - * @restrict E - * - * @description - * Modifies the default behavior of the html a tag so that the default action is prevented when - * the href attribute is empty. - * - * For dynamically creating `href` attributes for a tags, see the {@link ng.ngHref `ngHref`} directive. - */ -var htmlAnchorDirective = valueFn({ - restrict: 'E', - compile: function(element, attr) { - if (!attr.href && !attr.xlinkHref) { - return function(scope, element) { - // If the linked element is not an anchor tag anymore, do nothing - if (element[0].nodeName.toLowerCase() !== 'a') return; - - // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. - var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? - 'xlink:href' : 'href'; - element.on('click', function(event) { - // if we have no href url, then don't navigate anywhere. - if (!element.attr(href)) { - event.preventDefault(); - } - }); - }; - } - } -}); - -/** - * @ngdoc directive - * @name ngHref - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in an href attribute will - * make the link go to the wrong URL if the user clicks it before - * AngularJS has a chance to replace the `{{hash}}` markup with its - * value. Until AngularJS replaces the markup the link will be broken - * and will most likely return a 404 error. The `ngHref` directive - * solves this problem. - * - * The wrong way to write it: - * ```html - * link1 - * ``` - * - * The correct way to write it: - * ```html - * link1 - * ``` - * - * @element A - * @param {template} ngHref any string which can contain `{{}}` markup. - * - * @example - * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes - * in links and their different behaviors: - - -
- link 1 (link, don't reload)
- link 2 (link, don't reload)
- link 3 (link, reload!)
- anchor (link, don't reload)
- anchor (no link)
- link (link, change location) -
- - it('should execute ng-click but not reload when href without value', function() { - element(by.id('link-1')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('1'); - expect(element(by.id('link-1')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when href empty string', function() { - element(by.id('link-2')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('2'); - expect(element(by.id('link-2')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click and change url when ng-href specified', function() { - expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/); - - element(by.id('link-3')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/123$/); - }); - }, 5000, 'page should navigate to /123'); - }); - - it('should execute ng-click but not reload when href empty string and name specified', function() { - element(by.id('link-4')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('4'); - expect(element(by.id('link-4')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when no href but name specified', function() { - element(by.id('link-5')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('5'); - expect(element(by.id('link-5')).getAttribute('href')).toBe(null); - }); - - it('should only change url when only ng-href', function() { - element(by.model('value')).clear(); - element(by.model('value')).sendKeys('6'); - expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/); - - element(by.id('link-6')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/6$/); - }); - }, 5000, 'page should navigate to /6'); - }); - -
- */ - -/** - * @ngdoc directive - * @name ngSrc - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrc` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrc any string which can contain `{{}}` markup. - */ - -/** - * @ngdoc directive - * @name ngSrcset - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrcset` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrcset any string which can contain `{{}}` markup. - */ - -/** - * @ngdoc directive - * @name ngDisabled - * @restrict A - * @priority 100 - * - * @description - * - * This directive sets the `disabled` attribute on the element (typically a form control, - * e.g. `input`, `button`, `select` etc.) if the - * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `disabled` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should toggle button', function() { - expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy(); - }); - -
- * - * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy, - * then the `disabled` attribute will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngChecked - * @restrict A - * @priority 100 - * - * @description - * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy. - * - * Note that this directive should not be used together with {@link ngModel `ngModel`}, - * as this can lead to unexpected behavior. - * - * A special directive is necessary because we cannot use interpolation inside the `checked` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should check both checkBoxes', function() { - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeFalsy(); - element(by.model('leader')).click(); - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeTruthy(); - }); - -
- * - * @element INPUT - * @param {expression} ngChecked If the {@link guide/expression expression} is truthy, - * then the `checked` attribute will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngReadonly - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy. - * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on - * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information. - * - * A special directive is necessary because we cannot use interpolation inside the `readonly` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should toggle readonly attr', function() { - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy(); - }); - -
- * - * @element INPUT - * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy, - * then special attribute "readonly" will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngSelected - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `selected` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - *
- * **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only - * sets the `selected` attribute on the element. If you are using `ngModel` on the select, you - * should not use `ngSelected` on the options, as `ngModel` will set the select value and - * selected options. - *
- * - * @example - - -
- -
- - it('should select Greetings!', function() { - expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy(); - element(by.model('selected')).click(); - expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy(); - }); - -
- * - * @element OPTION - * @param {expression} ngSelected If the {@link guide/expression expression} is truthy, - * then special attribute "selected" will be set on the element - */ - -/** - * @ngdoc directive - * @name ngOpen - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `open` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * ## A note about browser compatibility - * - * Internet Explorer and Edge do not support the `details` element, it is - * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead. - * - * @example - - -
-
- List -
    -
  • Apple
  • -
  • Orange
  • -
  • Durian
  • -
-
-
- - it('should toggle open', function() { - expect(element(by.id('details')).getAttribute('open')).toBeFalsy(); - element(by.model('open')).click(); - expect(element(by.id('details')).getAttribute('open')).toBeTruthy(); - }); - -
- * - * @element DETAILS - * @param {expression} ngOpen If the {@link guide/expression expression} is truthy, - * then special attribute "open" will be set on the element - */ - -var ngAttributeAliasDirectives = {}; - -// boolean attrs are evaluated -forEach(BOOLEAN_ATTR, function(propName, attrName) { - // binding to multiple is not supported - if (propName === 'multiple') return; - - function defaultLinkFn(scope, element, attr) { - scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { - attr.$set(attrName, !!value); - }); - } - - var normalized = directiveNormalize('ng-' + attrName); - var linkFn = defaultLinkFn; - - if (propName === 'checked') { - linkFn = function(scope, element, attr) { - // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input - if (attr.ngModel !== attr[normalized]) { - defaultLinkFn(scope, element, attr); - } - }; - } - - ngAttributeAliasDirectives[normalized] = function() { - return { - restrict: 'A', - priority: 100, - link: linkFn - }; - }; -}); - -// aliased input attrs are evaluated -forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) { - ngAttributeAliasDirectives[ngAttr] = function() { - return { - priority: 100, - link: function(scope, element, attr) { - //special case ngPattern when a literal regular expression value - //is used as the expression (this way we don't have to watch anything). - if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') { - var match = attr.ngPattern.match(REGEX_STRING_REGEXP); - if (match) { - attr.$set('ngPattern', new RegExp(match[1], match[2])); - return; - } - } - - scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) { - attr.$set(ngAttr, value); - }); - } - }; - }; -}); - -// ng-src, ng-srcset, ng-href are interpolated -forEach(['src', 'srcset', 'href'], function(attrName) { - var normalized = directiveNormalize('ng-' + attrName); - ngAttributeAliasDirectives[normalized] = ['$sce', function($sce) { - return { - priority: 99, // it needs to run after the attributes are interpolated - link: function(scope, element, attr) { - var propName = attrName, - name = attrName; - - if (attrName === 'href' && - toString.call(element.prop('href')) === '[object SVGAnimatedString]') { - name = 'xlinkHref'; - attr.$attr[name] = 'xlink:href'; - propName = null; - } - - // We need to sanitize the url at least once, in case it is a constant - // non-interpolated attribute. - attr.$set(normalized, $sce.getTrustedMediaUrl(attr[normalized])); - - attr.$observe(normalized, function(value) { - if (!value) { - if (attrName === 'href') { - attr.$set(name, null); - } - return; - } - - attr.$set(name, value); - - // Support: IE 9-11 only - // On IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist - // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need - // to set the property as well to achieve the desired effect. - // We use attr[attrName] value since $set might have sanitized the url. - if (msie && propName) element.prop(propName, attr[name]); - }); - } - }; - }]; -}); - -/* global -nullFormCtrl, -PENDING_CLASS, -SUBMITTED_CLASS - */ -var nullFormCtrl = { - $addControl: noop, - $getControls: valueFn([]), - $$renameControl: nullFormRenameControl, - $removeControl: noop, - $setValidity: noop, - $setDirty: noop, - $setPristine: noop, - $setSubmitted: noop, - $$setSubmitted: noop -}, -PENDING_CLASS = 'ng-pending', -SUBMITTED_CLASS = 'ng-submitted'; - -function nullFormRenameControl(control, name) { - control.$name = name; -} - -/** - * @ngdoc type - * @name form.FormController - * - * @property {boolean} $pristine True if user has not interacted with the form yet. - * @property {boolean} $dirty True if user has already interacted with the form. - * @property {boolean} $valid True if all of the containing forms and controls are valid. - * @property {boolean} $invalid True if at least one containing control or form is invalid. - * @property {boolean} $submitted True if user has submitted the form even if its invalid. - * - * @property {Object} $pending An object hash, containing references to controls or forms with - * pending validators, where: - * - * - keys are validations tokens (error names). - * - values are arrays of controls or forms that have a pending validator for the given error name. - * - * See {@link form.FormController#$error $error} for a list of built-in validation tokens. - * - * @property {Object} $error An object hash, containing references to controls or forms with failing - * validators, where: - * - * - keys are validation tokens (error names), - * - values are arrays of controls or forms that have a failing validator for the given error name. - * - * Built-in validation tokens: - * - `email` - * - `max` - * - `maxlength` - * - `min` - * - `minlength` - * - `number` - * - `pattern` - * - `required` - * - `url` - * - `date` - * - `datetimelocal` - * - `time` - * - `week` - * - `month` - * - * @description - * `FormController` keeps track of all its controls and nested forms as well as the state of them, - * such as being valid/invalid or dirty/pristine. - * - * Each {@link ng.directive:form form} directive creates an instance - * of `FormController`. - * - */ -//asks for $scope to fool the BC controller module -FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; -function FormController($element, $attrs, $scope, $animate, $interpolate) { - this.$$controls = []; - - // init state - this.$error = {}; - this.$$success = {}; - this.$pending = undefined; - this.$name = $interpolate($attrs.name || $attrs.ngForm || '')($scope); - this.$dirty = false; - this.$pristine = true; - this.$valid = true; - this.$invalid = false; - this.$submitted = false; - this.$$parentForm = nullFormCtrl; - - this.$$element = $element; - this.$$animate = $animate; - - setupValidity(this); -} - -FormController.prototype = { - /** - * @ngdoc method - * @name form.FormController#$rollbackViewValue - * - * @description - * Rollback all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is typically needed by the reset button of - * a form that uses `ng-model-options` to pend updates. - */ - $rollbackViewValue: function() { - forEach(this.$$controls, function(control) { - control.$rollbackViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$commitViewValue - * - * @description - * Commit all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function() { - forEach(this.$$controls, function(control) { - control.$commitViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$addControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Register a control with the form. Input elements using ngModelController do this automatically - * when they are linked. - * - * Note that the current state of the control will not be reflected on the new parent form. This - * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine` - * state. - * - * However, if the method is used programmatically, for example by adding dynamically created controls, - * or controls that have been previously removed without destroying their corresponding DOM element, - * it's the developers responsibility to make sure the current state propagates to the parent form. - * - * For example, if an input control is added that is already `$dirty` and has `$error` properties, - * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form. - */ - $addControl: function(control) { - // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored - // and not added to the scope. Now we throw an error. - assertNotHasOwnProperty(control.$name, 'input'); - this.$$controls.push(control); - - if (control.$name) { - this[control.$name] = control; - } - - control.$$parentForm = this; - }, - - /** - * @ngdoc method - * @name form.FormController#$getControls - * @returns {Array} the controls that are currently part of this form - * - * @description - * This method returns a **shallow copy** of the controls that are currently part of this form. - * The controls can be instances of {@link form.FormController `FormController`} - * ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}. - * If you need access to the controls of child-forms, you have to call `$getControls()` - * recursively on them. - * This can be used for example to iterate over all controls to validate them. - * - * The controls can be accessed normally, but adding to, or removing controls from the array has - * no effect on the form. Instead, use {@link form.FormController#$addControl `$addControl()`} and - * {@link form.FormController#$removeControl `$removeControl()`} for this use-case. - * Likewise, adding a control to, or removing a control from the form is not reflected - * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time - * you need access to the controls. - */ - $getControls: function() { - return shallowCopy(this.$$controls); - }, - - // Private API: rename a form control - $$renameControl: function(control, newName) { - var oldName = control.$name; - - if (this[oldName] === control) { - delete this[oldName]; - } - this[newName] = control; - control.$name = newName; - }, - - /** - * @ngdoc method - * @name form.FormController#$removeControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Deregister a control from the form. - * - * Input elements using ngModelController do this automatically when they are destroyed. - * - * Note that only the removed control's validation state (`$errors`etc.) will be removed from the - * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be - * different from case to case. For example, removing the only `$dirty` control from a form may or - * may not mean that the form is still `$dirty`. - */ - $removeControl: function(control) { - if (control.$name && this[control.$name] === control) { - delete this[control.$name]; - } - forEach(this.$pending, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$error, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$$success, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - - arrayRemove(this.$$controls, control); - control.$$parentForm = nullFormCtrl; - }, - - /** - * @ngdoc method - * @name form.FormController#$setDirty - * - * @description - * Sets the form to a dirty state. - * - * This method can be called to add the 'ng-dirty' class and set the form to a dirty - * state (ng-dirty class). This method will also propagate to parent forms. - */ - $setDirty: function() { - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$dirty = true; - this.$pristine = false; - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name form.FormController#$setPristine - * - * @description - * Sets the form to its pristine state. - * - * This method sets the form's `$pristine` state to true, the `$dirty` state to false, removes - * the `ng-dirty` class and adds the `ng-pristine` class. Additionally, it sets the `$submitted` - * state to false. - * - * This method will also propagate to all the controls contained in this form. - * - * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after - * saving or resetting it. - */ - $setPristine: function() { - this.$$animate.setClass(this.$$element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS); - this.$dirty = false; - this.$pristine = true; - this.$submitted = false; - forEach(this.$$controls, function(control) { - control.$setPristine(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setUntouched - * - * @description - * Sets the form to its untouched state. - * - * This method can be called to remove the 'ng-touched' class and set the form controls to their - * untouched state (ng-untouched class). - * - * Setting a form controls back to their untouched state is often useful when setting the form - * back to its pristine state. - */ - $setUntouched: function() { - forEach(this.$$controls, function(control) { - control.$setUntouched(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setSubmitted - * - * @description - * Sets the form to its `$submitted` state. This will also set `$submitted` on all child and - * parent forms of the form. - */ - $setSubmitted: function() { - var rootForm = this; - while (rootForm.$$parentForm && (rootForm.$$parentForm !== nullFormCtrl)) { - rootForm = rootForm.$$parentForm; - } - rootForm.$$setSubmitted(); - }, - - $$setSubmitted: function() { - this.$$animate.addClass(this.$$element, SUBMITTED_CLASS); - this.$submitted = true; - forEach(this.$$controls, function(control) { - if (control.$$setSubmitted) { - control.$$setSubmitted(); - } - }); - } -}; - -/** - * @ngdoc method - * @name form.FormController#$setValidity - * - * @description - * Change the validity state of the form, and notify the parent form (if any). - * - * Application developers will rarely need to call this method directly. It is used internally, by - * {@link ngModel.NgModelController#$setValidity NgModelController.$setValidity()}, to propagate a - * control's validity state to the parent `FormController`. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be - * assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for - * unfulfilled `$asyncValidators`), so that it is available for data-binding. The - * `validationErrorKey` should be in camelCase and will get converted into dash-case for - * class name. Example: `myError` will result in `ng-valid-my-error` and - * `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending - * (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and when - * `$asyncValidators` do not run because any of the `$validators` failed. - * @param {NgModelController | FormController} controller - The controller whose validity state is - * triggering the change. - */ -addSetValidityMethod({ - clazz: FormController, - set: function(object, property, controller) { - var list = object[property]; - if (!list) { - object[property] = [controller]; - } else { - var index = list.indexOf(controller); - if (index === -1) { - list.push(controller); - } - } - }, - unset: function(object, property, controller) { - var list = object[property]; - if (!list) { - return; - } - arrayRemove(list, controller); - if (list.length === 0) { - delete object[property]; - } - } -}); - -/** - * @ngdoc directive - * @name ngForm - * @restrict EAC - * - * @description - * Helper directive that makes it possible to create control groups inside a - * {@link ng.directive:form `form`} directive. - * These "child forms" can be used, for example, to determine the validity of a sub-group of - * controls. - * - *
- * **Note**: `ngForm` cannot be used as a replacement for `
`, because it lacks its - * [built-in HTML functionality](https://html.spec.whatwg.org/#the-form-element). - * Specifically, you cannot submit `ngForm` like a `` tag. That means, - * you cannot send data to the server with `ngForm`, or integrate it with - * {@link ng.directive:ngSubmit `ngSubmit`}. - *
- * - * @param {string=} ngForm|name Name of the form. If specified, the form controller will - * be published into the related scope, under this name. - * - */ - - /** - * @ngdoc directive - * @name form - * @restrict E - * - * @description - * Directive that instantiates - * {@link form.FormController FormController}. - * - * If the `name` attribute is specified, the form controller is published onto the current scope under - * this name. - * - * ## Alias: {@link ng.directive:ngForm `ngForm`} - * - * In AngularJS, forms can be nested. This means that the outer form is valid when all of the child - * forms are valid as well. However, browsers do not allow nesting of `` elements, so - * AngularJS provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to - * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group - * of controls needs to be determined. - * - * ## CSS classes - * - `ng-valid` is set if the form is valid. - * - `ng-invalid` is set if the form is invalid. - * - `ng-pending` is set if the form is pending. - * - `ng-pristine` is set if the form is pristine. - * - `ng-dirty` is set if the form is dirty. - * - `ng-submitted` is set if the form was submitted. - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * - * ## Submitting a form and preventing the default action - * - * Since the role of forms in client-side AngularJS applications is different than in classical - * roundtrip apps, it is desirable for the browser not to translate the form submission into a full - * page reload that sends the data to the server. Instead some javascript logic should be triggered - * to handle the form submission in an application-specific way. - * - * For this reason, AngularJS prevents the default action (form submission to the server) unless the - * `` element has an `action` attribute specified. - * - * You can use one of the following two ways to specify what javascript method should be called when - * a form is submitted: - * - * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element - * - {@link ng.directive:ngClick ngClick} directive on the first - * button or input field of type submit (input[type=submit]) - * - * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit} - * or {@link ng.directive:ngClick ngClick} directives. - * This is because of the following form submission rules in the HTML specification: - * - * - If a form has only one input field then hitting enter in this field triggers form submit - * (`ngSubmit`) - * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter - * doesn't trigger submit - * - if a form has one or more input fields and one or more buttons or input[type=submit] then - * hitting enter in any of the input fields will trigger the click handler on the *first* button or - * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) - * - * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is - * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * @animations - * Animations in ngForm are triggered when any of the associated CSS classes are added and removed. - * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any - * other validations that are performed within the form. Animations in ngForm are similar to how - * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well - * as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style a form element - * that has been rendered as invalid after it has been validated: - * - *
- * //be sure to include ngAnimate as a module to hook into more
- * //advanced animations
- * .my-form {
- *   transition:0.5s linear all;
- *   background: white;
- * }
- * .my-form.ng-invalid {
- *   background: red;
- *   color:white;
- * }
- * 
- * - * @example - - - - - - userType: - Required!
- userType = {{userType}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
- -
- - it('should initialize to model', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - - expect(userType.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - var userInput = element(by.model('userType')); - - userInput.clear(); - userInput.sendKeys(''); - - expect(userType.getText()).toEqual('userType ='); - expect(valid.getText()).toContain('false'); - }); - -
- * - * @param {string=} name Name of the form. If specified, the form controller will be published into - * related scope, under this name. - */ -var formDirectiveFactory = function(isNgForm) { - return ['$timeout', '$parse', function($timeout, $parse) { - var formDirective = { - name: 'form', - restrict: isNgForm ? 'EAC' : 'E', - require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form - controller: FormController, - compile: function ngFormCompile(formElement, attr) { - // Setup initial state of the control - formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS); - - var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false); - - return { - pre: function ngFormPreLink(scope, formElement, attr, ctrls) { - var controller = ctrls[0]; - - // if `action` attr is not present on the form, prevent the default action (submission) - if (!('action' in attr)) { - // we can't use jq events because if a form is destroyed during submission the default - // action is not prevented. see #1238 - // - // IE 9 is not affected because it doesn't fire a submit event and try to do a full - // page reload if the form was destroyed by submission of the form via a click handler - // on a button in the form. Looks like an IE9 specific bug. - var handleFormSubmission = function(event) { - scope.$apply(function() { - controller.$commitViewValue(); - controller.$setSubmitted(); - }); - - event.preventDefault(); - }; - - formElement[0].addEventListener('submit', handleFormSubmission); - - // unregister the preventDefault listener so that we don't not leak memory but in a - // way that will achieve the prevention of the default action. - formElement.on('$destroy', function() { - $timeout(function() { - formElement[0].removeEventListener('submit', handleFormSubmission); - }, 0, false); - }); - } - - var parentFormCtrl = ctrls[1] || controller.$$parentForm; - parentFormCtrl.$addControl(controller); - - var setter = nameAttr ? getSetter(controller.$name) : noop; - - if (nameAttr) { - setter(scope, controller); - attr.$observe(nameAttr, function(newValue) { - if (controller.$name === newValue) return; - setter(scope, undefined); - controller.$$parentForm.$$renameControl(controller, newValue); - setter = getSetter(controller.$name); - setter(scope, controller); - }); - } - formElement.on('$destroy', function() { - controller.$$parentForm.$removeControl(controller); - setter(scope, undefined); - extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards - }); - } - }; - } - }; - - return formDirective; - - function getSetter(expression) { - if (expression === '') { - //create an assignable expression, so forms with an empty name can be renamed later - return $parse('this[""]').assign; - } - return $parse(expression).assign || noop; - } - }]; -}; - -var formDirective = formDirectiveFactory(); -var ngFormDirective = formDirectiveFactory(true); - - - -// helper methods -function setupValidity(instance) { - instance.$$classCache = {}; - instance.$$classCache[INVALID_CLASS] = !(instance.$$classCache[VALID_CLASS] = instance.$$element.hasClass(VALID_CLASS)); -} -function addSetValidityMethod(context) { - var clazz = context.clazz, - set = context.set, - unset = context.unset; - - clazz.prototype.$setValidity = function(validationErrorKey, state, controller) { - if (isUndefined(state)) { - createAndSet(this, '$pending', validationErrorKey, controller); - } else { - unsetAndCleanup(this, '$pending', validationErrorKey, controller); - } - if (!isBoolean(state)) { - unset(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } else { - if (state) { - unset(this.$error, validationErrorKey, controller); - set(this.$$success, validationErrorKey, controller); - } else { - set(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } - } - if (this.$pending) { - cachedToggleClass(this, PENDING_CLASS, true); - this.$valid = this.$invalid = undefined; - toggleValidationCss(this, '', null); - } else { - cachedToggleClass(this, PENDING_CLASS, false); - this.$valid = isObjectEmpty(this.$error); - this.$invalid = !this.$valid; - toggleValidationCss(this, '', this.$valid); - } - - // re-read the state as the set/unset methods could have - // combined state in this.$error[validationError] (used for forms), - // where setting/unsetting only increments/decrements the value, - // and does not replace it. - var combinedState; - if (this.$pending && this.$pending[validationErrorKey]) { - combinedState = undefined; - } else if (this.$error[validationErrorKey]) { - combinedState = false; - } else if (this.$$success[validationErrorKey]) { - combinedState = true; - } else { - combinedState = null; - } - - toggleValidationCss(this, validationErrorKey, combinedState); - this.$$parentForm.$setValidity(validationErrorKey, combinedState, this); - }; - - function createAndSet(ctrl, name, value, controller) { - if (!ctrl[name]) { - ctrl[name] = {}; - } - set(ctrl[name], value, controller); - } - - function unsetAndCleanup(ctrl, name, value, controller) { - if (ctrl[name]) { - unset(ctrl[name], value, controller); - } - if (isObjectEmpty(ctrl[name])) { - ctrl[name] = undefined; - } - } - - function cachedToggleClass(ctrl, className, switchValue) { - if (switchValue && !ctrl.$$classCache[className]) { - ctrl.$$animate.addClass(ctrl.$$element, className); - ctrl.$$classCache[className] = true; - } else if (!switchValue && ctrl.$$classCache[className]) { - ctrl.$$animate.removeClass(ctrl.$$element, className); - ctrl.$$classCache[className] = false; - } - } - - function toggleValidationCss(ctrl, validationErrorKey, isValid) { - validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; - - cachedToggleClass(ctrl, VALID_CLASS + validationErrorKey, isValid === true); - cachedToggleClass(ctrl, INVALID_CLASS + validationErrorKey, isValid === false); - } -} - -function isObjectEmpty(obj) { - if (obj) { - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - return false; - } - } - } - return true; -} - -/* global - VALID_CLASS: false, - INVALID_CLASS: false, - PRISTINE_CLASS: false, - DIRTY_CLASS: false, - ngModelMinErr: false -*/ - -// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231 -var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/; -// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987) -// Note: We are being more lenient, because browsers are too. -// 1. Scheme -// 2. Slashes -// 3. Username -// 4. Password -// 5. Hostname -// 6. Port -// 7. Path -// 8. Query -// 9. Fragment -// 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999 -var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i; -// eslint-disable-next-line max-len -var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; -var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/; -var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/; -var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; -var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/; -var MONTH_REGEXP = /^(\d{4,})-(\d\d)$/; -var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; - -var PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown'; -var PARTIAL_VALIDATION_TYPES = createMap(); -forEach('date,datetime-local,month,time,week'.split(','), function(type) { - PARTIAL_VALIDATION_TYPES[type] = true; -}); - -var inputType = { - - /** - * @ngdoc input - * @name input[text] - * - * @description - * Standard HTML text input with AngularJS data binding, inherited by most of the `input` elements. - * - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Adds `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * This parameter is ignored for input[type=password] controls, which will never trim the - * input. - * - * @example - - - -
- -
- - Required! - - Single word only! -
- text = {{example.text}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var text = element(by.binding('example.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if multi word', function() { - input.clear(); - input.sendKeys('hello world'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'text': textInputType, - - /** - * @ngdoc input - * @name input[date] - * - * @description - * Input with date validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601 - * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many - * modern browsers do not yet support this input type, it is important to provide cues to users on the - * expected input format via a placeholder or label. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a - * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5 - * constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be - * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5 - * constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-MM-dd"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM-dd"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (see https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10-22'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'date': createDateInputType('date', DATE_REGEXP, - createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']), - 'yyyy-MM-dd'), - - /** - * @ngdoc input - * @name input[datetime-local] - * - * @description - * Input with datetime validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `min` will also add native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `max` will also add native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2010-12-28T14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01T23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP, - createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']), - 'yyyy-MM-ddTHH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[time] - * - * @description - * Input with time validation and transformation. In browsers that do not yet support - * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a - * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions}. By default, - * this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the - * `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the - * `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "HH:mm:ss"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "HH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'time': createDateInputType('time', TIME_REGEXP, - createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']), - 'HH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[week] - * - * @description - * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support - * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * week format (yyyy-W##), for example: `2013-W02`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The value of the resulting Date object will be set to Thursday at 00:00:00 of the requested week, - * due to ISO-8601 week numbering standards. Information on ISO's system for numbering the weeks of the - * year can be found at: https://en.wikipedia.org/wiki/ISO_8601#Week_dates - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-Www"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-Www"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-W01'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-W01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'), - - /** - * @ngdoc input - * @name input[month] - * - * @description - * Input with month validation and transformation. In browsers that do not yet support - * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * month format (yyyy-MM), for example: `2009-01`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * If the model is not set to the first of the month, the next view to model update will set it - * to the first of the month. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid month! -
- value = {{example.value | date: "yyyy-MM"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'month': createDateInputType('month', MONTH_REGEXP, - createDateParser(MONTH_REGEXP, ['yyyy', 'MM']), - 'yyyy-MM'), - - /** - * @ngdoc input - * @name input[number] - * - * @description - * Text input with number validation and transformation. Sets the `number` validation - * error if not a valid number. - * - *
- * The model must always be of type `number` otherwise AngularJS will throw an error. - * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt} - * error docs for more information and an example of how to convert your model if necessary. - *
- * - * - * - * @knownIssue - * - * ### HTML5 constraint validation and `allowInvalid` - * - * In browsers that follow the - * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29), - * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}. - * If a non-number is entered in the input, the browser will report the value as an empty string, - * which means the view / model values in `ngModel` and subsequently the scope value - * will also be an empty string. - * - * @knownIssue - * - * ### Large numbers and `step` validation - * - * The `step` validation will not work correctly for very large numbers (e.g. 9999999999) due to - * Javascript's arithmetic limitations. If you need to handle large numbers, purpose-built - * libraries (e.g. https://github.com/MikeMcl/big.js/), can be included into AngularJS by - * {@link guide/forms#modifying-built-in-validators overwriting the validators} - * for `number` and / or `step`, or by {@link guide/forms#custom-validation applying custom validators} - * to an `input[text]` element. The source for `input[number]` type can be used as a starting - * point for both implementations. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * Can be interpolated. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * Can be interpolated. - * @param {string=} ngMin Like `min`, sets the `min` validation error key if the value entered is less than `ngMin`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} ngMax Like `max`, sets the `max` validation error key if the value entered is greater than `ngMax`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} step Sets the `step` validation error key if the value entered does not fit the `step` constraint. - * Can be interpolated. - * @param {string=} ngStep Like `step`, sets the `step` validation error key if the value entered does not fit the `ngStep` constraint, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not valid number! -
- value = {{example.value}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.value')); - - it('should initialize to model', function() { - expect(value.getText()).toContain('12'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if over max', function() { - input.clear(); - input.sendKeys('123'); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'number': numberInputType, - - - /** - * @ngdoc input - * @name input[url] - * - * @description - * Text input with URL validation. Sets the `url` validation error key if the content is not a - * valid URL. - * - *
- * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex - * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify - * the built-in validators (see the {@link guide/forms Forms guide}) - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
-
- - var text = element(by.binding('url.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('url.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('http://google.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not url', function() { - input.clear(); - input.sendKeys('box'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'url': urlInputType, - - - /** - * @ngdoc input - * @name input[email] - * - * @description - * Text input with email validation. Sets the `email` validation error key if not a valid email - * address. - * - *
- * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex - * used in Chromium, which may not fulfill your app's requirements. - * If you need stricter (e.g. requiring a top-level domain), or more relaxed validation - * (e.g. allowing IPv6 address literals) you can use `ng-pattern` or - * modify the built-in validators (see the {@link guide/forms Forms guide}). - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not valid email! -
- text = {{email.text}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
- myForm.$error.email = {{!!myForm.$error.email}}
-
-
- - var text = element(by.binding('email.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('email.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('me@example.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not email', function() { - input.clear(); - input.sendKeys('xxx'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'email': emailInputType, - - - /** - * @ngdoc input - * @name input[radio] - * - * @description - * HTML radio button. - * - * **Note:**
- * All inputs controlled by {@link ngModel ngModel} (including those of type `radio`) will use the - * value of their `name` attribute to determine the property under which their - * {@link ngModel.NgModelController NgModelController} will be published on the parent - * {@link form.FormController FormController}. Thus, if you use the same `name` for multiple - * inputs of a form (e.g. a group of radio inputs), only _one_ `NgModelController` will be - * published on the parent `FormController` under that name. The rest of the controllers will - * continue to work as expected, but you won't be able to access them as properties on the parent - * `FormController`. - * - *
- *

- * In plain HTML forms, the `name` attribute is used to identify groups of radio inputs, so - * that the browser can manage their state (checked/unchecked) based on the state of other - * inputs in the same group. - *

- *

- * In AngularJS forms, this is not necessary. The input's state will be updated based on the - * value of the underlying model data. - *

- *
- * - *
- * If you omit the `name` attribute on a radio input, `ngModel` will automatically assign it a - * unique name. - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string} value The value to which the `ngModel` expression should be set when selected. - * Note that `value` only supports `string` values, i.e. the scope model needs to be a string, - * too. Use `ngValue` if you need complex models (`number`, `object`, ...). - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {string} ngValue AngularJS expression to which `ngModel` will be be set when the radio - * is selected. Should be used instead of the `value` attribute if you need - * a non-string `ngModel` (`boolean`, `array`, ...). - * - * @example - - - -
-
-
-
- color = {{color.name | json}}
-
- Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. -
- - it('should change state', function() { - var inputs = element.all(by.model('color.name')); - var color = element(by.binding('color.name')); - - expect(color.getText()).toContain('blue'); - - inputs.get(0).click(); - expect(color.getText()).toContain('red'); - - inputs.get(1).click(); - expect(color.getText()).toContain('green'); - }); - -
- */ - 'radio': radioInputType, - - /** - * @ngdoc input - * @name input[range] - * - * @description - * Native range input with validation and transformation. - * - * The model for the range input must always be a `Number`. - * - * IE9 and other browsers that do not support the `range` type fall back - * to a text input without any default values for `min`, `max` and `step`. Model binding, - * validation and number parsing are nevertheless supported. - * - * Browsers that support range (latest Chrome, Safari, Firefox, Edge) treat `input[range]` - * in a way that never allows the input to hold an invalid value. That means: - * - any non-numerical value is set to `(max + min) / 2`. - * - any numerical value that is less than the current min val, or greater than the current max val - * is set to the min / max val respectively. - * - additionally, the current `step` is respected, so the nearest value that satisfies a step - * is used. - * - * See the [HTML Spec on input[type=range]](https://www.w3.org/TR/html5/forms.html#range-state-(type=range)) - * for more info. - * - * This has the following consequences for AngularJS: - * - * Since the element value should always reflect the current model value, a range input - * will set the bound ngModel expression to the value that the browser has set for the - * input element. For example, in the following input ``, - * if the application sets `model.value = null`, the browser will set the input to `'50'`. - * AngularJS will then set the model to `50`, to prevent input and model value being out of sync. - * - * That means the model for range will immediately be set to `50` after `ngModel` has been - * initialized. It also means a range input can never have the required error. - * - * This does not only affect changes to the model value, but also to the values of the `min`, - * `max`, and `step` attributes. When these change in a way that will cause the browser to modify - * the input value, AngularJS will also update the model value. - * - * Automatic value adjustment also means that a range input element can never have the `required`, - * `min`, or `max` errors. - * - * However, `step` is currently only fully implemented by Firefox. Other browsers have problems - * when the step value changes dynamically - they do not adjust the element value correctly, but - * instead may set the `stepMismatch` error. If that's the case, the AngularJS will set the `step` - * error on the input, and set the model to `undefined`. - * - * Note that `input[range]` is not compatible with`ngMax`, `ngMin`, and `ngStep`, because they do - * not set the `min` and `max` attributes, which means that the browser won't automatically adjust - * the input value based on their values, and will always assume min = 0, max = 100, and step = 1. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation to ensure that the value entered is greater - * than `min`. Can be interpolated. - * @param {string=} max Sets the `max` validation to ensure that the value entered is less than `max`. - * Can be interpolated. - * @param {string=} step Sets the `step` validation to ensure that the value entered matches the `step` - * Can be interpolated. - * @param {expression=} ngChange AngularJS expression to be executed when the ngModel value changes due - * to user interaction with the input element. - * @param {expression=} ngChecked If the expression is truthy, then the `checked` attribute will be set on the - * element. **Note** : `ngChecked` should not be used alongside `ngModel`. - * Checkout {@link ng.directive:ngChecked ngChecked} for usage. - * - * @example - - - -
- - Model as range: -
- Model as number:
- Min:
- Max:
- value = {{value}}
- myForm.range.$valid = {{myForm.range.$valid}}
- myForm.range.$error = {{myForm.range.$error}} -
-
-
- - * ## Range Input with ngMin & ngMax attributes - - * @example - - - -
- Model as range: -
- Model as number:
- Min:
- Max:
- value = {{value}}
- myForm.range.$valid = {{myForm.range.$valid}}
- myForm.range.$error = {{myForm.range.$error}} -
-
-
- - */ - 'range': rangeInputType, - - /** - * @ngdoc input - * @name input[checkbox] - * - * @description - * HTML checkbox. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {expression=} ngTrueValue The value to which the expression should be set when selected. - * @param {expression=} ngFalseValue The value to which the expression should be set when not selected. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
-
-
- value1 = {{checkboxModel.value1}}
- value2 = {{checkboxModel.value2}}
-
-
- - it('should change state', function() { - var value1 = element(by.binding('checkboxModel.value1')); - var value2 = element(by.binding('checkboxModel.value2')); - - expect(value1.getText()).toContain('true'); - expect(value2.getText()).toContain('YES'); - - element(by.model('checkboxModel.value1')).click(); - element(by.model('checkboxModel.value2')).click(); - - expect(value1.getText()).toContain('false'); - expect(value2.getText()).toContain('NO'); - }); - -
- */ - 'checkbox': checkboxInputType, - - 'hidden': noop, - 'button': noop, - 'submit': noop, - 'reset': noop, - 'file': noop -}; - -function stringBasedInputType(ctrl) { - ctrl.$formatters.push(function(value) { - return ctrl.$isEmpty(value) ? value : value.toString(); - }); -} - -function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); -} - -function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { - var type = lowercase(element[0].type); - - // In composition mode, users are still inputting intermediate text buffer, - // hold the listener until composition is done. - // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent - if (!$sniffer.android) { - var composing = false; - - element.on('compositionstart', function() { - composing = true; - }); - - // Support: IE9+ - element.on('compositionupdate', function(ev) { - // End composition when ev.data is empty string on 'compositionupdate' event. - // When the input de-focusses (e.g. by clicking away), IE triggers 'compositionupdate' - // instead of 'compositionend'. - if (isUndefined(ev.data) || ev.data === '') { - composing = false; - } - }); - - element.on('compositionend', function() { - composing = false; - listener(); - }); - } - - var timeout; - - var listener = function(ev) { - if (timeout) { - $browser.defer.cancel(timeout); - timeout = null; - } - if (composing) return; - var value = element.val(), - event = ev && ev.type; - - // By default we will trim the value - // If the attribute ng-trim exists we will avoid trimming - // If input type is 'password', the value is never trimmed - if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) { - value = trim(value); - } - - // If a control is suffering from bad input (due to native validators), browsers discard its - // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the - // control's value is the same empty value twice in a row. - if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) { - ctrl.$setViewValue(value, event); - } - }; - - // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the - // input event on backspace, delete or cut - if ($sniffer.hasEvent('input')) { - element.on('input', listener); - } else { - var deferListener = function(ev, input, origValue) { - if (!timeout) { - timeout = $browser.defer(function() { - timeout = null; - if (!input || input.value !== origValue) { - listener(ev); - } - }); - } - }; - - element.on('keydown', /** @this */ function(event) { - var key = event.keyCode; - - // ignore - // command modifiers arrows - if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; - - deferListener(event, this, this.value); - }); - - // if user modifies input value using context menu in IE, we need "paste", "cut" and "drop" events to catch it - if ($sniffer.hasEvent('paste')) { - element.on('paste cut drop', deferListener); - } - } - - // if user paste into input using mouse on older browser - // or form autocomplete on newer browser, we need "change" event to catch it - element.on('change', listener); - - // Some native input types (date-family) have the ability to change validity without - // firing any input/change events. - // For these event types, when native validators are present and the browser supports the type, - // check for validity changes on various DOM events. - if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) { - element.on(PARTIAL_VALIDATION_EVENTS, /** @this */ function(ev) { - if (!timeout) { - var validity = this[VALIDITY_STATE_PROPERTY]; - var origBadInput = validity.badInput; - var origTypeMismatch = validity.typeMismatch; - timeout = $browser.defer(function() { - timeout = null; - if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) { - listener(ev); - } - }); - } - }); - } - - ctrl.$render = function() { - // Workaround for Firefox validation #12102. - var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue; - if (element.val() !== value) { - element.val(value); - } - }; -} - -function weekParser(isoWeek, existingDate) { - if (isDate(isoWeek)) { - return isoWeek; - } - - if (isString(isoWeek)) { - WEEK_REGEXP.lastIndex = 0; - var parts = WEEK_REGEXP.exec(isoWeek); - if (parts) { - var year = +parts[1], - week = +parts[2], - hours = 0, - minutes = 0, - seconds = 0, - milliseconds = 0, - firstThurs = getFirstThursdayOfYear(year), - addDays = (week - 1) * 7; - - if (existingDate) { - hours = existingDate.getHours(); - minutes = existingDate.getMinutes(); - seconds = existingDate.getSeconds(); - milliseconds = existingDate.getMilliseconds(); - } - - return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds); - } - } - - return NaN; -} - -function createDateParser(regexp, mapping) { - return function(iso, previousDate) { - var parts, map; - - if (isDate(iso)) { - return iso; - } - - if (isString(iso)) { - // When a date is JSON'ified to wraps itself inside of an extra - // set of double quotes. This makes the date parsing code unable - // to match the date string and parse it as a date. - if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') { - iso = iso.substring(1, iso.length - 1); - } - if (ISO_DATE_REGEXP.test(iso)) { - return new Date(iso); - } - regexp.lastIndex = 0; - parts = regexp.exec(iso); - - if (parts) { - parts.shift(); - if (previousDate) { - map = { - yyyy: previousDate.getFullYear(), - MM: previousDate.getMonth() + 1, - dd: previousDate.getDate(), - HH: previousDate.getHours(), - mm: previousDate.getMinutes(), - ss: previousDate.getSeconds(), - sss: previousDate.getMilliseconds() / 1000 - }; - } else { - map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 }; - } - - forEach(parts, function(part, index) { - if (index < mapping.length) { - map[mapping[index]] = +part; - } - }); - - var date = new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0); - if (map.yyyy < 100) { - // In the constructor, 2-digit years map to 1900-1999. - // Use `setFullYear()` to set the correct year. - date.setFullYear(map.yyyy); - } - - return date; - } - } - - return NaN; - }; -} - -function createDateInputType(type, regexp, parseDate, format) { - return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, type); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var isTimeType = type === 'time' || type === 'datetimelocal'; - var previousDate; - var previousTimezone; - - ctrl.$parsers.push(function(value) { - if (ctrl.$isEmpty(value)) return null; - - if (regexp.test(value)) { - // Note: We cannot read ctrl.$modelValue, as there might be a different - // parser/formatter in the processing chain so that the model - // contains some different data format! - return parseDateAndConvertTimeZoneToLocal(value, previousDate); - } - ctrl.$$parserName = type; - return undefined; - }); - - ctrl.$formatters.push(function(value) { - if (value && !isDate(value)) { - throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value); - } - if (isValidDate(value)) { - previousDate = value; - var timezone = ctrl.$options.getOption('timezone'); - - if (timezone) { - previousTimezone = timezone; - previousDate = convertTimezoneToLocal(previousDate, timezone, true); - } - - return formatter(value, timezone); - } else { - previousDate = null; - previousTimezone = null; - return ''; - } - }); - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - var parsedMinVal = parseObservedDateValue(minVal); - - ctrl.$validators.min = function(value) { - return !isValidDate(value) || isUndefined(parsedMinVal) || parseDate(value) >= parsedMinVal; - }; - attr.$observe('min', function(val) { - if (val !== minVal) { - parsedMinVal = parseObservedDateValue(val); - minVal = val; - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseObservedDateValue(maxVal); - - ctrl.$validators.max = function(value) { - return !isValidDate(value) || isUndefined(parsedMaxVal) || parseDate(value) <= parsedMaxVal; - }; - attr.$observe('max', function(val) { - if (val !== maxVal) { - parsedMaxVal = parseObservedDateValue(val); - maxVal = val; - ctrl.$validate(); - } - }); - } - - function isValidDate(value) { - // Invalid Date: getTime() returns NaN - return value && !(value.getTime && value.getTime() !== value.getTime()); - } - - function parseObservedDateValue(val) { - return isDefined(val) && !isDate(val) ? parseDateAndConvertTimeZoneToLocal(val) || undefined : val; - } - - function parseDateAndConvertTimeZoneToLocal(value, previousDate) { - var timezone = ctrl.$options.getOption('timezone'); - - if (previousTimezone && previousTimezone !== timezone) { - // If the timezone has changed, adjust the previousDate to the default timezone - // so that the new date is converted with the correct timezone offset - previousDate = addDateMinutes(previousDate, timezoneToOffset(previousTimezone)); - } - - var parsedDate = parseDate(value, previousDate); - - if (!isNaN(parsedDate) && timezone) { - parsedDate = convertTimezoneToLocal(parsedDate, timezone); - } - return parsedDate; - } - - function formatter(value, timezone) { - var targetFormat = format; - - if (isTimeType && isString(ctrl.$options.getOption('timeSecondsFormat'))) { - targetFormat = format - .replace('ss.sss', ctrl.$options.getOption('timeSecondsFormat')) - .replace(/:$/, ''); - } - - var formatted = $filter('date')(value, targetFormat, timezone); - - if (isTimeType && ctrl.$options.getOption('timeStripZeroSeconds')) { - formatted = formatted.replace(/(?::00)?(?:\.000)?$/, ''); - } - - return formatted; - } - }; -} - -function badInputChecker(scope, element, attr, ctrl, parserName) { - var node = element[0]; - var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity); - if (nativeValidation) { - ctrl.$parsers.push(function(value) { - var validity = element.prop(VALIDITY_STATE_PROPERTY) || {}; - if (validity.badInput || validity.typeMismatch) { - ctrl.$$parserName = parserName; - return undefined; - } - - return value; - }); - } -} - -function numberFormatterParser(ctrl) { - ctrl.$parsers.push(function(value) { - if (ctrl.$isEmpty(value)) return null; - if (NUMBER_REGEXP.test(value)) return parseFloat(value); - - ctrl.$$parserName = 'number'; - return undefined; - }); - - ctrl.$formatters.push(function(value) { - if (!ctrl.$isEmpty(value)) { - if (!isNumber(value)) { - throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); - } - value = value.toString(); - } - return value; - }); -} - -function parseNumberAttrVal(val) { - if (isDefined(val) && !isNumber(val)) { - val = parseFloat(val); - } - return !isNumberNaN(val) ? val : undefined; -} - -function isNumberInteger(num) { - // See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066 - // (minus the assumption that `num` is a number) - - // eslint-disable-next-line no-bitwise - return (num | 0) === num; -} - -function countDecimals(num) { - var numString = num.toString(); - var decimalSymbolIndex = numString.indexOf('.'); - - if (decimalSymbolIndex === -1) { - if (-1 < num && num < 1) { - // It may be in the exponential notation format (`1e-X`) - var match = /e-(\d+)$/.exec(numString); - - if (match) { - return Number(match[1]); - } - } - - return 0; - } - - return numString.length - decimalSymbolIndex - 1; -} - -function isValidForStep(viewValue, stepBase, step) { - // At this point `stepBase` and `step` are expected to be non-NaN values - // and `viewValue` is expected to be a valid stringified number. - var value = Number(viewValue); - - var isNonIntegerValue = !isNumberInteger(value); - var isNonIntegerStepBase = !isNumberInteger(stepBase); - var isNonIntegerStep = !isNumberInteger(step); - - // Due to limitations in Floating Point Arithmetic (e.g. `0.3 - 0.2 !== 0.1` or - // `0.5 % 0.1 !== 0`), we need to convert all numbers to integers. - if (isNonIntegerValue || isNonIntegerStepBase || isNonIntegerStep) { - var valueDecimals = isNonIntegerValue ? countDecimals(value) : 0; - var stepBaseDecimals = isNonIntegerStepBase ? countDecimals(stepBase) : 0; - var stepDecimals = isNonIntegerStep ? countDecimals(step) : 0; - - var decimalCount = Math.max(valueDecimals, stepBaseDecimals, stepDecimals); - var multiplier = Math.pow(10, decimalCount); - - value = value * multiplier; - stepBase = stepBase * multiplier; - step = step * multiplier; - - if (isNonIntegerValue) value = Math.round(value); - if (isNonIntegerStepBase) stepBase = Math.round(stepBase); - if (isNonIntegerStep) step = Math.round(step); - } - - return (value - stepBase) % step === 0; -} - -function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, 'number'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var parsedMinVal; - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - parsedMinVal = parseNumberAttrVal(minVal); - - ctrl.$validators.min = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMinVal) || viewValue >= parsedMinVal; - }; - - attr.$observe('min', function(val) { - if (val !== minVal) { - parsedMinVal = parseNumberAttrVal(val); - minVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseNumberAttrVal(maxVal); - - ctrl.$validators.max = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMaxVal) || viewValue <= parsedMaxVal; - }; - - attr.$observe('max', function(val) { - if (val !== maxVal) { - parsedMaxVal = parseNumberAttrVal(val); - maxVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.step) || attr.ngStep) { - var stepVal = attr.step || $parse(attr.ngStep)(scope); - var parsedStepVal = parseNumberAttrVal(stepVal); - - ctrl.$validators.step = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedStepVal) || - isValidForStep(viewValue, parsedMinVal || 0, parsedStepVal); - }; - - attr.$observe('step', function(val) { - // TODO(matsko): implement validateLater to reduce number of validations - if (val !== stepVal) { - parsedStepVal = parseNumberAttrVal(val); - stepVal = val; - ctrl.$validate(); - } - - }); - - } -} - -function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) { - badInputChecker(scope, element, attr, ctrl, 'range'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var supportsRange = ctrl.$$hasNativeValidators && element[0].type === 'range', - minVal = supportsRange ? 0 : undefined, - maxVal = supportsRange ? 100 : undefined, - stepVal = supportsRange ? 1 : undefined, - validity = element[0].validity, - hasMinAttr = isDefined(attr.min), - hasMaxAttr = isDefined(attr.max), - hasStepAttr = isDefined(attr.step); - - var originalRender = ctrl.$render; - - ctrl.$render = supportsRange && isDefined(validity.rangeUnderflow) && isDefined(validity.rangeOverflow) ? - //Browsers that implement range will set these values automatically, but reading the adjusted values after - //$render would cause the min / max validators to be applied with the wrong value - function rangeRender() { - originalRender(); - ctrl.$setViewValue(element.val()); - } : - originalRender; - - if (hasMinAttr) { - minVal = parseNumberAttrVal(attr.min); - - ctrl.$validators.min = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMinValidator() { return true; } : - // non-support browsers validate the min val - function minValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(minVal) || viewValue >= minVal; - }; - - setInitialValueAndObserver('min', minChange); - } - - if (hasMaxAttr) { - maxVal = parseNumberAttrVal(attr.max); - - ctrl.$validators.max = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMaxValidator() { return true; } : - // non-support browsers validate the max val - function maxValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(maxVal) || viewValue <= maxVal; - }; - - setInitialValueAndObserver('max', maxChange); - } - - if (hasStepAttr) { - stepVal = parseNumberAttrVal(attr.step); - - ctrl.$validators.step = supportsRange ? - function nativeStepValidator() { - // Currently, only FF implements the spec on step change correctly (i.e. adjusting the - // input element value to a valid value). It's possible that other browsers set the stepMismatch - // validity error instead, so we can at least report an error in that case. - return !validity.stepMismatch; - } : - // ngStep doesn't set the setp attr, so the browser doesn't adjust the input value as setting step would - function stepValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) || - isValidForStep(viewValue, minVal || 0, stepVal); - }; - - setInitialValueAndObserver('step', stepChange); - } - - function setInitialValueAndObserver(htmlAttrName, changeFn) { - // interpolated attributes set the attribute value only after a digest, but we need the - // attribute value when the input is first rendered, so that the browser can adjust the - // input value based on the min/max value - element.attr(htmlAttrName, attr[htmlAttrName]); - var oldVal = attr[htmlAttrName]; - attr.$observe(htmlAttrName, function wrappedObserver(val) { - if (val !== oldVal) { - oldVal = val; - changeFn(val); - } - }); - } - - function minChange(val) { - minVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the minVal is greater than the element value - if (minVal > elVal) { - elVal = minVal; - element.val(elVal); - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function maxChange(val) { - maxVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the maxVal is less than the element value - if (maxVal < elVal) { - element.val(maxVal); - // IE11 and Chrome don't set the value to the minVal when max < min - elVal = maxVal < minVal ? minVal : maxVal; - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function stepChange(val) { - stepVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - // Some browsers don't adjust the input value correctly, but set the stepMismatch error - if (!supportsRange) { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } else if (ctrl.$viewValue !== element.val()) { - ctrl.$setViewValue(element.val()); - } - } -} - -function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.url = function(modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || URL_REGEXP.test(value); - }; -} - -function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.email = function(modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value); - }; -} - -function radioInputType(scope, element, attr, ctrl) { - var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false'; - // make the name unique, if not defined - if (isUndefined(attr.name)) { - element.attr('name', nextUid()); - } - - var listener = function(ev) { - var value; - if (element[0].checked) { - value = attr.value; - if (doTrim) { - value = trim(value); - } - ctrl.$setViewValue(value, ev && ev.type); - } - }; - - element.on('change', listener); - - ctrl.$render = function() { - var value = attr.value; - if (doTrim) { - value = trim(value); - } - element[0].checked = (value === ctrl.$viewValue); - }; - - attr.$observe('value', ctrl.$render); -} - -function parseConstantExpr($parse, context, name, expression, fallback) { - var parseFn; - if (isDefined(expression)) { - parseFn = $parse(expression); - if (!parseFn.constant) { - throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' + - '`{1}`.', name, expression); - } - return parseFn(context); - } - return fallback; -} - -function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true); - var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false); - - var listener = function(ev) { - ctrl.$setViewValue(element[0].checked, ev && ev.type); - }; - - element.on('change', listener); - - ctrl.$render = function() { - element[0].checked = ctrl.$viewValue; - }; - - // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false` - // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert - // it to a boolean. - ctrl.$isEmpty = function(value) { - return value === false; - }; - - ctrl.$formatters.push(function(value) { - return equals(value, trueValue); - }); - - ctrl.$parsers.push(function(value) { - return value ? trueValue : falseValue; - }); -} - - -/** - * @ngdoc directive - * @name textarea - * @restrict E - * - * @description - * HTML textarea element control with AngularJS data-binding. The data-binding and validation - * properties of this element are exactly the same as those of the - * {@link ng.directive:input input element}. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any - * length. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * - * @knownIssue - * - * When specifying the `placeholder` attribute of ` - *
{{ list | json }}
- * - * - * it("should split the text by newlines", function() { - * var listInput = element(by.model('list')); - * var output = element(by.binding('list | json')); - * listInput.sendKeys('abc\ndef\nghi'); - * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); - * }); - * - * - * - */ -var ngListDirective = function() { - return { - restrict: 'A', - priority: 100, - require: 'ngModel', - link: function(scope, element, attr, ctrl) { - var ngList = attr.ngList || ', '; - var trimValues = attr.ngTrim !== 'false'; - var separator = trimValues ? trim(ngList) : ngList; - - var parse = function(viewValue) { - // If the viewValue is invalid (say required but empty) it will be `undefined` - if (isUndefined(viewValue)) return; - - var list = []; - - if (viewValue) { - forEach(viewValue.split(separator), function(value) { - if (value) list.push(trimValues ? trim(value) : value); - }); - } - - return list; - }; - - ctrl.$parsers.push(parse); - ctrl.$formatters.push(function(value) { - if (isArray(value)) { - return value.join(ngList); - } - - return undefined; - }); - - // Override the standard $isEmpty because an empty array means the input is empty. - ctrl.$isEmpty = function(value) { - return !value || !value.length; - }; - } - }; -}; - -/* global VALID_CLASS: true, - INVALID_CLASS: true, - PRISTINE_CLASS: true, - DIRTY_CLASS: true, - UNTOUCHED_CLASS: true, - TOUCHED_CLASS: true, - PENDING_CLASS: true, - addSetValidityMethod: true, - setupValidity: true, - defaultModelOptions: false -*/ - - -var VALID_CLASS = 'ng-valid', - INVALID_CLASS = 'ng-invalid', - PRISTINE_CLASS = 'ng-pristine', - DIRTY_CLASS = 'ng-dirty', - UNTOUCHED_CLASS = 'ng-untouched', - TOUCHED_CLASS = 'ng-touched', - EMPTY_CLASS = 'ng-empty', - NOT_EMPTY_CLASS = 'ng-not-empty'; - -var ngModelMinErr = minErr('ngModel'); - -/** - * @ngdoc type - * @name ngModel.NgModelController - * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a - * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue - * is set. - * - * @property {*} $modelValue The value in the model that the control is bound to. - * - * @property {Array.} $parsers Array of functions to execute, as a pipeline, whenever - * the control updates the ngModelController with a new {@link ngModel.NgModelController#$viewValue - `$viewValue`} from the DOM, usually via user input. - See {@link ngModel.NgModelController#$setViewValue `$setViewValue()`} for a detailed lifecycle explanation. - Note that the `$parsers` are not called when the bound ngModel expression changes programmatically. - - The functions are called in array order, each passing - its return value through to the next. The last return value is forwarded to the - {@link ngModel.NgModelController#$validators `$validators`} collection. - - Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue - `$viewValue`}. - - Returning `undefined` from a parser means a parse error occurred. In that case, - no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel` - will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`} - is set to `true`. The parse error is stored in `ngModel.$error.parse`. - - This simple example shows a parser that would convert text input value to lowercase: - * ```js - * function parse(value) { - * if (value) { - * return value.toLowerCase(); - * } - * } - * ngModelController.$parsers.push(parse); - * ``` - - * - * @property {Array.} $formatters Array of functions to execute, as a pipeline, whenever - the bound ngModel expression changes programmatically. The `$formatters` are not called when the - value of the control is changed by user interaction. - - Formatters are used to format / convert the {@link ngModel.NgModelController#$modelValue - `$modelValue`} for display in the control. - - The functions are called in reverse array order, each passing the value through to the - next. The last return value is used as the actual DOM value. - - This simple example shows a formatter that would convert the model value to uppercase: - - * ```js - * function format(value) { - * if (value) { - * return value.toUpperCase(); - * } - * } - * ngModel.$formatters.push(format); - * ``` - * - * @property {Object.} $validators A collection of validators that are applied - * whenever the model value changes. The key value within the object refers to the name of the - * validator while the function refers to the validation operation. The validation operation is - * provided with the model value as an argument and must return a true or false value depending - * on the response of that validation. - * - * ```js - * ngModel.$validators.validCharacters = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * return /[0-9]+/.test(value) && - * /[a-z]+/.test(value) && - * /[A-Z]+/.test(value) && - * /\W+/.test(value); - * }; - * ``` - * - * @property {Object.} $asyncValidators A collection of validations that are expected to - * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided - * is expected to return a promise when it is run during the model validation process. Once the promise - * is delivered then the validation status will be set to true when fulfilled and false when rejected. - * When the asynchronous validators are triggered, each of the validators will run in parallel and the model - * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator - * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators - * will only run once all synchronous validators have passed. - * - * Please note that if $http is used then it is important that the server returns a success HTTP response code - * in order to fulfill the validation and a status level of `4xx` in order to reject the validation. - * - * ```js - * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * - * // Lookup user by username - * return $http.get('/api/users/' + value). - * then(function resolved() { - * //username exists, this means validation fails - * return $q.reject('exists'); - * }, function rejected() { - * //username does not exist, therefore this validation passes - * return true; - * }); - * }; - * ``` - * - * @property {Array.} $viewChangeListeners Array of functions to execute whenever - * a change to {@link ngModel.NgModelController#$viewValue `$viewValue`} has caused a change - * to {@link ngModel.NgModelController#$modelValue `$modelValue`}. - * It is called with no arguments, and its return value is ignored. - * This can be used in place of additional $watches against the model value. - * - * @property {Object} $error An object hash with all failing validator ids as keys. - * @property {Object} $pending An object hash with all pending validator ids as keys. - * - * @property {boolean} $untouched True if control has not lost focus yet. - * @property {boolean} $touched True if control has lost focus. - * @property {boolean} $pristine True if user has not interacted with the control yet. - * @property {boolean} $dirty True if user has already interacted with the control. - * @property {boolean} $valid True if there is no error. - * @property {boolean} $invalid True if at least one error on the control. - * @property {string} $name The name attribute of the control. - * - * @description - * - * `NgModelController` provides API for the {@link ngModel `ngModel`} directive. - * The controller contains services for data-binding, validation, CSS updates, and value formatting - * and parsing. It purposefully does not contain any logic which deals with DOM rendering or - * listening to DOM events. - * Such DOM related logic should be provided by other directives which make use of - * `NgModelController` for data-binding to control elements. - * AngularJS provides this DOM logic for most {@link input `input`} elements. - * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example - * custom control example} that uses `ngModelController` to bind to `contenteditable` elements. - * - * @example - * ### Custom Control Example - * This example shows how to use `NgModelController` with a custom control to achieve - * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) - * collaborate together to achieve the desired result. - * - * `contenteditable` is an HTML5 attribute, which tells the browser to let the element - * contents be edited in place by the user. - * - * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize} - * module to automatically remove "bad" content like inline event listener (e.g. ``). - * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks - * that content using the `$sce` service. - * - * - - [contenteditable] { - border: 1px solid black; - background-color: white; - min-height: 20px; - } - - .ng-invalid { - border: 1px solid red; - } - - - - angular.module('customControl', ['ngSanitize']). - directive('contenteditable', ['$sce', function($sce) { - return { - restrict: 'A', // only activate on element attribute - require: '?ngModel', // get a hold of NgModelController - link: function(scope, element, attrs, ngModel) { - if (!ngModel) return; // do nothing if no ng-model - - // Specify how UI should be updated - ngModel.$render = function() { - element.html($sce.getTrustedHtml(ngModel.$viewValue || '')); - }; - - // Listen for change events to enable binding - element.on('blur keyup change', function() { - scope.$evalAsync(read); - }); - read(); // initialize - - // Write data to the model - function read() { - var html = element.html(); - // When we clear the content editable the browser leaves a
behind - // If strip-br attribute is provided then we strip this out - if (attrs.stripBr && html === '
') { - html = ''; - } - ngModel.$setViewValue(html); - } - } - }; - }]); -
- -
-
Change me!
- Required! -
- -
-
- - it('should data-bind and become invalid', function() { - if (browser.params.browser === 'safari' || browser.params.browser === 'firefox') { - // SafariDriver can't handle contenteditable - // and Firefox driver can't clear contenteditables very well - return; - } - var contentEditable = element(by.css('[contenteditable]')); - var content = 'Change me!'; - - expect(contentEditable.getText()).toEqual(content); - - contentEditable.clear(); - contentEditable.sendKeys(protractor.Key.BACK_SPACE); - expect(contentEditable.getText()).toEqual(''); - expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/); - }); - - *
- * - * - */ -NgModelController.$inject = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$q', '$interpolate']; -function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) { - this.$viewValue = Number.NaN; - this.$modelValue = Number.NaN; - this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity. - this.$validators = {}; - this.$asyncValidators = {}; - this.$parsers = []; - this.$formatters = []; - this.$viewChangeListeners = []; - this.$untouched = true; - this.$touched = false; - this.$pristine = true; - this.$dirty = false; - this.$valid = true; - this.$invalid = false; - this.$error = {}; // keep invalid keys here - this.$$success = {}; // keep valid keys here - this.$pending = undefined; // keep pending keys here - this.$name = $interpolate($attr.name || '', false)($scope); - this.$$parentForm = nullFormCtrl; - this.$options = defaultModelOptions; - this.$$updateEvents = ''; - // Attach the correct context to the event handler function for updateOn - this.$$updateEventHandler = this.$$updateEventHandler.bind(this); - - this.$$parsedNgModel = $parse($attr.ngModel); - this.$$parsedNgModelAssign = this.$$parsedNgModel.assign; - this.$$ngModelGet = this.$$parsedNgModel; - this.$$ngModelSet = this.$$parsedNgModelAssign; - this.$$pendingDebounce = null; - this.$$parserValid = undefined; - this.$$parserName = 'parse'; - - this.$$currentValidationRunId = 0; - - this.$$scope = $scope; - this.$$rootScope = $scope.$root; - this.$$attr = $attr; - this.$$element = $element; - this.$$animate = $animate; - this.$$timeout = $timeout; - this.$$parse = $parse; - this.$$q = $q; - this.$$exceptionHandler = $exceptionHandler; - - setupValidity(this); - setupModelWatcher(this); -} - -NgModelController.prototype = { - $$initGetterSetters: function() { - if (this.$options.getOption('getterSetter')) { - var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'), - invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)'); - - this.$$ngModelGet = function($scope) { - var modelValue = this.$$parsedNgModel($scope); - if (isFunction(modelValue)) { - modelValue = invokeModelGetter($scope); - } - return modelValue; - }; - this.$$ngModelSet = function($scope, newValue) { - if (isFunction(this.$$parsedNgModel($scope))) { - invokeModelSetter($scope, {$$$p: newValue}); - } else { - this.$$parsedNgModelAssign($scope, newValue); - } - }; - } else if (!this.$$parsedNgModel.assign) { - throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}', - this.$$attr.ngModel, startingTag(this.$$element)); - } - }, - - - /** - * @ngdoc method - * @name ngModel.NgModelController#$render - * - * @description - * Called when the view needs to be updated. It is expected that the user of the ng-model - * directive will implement this method. - * - * The `$render()` method is invoked in the following situations: - * - * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last - * committed value then `$render()` is called to update the input control. - * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and - * the `$viewValue` are different from last time. - * - * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of - * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue` - * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be - * invoked if you only change a property on the objects. - */ - $render: noop, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$isEmpty - * - * @description - * This is called when we need to determine if the value of an input is empty. - * - * For instance, the required directive does this to work out if the input has data or not. - * - * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`. - * - * You can override this for input directives whose concept of being empty is different from the - * default. The `checkboxInputType` directive does this because in its case a value of `false` - * implies empty. - * - * @param {*} value The value of the input to check for emptiness. - * @returns {boolean} True if `value` is "empty". - */ - $isEmpty: function(value) { - // eslint-disable-next-line no-self-compare - return isUndefined(value) || value === '' || value === null || value !== value; - }, - - $$updateEmptyClasses: function(value) { - if (this.$isEmpty(value)) { - this.$$animate.removeClass(this.$$element, NOT_EMPTY_CLASS); - this.$$animate.addClass(this.$$element, EMPTY_CLASS); - } else { - this.$$animate.removeClass(this.$$element, EMPTY_CLASS); - this.$$animate.addClass(this.$$element, NOT_EMPTY_CLASS); - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setPristine - * - * @description - * Sets the control to its pristine state. - * - * This method can be called to remove the `ng-dirty` class and set the control to its pristine - * state (`ng-pristine` class). A model is considered to be pristine when the control - * has not been changed from when first compiled. - */ - $setPristine: function() { - this.$dirty = false; - this.$pristine = true; - this.$$animate.removeClass(this.$$element, DIRTY_CLASS); - this.$$animate.addClass(this.$$element, PRISTINE_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setDirty - * - * @description - * Sets the control to its dirty state. - * - * This method can be called to remove the `ng-pristine` class and set the control to its dirty - * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed - * from when first compiled. - */ - $setDirty: function() { - this.$dirty = true; - this.$pristine = false; - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setUntouched - * - * @description - * Sets the control to its untouched state. - * - * This method can be called to remove the `ng-touched` class and set the control to its - * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched - * by default, however this function can be used to restore that state if the model has - * already been touched by the user. - */ - $setUntouched: function() { - this.$touched = false; - this.$untouched = true; - this.$$animate.setClass(this.$$element, UNTOUCHED_CLASS, TOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setTouched - * - * @description - * Sets the control to its touched state. - * - * This method can be called to remove the `ng-untouched` class and set the control to its - * touched state (`ng-touched` class). A model is considered to be touched when the user has - * first focused the control element and then shifted focus away from the control (blur event). - */ - $setTouched: function() { - this.$touched = true; - this.$untouched = false; - this.$$animate.setClass(this.$$element, TOUCHED_CLASS, UNTOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$rollbackViewValue - * - * @description - * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`, - * which may be caused by a pending debounced event or because the input is waiting for some - * future event. - * - * If you have an input that uses `ng-model-options` to set up debounced updates or updates that - * depend on special events such as `blur`, there can be a period when the `$viewValue` is out of - * sync with the ngModel's `$modelValue`. - * - * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update - * and reset the input to the last committed view value. - * - * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue` - * programmatically before these debounced/future events have resolved/occurred, because AngularJS's - * dirty checking mechanism is not able to tell whether the model has actually changed or not. - * - * The `$rollbackViewValue()` method should be called before programmatically changing the model of an - * input which may have such events pending. This is important in order to make sure that the - * input field will be updated with the new model value and any pending operations are cancelled. - * - * @example - * - * - * angular.module('cancel-update-example', []) - * - * .controller('CancelUpdateController', ['$scope', function($scope) { - * $scope.model = {value1: '', value2: ''}; - * - * $scope.setEmpty = function(e, value, rollback) { - * if (e.keyCode === 27) { - * e.preventDefault(); - * if (rollback) { - * $scope.myForm[value].$rollbackViewValue(); - * } - * $scope.model[value] = ''; - * } - * }; - * }]); - * - * - *
- *

Both of these inputs are only updated if they are blurred. Hitting escape should - * empty them. Follow these steps and observe the difference:

- *
    - *
  1. Type something in the input. You will see that the model is not yet updated
  2. - *
  3. Press the Escape key. - *
      - *
    1. In the first example, nothing happens, because the model is already '', and no - * update is detected. If you blur the input, the model will be set to the current view. - *
    2. - *
    3. In the second example, the pending update is cancelled, and the input is set back - * to the last committed view value (''). Blurring the input does nothing. - *
    4. - *
    - *
  4. - *
- * - *
- *
- *

Without $rollbackViewValue():

- * - * value1: "{{ model.value1 }}" - *
- * - *
- *

With $rollbackViewValue():

- * - * value2: "{{ model.value2 }}" - *
- *
- *
- *
- - div { - display: table-cell; - } - div:nth-child(1) { - padding-right: 30px; - } - - - *
- */ - $rollbackViewValue: function() { - this.$$timeout.cancel(this.$$pendingDebounce); - this.$viewValue = this.$$lastCommittedViewValue; - this.$render(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$validate - * - * @description - * Runs each of the registered validators (first synchronous validators and then - * asynchronous validators). - * If the validity changes to invalid, the model will be set to `undefined`, - * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`. - * If the validity changes to valid, it will set the model to the last available valid - * `$modelValue`, i.e. either the last parsed value or the last value set from the scope. - */ - $validate: function() { - - // ignore $validate before model is initialized - if (isNumberNaN(this.$modelValue)) { - return; - } - - var viewValue = this.$$lastCommittedViewValue; - // Note: we use the $$rawModelValue as $modelValue might have been - // set to undefined during a view -> model update that found validation - // errors. We can't parse the view here, since that could change - // the model although neither viewValue nor the model on the scope changed - var modelValue = this.$$rawModelValue; - - var prevValid = this.$valid; - var prevModelValue = this.$modelValue; - - var allowInvalid = this.$options.getOption('allowInvalid'); - - var that = this; - this.$$runValidators(modelValue, viewValue, function(allValid) { - // If there was no change in validity, don't update the model - // This prevents changing an invalid modelValue to undefined - if (!allowInvalid && prevValid !== allValid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }); - }, - - $$runValidators: function(modelValue, viewValue, doneCallback) { - this.$$currentValidationRunId++; - var localValidationRunId = this.$$currentValidationRunId; - var that = this; - - // check parser error - if (!processParseErrors()) { - validationDone(false); - return; - } - if (!processSyncValidators()) { - validationDone(false); - return; - } - processAsyncValidators(); - - function processParseErrors() { - var errorKey = that.$$parserName; - - if (isUndefined(that.$$parserValid)) { - setValidity(errorKey, null); - } else { - if (!that.$$parserValid) { - forEach(that.$validators, function(v, name) { - setValidity(name, null); - }); - forEach(that.$asyncValidators, function(v, name) { - setValidity(name, null); - }); - } - - // Set the parse error last, to prevent unsetting it, should a $validators key == parserName - setValidity(errorKey, that.$$parserValid); - return that.$$parserValid; - } - return true; - } - - function processSyncValidators() { - var syncValidatorsValid = true; - forEach(that.$validators, function(validator, name) { - var result = Boolean(validator(modelValue, viewValue)); - syncValidatorsValid = syncValidatorsValid && result; - setValidity(name, result); - }); - if (!syncValidatorsValid) { - forEach(that.$asyncValidators, function(v, name) { - setValidity(name, null); - }); - return false; - } - return true; - } - - function processAsyncValidators() { - var validatorPromises = []; - var allValid = true; - forEach(that.$asyncValidators, function(validator, name) { - var promise = validator(modelValue, viewValue); - if (!isPromiseLike(promise)) { - throw ngModelMinErr('nopromise', - 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); - } - setValidity(name, undefined); - validatorPromises.push(promise.then(function() { - setValidity(name, true); - }, function() { - allValid = false; - setValidity(name, false); - })); - }); - if (!validatorPromises.length) { - validationDone(true); - } else { - that.$$q.all(validatorPromises).then(function() { - validationDone(allValid); - }, noop); - } - } - - function setValidity(name, isValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - that.$setValidity(name, isValid); - } - } - - function validationDone(allValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - - doneCallback(allValid); - } - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$commitViewValue - * - * @description - * Commit a pending update to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. this method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function() { - var viewValue = this.$viewValue; - - this.$$timeout.cancel(this.$$pendingDebounce); - - // If the view value has not changed then we should just exit, except in the case where there is - // a native validator on the element. In this case the validation state may have changed even though - // the viewValue has stayed empty. - if (this.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !this.$$hasNativeValidators)) { - return; - } - this.$$updateEmptyClasses(viewValue); - this.$$lastCommittedViewValue = viewValue; - - // change to dirty - if (this.$pristine) { - this.$setDirty(); - } - this.$$parseAndValidate(); - }, - - $$parseAndValidate: function() { - var viewValue = this.$$lastCommittedViewValue; - var modelValue = viewValue; - var that = this; - - this.$$parserValid = isUndefined(modelValue) ? undefined : true; - - // Reset any previous parse error - this.$setValidity(this.$$parserName, null); - this.$$parserName = 'parse'; - - if (this.$$parserValid) { - for (var i = 0; i < this.$parsers.length; i++) { - modelValue = this.$parsers[i](modelValue); - if (isUndefined(modelValue)) { - this.$$parserValid = false; - break; - } - } - } - if (isNumberNaN(this.$modelValue)) { - // this.$modelValue has not been touched yet... - this.$modelValue = this.$$ngModelGet(this.$$scope); - } - var prevModelValue = this.$modelValue; - var allowInvalid = this.$options.getOption('allowInvalid'); - this.$$rawModelValue = modelValue; - - if (allowInvalid) { - this.$modelValue = modelValue; - writeToModelIfNeeded(); - } - - // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date. - // This can happen if e.g. $setViewValue is called from inside a parser - this.$$runValidators(modelValue, this.$$lastCommittedViewValue, function(allValid) { - if (!allowInvalid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - writeToModelIfNeeded(); - } - }); - - function writeToModelIfNeeded() { - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }, - - $$writeModelToScope: function() { - this.$$ngModelSet(this.$$scope, this.$modelValue); - forEach(this.$viewChangeListeners, function(listener) { - try { - listener(); - } catch (e) { - // eslint-disable-next-line no-invalid-this - this.$$exceptionHandler(e); - } - }, this); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setViewValue - * - * @description - * Update the view value. - * - * This method should be called when a control wants to change the view value; typically, - * this is done from within a DOM event handler. For example, the {@link ng.directive:input input} - * directive calls it when the value of the input changes and {@link ng.directive:select select} - * calls it when an option is selected. - * - * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers` - * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged - * value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and - * `$asyncValidators` are called and the value is applied to `$modelValue`. - * Finally, the value is set to the **expression** specified in the `ng-model` attribute and - * all the registered change listeners, in the `$viewChangeListeners` list are called. - * - * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn` - * and the `default` trigger is not listed, all those actions will remain pending until one of the - * `updateOn` events is triggered on the DOM element. - * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions} - * directive is used with a custom debounce for this particular event. - * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce` - * is specified, once the timer runs out. - * - * When used with standard inputs, the view value will always be a string (which is in some cases - * parsed into another type, such as a `Date` object for `input[date]`.) - * However, custom controls might also pass objects to this method. In this case, we should make - * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not - * perform a deep watch of objects, it only looks for a change of identity. If you only change - * the property of the object then ngModel will not realize that the object has changed and - * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should - * not change properties of the copy once it has been passed to `$setViewValue`. - * Otherwise you may cause the model value on the scope to change incorrectly. - * - *
- * In any case, the value passed to the method should always reflect the current value - * of the control. For example, if you are calling `$setViewValue` for an input element, - * you should pass the input DOM value. Otherwise, the control and the scope model become - * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change - * the control's DOM value in any way. If we want to change the control's DOM value - * programmatically, we should update the `ngModel` scope expression. Its new value will be - * picked up by the model controller, which will run it through the `$formatters`, `$render` it - * to update the DOM, and finally call `$validate` on it. - *
- * - * @param {*} value value from the view. - * @param {string} trigger Event that triggered the update. - */ - $setViewValue: function(value, trigger) { - this.$viewValue = value; - if (this.$options.getOption('updateOnDefault')) { - this.$$debounceViewValueCommit(trigger); - } - }, - - $$debounceViewValueCommit: function(trigger) { - var debounceDelay = this.$options.getOption('debounce'); - - if (isNumber(debounceDelay[trigger])) { - debounceDelay = debounceDelay[trigger]; - } else if (isNumber(debounceDelay['default']) && - this.$options.getOption('updateOn').indexOf(trigger) === -1 - ) { - debounceDelay = debounceDelay['default']; - } else if (isNumber(debounceDelay['*'])) { - debounceDelay = debounceDelay['*']; - } - - this.$$timeout.cancel(this.$$pendingDebounce); - var that = this; - if (debounceDelay > 0) { // this fails if debounceDelay is an object - this.$$pendingDebounce = this.$$timeout(function() { - that.$commitViewValue(); - }, debounceDelay); - } else if (this.$$rootScope.$$phase) { - this.$commitViewValue(); - } else { - this.$$scope.$apply(function() { - that.$commitViewValue(); - }); - } - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$overrideModelOptions - * - * @description - * - * Override the current model options settings programmatically. - * - * The previous `ModelOptions` value will not be modified. Instead, a - * new `ModelOptions` object will inherit from the previous one overriding - * or inheriting settings that are defined in the given parameter. - * - * See {@link ngModelOptions} for information about what options can be specified - * and how model option inheritance works. - * - *
- * **Note:** this function only affects the options set on the `ngModelController`, - * and not the options on the {@link ngModelOptions} directive from which they might have been - * obtained initially. - *
- * - *
- * **Note:** it is not possible to override the `getterSetter` option. - *
- * - * @param {Object} options a hash of settings to override the previous options - * - */ - $overrideModelOptions: function(options) { - this.$options = this.$options.createChild(options); - this.$$setUpdateOnEvents(); - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$processModelValue - - * @description - * - * Runs the model -> view pipeline on the current - * {@link ngModel.NgModelController#$modelValue $modelValue}. - * - * The following actions are performed by this method: - * - * - the `$modelValue` is run through the {@link ngModel.NgModelController#$formatters $formatters} - * and the result is set to the {@link ngModel.NgModelController#$viewValue $viewValue} - * - the `ng-empty` or `ng-not-empty` class is set on the element - * - if the `$viewValue` has changed: - * - {@link ngModel.NgModelController#$render $render} is called on the control - * - the {@link ngModel.NgModelController#$validators $validators} are run and - * the validation status is set. - * - * This method is called by ngModel internally when the bound scope value changes. - * Application developers usually do not have to call this function themselves. - * - * This function can be used when the `$viewValue` or the rendered DOM value are not correctly - * formatted and the `$modelValue` must be run through the `$formatters` again. - * - * @example - * Consider a text input with an autocomplete list (for fruit), where the items are - * objects with a name and an id. - * A user enters `ap` and then selects `Apricot` from the list. - * Based on this, the autocomplete widget will call `$setViewValue({name: 'Apricot', id: 443})`, - * but the rendered value will still be `ap`. - * The widget can then call `ctrl.$processModelValue()` to run the model -> view - * pipeline again, which formats the object to the string `Apricot`, - * then updates the `$viewValue`, and finally renders it in the DOM. - * - * - -
-
- Search Fruit: - -
-
- Model:
-
{{selectedFruit | json}}
-
-
-
- - angular.module('inputExample', []) - .controller('inputController', function($scope) { - $scope.items = [ - {name: 'Apricot', id: 443}, - {name: 'Clementine', id: 972}, - {name: 'Durian', id: 169}, - {name: 'Jackfruit', id: 982}, - {name: 'Strawberry', id: 863} - ]; - }) - .component('basicAutocomplete', { - bindings: { - items: '<', - onSelect: '&' - }, - templateUrl: 'autocomplete.html', - controller: function($element, $scope) { - var that = this; - var ngModel; - - that.$postLink = function() { - ngModel = $element.find('input').controller('ngModel'); - - ngModel.$formatters.push(function(value) { - return (value && value.name) || value; - }); - - ngModel.$parsers.push(function(value) { - var match = value; - for (var i = 0; i < that.items.length; i++) { - if (that.items[i].name === value) { - match = that.items[i]; - break; - } - } - - return match; - }); - }; - - that.selectItem = function(item) { - ngModel.$setViewValue(item); - ngModel.$processModelValue(); - that.onSelect({item: item}); - }; - } - }); - - -
- -
    -
  • - -
  • -
-
-
- *
- * - */ - $processModelValue: function() { - var viewValue = this.$$format(); - - if (this.$viewValue !== viewValue) { - this.$$updateEmptyClasses(viewValue); - this.$viewValue = this.$$lastCommittedViewValue = viewValue; - this.$render(); - // It is possible that model and view value have been updated during render - this.$$runValidators(this.$modelValue, this.$viewValue, noop); - } - }, - - /** - * This method is called internally to run the $formatters on the $modelValue - */ - $$format: function() { - var formatters = this.$formatters, - idx = formatters.length; - - var viewValue = this.$modelValue; - while (idx--) { - viewValue = formatters[idx](viewValue); - } - - return viewValue; - }, - - /** - * This method is called internally when the bound scope value changes. - */ - $$setModelValue: function(modelValue) { - this.$modelValue = this.$$rawModelValue = modelValue; - this.$$parserValid = undefined; - this.$processModelValue(); - }, - - $$setUpdateOnEvents: function() { - if (this.$$updateEvents) { - this.$$element.off(this.$$updateEvents, this.$$updateEventHandler); - } - - this.$$updateEvents = this.$options.getOption('updateOn'); - if (this.$$updateEvents) { - this.$$element.on(this.$$updateEvents, this.$$updateEventHandler); - } - }, - - $$updateEventHandler: function(ev) { - this.$$debounceViewValueCommit(ev && ev.type); - } -}; - -function setupModelWatcher(ctrl) { - // model -> value - // Note: we cannot use a normal scope.$watch as we want to detect the following: - // 1. scope value is 'a' - // 2. user enters 'b' - // 3. ng-change kicks in and reverts scope value to 'a' - // -> scope value did not change since the last digest as - // ng-change executes in apply phase - // 4. view should be changed back to 'a' - ctrl.$$scope.$watch(function ngModelWatch(scope) { - var modelValue = ctrl.$$ngModelGet(scope); - - // if scope model value and ngModel value are out of sync - // This cannot be moved to the action function, because it would not catch the - // case where the model is changed in the ngChange function or the model setter - if (modelValue !== ctrl.$modelValue && - // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator - // eslint-disable-next-line no-self-compare - (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue) - ) { - ctrl.$$setModelValue(modelValue); - } - - return modelValue; - }); -} - -/** - * @ngdoc method - * @name ngModel.NgModelController#$setValidity - * - * @description - * Change the validity state, and notify the form. - * - * This method can be called within $parsers/$formatters or a custom validation implementation. - * However, in most cases it should be sufficient to use the `ngModel.$validators` and - * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned - * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` - * (for unfulfilled `$asyncValidators`), so that it is available for data-binding. - * The `validationErrorKey` should be in camelCase and will get converted into dash-case - * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` - * classes and can be bound to as `{{ someForm.someControl.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined), - * or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and - * when `$asyncValidators` do not run because any of the `$validators` failed. - */ -addSetValidityMethod({ - clazz: NgModelController, - set: function(object, property) { - object[property] = true; - }, - unset: function(object, property) { - delete object[property]; - } -}); - - -/** - * @ngdoc directive - * @name ngModel - * @restrict A - * @priority 1 - * @param {expression} ngModel assignable {@link guide/expression Expression} to bind to. - * - * @description - * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a - * property on the scope using {@link ngModel.NgModelController NgModelController}, - * which is created and exposed by this directive. - * - * `ngModel` is responsible for: - * - * - Binding the view into the model, which other directives such as `input`, `textarea` or `select` - * require. - * - Providing validation behavior (i.e. required, number, email, url). - * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors). - * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, - * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations. - * - Registering the control with its parent {@link ng.directive:form form}. - * - * Note: `ngModel` will try to bind to the property given by evaluating the expression on the - * current scope. If the property doesn't already exist on this scope, it will be created - * implicitly and added to the scope. - * - * For best practices on using `ngModel`, see: - * - * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) - * - * For basic examples, how to use `ngModel`, see: - * - * - {@link ng.directive:input input} - * - {@link input[text] text} - * - {@link input[checkbox] checkbox} - * - {@link input[radio] radio} - * - {@link input[number] number} - * - {@link input[email] email} - * - {@link input[url] url} - * - {@link input[date] date} - * - {@link input[datetime-local] datetime-local} - * - {@link input[time] time} - * - {@link input[month] month} - * - {@link input[week] week} - * - {@link ng.directive:select select} - * - {@link ng.directive:textarea textarea} - * - * ## Complex Models (objects or collections) - * - * By default, `ngModel` watches the model by reference, not value. This is important to know when - * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the - * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered. - * - * The model must be assigned an entirely new object or collection before a re-rendering will occur. - * - * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression - * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or - * if the select is given the `multiple` attribute. - * - * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the - * first level of the object (or only changing the properties of an item in the collection if it's an array) will still - * not trigger a re-rendering of the model. - * - * ## CSS classes - * The following CSS classes are added and removed on the associated input/select/textarea element - * depending on the validity of the model. - * - * - `ng-valid`: the model is valid - * - `ng-invalid`: the model is invalid - * - `ng-valid-[key]`: for each valid key added by `$setValidity` - * - `ng-invalid-[key]`: for each invalid key added by `$setValidity` - * - `ng-pristine`: the control hasn't been interacted with yet - * - `ng-dirty`: the control has been interacted with - * - `ng-touched`: the control has been blurred - * - `ng-untouched`: the control hasn't been blurred - * - `ng-pending`: any `$asyncValidators` are unfulfilled - * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined - * by the {@link ngModel.NgModelController#$isEmpty} method - * - `ng-not-empty`: the view contains a non-empty value - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * @animations - * Animations within models are triggered when any of the associated CSS classes are added and removed - * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`, - * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself. - * The animations that are triggered within ngModel are similar to how they work in ngClass and - * animations can be hooked into using CSS transitions, keyframes as well as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style an input element - * that has been rendered as invalid after it has been validated: - * - *
- * //be sure to include ngAnimate as a module to hook into more
- * //advanced animations
- * .my-input {
- *   transition:0.5s linear all;
- *   background: white;
- * }
- * .my-input.ng-invalid {
- *   background: red;
- *   color:white;
- * }
- * 
- * - * @example - * ### Basic Usage - * - - - -

- Update input to see transitions when valid/invalid. - Integer is a valid value. -

-
- -
-
- *
- * - * @example - * ### Binding to a getter/setter - * - * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a - * function that returns a representation of the model when called with zero arguments, and sets - * the internal state of a model when called with an argument. It's sometimes useful to use this - * for models that have an internal representation that's different from what the model exposes - * to the view. - * - *
- * **Best Practice:** It's best to keep getters fast because AngularJS is likely to call them more - * frequently than other parts of your code. - *
- * - * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that - * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to - * a `
`, which will enable this behavior for all ``s within it. See - * {@link ng.directive:ngModelOptions `ngModelOptions`} for more. - * - * The following example shows how to use `ngModel` with a getter/setter: - * - * @example - * - -
- - - -
user.name = 
-
-
- - angular.module('getterSetterExample', []) - .controller('ExampleController', ['$scope', function($scope) { - var _name = 'Brian'; - $scope.user = { - name: function(newName) { - // Note that newName can be undefined for two reasons: - // 1. Because it is called as a getter and thus called with no arguments - // 2. Because the property should actually be set to undefined. This happens e.g. if the - // input is invalid - return arguments.length ? (_name = newName) : _name; - } - }; - }]); - - *
- */ -var ngModelDirective = ['$rootScope', function($rootScope) { - return { - restrict: 'A', - require: ['ngModel', '^?form', '^?ngModelOptions'], - controller: NgModelController, - // Prelink needs to run before any input directive - // so that we can set the NgModelOptions in NgModelController - // before anyone else uses it. - priority: 1, - compile: function ngModelCompile(element) { - // Setup initial state of the control - element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS); - - return { - pre: function ngModelPreLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0], - formCtrl = ctrls[1] || modelCtrl.$$parentForm, - optionsCtrl = ctrls[2]; - - if (optionsCtrl) { - modelCtrl.$options = optionsCtrl.$options; - } - - modelCtrl.$$initGetterSetters(); - - // notify others, especially parent forms - formCtrl.$addControl(modelCtrl); - - attr.$observe('name', function(newValue) { - if (modelCtrl.$name !== newValue) { - modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue); - } - }); - - scope.$on('$destroy', function() { - modelCtrl.$$parentForm.$removeControl(modelCtrl); - }); - }, - post: function ngModelPostLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0]; - modelCtrl.$$setUpdateOnEvents(); - - function setTouched() { - modelCtrl.$setTouched(); - } - - element.on('blur', function() { - if (modelCtrl.$touched) return; - - if ($rootScope.$$phase) { - scope.$evalAsync(setTouched); - } else { - scope.$apply(setTouched); - } - }); - } - }; - } - }; -}]; - -/* exported defaultModelOptions */ -var defaultModelOptions; -var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/; - -/** - * @ngdoc type - * @name ModelOptions - * @description - * A container for the options set by the {@link ngModelOptions} directive - */ -function ModelOptions(options) { - this.$$options = options; -} - -ModelOptions.prototype = { - - /** - * @ngdoc method - * @name ModelOptions#getOption - * @param {string} name the name of the option to retrieve - * @returns {*} the value of the option - * @description - * Returns the value of the given option - */ - getOption: function(name) { - return this.$$options[name]; - }, - - /** - * @ngdoc method - * @name ModelOptions#createChild - * @param {Object} options a hash of options for the new child that will override the parent's options - * @return {ModelOptions} a new `ModelOptions` object initialized with the given options. - */ - createChild: function(options) { - var inheritAll = false; - - // make a shallow copy - options = extend({}, options); - - // Inherit options from the parent if specified by the value `"$inherit"` - forEach(options, /** @this */ function(option, key) { - if (option === '$inherit') { - if (key === '*') { - inheritAll = true; - } else { - options[key] = this.$$options[key]; - // `updateOn` is special so we must also inherit the `updateOnDefault` option - if (key === 'updateOn') { - options.updateOnDefault = this.$$options.updateOnDefault; - } - } - } else { - if (key === 'updateOn') { - // If the `updateOn` property contains the `default` event then we have to remove - // it from the event list and set the `updateOnDefault` flag. - options.updateOnDefault = false; - options[key] = trim(option.replace(DEFAULT_REGEXP, function() { - options.updateOnDefault = true; - return ' '; - })); - } - } - }, this); - - if (inheritAll) { - // We have a property of the form: `"*": "$inherit"` - delete options['*']; - defaults(options, this.$$options); - } - - // Finally add in any missing defaults - defaults(options, defaultModelOptions.$$options); - - return new ModelOptions(options); - } -}; - - -defaultModelOptions = new ModelOptions({ - updateOn: '', - updateOnDefault: true, - debounce: 0, - getterSetter: false, - allowInvalid: false, - timezone: null -}); - - -/** - * @ngdoc directive - * @name ngModelOptions - * @restrict A - * @priority 10 - * - * @description - * This directive allows you to modify the behaviour of {@link ngModel} directives within your - * application. You can specify an `ngModelOptions` directive on any element. All {@link ngModel} - * directives will use the options of their nearest `ngModelOptions` ancestor. - * - * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as - * an AngularJS expression. This expression should evaluate to an object, whose properties contain - * the settings. For example: `
- *
- * - *
- *
- * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 0 } - * ``` - * - * Notice that the `debounce` setting was not inherited and used the default value instead. - * - * You can specify that all undefined settings are automatically inherited from an ancestor by - * including a property with key of `"*"` and value of `"$inherit"`. - * - * For example given the following fragment of HTML - * - * - * ```html - *
- *
- * - *
- *
- * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 200 } - * ``` - * - * Notice that the `debounce` setting now inherits the value from the outer `
` element. - * - * If you are creating a reusable component then you should be careful when using `"*": "$inherit"` - * since you may inadvertently inherit a setting in the future that changes the behavior of your component. - * - * - * ## Triggering and debouncing model updates - * - * The `updateOn` and `debounce` properties allow you to specify a custom list of events that will - * trigger a model update and/or a debouncing delay so that the actual update only takes place when - * a timer expires; this timer will be reset after another change takes place. - * - * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might - * be different from the value in the actual model. This means that if you update the model you - * should also invoke {@link ngModel.NgModelController#$rollbackViewValue} on the relevant input field in - * order to make sure it is synchronized with the model and that any debounced action is canceled. - * - * The easiest way to reference the control's {@link ngModel.NgModelController#$rollbackViewValue} - * method is by making sure the input is placed inside a form that has a `name` attribute. This is - * important because `form` controllers are published to the related scope under the name in their - * `name` attribute. - * - * Any pending changes will take place immediately when an enclosing form is submitted via the - * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * ### Overriding immediate updates - * - * The following example shows how to override immediate updates. Changes on the inputs within the - * form will update the model only when the control loses focus (blur event). If `escape` key is - * pressed while the input field is focused, the value is reset to the value in the current model. - * - * - * - *
- *
- *
- *
- *
- *
user.name = 
- *
- *
- * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say', data: '' }; - * - * $scope.cancel = function(e) { - * if (e.keyCode === 27) { - * $scope.userForm.userName.$rollbackViewValue(); - * } - * }; - * }]); - * - * - * var model = element(by.binding('user.name')); - * var input = element(by.model('user.name')); - * var other = element(by.model('user.data')); - * - * it('should allow custom events', function() { - * input.sendKeys(' hello'); - * input.click(); - * expect(model.getText()).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say hello'); - * }); - * - * it('should $rollbackViewValue when model changes', function() { - * input.sendKeys(' hello'); - * expect(input.getAttribute('value')).toEqual('say hello'); - * input.sendKeys(protractor.Key.ESCAPE); - * expect(input.getAttribute('value')).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say'); - * }); - * - *
- * - * ### Debouncing updates - * - * The next example shows how to debounce model changes. Model will be updated only 1 sec after last change. - * If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty. - * - * - * - *
- *
- * Name: - * - *
- *
- *
user.name = 
- *
- *
- * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say' }; - * }]); - * - *
- * - * ### Default events, extra triggers, and catch-all debounce values - * - * This example shows the relationship between "default" update events and - * additional `updateOn` triggers. - * - * `default` events are those that are bound to the control, and when fired, update the `$viewValue` - * via {@link ngModel.NgModelController#$setViewValue $setViewValue}. Every event that is not listed - * in `updateOn` is considered a "default" event, since different control types have different - * default events. - * - * The control in this example updates by "default", "click", and "blur", with different `debounce` - * values. You can see that "click" doesn't have an individual `debounce` value - - * therefore it uses the `*` debounce value. - * - * There is also a button that calls {@link ngModel.NgModelController#$setViewValue $setViewValue} - * directly with a "custom" event. Since "custom" is not defined in the `updateOn` list, - * it is considered a "default" event and will update the - * control if "default" is defined in `updateOn`, and will receive the "default" debounce value. - * Note that this is just to illustrate how custom controls would possibly call `$setViewValue`. - * - * You can change the `updateOn` and `debounce` configuration to test different scenarios. This - * is done with {@link ngModel.NgModelController#$overrideModelOptions $overrideModelOptions}. - * - - - - - - angular.module('optionsExample', []) - .component('modelUpdateDemo', { - templateUrl: 'template.html', - controller: function() { - this.name = 'Chinua'; - - this.options = { - updateOn: 'default blur click', - debounce: { - default: 2000, - blur: 0, - '*': 1000 - } - }; - - this.updateEvents = function() { - var eventList = this.options.updateOn.split(' '); - eventList.push('*'); - var events = {}; - - for (var i = 0; i < eventList.length; i++) { - events[eventList[i]] = this.options.debounce[eventList[i]]; - } - - this.events = events; - }; - - this.updateOptions = function() { - var options = angular.extend(this.options, { - updateOn: Object.keys(this.events).join(' ').replace('*', ''), - debounce: this.events - }); - - this.form.input.$overrideModelOptions(options); - }; - - // Initialize the event form - this.updateEvents(); - } - }); - - -
- Input: -
- Model: {{$ctrl.name}} -
- - -
-
- updateOn
- - - - - - - - - - - -
OptionDebounce value
{{key}}
- -
- -
-
-
- * - * - * ## Model updates and validation - * - * The default behaviour in `ngModel` is that the model value is set to `undefined` when the - * validation determines that the value is invalid. By setting the `allowInvalid` property to true, - * the model will still be updated even if the value is invalid. - * - * - * ## Connecting to the scope - * - * By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression - * on the scope refers to a "getter/setter" function rather than the value itself. - * - * The following example shows how to bind to getter/setters: - * - * - * - *
- *
- * - *
- *
user.name = 
- *
- *
- * - * angular.module('getterSetterExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * var _name = 'Brian'; - * $scope.user = { - * name: function(newName) { - * return angular.isDefined(newName) ? (_name = newName) : _name; - * } - * }; - * }]); - * - *
- * - * - * ## Programmatically changing options - * - * The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not - * watched for changes. However, it is possible to override the options on a single - * {@link ngModel.NgModelController} instance with - * {@link ngModel.NgModelController#$overrideModelOptions `NgModelController#$overrideModelOptions()`}. - * See also the example for - * {@link ngModelOptions#default-events-extra-triggers-and-catch-all-debounce-values - * Default events, extra triggers, and catch-all debounce values}. - * - * - * ## Specifying timezones - * - * You can specify the timezone that date/time input directives expect by providing its name in the - * `timezone` property. - * - * - * ## Formatting the value of `time` and `datetime-local` - * - * With the options `timeSecondsFormat` and `timeStripZeroSeconds` it is possible to adjust the value - * that is displayed in the control. Note that browsers may apply their own formatting - * in the user interface. - * - - - - - - angular.module('timeExample', []) - .component('timeExample', { - templateUrl: 'timeExample.html', - controller: function() { - this.time = new Date(1970, 0, 1, 14, 57, 0); - - this.options = { - timeSecondsFormat: 'ss', - timeStripZeroSeconds: true - }; - - this.optionChange = function() { - this.timeForm.timeFormatted.$overrideModelOptions(this.options); - this.time = new Date(this.time); - }; - } - }); - - -
- Default: -
- With options: - -
- - Options:
- timeSecondsFormat: - -
- timeStripZeroSeconds: - -
-
- *
- * - * @param {Object} ngModelOptions options to apply to {@link ngModel} directives on this element and - * and its descendents. - * - * **General options**: - * - * - `updateOn`: string specifying which event should the input be bound to. You can set several - * events using an space delimited list. There is a special event called `default` that - * matches the default events belonging to the control. These are the events that are bound to - * the control, and when fired, update the `$viewValue` via `$setViewValue`. - * - * `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event, - * since different control types use different default events. - * - * See also the section {@link ngModelOptions#triggering-and-debouncing-model-updates - * Triggering and debouncing model updates}. - * - * - `debounce`: integer value which contains the debounce model update value in milliseconds. A - * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a - * custom value for each event. For example: - * ``` - * ng-model-options="{ - * updateOn: 'default blur', - * debounce: { 'default': 500, 'blur': 0 } - * }" - * ``` - * You can use the `*` key to specify a debounce value that applies to all events that are not - * specifically listed. In the following example, `mouseup` would have a debounce delay of 1000: - * ``` - * ng-model-options="{ - * updateOn: 'default blur mouseup', - * debounce: { 'default': 500, 'blur': 0, '*': 1000 } - * }" - * ``` - * - `allowInvalid`: boolean value which indicates that the model can be set with values that did - * not validate correctly instead of the default behavior of setting the model to undefined. - * - `getterSetter`: boolean value which determines whether or not to treat functions bound to - * `ngModel` as getters/setters. - * - * - * **Input-type specific options**: - * - * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for - * ``, ``, ... . It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * Note that changing the timezone will have no effect on the current date, and is only applied after - * the next input / model change. - * - * - `timeSecondsFormat`: Defines if the `time` and `datetime-local` types should show seconds and - * milliseconds. The option follows the format string of {@link date date filter}. - * By default, the options is `undefined` which is equal to `'ss.sss'` (seconds and milliseconds). - * The other options are `'ss'` (strips milliseconds), and `''` (empty string), which strips both - * seconds and milliseconds. - * Note that browsers that support `time` and `datetime-local` require the hour and minutes - * part of the time string, and may show the value differently in the user interface. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - * - `timeStripZeroSeconds`: Defines if the `time` and `datetime-local` types should strip the - * seconds and milliseconds from the formatted value if they are zero. This option is applied - * after `timeSecondsFormat`. - * This option can be used to make the formatting consistent over different browsers, as some - * browsers with support for `time` will natively hide the milliseconds and - * seconds if they are zero, but others won't, and browsers that don't implement these input - * types will always show the full string. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - */ -var ngModelOptionsDirective = function() { - NgModelOptionsController.$inject = ['$attrs', '$scope']; - function NgModelOptionsController($attrs, $scope) { - this.$$attrs = $attrs; - this.$$scope = $scope; - } - NgModelOptionsController.prototype = { - $onInit: function() { - var parentOptions = this.parentCtrl ? this.parentCtrl.$options : defaultModelOptions; - var modelOptionsDefinition = this.$$scope.$eval(this.$$attrs.ngModelOptions); - - this.$options = parentOptions.createChild(modelOptionsDefinition); - } - }; - - return { - restrict: 'A', - // ngModelOptions needs to run before ngModel and input directives - priority: 10, - require: {parentCtrl: '?^^ngModelOptions'}, - bindToController: true, - controller: NgModelOptionsController - }; -}; - - -// shallow copy over values from `src` that are not already specified on `dst` -function defaults(dst, src) { - forEach(src, function(value, key) { - if (!isDefined(dst[key])) { - dst[key] = value; - } - }); -} - -/** - * @ngdoc directive - * @name ngNonBindable - * @restrict AC - * @priority 1000 - * @element ANY - * - * @description - * The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current - * DOM element, including directives on the element itself that have a lower priority than - * `ngNonBindable`. This is useful if the element contains what appears to be AngularJS directives - * and bindings but which should be ignored by AngularJS. This could be the case if you have a site - * that displays snippets of code, for instance. - * - * @example - * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, - * but the one wrapped in `ngNonBindable` is left alone. - * - - -
Normal: {{1 + 2}}
-
Ignored: {{1 + 2}}
-
- - it('should check ng-non-bindable', function() { - expect(element(by.binding('1 + 2')).getText()).toContain('3'); - expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/); - }); - -
- */ -var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); - -/* exported ngOptionsDirective */ - -/* global jqLiteRemove */ - -var ngOptionsMinErr = minErr('ngOptions'); - -/** - * @ngdoc directive - * @name ngOptions - * @restrict A - * - * @description - * - * The `ngOptions` attribute can be used to dynamically generate a list of `` - * DOM element. - * * `disable`: The result of this expression will be used to disable the rendered `