| 
									
										
										
										
											2018-03-03 14:15:50 -08:00
										 |  |  | import { observers } from './observers/observers' | 
					
						
							|  |  |  | import { computations } from './computations/computations' | 
					
						
							|  |  |  | import { mixins } from './mixins/mixins' | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  | import { LocalStorageStore } from './LocalStorageStore' | 
					
						
							| 
									
										
										
										
											2018-04-30 17:20:20 -07:00
										 |  |  | import { observe } from 'svelte-extras' | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  | const persistedState = { | 
					
						
							|  |  |  |   autoplayGifs: false, | 
					
						
							|  |  |  |   composeData: {}, | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  |   currentInstance: null, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   currentRegisteredInstanceName: undefined, | 
					
						
							|  |  |  |   currentRegisteredInstance: undefined, | 
					
						
							| 
									
										
										
										
											2019-04-05 18:27:44 +02:00
										 |  |  |   // we disable scrollbars by default on iOS
 | 
					
						
							|  |  |  |   disableCustomScrollbars: process.browser && /iP(?:hone|ad|od)/.test(navigator.userAgent), | 
					
						
							| 
									
										
										
										
											2019-06-01 13:07:31 -07:00
										 |  |  |   disableFavCounts: false, | 
					
						
							|  |  |  |   disableFollowerCounts: false, | 
					
						
							| 
									
										
										
										
											2019-01-13 14:02:15 -08:00
										 |  |  |   disableHotkeys: false, | 
					
						
							| 
									
										
										
										
											2019-05-28 22:46:01 -07:00
										 |  |  |   disableInfiniteScroll: false, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   disableLongAriaLabels: false, | 
					
						
							| 
									
										
										
										
											2019-06-01 13:07:31 -07:00
										 |  |  |   disableNotificationBadge: false, | 
					
						
							|  |  |  |   disableReblogCounts: false, | 
					
						
							| 
									
										
										
										
											2018-12-02 21:12:58 -08:00
										 |  |  |   disableTapOnStatus: false, | 
					
						
							| 
									
										
										
										
											2019-06-01 13:07:31 -07:00
										 |  |  |   enableGrayscale: false, | 
					
						
							| 
									
										
										
										
											2019-04-20 09:12:42 -07:00
										 |  |  |   hideCards: false, | 
					
						
							| 
									
										
										
										
											2018-12-08 09:44:12 -08:00
										 |  |  |   largeInlineMedia: false, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   instanceNameInSearch: '', | 
					
						
							|  |  |  |   instanceThemes: {}, | 
					
						
							| 
									
										
										
										
											2019-05-25 13:21:36 -07:00
										 |  |  |   instanceSettings: {}, | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  |   loggedInInstances: {}, | 
					
						
							|  |  |  |   loggedInInstancesInOrder: [], | 
					
						
							| 
									
										
										
										
											2018-02-07 22:49:50 -08:00
										 |  |  |   markMediaAsSensitive: false, | 
					
						
							| 
									
										
										
										
											2018-12-01 14:09:08 -08:00
										 |  |  |   neverMarkMediaAsSensitive: false, | 
					
						
							| 
									
										
										
										
											2019-08-17 20:54:45 +03:00
										 |  |  |   ignoreBlurhash: false, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   omitEmojiInDisplayNames: undefined, | 
					
						
							| 
									
										
										
										
											2018-02-08 09:15:25 -08:00
										 |  |  |   pinnedPages: {}, | 
					
						
							| 
									
										
										
										
											2019-06-19 23:00:27 -07:00
										 |  |  |   pushSubscriptions: {}, | 
					
						
							| 
									
										
										
										
											2018-12-08 18:42:38 +01:00
										 |  |  |   reduceMotion: | 
					
						
							|  |  |  |     !process.browser || | 
					
						
							| 
									
										
										
										
											2019-07-23 20:33:40 -07:00
										 |  |  |     matchMedia('(prefers-reduced-motion: reduce)').matches, | 
					
						
							| 
									
										
										
										
											2019-01-26 12:58:11 -08:00
										 |  |  |   underlineLinks: false | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const nonPersistedState = { | 
					
						
							| 
									
										
										
										
											2018-03-03 10:11:32 -08:00
										 |  |  |   customEmoji: {}, | 
					
						
							| 
									
										
										
										
											2019-09-16 22:36:24 -07:00
										 |  |  |   followRequestCounts: {}, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   instanceInfos: {}, | 
					
						
							|  |  |  |   instanceLists: {}, | 
					
						
							| 
									
										
										
										
											2018-10-06 20:06:10 +00:00
										 |  |  |   online: !process.browser || navigator.onLine, | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   pinnedStatuses: {}, | 
					
						
							| 
									
										
										
										
											2019-05-26 20:45:42 -07:00
										 |  |  |   polls: {}, | 
					
						
							| 
									
										
										
										
											2018-12-08 18:42:38 +01:00
										 |  |  |   pushNotificationsSupport: | 
					
						
							|  |  |  |     process.browser && | 
					
						
							|  |  |  |     ('serviceWorker' in navigator && | 
					
						
							|  |  |  |       'PushManager' in window && | 
					
						
							|  |  |  |       'getKey' in window.PushSubscription.prototype), | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  |   queryInSearch: '', | 
					
						
							|  |  |  |   repliesShown: {}, | 
					
						
							|  |  |  |   sensitivesShown: {}, | 
					
						
							|  |  |  |   spoilersShown: {}, | 
					
						
							|  |  |  |   statusModifications: {}, | 
					
						
							| 
									
										
										
										
											2019-02-13 18:38:44 -08:00
										 |  |  |   verifyCredentials: {}, | 
					
						
							|  |  |  |   openShareDialog: false | 
					
						
							| 
									
										
										
										
											2018-12-01 11:53:20 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const state = Object.assign({}, persistedState, nonPersistedState) | 
					
						
							|  |  |  | const keysToStoreInLocalStorage = new Set(Object.keys(persistedState)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PinaforeStore extends LocalStorageStore { | 
					
						
							|  |  |  |   constructor (state) { | 
					
						
							|  |  |  |     super(state, keysToStoreInLocalStorage) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PinaforeStore.prototype.observe = observe | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const store = new PinaforeStore(state) | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | mixins(PinaforeStore) | 
					
						
							|  |  |  | computations(store) | 
					
						
							| 
									
										
										
										
											2018-02-20 21:29:59 -08:00
										 |  |  | observers(store) | 
					
						
							| 
									
										
										
										
											2018-01-28 13:09:39 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-19 20:15:24 -08:00
										 |  |  | if (process.browser && process.env.NODE_ENV !== 'production') { | 
					
						
							|  |  |  |   window.store = store // for debugging
 | 
					
						
							| 
									
										
										
										
											2018-02-19 20:28:31 -08:00
										 |  |  | } |