a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. import { EventEmitter, Injectable } from '@angular/core';
  7. import { LocationStrategy } from '@angular/common';
  8. /**
  9. * @fileoverview added by tsickle
  10. * @suppress {checkTypes} checked by tsc
  11. */
  12. /**
  13. * @license
  14. * Copyright Google Inc. All Rights Reserved.
  15. *
  16. * Use of this source code is governed by an MIT-style license that can be
  17. * found in the LICENSE file at https://angular.io/license
  18. */
  19. /**
  20. * A spy for {\@link Location} that allows tests to fire simulated location events.
  21. *
  22. * \@experimental
  23. */
  24. class SpyLocation {
  25. constructor() {
  26. this.urlChanges = [];
  27. this._history = [new LocationState('', '')];
  28. this._historyIndex = 0;
  29. /**
  30. * \@internal
  31. */
  32. this._subject = new EventEmitter();
  33. /**
  34. * \@internal
  35. */
  36. this._baseHref = '';
  37. /**
  38. * \@internal
  39. */
  40. this._platformStrategy = /** @type {?} */ ((null));
  41. }
  42. /**
  43. * @param {?} url
  44. * @return {?}
  45. */
  46. setInitialPath(url) { this._history[this._historyIndex].path = url; }
  47. /**
  48. * @param {?} url
  49. * @return {?}
  50. */
  51. setBaseHref(url) { this._baseHref = url; }
  52. /**
  53. * @return {?}
  54. */
  55. path() { return this._history[this._historyIndex].path; }
  56. /**
  57. * @param {?} path
  58. * @param {?=} query
  59. * @return {?}
  60. */
  61. isCurrentPathEqualTo(path, query = '') {
  62. const /** @type {?} */ givenPath = path.endsWith('/') ? path.substring(0, path.length - 1) : path;
  63. const /** @type {?} */ currPath = this.path().endsWith('/') ? this.path().substring(0, this.path().length - 1) : this.path();
  64. return currPath == givenPath + (query.length > 0 ? ('?' + query) : '');
  65. }
  66. /**
  67. * @param {?} pathname
  68. * @return {?}
  69. */
  70. simulateUrlPop(pathname) {
  71. this._subject.emit({ 'url': pathname, 'pop': true, 'type': 'popstate' });
  72. }
  73. /**
  74. * @param {?} pathname
  75. * @return {?}
  76. */
  77. simulateHashChange(pathname) {
  78. // Because we don't prevent the native event, the browser will independently update the path
  79. this.setInitialPath(pathname);
  80. this.urlChanges.push('hash: ' + pathname);
  81. this._subject.emit({ 'url': pathname, 'pop': true, 'type': 'hashchange' });
  82. }
  83. /**
  84. * @param {?} url
  85. * @return {?}
  86. */
  87. prepareExternalUrl(url) {
  88. if (url.length > 0 && !url.startsWith('/')) {
  89. url = '/' + url;
  90. }
  91. return this._baseHref + url;
  92. }
  93. /**
  94. * @param {?} path
  95. * @param {?=} query
  96. * @return {?}
  97. */
  98. go(path, query = '') {
  99. path = this.prepareExternalUrl(path);
  100. if (this._historyIndex > 0) {
  101. this._history.splice(this._historyIndex + 1);
  102. }
  103. this._history.push(new LocationState(path, query));
  104. this._historyIndex = this._history.length - 1;
  105. const /** @type {?} */ locationState = this._history[this._historyIndex - 1];
  106. if (locationState.path == path && locationState.query == query) {
  107. return;
  108. }
  109. const /** @type {?} */ url = path + (query.length > 0 ? ('?' + query) : '');
  110. this.urlChanges.push(url);
  111. this._subject.emit({ 'url': url, 'pop': false });
  112. }
  113. /**
  114. * @param {?} path
  115. * @param {?=} query
  116. * @return {?}
  117. */
  118. replaceState(path, query = '') {
  119. path = this.prepareExternalUrl(path);
  120. const /** @type {?} */ history = this._history[this._historyIndex];
  121. if (history.path == path && history.query == query) {
  122. return;
  123. }
  124. history.path = path;
  125. history.query = query;
  126. const /** @type {?} */ url = path + (query.length > 0 ? ('?' + query) : '');
  127. this.urlChanges.push('replace: ' + url);
  128. }
  129. /**
  130. * @return {?}
  131. */
  132. forward() {
  133. if (this._historyIndex < (this._history.length - 1)) {
  134. this._historyIndex++;
  135. this._subject.emit({ 'url': this.path(), 'pop': true });
  136. }
  137. }
  138. /**
  139. * @return {?}
  140. */
  141. back() {
  142. if (this._historyIndex > 0) {
  143. this._historyIndex--;
  144. this._subject.emit({ 'url': this.path(), 'pop': true });
  145. }
  146. }
  147. /**
  148. * @param {?} onNext
  149. * @param {?=} onThrow
  150. * @param {?=} onReturn
  151. * @return {?}
  152. */
  153. subscribe(onNext, onThrow, onReturn) {
  154. return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
  155. }
  156. /**
  157. * @param {?} url
  158. * @return {?}
  159. */
  160. normalize(url) { return /** @type {?} */ ((null)); }
  161. }
  162. SpyLocation.decorators = [
  163. { type: Injectable },
  164. ];
  165. /** @nocollapse */
  166. SpyLocation.ctorParameters = () => [];
  167. class LocationState {
  168. /**
  169. * @param {?} path
  170. * @param {?} query
  171. */
  172. constructor(path, query) {
  173. this.path = path;
  174. this.query = query;
  175. }
  176. }
  177. /**
  178. * @fileoverview added by tsickle
  179. * @suppress {checkTypes} checked by tsc
  180. */
  181. /**
  182. * @license
  183. * Copyright Google Inc. All Rights Reserved.
  184. *
  185. * Use of this source code is governed by an MIT-style license that can be
  186. * found in the LICENSE file at https://angular.io/license
  187. */
  188. /**
  189. * A mock implementation of {\@link LocationStrategy} that allows tests to fire simulated
  190. * location events.
  191. *
  192. * \@stable
  193. */
  194. class MockLocationStrategy extends LocationStrategy {
  195. constructor() {
  196. super();
  197. this.internalBaseHref = '/';
  198. this.internalPath = '/';
  199. this.internalTitle = '';
  200. this.urlChanges = [];
  201. /**
  202. * \@internal
  203. */
  204. this._subject = new EventEmitter();
  205. }
  206. /**
  207. * @param {?} url
  208. * @return {?}
  209. */
  210. simulatePopState(url) {
  211. this.internalPath = url;
  212. this._subject.emit(new _MockPopStateEvent(this.path()));
  213. }
  214. /**
  215. * @param {?=} includeHash
  216. * @return {?}
  217. */
  218. path(includeHash = false) { return this.internalPath; }
  219. /**
  220. * @param {?} internal
  221. * @return {?}
  222. */
  223. prepareExternalUrl(internal) {
  224. if (internal.startsWith('/') && this.internalBaseHref.endsWith('/')) {
  225. return this.internalBaseHref + internal.substring(1);
  226. }
  227. return this.internalBaseHref + internal;
  228. }
  229. /**
  230. * @param {?} ctx
  231. * @param {?} title
  232. * @param {?} path
  233. * @param {?} query
  234. * @return {?}
  235. */
  236. pushState(ctx, title, path, query) {
  237. this.internalTitle = title;
  238. const /** @type {?} */ url = path + (query.length > 0 ? ('?' + query) : '');
  239. this.internalPath = url;
  240. const /** @type {?} */ externalUrl = this.prepareExternalUrl(url);
  241. this.urlChanges.push(externalUrl);
  242. }
  243. /**
  244. * @param {?} ctx
  245. * @param {?} title
  246. * @param {?} path
  247. * @param {?} query
  248. * @return {?}
  249. */
  250. replaceState(ctx, title, path, query) {
  251. this.internalTitle = title;
  252. const /** @type {?} */ url = path + (query.length > 0 ? ('?' + query) : '');
  253. this.internalPath = url;
  254. const /** @type {?} */ externalUrl = this.prepareExternalUrl(url);
  255. this.urlChanges.push('replace: ' + externalUrl);
  256. }
  257. /**
  258. * @param {?} fn
  259. * @return {?}
  260. */
  261. onPopState(fn) { this._subject.subscribe({ next: fn }); }
  262. /**
  263. * @return {?}
  264. */
  265. getBaseHref() { return this.internalBaseHref; }
  266. /**
  267. * @return {?}
  268. */
  269. back() {
  270. if (this.urlChanges.length > 0) {
  271. this.urlChanges.pop();
  272. const /** @type {?} */ nextUrl = this.urlChanges.length > 0 ? this.urlChanges[this.urlChanges.length - 1] : '';
  273. this.simulatePopState(nextUrl);
  274. }
  275. }
  276. /**
  277. * @return {?}
  278. */
  279. forward() { throw 'not implemented'; }
  280. }
  281. MockLocationStrategy.decorators = [
  282. { type: Injectable },
  283. ];
  284. /** @nocollapse */
  285. MockLocationStrategy.ctorParameters = () => [];
  286. class _MockPopStateEvent {
  287. /**
  288. * @param {?} newUrl
  289. */
  290. constructor(newUrl) {
  291. this.newUrl = newUrl;
  292. this.pop = true;
  293. this.type = 'popstate';
  294. }
  295. }
  296. /**
  297. * @fileoverview added by tsickle
  298. * @suppress {checkTypes} checked by tsc
  299. */
  300. /**
  301. * @license
  302. * Copyright Google Inc. All Rights Reserved.
  303. *
  304. * Use of this source code is governed by an MIT-style license that can be
  305. * found in the LICENSE file at https://angular.io/license
  306. */
  307. /**
  308. * @fileoverview added by tsickle
  309. * @suppress {checkTypes} checked by tsc
  310. */
  311. /**
  312. * @license
  313. * Copyright Google Inc. All Rights Reserved.
  314. *
  315. * Use of this source code is governed by an MIT-style license that can be
  316. * found in the LICENSE file at https://angular.io/license
  317. */
  318. /**
  319. * @module
  320. * @description
  321. * Entry point for all public APIs of this package.
  322. */
  323. // This file only reexports content of the `src` folder. Keep it that way.
  324. /**
  325. * @fileoverview added by tsickle
  326. * @suppress {checkTypes} checked by tsc
  327. */
  328. /**
  329. * Generated bundle index. Do not edit.
  330. */
  331. export { SpyLocation, MockLocationStrategy };
  332. //# sourceMappingURL=testing.js.map