@jupyterlite/server 0.6.0-alpha.1 → 0.6.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,253 @@
1
+ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
2
+
3
+ import { Contents } from '@jupyterlab/services';
4
+
5
+ import {
6
+ DRIVE_API_PATH,
7
+ DriveContentsProcessor,
8
+ TDriveMethod,
9
+ TDriveRequest,
10
+ } from '@jupyterlite/contents';
11
+
12
+ import { PromiseDelegate, UUID } from '@lumino/coreutils';
13
+
14
+ import { ISignal, Signal } from '@lumino/signaling';
15
+
16
+ import { IServiceWorkerManager, WORKER_NAME } from './tokens';
17
+
18
+ /**
19
+ * The version of the app
20
+ */
21
+ const VERSION = PageConfig.getOption('appVersion');
22
+
23
+ /**
24
+ * Used to keep the service worker alive
25
+ */
26
+ const SW_PING_ENDPOINT = '/api/service-worker-heartbeat';
27
+
28
+ /**
29
+ * A class that manages the ServiceWorker registration and communication,
30
+ * used for accessing the file system.
31
+ */
32
+ export class ServiceWorkerManager implements IServiceWorkerManager {
33
+ /**
34
+ * Construct a new ServiceWorkerManager.
35
+ */
36
+ constructor(options: IServiceWorkerManager.IOptions) {
37
+ const workerUrl =
38
+ options.workerUrl ?? URLExt.join(PageConfig.getBaseUrl(), WORKER_NAME);
39
+ const fullWorkerUrl = new URL(workerUrl, window.location.href);
40
+ const enableCache = PageConfig.getOption('enableServiceWorkerCache') || 'false';
41
+ fullWorkerUrl.searchParams.set('enableCache', enableCache);
42
+
43
+ // Initialize broadcast channel related properties
44
+ this._browsingContextId = UUID.uuid4();
45
+ this._contents = options.contents;
46
+ this._broadcastChannel = new BroadcastChannel(DRIVE_API_PATH);
47
+ this._broadcastChannel.addEventListener('message', this._onBroadcastMessage);
48
+
49
+ this._driveContentsProcessor = new DriveContentsProcessor({
50
+ contentsManager: this._contents,
51
+ });
52
+
53
+ void this._initialize(fullWorkerUrl.href).catch(console.warn);
54
+ }
55
+
56
+ /**
57
+ * A signal emitted when the registration changes.
58
+ */
59
+ get registrationChanged(): ISignal<
60
+ IServiceWorkerManager,
61
+ ServiceWorkerRegistration | null
62
+ > {
63
+ return this._registrationChanged;
64
+ }
65
+
66
+ /**
67
+ * Whether the ServiceWorker is enabled or not.
68
+ */
69
+ get enabled(): boolean {
70
+ return this._registration !== null;
71
+ }
72
+
73
+ /**
74
+ * A unique id to identify the browsing context where the ServiceWorkerManager was instantiated.
75
+ */
76
+ get browsingContextId(): string {
77
+ return this._browsingContextId;
78
+ }
79
+
80
+ /**
81
+ * Whether the ServiceWorker is ready or not.
82
+ */
83
+ get ready(): Promise<void> {
84
+ return this._ready.promise;
85
+ }
86
+
87
+ /**
88
+ * Register a handler for stdin requests received via ServiceWorker.
89
+ * @param pathnameSuffix URL pathname suffix to match such as "kernel" or "terminal".
90
+ * @param stdinHandler
91
+ */
92
+ registerStdinHandler(
93
+ pathnameSuffix: string,
94
+ stdinHandler: IServiceWorkerManager.IStdinHandler,
95
+ ): void {
96
+ this._stdinHandlers.set(pathnameSuffix, stdinHandler);
97
+ }
98
+
99
+ /**
100
+ * Initialize the ServiceWorkerManager.
101
+ */
102
+ private async _initialize(workerUrl: string): Promise<void> {
103
+ const { serviceWorker } = navigator;
104
+
105
+ let registration: ServiceWorkerRegistration | null = null;
106
+
107
+ if (!serviceWorker) {
108
+ console.warn('ServiceWorkers not supported in this browser');
109
+ return;
110
+ } else if (serviceWorker.controller) {
111
+ const scriptURL = serviceWorker.controller.scriptURL;
112
+ await this._unregisterOldServiceWorkers(scriptURL);
113
+
114
+ registration = (await serviceWorker.getRegistration(scriptURL)) || null;
115
+ // eslint-disable-next-line no-console
116
+ console.info('JupyterLite ServiceWorker was already registered');
117
+ }
118
+
119
+ if (!registration && serviceWorker) {
120
+ try {
121
+ // eslint-disable-next-line no-console
122
+ console.info('Registering new JupyterLite ServiceWorker', workerUrl);
123
+ registration = await serviceWorker.register(workerUrl);
124
+ // eslint-disable-next-line no-console
125
+ console.info('JupyterLite ServiceWorker was sucessfully registered');
126
+ } catch (err: any) {
127
+ console.warn(err);
128
+ console.warn(
129
+ `JupyterLite ServiceWorker registration unexpectedly failed: ${err}`,
130
+ );
131
+ }
132
+ }
133
+
134
+ this._setRegistration(registration);
135
+
136
+ if (!registration) {
137
+ this._ready.reject(void 0);
138
+ } else {
139
+ this._ready.resolve(void 0);
140
+ setTimeout(this._pingServiceWorker, 20000);
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Unregister old service workers if the version has changed.
146
+ */
147
+ private async _unregisterOldServiceWorkers(scriptURL: string): Promise<void> {
148
+ const versionKey = `${scriptURL}-version`;
149
+ // Check if we have an installed version. If we do, compare it to the current version
150
+ // and unregister all service workers if they are different.
151
+ const installedVersion = localStorage.getItem(versionKey);
152
+
153
+ if ((installedVersion && installedVersion !== VERSION) || !installedVersion) {
154
+ // eslint-disable-next-line no-console
155
+ console.info('New version, unregistering existing service workers.');
156
+ const registrations = await navigator.serviceWorker.getRegistrations();
157
+
158
+ await Promise.all(registrations.map((registration) => registration.unregister()));
159
+
160
+ // eslint-disable-next-line no-console
161
+ console.info('All existing service workers have been unregistered.');
162
+ }
163
+
164
+ localStorage.setItem(versionKey, VERSION);
165
+ }
166
+
167
+ /**
168
+ * Ping the service worker to keep it alive.
169
+ */
170
+ private async _pingServiceWorker(): Promise<void> {
171
+ const response = await fetch(SW_PING_ENDPOINT);
172
+ const text = await response.text();
173
+ if (text === 'ok') {
174
+ setTimeout(this._pingServiceWorker, 20000);
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Set the registration and emit a signal.
180
+ */
181
+ private _setRegistration(registration: ServiceWorkerRegistration | null) {
182
+ this._registration = registration;
183
+ this._registrationChanged.emit(this._registration);
184
+ }
185
+
186
+ /**
187
+ * Handle a message received on the BroadcastChannel
188
+ *
189
+ * Message data is `any` because it can either be a drive message of type `TDriveReqiest<T>`
190
+ * or a stdin message of type `any` as ServiceWorkerManager passes it through to the
191
+ * stdinHandler without understanding or altering it.
192
+ */
193
+ private _onBroadcastMessage = async (
194
+ event: MessageEvent<{
195
+ data: any;
196
+ browsingContextId: string;
197
+ pathname: string;
198
+ }>,
199
+ ): Promise<void> => {
200
+ const { data, browsingContextId, pathname } = event.data;
201
+
202
+ if (browsingContextId !== this._browsingContextId) {
203
+ // Message is not meant for us
204
+ return;
205
+ }
206
+
207
+ if (pathname.includes('/api/stdin/')) {
208
+ this._onStdinMessage(pathname, data);
209
+ } else {
210
+ this._onDriveMessage(data);
211
+ }
212
+ };
213
+
214
+ private _onDriveMessage = async <T extends TDriveMethod>(
215
+ data: TDriveRequest<T>,
216
+ ): Promise<void> => {
217
+ const response = await this._driveContentsProcessor.processDriveRequest(data);
218
+ // pass the browsingContextId along so the Service Worker can identify the request
219
+ this._broadcastChannel.postMessage({
220
+ response,
221
+ browsingContextId: this._browsingContextId,
222
+ });
223
+ };
224
+
225
+ private _onStdinMessage = async (pathname: string, data: any): Promise<void> => {
226
+ // Expecting pathname of the form '<optional something>/api/stdin/<suffix>' from which
227
+ // suffix is used to identify which stdinHandler to call.
228
+ // `data: any` because ServiceWorkerManager accepts any data and passes it through
229
+ // to the stdinHandler without understanding or altering it.
230
+ const suffix = pathname.slice(pathname.lastIndexOf('/') + 1);
231
+ const stdinHandler = this._stdinHandlers.get(suffix);
232
+ if (stdinHandler !== undefined) {
233
+ const response = await stdinHandler(data);
234
+ this._broadcastChannel.postMessage({
235
+ response,
236
+ browsingContextId: this._browsingContextId,
237
+ });
238
+ } else {
239
+ console.warn(`No stdin handler registered for '${pathname}'`);
240
+ }
241
+ };
242
+
243
+ private _registration: ServiceWorkerRegistration | null = null;
244
+ private _registrationChanged = new Signal<this, ServiceWorkerRegistration | null>(
245
+ this,
246
+ );
247
+ private _ready = new PromiseDelegate<void>();
248
+ private _broadcastChannel: BroadcastChannel;
249
+ private _browsingContextId: string;
250
+ private _contents: Contents.IManager;
251
+ private _driveContentsProcessor: DriveContentsProcessor;
252
+ private _stdinHandlers = new Map<string, IServiceWorkerManager.IStdinHandler>();
253
+ }
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line @typescript-eslint/triple-slash-reference
2
- /// <reference path="../../../node_modules/@types/serviceworker/index.d.ts" />
2
+ /// <reference path="../../../node_modules/@types/serviceworker/index.d.ts" preserve="true" />
3
3
 
4
4
  /**
5
5
  * The name of the cache
@@ -57,7 +57,7 @@ async function onFetch(event: FetchEvent): Promise<void> {
57
57
 
58
58
  let responsePromise: Promise<Response> | null = null;
59
59
  if (shouldBroadcast(url)) {
60
- responsePromise = broadcastOne(request);
60
+ responsePromise = broadcastOne(request, url);
61
61
  } else if (!shouldDrop(request, url)) {
62
62
  responsePromise = maybeFromCache(event);
63
63
  }
@@ -117,7 +117,10 @@ async function refetch(request: Request): Promise<Response> {
117
117
  * Whether a given URL should be broadcast
118
118
  */
119
119
  function shouldBroadcast(url: URL): boolean {
120
- return url.origin === location.origin && url.pathname.includes('/api/drive');
120
+ return (
121
+ url.origin === location.origin &&
122
+ (url.pathname.includes('/api/drive') || url.pathname.includes('/api/stdin/'))
123
+ );
121
124
  }
122
125
 
123
126
  /**
@@ -134,18 +137,25 @@ function shouldDrop(request: Request, url: URL): boolean {
134
137
  /**
135
138
  * Forward request to main using the broadcast channel
136
139
  */
137
- async function broadcastOne(request: Request): Promise<Response> {
140
+ async function broadcastOne(request: Request, url: URL): Promise<Response> {
141
+ const message = await request.json();
138
142
  const promise = new Promise<Response>((resolve) => {
139
- broadcast.onmessage = (event) => {
140
- resolve(new Response(JSON.stringify(event.data)));
143
+ const messageHandler = (event: MessageEvent) => {
144
+ const data = event.data;
145
+ if (data.browsingContextId !== message.browsingContextId) {
146
+ // bail if the message is not for us
147
+ return;
148
+ }
149
+ const response = data.response;
150
+ resolve(new Response(JSON.stringify(response)));
151
+ broadcast.removeEventListener('message', messageHandler);
141
152
  };
153
+
154
+ broadcast.addEventListener('message', messageHandler);
142
155
  });
143
156
 
144
- const message = await request.json();
145
- // Mark message as being for broadcast.ts
146
- // This makes sure we won't get problems with messages
147
- // across tabs with multiple notebook tabs open
148
- message.receiver = 'broadcast.ts';
157
+ // Add URL pathname to message
158
+ message.pathname = url.pathname;
149
159
  broadcast.postMessage(message);
150
160
 
151
161
  return await promise;
package/src/tokens.ts CHANGED
@@ -2,13 +2,15 @@ import { Token } from '@lumino/coreutils';
2
2
 
3
3
  import { ISignal } from '@lumino/signaling';
4
4
 
5
+ import { Contents } from '@jupyterlab/services';
6
+
5
7
  import SW_URL from './service-worker?text';
6
8
 
7
9
  /**
8
10
  * The token for the ServiceWorker.
9
11
  */
10
12
  export const IServiceWorkerManager = new Token<IServiceWorkerManager>(
11
- '@jupyterlite/server-extension:IServiceWorkerManager',
13
+ '@jupyterlite/server:IServiceWorkerManager',
12
14
  );
13
15
 
14
16
  /**
@@ -28,10 +30,25 @@ export interface IServiceWorkerManager {
28
30
  */
29
31
  readonly enabled: boolean;
30
32
 
33
+ /**
34
+ * A unique id to identify the browsing context where the ServiceWorkerManager was instantiated.
35
+ */
36
+ readonly browsingContextId: string;
37
+
31
38
  /**
32
39
  * A Promise that resolves when the ServiceWorker is registered, or rejects if it cannot
33
40
  */
34
41
  ready: Promise<void>;
42
+
43
+ /**
44
+ * Register a handler for stdin requests received via ServiceWorker.
45
+ * @param pathnameSuffix URL pathname suffix to match such as "kernel" or "terminal".
46
+ * @param stdinHandler
47
+ */
48
+ registerStdinHandler(
49
+ pathnameSuffix: string,
50
+ stdinHandler: IServiceWorkerManager.IStdinHandler,
51
+ ): void;
35
52
  }
36
53
 
37
54
  /**
@@ -42,11 +59,27 @@ export namespace IServiceWorkerManager {
42
59
  * An options object for initializing a worker manager.
43
60
  */
44
61
  export interface IOptions {
62
+ /**
63
+ * The contents manager to use for handling drive contents requests
64
+ */
65
+ contents: Contents.IManager;
66
+
45
67
  /**
46
68
  * URL to load the worker file. Default to "{baseURL}/service-worker.js"
47
69
  */
48
70
  workerUrl?: string;
49
71
  }
72
+
73
+ /**
74
+ * Interface for handler of stdin requests received via Service Worker.
75
+ *
76
+ * Types are `any` because they are defined by whatever calls `registerStdinHandler`
77
+ * and the ServiceWorkerManager does not need to understand them, it just passes them
78
+ * through without altering them.
79
+ */
80
+ export interface IStdinHandler {
81
+ (message: any): Promise<any>;
82
+ }
50
83
  }
51
84
 
52
85
  export const WORKER_NAME = `${SW_URL}`.split('/').slice(-1)[0];
package/lib/app.d.ts DELETED
@@ -1,87 +0,0 @@
1
- import { ServiceManager } from '@jupyterlab/services';
2
- import { Application, IPlugin } from '@lumino/application';
3
- import { Router } from './router';
4
- export type JupyterLiteServerPlugin<T> = IPlugin<JupyterLiteServer, T>;
5
- /**
6
- * Server is the main application class. It is instantiated once and shared.
7
- */
8
- export declare class JupyterLiteServer extends Application<never> {
9
- /**
10
- * Construct a new JupyterLite object.
11
- *
12
- * @param options The instantiation options for a JupyterLiteServer application.
13
- */
14
- constructor(options: Application.IOptions<never>);
15
- /**
16
- * The name of the application.
17
- */
18
- readonly name = "JupyterLite Server";
19
- /**
20
- * A namespace/prefix plugins may use to denote their provenance.
21
- */
22
- readonly namespace = "JupyterLite Server";
23
- /**
24
- * The version of the application.
25
- */
26
- readonly version = "unknown";
27
- /**
28
- * Get the underlying `Router` instance.
29
- */
30
- get router(): Router;
31
- /**
32
- * Get the underlying lite service manager for this app.
33
- */
34
- get serviceManager(): ServiceManager;
35
- /**
36
- * Handle an incoming request from the client.
37
- *
38
- * @param req The incoming request
39
- * @param init The optional init request
40
- */
41
- fetch(req: RequestInfo, init?: RequestInit | null | undefined): Promise<Response>;
42
- /**
43
- * Attach the application shell to the DOM.
44
- *
45
- * @param id - The id of the host node for the shell, or `''`.
46
- *
47
- * #### Notes
48
- * For this server application there is no shell to attach
49
- */
50
- protected attachShell(id: string): void;
51
- /**
52
- * A method invoked on a window `'resize'` event.
53
- *
54
- * #### Notes
55
- * For this server application there is no shell to update
56
- */
57
- protected evtResize(event: Event): void;
58
- /**
59
- * Register plugins from a plugin module.
60
- *
61
- * @param mod - The plugin module to register.
62
- */
63
- registerPluginModule(mod: JupyterLiteServer.IPluginModule): void;
64
- /**
65
- * Register the plugins from multiple plugin modules.
66
- *
67
- * @param mods - The plugin modules to register.
68
- */
69
- registerPluginModules(mods: JupyterLiteServer.IPluginModule[]): void;
70
- private _router;
71
- private _serviceManager;
72
- }
73
- /**
74
- * A namespace for Server statics.
75
- */
76
- export declare namespace JupyterLiteServer {
77
- /**
78
- * The interface for a module that exports a plugin or plugins as
79
- * the default value.
80
- */
81
- interface IPluginModule {
82
- /**
83
- * The default export.
84
- */
85
- default: IPlugin<JupyterLiteServer, any> | IPlugin<JupyterLiteServer, any>[];
86
- }
87
- }
package/lib/app.js DELETED
@@ -1,155 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { ServerConnection, ServiceManager } from '@jupyterlab/services';
4
- import { Application } from '@lumino/application';
5
- import { Signal, Stream } from '@lumino/signaling';
6
- import { WebSocket } from 'mock-socket';
7
- import { Router } from './router';
8
- /**
9
- * A local event manager service.
10
- *
11
- * #### Notes
12
- * Schema IDs are not verified and all client-emitted events emit.
13
- */
14
- class LocalEventManager {
15
- constructor(options) {
16
- this._isDisposed = false;
17
- this._serverSettings = options.serverSettings;
18
- this._stream = new Stream(this);
19
- }
20
- async emit({ data, schema_id }) {
21
- this._stream.emit({ ...data, schema_id });
22
- }
23
- dispose() {
24
- if (this.isDisposed) {
25
- return;
26
- }
27
- this._isDisposed = true;
28
- Signal.clearData(this);
29
- this._stream.stop();
30
- }
31
- get isDisposed() {
32
- return this._isDisposed;
33
- }
34
- get stream() {
35
- return this._stream;
36
- }
37
- get serverSettings() {
38
- return this._serverSettings;
39
- }
40
- }
41
- /**
42
- * Server is the main application class. It is instantiated once and shared.
43
- */
44
- export class JupyterLiteServer extends Application {
45
- /**
46
- * Construct a new JupyterLite object.
47
- *
48
- * @param options The instantiation options for a JupyterLiteServer application.
49
- */
50
- constructor(options) {
51
- var _a;
52
- super(options);
53
- /**
54
- * The name of the application.
55
- */
56
- this.name = 'JupyterLite Server';
57
- /**
58
- * A namespace/prefix plugins may use to denote their provenance.
59
- */
60
- this.namespace = this.name;
61
- /**
62
- * The version of the application.
63
- */
64
- this.version = 'unknown';
65
- this._router = new Router();
66
- const serverSettings = {
67
- ...ServerConnection.makeSettings(),
68
- WebSocket,
69
- fetch: (_a = this.fetch.bind(this)) !== null && _a !== void 0 ? _a : undefined,
70
- };
71
- this._serviceManager = new ServiceManager({
72
- standby: 'never',
73
- serverSettings,
74
- events: new LocalEventManager({ serverSettings }),
75
- });
76
- }
77
- /**
78
- * Get the underlying `Router` instance.
79
- */
80
- get router() {
81
- return this._router;
82
- }
83
- /**
84
- * Get the underlying lite service manager for this app.
85
- */
86
- get serviceManager() {
87
- return this._serviceManager;
88
- }
89
- /**
90
- * Handle an incoming request from the client.
91
- *
92
- * @param req The incoming request
93
- * @param init The optional init request
94
- */
95
- async fetch(req, init) {
96
- if (!(req instanceof Request)) {
97
- throw Error('Request info is not a Request');
98
- }
99
- return this._router.route(req);
100
- }
101
- /**
102
- * Attach the application shell to the DOM.
103
- *
104
- * @param id - The id of the host node for the shell, or `''`.
105
- *
106
- * #### Notes
107
- * For this server application there is no shell to attach
108
- */
109
- attachShell(id) {
110
- // no-op
111
- }
112
- /**
113
- * A method invoked on a window `'resize'` event.
114
- *
115
- * #### Notes
116
- * For this server application there is no shell to update
117
- */
118
- evtResize(event) {
119
- // no-op
120
- }
121
- /**
122
- * Register plugins from a plugin module.
123
- *
124
- * @param mod - The plugin module to register.
125
- */
126
- registerPluginModule(mod) {
127
- let data = mod.default;
128
- // Handle commonjs exports.
129
- if (!Object.prototype.hasOwnProperty.call(mod, '__esModule')) {
130
- data = mod;
131
- }
132
- if (!Array.isArray(data)) {
133
- data = [data];
134
- }
135
- data.forEach((item) => {
136
- try {
137
- this.registerPlugin(item);
138
- }
139
- catch (error) {
140
- console.error(error);
141
- }
142
- });
143
- }
144
- /**
145
- * Register the plugins from multiple plugin modules.
146
- *
147
- * @param mods - The plugin modules to register.
148
- */
149
- registerPluginModules(mods) {
150
- mods.forEach((mod) => {
151
- this.registerPluginModule(mod);
152
- });
153
- }
154
- }
155
- //# sourceMappingURL=app.js.map
package/lib/app.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAS,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAW,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,MAAM,iBAAiB;IACrB,YAAY,OAAuD;QA8B3D,gBAAW,GAAG,KAAK,CAAC;QA7B1B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAiB;QAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;SACR;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC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