@luckylillia-dev/plugin-aiimgdetector 0.0.0-stage → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/assets/demo.png +0 -0
- package/assets/icon.svg +15 -0
- package/assets/synthid-login-check.jpg +0 -0
- package/docs/details.md +45 -0
- package/docs/publishing.md +66 -0
- package/docs/synthid.md +80 -0
- package/lib/image.js +90 -0
- package/lib/index.js +207 -0
- package/lib/provenance.js +21 -0
- package/lib/synthid-auth.js +100 -0
- package/lib/synthid-browser.js +451 -0
- package/lib/synthid-http-runtime/chromium-css-property-catalog.mjs +7 -0
- package/lib/synthid-http-runtime/complete-protocol.mjs +88 -0
- package/lib/synthid-http-runtime/entry.d.mts +41 -0
- package/lib/synthid-http-runtime/entry.mjs +6 -0
- package/lib/synthid-http-runtime/event-listener-diagnostics.mjs +141 -0
- package/lib/synthid-http-runtime/independent-request-reference.mjs +49 -0
- package/lib/synthid-http-runtime/jsdom-event-clock-compat.mjs +76 -0
- package/lib/synthid-http-runtime/lifecycle-client.mjs +165 -0
- package/lib/synthid-http-runtime/lifecycle-web-session.mjs +114 -0
- package/lib/synthid-http-runtime/lifecycle-worker.mjs +363 -0
- package/lib/synthid-http-runtime/node-platform-failure-diagnostics.mjs +108 -0
- package/lib/synthid-http-runtime/realm-activation-diagnostic.js +31 -0
- package/lib/synthid-http-runtime/realm-focus-diagnostic.js +9 -0
- package/lib/synthid-http-runtime/realm-init.js +34 -0
- package/lib/synthid-http-runtime/realm-pointer-diagnostic.js +49 -0
- package/lib/synthid-http-runtime/runtime-anchor-href-translate.mjs +242 -0
- package/lib/synthid-http-runtime/runtime-child-web-compat.mjs +103 -0
- package/lib/synthid-http-runtime/runtime-chrome-csi.mjs +216 -0
- package/lib/synthid-http-runtime/runtime-clock-precision-control.mjs +51 -0
- package/lib/synthid-http-runtime/runtime-css-properties-compat.mjs +165 -0
- package/lib/synthid-http-runtime/runtime-detached-frame-compat.mjs +214 -0
- package/lib/synthid-http-runtime/runtime-javascript-bindings.mjs +69 -0
- package/lib/synthid-http-runtime/runtime-navigator-compat.mjs +99 -0
- package/lib/synthid-http-runtime/runtime-permissions-binding.mjs +64 -0
- package/lib/synthid-http-runtime/runtime-permissions-control.mjs +143 -0
- package/lib/synthid-http-runtime/runtime-web-compat.mjs +639 -0
- package/lib/synthid-http-runtime/runtime-webidl-callable-control.mjs +151 -0
- package/lib/synthid-http-runtime/runtime-webidl-realm-compat.mjs +132 -0
- package/lib/synthid-http-runtime/runtime-window-state-compat.mjs +128 -0
- package/lib/synthid-http-runtime/scripting-parser.mjs +13 -0
- package/lib/synthid-http-runtime/web-session.mjs +64 -0
- package/lib/synthid-http-runtime/webidl-brand-errors-preload.mjs +49 -0
- package/lib/synthid-http-runtime/webidl-callable-source-catalog.mjs +4491 -0
- package/lib/synthid-http-runtime/webidl-realm-catalog.mjs +124 -0
- package/lib/synthid-http.js +314 -0
- package/lib/synthid-manual.js +365 -0
- package/lib/synthid-page.js +101 -0
- package/lib/synthid-result.js +189 -0
- package/lib/synthid.js +540 -0
- package/lib/vision.js +41 -0
- package/package.json +84 -4
- package/src/image.ts +74 -0
- package/src/index.ts +203 -0
- package/src/provenance.ts +40 -0
- package/src/synthid-auth.ts +83 -0
- package/src/synthid-browser.ts +426 -0
- package/src/synthid-http-runtime/chromium-css-property-catalog.mjs +7 -0
- package/src/synthid-http-runtime/complete-protocol.mjs +88 -0
- package/src/synthid-http-runtime/entry.d.mts +41 -0
- package/src/synthid-http-runtime/entry.mjs +6 -0
- package/src/synthid-http-runtime/event-listener-diagnostics.mjs +141 -0
- package/src/synthid-http-runtime/independent-request-reference.mjs +49 -0
- package/src/synthid-http-runtime/jsdom-event-clock-compat.mjs +76 -0
- package/src/synthid-http-runtime/lifecycle-client.mjs +165 -0
- package/src/synthid-http-runtime/lifecycle-web-session.mjs +114 -0
- package/src/synthid-http-runtime/lifecycle-worker.mjs +363 -0
- package/src/synthid-http-runtime/node-platform-failure-diagnostics.mjs +108 -0
- package/src/synthid-http-runtime/realm-activation-diagnostic.js +31 -0
- package/src/synthid-http-runtime/realm-focus-diagnostic.js +9 -0
- package/src/synthid-http-runtime/realm-init.js +34 -0
- package/src/synthid-http-runtime/realm-pointer-diagnostic.js +49 -0
- package/src/synthid-http-runtime/runtime-anchor-href-translate.mjs +242 -0
- package/src/synthid-http-runtime/runtime-child-web-compat.mjs +103 -0
- package/src/synthid-http-runtime/runtime-chrome-csi.mjs +216 -0
- package/src/synthid-http-runtime/runtime-clock-precision-control.mjs +51 -0
- package/src/synthid-http-runtime/runtime-css-properties-compat.mjs +165 -0
- package/src/synthid-http-runtime/runtime-detached-frame-compat.mjs +214 -0
- package/src/synthid-http-runtime/runtime-javascript-bindings.mjs +69 -0
- package/src/synthid-http-runtime/runtime-navigator-compat.mjs +99 -0
- package/src/synthid-http-runtime/runtime-permissions-binding.mjs +64 -0
- package/src/synthid-http-runtime/runtime-permissions-control.mjs +143 -0
- package/src/synthid-http-runtime/runtime-web-compat.mjs +639 -0
- package/src/synthid-http-runtime/runtime-webidl-callable-control.mjs +151 -0
- package/src/synthid-http-runtime/runtime-webidl-realm-compat.mjs +132 -0
- package/src/synthid-http-runtime/runtime-window-state-compat.mjs +128 -0
- package/src/synthid-http-runtime/scripting-parser.mjs +13 -0
- package/src/synthid-http-runtime/web-session.mjs +64 -0
- package/src/synthid-http-runtime/webidl-brand-errors-preload.mjs +49 -0
- package/src/synthid-http-runtime/webidl-callable-source-catalog.mjs +4491 -0
- package/src/synthid-http-runtime/webidl-realm-catalog.mjs +124 -0
- package/src/synthid-http.ts +290 -0
- package/src/synthid-manual.ts +388 -0
- package/src/synthid-page.ts +103 -0
- package/src/synthid-result.ts +177 -0
- package/src/synthid.ts +514 -0
- package/src/vision.ts +57 -0
- package/webui/index.js +279 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdir } from 'node:fs/promises';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { createServer } from 'node:net';
|
|
7
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
8
|
+
import { accountScript, refreshTokenScript } from './synthid-page.js';
|
|
9
|
+
import { SynthIdError } from './synthid-result.js';
|
|
10
|
+
const ORIGIN = 'https://synthid.com';
|
|
11
|
+
// Keep Playwright's CommonJS bootstrap at its canonical path. The host's ESM
|
|
12
|
+
// reload query must not propagate into the bundle's circular imports.
|
|
13
|
+
const { chromium, errors } = createRequire(import.meta.url)('playwright-core');
|
|
14
|
+
function browserExecutable() {
|
|
15
|
+
const paths = process.platform === 'win32' ? [
|
|
16
|
+
join(process.env.PROGRAMFILES || 'C:/Program Files', 'Google/Chrome/Application/chrome.exe'),
|
|
17
|
+
join(process.env['PROGRAMFILES(X86)'] || 'C:/Program Files (x86)', 'Google/Chrome/Application/chrome.exe'),
|
|
18
|
+
join(process.env.LOCALAPPDATA || '', 'Google/Chrome/Application/chrome.exe'),
|
|
19
|
+
join(process.env['PROGRAMFILES(X86)'] || 'C:/Program Files (x86)', 'Microsoft/Edge/Application/msedge.exe'),
|
|
20
|
+
join(process.env.PROGRAMFILES || 'C:/Program Files', 'Microsoft/Edge/Application/msedge.exe'),
|
|
21
|
+
] : process.platform === 'darwin' ? [
|
|
22
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
23
|
+
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
|
|
24
|
+
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
25
|
+
] : [
|
|
26
|
+
'/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/usr/bin/chromium',
|
|
27
|
+
'/usr/bin/chromium-browser', '/usr/bin/microsoft-edge', '/opt/google/chrome/chrome',
|
|
28
|
+
];
|
|
29
|
+
paths.push(chromium.executablePath());
|
|
30
|
+
const executable = paths.find(path => existsSync(path));
|
|
31
|
+
if (!executable)
|
|
32
|
+
throw new SynthIdError('config', 'SynthID needs an installed Chrome, Edge, or Chromium browser');
|
|
33
|
+
return executable;
|
|
34
|
+
}
|
|
35
|
+
function failure(error, closed) {
|
|
36
|
+
if (error instanceof SynthIdError)
|
|
37
|
+
return error;
|
|
38
|
+
if (closed)
|
|
39
|
+
return new SynthIdError('cancelled', 'SynthID browser was closed');
|
|
40
|
+
if (error instanceof errors.TimeoutError)
|
|
41
|
+
return new SynthIdError('timeout', 'SynthID browser request timed out');
|
|
42
|
+
if (error instanceof Error && /net::ERR_(?:PROXY_CONNECTION_FAILED|TUNNEL_CONNECTION_FAILED|NO_SUPPORTED_PROXIES|SOCKS_CONNECTION_FAILED|PROXY_AUTH_UNSUPPORTED)/.test(error.message)) {
|
|
43
|
+
return new SynthIdError('proxy', 'SynthID browser could not connect through the configured proxy');
|
|
44
|
+
}
|
|
45
|
+
// Playwright exceptions can contain URLs, page text, or request data. Never expose them to logs or WebUI.
|
|
46
|
+
return new SynthIdError('network', 'SynthID browser could not complete the request');
|
|
47
|
+
}
|
|
48
|
+
/** Ask the host's proxy plugin, without reading its config files or inspecting its dispatcher. */
|
|
49
|
+
function nativeProxy(http) {
|
|
50
|
+
if (typeof http.proxy !== 'function')
|
|
51
|
+
return undefined;
|
|
52
|
+
try {
|
|
53
|
+
const address = http.proxy(ORIGIN);
|
|
54
|
+
if (address === '')
|
|
55
|
+
return { server: '' };
|
|
56
|
+
const url = new URL(address);
|
|
57
|
+
if (url.protocol === 'socks:')
|
|
58
|
+
url.protocol = 'socks5:';
|
|
59
|
+
if (!['http:', 'https:', 'socks5:'].includes(url.protocol) || !url.hostname
|
|
60
|
+
|| url.pathname !== '/' && url.pathname !== '' || url.search || url.hash)
|
|
61
|
+
throw new Error();
|
|
62
|
+
const credentials = url.username || url.password
|
|
63
|
+
? { username: decodeURIComponent(url.username), password: decodeURIComponent(url.password) } : undefined;
|
|
64
|
+
// Chromium supports HTTP proxy authentication, but not authenticated SOCKS5. Fail before launch.
|
|
65
|
+
if (url.protocol === 'socks5:' && credentials)
|
|
66
|
+
throw new Error();
|
|
67
|
+
url.username = '';
|
|
68
|
+
url.password = '';
|
|
69
|
+
return { server: url.origin === 'null' ? 'socks5://' + url.host : url.origin, credentials };
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new SynthIdError('proxy', 'SynthID browser proxy settings are not supported');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Retain only known transport codes, never exception text, URLs or proxy credentials. */
|
|
76
|
+
function navigationFailure(error) {
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
const codes = ['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN', 'ETIMEDOUT'];
|
|
79
|
+
for (let cause = error; cause && typeof cause === 'object' && !seen.has(cause);) {
|
|
80
|
+
seen.add(cause);
|
|
81
|
+
const detail = cause;
|
|
82
|
+
if (typeof detail.code === 'string' && codes.includes(detail.code)) {
|
|
83
|
+
return new SynthIdError('network', 'SynthID login page connection failed', undefined, undefined, detail.code);
|
|
84
|
+
}
|
|
85
|
+
cause = detail.cause;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Chromium retains its cookie jar and redirect rules; Node handles only one HTTP exchange at a time. */
|
|
89
|
+
async function forward(event, sessionId, send, http, signal, timeout, onNavigationFailure) {
|
|
90
|
+
const { request, requestId } = event;
|
|
91
|
+
try {
|
|
92
|
+
const url = new URL(request.url);
|
|
93
|
+
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
|
|
94
|
+
await send('Fetch.continueRequest', { requestId }, sessionId);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const headers = Object.fromEntries(Object.entries(request.headers).map(([name, value]) => [name.toLowerCase(), value]));
|
|
98
|
+
for (const name of ['host', 'connection', 'content-length', 'accept-encoding', 'transfer-encoding'])
|
|
99
|
+
delete headers[name];
|
|
100
|
+
// CDP includes the raw upload bytes as base64. In particular, never re-encode image data as UTF-8.
|
|
101
|
+
const data = request.postDataEntries?.length
|
|
102
|
+
? Buffer.concat(request.postDataEntries.map(entry => Buffer.from(entry.bytes || '', 'base64')))
|
|
103
|
+
: request.postData === undefined ? undefined : Buffer.from(request.postData);
|
|
104
|
+
if (request.hasPostData && data === undefined)
|
|
105
|
+
throw new Error('Missing request bytes');
|
|
106
|
+
const response = await http.fetch(url, {
|
|
107
|
+
method: request.method, headers, redirect: 'manual',
|
|
108
|
+
body: data === undefined ? undefined : new Uint8Array(data),
|
|
109
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(timeout)]),
|
|
110
|
+
}, { timeout });
|
|
111
|
+
const responseHeaders = [];
|
|
112
|
+
response.headers.forEach((value, name) => {
|
|
113
|
+
// Node fetch already decompresses the payload. Let Chromium calculate its new length.
|
|
114
|
+
if (!['content-encoding', 'content-length', 'transfer-encoding', 'connection', 'set-cookie'].includes(name)) {
|
|
115
|
+
responseHeaders.push({ name, value });
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
for (const value of response.headers.getSetCookie())
|
|
119
|
+
responseHeaders.push({ name: 'set-cookie', value });
|
|
120
|
+
await send('Fetch.fulfillRequest', {
|
|
121
|
+
requestId, responseCode: response.status, responseHeaders,
|
|
122
|
+
body: Buffer.from(await response.arrayBuffer()).toString('base64'),
|
|
123
|
+
}, sessionId);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (!signal.aborted && event.resourceType === 'Document' && (request.url === ORIGIN || request.url.startsWith(ORIGIN + '/'))) {
|
|
127
|
+
onNavigationFailure(error);
|
|
128
|
+
}
|
|
129
|
+
await send('Fetch.failRequest', { requestId, errorReason: signal.aborted ? 'Aborted' : 'Failed' }, sessionId).catch(() => { });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Playwright route() deliberately lets redirected requests bypass its handler. CDP interception is
|
|
134
|
+
* necessary for OAuth: attach before new pages/iframes execute, including the popup's first request.
|
|
135
|
+
*/
|
|
136
|
+
async function forwardBrowser(endpoint, http, signal, timeout, onNavigationFailure, proxyCredentials) {
|
|
137
|
+
const socket = new WebSocket(endpoint);
|
|
138
|
+
let nextId = 0;
|
|
139
|
+
const pending = new Map();
|
|
140
|
+
const targets = new Set();
|
|
141
|
+
const targetRequests = new Map();
|
|
142
|
+
const authenticatedRequests = new Set();
|
|
143
|
+
const finish = () => {
|
|
144
|
+
for (const controller of targetRequests.values())
|
|
145
|
+
controller.abort();
|
|
146
|
+
targetRequests.clear();
|
|
147
|
+
authenticatedRequests.clear();
|
|
148
|
+
for (const task of pending.values())
|
|
149
|
+
task.reject(new Error('Browser transport closed'));
|
|
150
|
+
pending.clear();
|
|
151
|
+
};
|
|
152
|
+
const close = () => { signal.removeEventListener('abort', close); socket.close(); finish(); };
|
|
153
|
+
socket.addEventListener('close', finish);
|
|
154
|
+
socket.addEventListener('error', finish);
|
|
155
|
+
const send = (method, params = {}, sessionId) => new Promise((resolve, reject) => {
|
|
156
|
+
if (socket.readyState !== WebSocket.OPEN) {
|
|
157
|
+
reject(new Error('Browser transport unavailable'));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const id = ++nextId;
|
|
161
|
+
pending.set(id, { resolve, reject });
|
|
162
|
+
socket.send(JSON.stringify({ id, method, params, sessionId }));
|
|
163
|
+
});
|
|
164
|
+
const attach = async (sessionId, type) => {
|
|
165
|
+
targetRequests.set(sessionId, new AbortController());
|
|
166
|
+
// This must be the first command: popup navigation can begin before Network.enable returns.
|
|
167
|
+
await send('Fetch.enable', { patterns: [{ urlPattern: '*', requestStage: 'Request' }],
|
|
168
|
+
...(proxyCredentials ? { handleAuthRequests: true } : {}) }, sessionId);
|
|
169
|
+
await send('Network.enable', { maxPostDataSize: 20 * 1024 * 1024 }, sessionId);
|
|
170
|
+
if (type === 'page' || type === 'iframe') {
|
|
171
|
+
if (!proxyCredentials)
|
|
172
|
+
await send('Network.setBypassServiceWorker', { bypass: true }, sessionId);
|
|
173
|
+
await send('Target.setAutoAttach', {
|
|
174
|
+
autoAttach: true, waitForDebuggerOnStart: true, flatten: true,
|
|
175
|
+
filter: [{ type: 'page' }, { type: 'iframe' }, { type: 'shared_worker' }, { exclude: true }],
|
|
176
|
+
}, sessionId);
|
|
177
|
+
}
|
|
178
|
+
await send('Runtime.runIfWaitingForDebugger', {}, sessionId);
|
|
179
|
+
};
|
|
180
|
+
socket.addEventListener('message', event => {
|
|
181
|
+
let message;
|
|
182
|
+
try {
|
|
183
|
+
message = JSON.parse(String(event.data));
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (message.id !== undefined) {
|
|
189
|
+
const task = pending.get(message.id);
|
|
190
|
+
pending.delete(message.id);
|
|
191
|
+
if (message.error)
|
|
192
|
+
task?.reject(new Error('Browser transport command failed'));
|
|
193
|
+
else
|
|
194
|
+
task?.resolve(message.result);
|
|
195
|
+
}
|
|
196
|
+
else if (message.method === 'Target.attachedToTarget') {
|
|
197
|
+
const { sessionId, targetInfo } = message.params;
|
|
198
|
+
const task = attach(sessionId, targetInfo.type);
|
|
199
|
+
targets.add(task);
|
|
200
|
+
void task.finally(() => targets.delete(task)).catch(() => { close(); });
|
|
201
|
+
}
|
|
202
|
+
else if (message.method === 'Target.detachedFromTarget') {
|
|
203
|
+
const { sessionId } = message.params;
|
|
204
|
+
targetRequests.get(sessionId)?.abort();
|
|
205
|
+
targetRequests.delete(sessionId);
|
|
206
|
+
}
|
|
207
|
+
else if (message.method === 'Fetch.requestPaused' && message.sessionId) {
|
|
208
|
+
if (proxyCredentials) {
|
|
209
|
+
const { requestId } = message.params;
|
|
210
|
+
void send('Fetch.continueRequest', { requestId }, message.sessionId).catch(() => { });
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const target = targetRequests.get(message.sessionId);
|
|
214
|
+
void forward(message.params, message.sessionId, send, http, target ? AbortSignal.any([signal, target.signal]) : signal, timeout, onNavigationFailure);
|
|
215
|
+
}
|
|
216
|
+
else if (message.method === 'Fetch.authRequired' && message.sessionId && proxyCredentials) {
|
|
217
|
+
const { requestId, authChallenge } = message.params;
|
|
218
|
+
const key = message.sessionId + ':' + requestId;
|
|
219
|
+
// Never send proxy credentials to an origin-server challenge, or loop after rejected credentials.
|
|
220
|
+
const answer = authChallenge.source !== 'Proxy' ? { response: 'Default' }
|
|
221
|
+
: authenticatedRequests.has(key) ? { response: 'CancelAuth' }
|
|
222
|
+
: { response: 'ProvideCredentials', ...proxyCredentials };
|
|
223
|
+
authenticatedRequests.add(key);
|
|
224
|
+
void send('Fetch.continueWithAuth', { requestId, authChallengeResponse: answer }, message.sessionId).catch(() => { });
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
try {
|
|
228
|
+
await new Promise((resolve, reject) => {
|
|
229
|
+
const timer = setTimeout(() => reject(new Error('Browser transport timed out')), timeout);
|
|
230
|
+
socket.addEventListener('open', () => { clearTimeout(timer); resolve(); }, { once: true });
|
|
231
|
+
socket.addEventListener('error', () => { clearTimeout(timer); reject(new Error('Browser transport unavailable')); }, { once: true });
|
|
232
|
+
socket.addEventListener('close', () => { clearTimeout(timer); reject(new Error('Browser transport closed')); }, { once: true });
|
|
233
|
+
});
|
|
234
|
+
signal.addEventListener('abort', close, { once: true });
|
|
235
|
+
if (signal.aborted)
|
|
236
|
+
throw new Error('Browser transport cancelled');
|
|
237
|
+
await send('Target.setAutoAttach', {
|
|
238
|
+
autoAttach: true, waitForDebuggerOnStart: true, flatten: true,
|
|
239
|
+
filter: [{ type: 'page' }, { type: 'iframe' }, { type: 'shared_worker' }, { exclude: true }],
|
|
240
|
+
});
|
|
241
|
+
await Promise.all([...targets]);
|
|
242
|
+
return { close, shutdown: async () => {
|
|
243
|
+
let timer;
|
|
244
|
+
try {
|
|
245
|
+
await Promise.race([send('Browser.close').catch(() => { }), new Promise(resolve => {
|
|
246
|
+
timer = setTimeout(resolve, 2000);
|
|
247
|
+
})]);
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
clearTimeout(timer);
|
|
251
|
+
close();
|
|
252
|
+
}
|
|
253
|
+
} };
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
close();
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async function unusedPort() {
|
|
261
|
+
const server = createServer();
|
|
262
|
+
try {
|
|
263
|
+
await new Promise((resolve, reject) => {
|
|
264
|
+
server.once('error', reject);
|
|
265
|
+
server.listen(0, '127.0.0.1', resolve);
|
|
266
|
+
});
|
|
267
|
+
return server.address().port;
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
await new Promise(resolve => server.close(() => resolve()));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
async function browserEndpoint(port, child, signal, timeout) {
|
|
274
|
+
const deadline = Date.now() + timeout;
|
|
275
|
+
while (Date.now() < deadline) {
|
|
276
|
+
if (signal.aborted || !child.pid || child.exitCode !== null)
|
|
277
|
+
throw new Error('Browser startup cancelled');
|
|
278
|
+
try {
|
|
279
|
+
// Only the private loopback DevTools connection uses direct fetch.
|
|
280
|
+
const response = await fetch('http://127.0.0.1:' + port + '/json/version', {
|
|
281
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(500)]),
|
|
282
|
+
});
|
|
283
|
+
const result = await response.json();
|
|
284
|
+
const endpoint = new URL(result.webSocketDebuggerUrl || '');
|
|
285
|
+
if (endpoint.protocol === 'ws:' && endpoint.hostname === '127.0.0.1' && endpoint.port === String(port)
|
|
286
|
+
&& endpoint.pathname.startsWith('/devtools/browser/'))
|
|
287
|
+
return endpoint.href;
|
|
288
|
+
}
|
|
289
|
+
catch { /* Chrome may still be creating its profile. */ }
|
|
290
|
+
await delay(100, undefined, { signal });
|
|
291
|
+
}
|
|
292
|
+
throw new SynthIdError('timeout', 'SynthID browser startup timed out');
|
|
293
|
+
}
|
|
294
|
+
function isSynthIdPage(page) {
|
|
295
|
+
try {
|
|
296
|
+
return !page.isClosed() && new URL(page.url()).origin === ORIGIN;
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/** Read the refresh token only after the user completed the browser login. */
|
|
303
|
+
async function readRefreshToken(page, userId) {
|
|
304
|
+
const token = await page.evaluate(refreshTokenScript + '(' + JSON.stringify(userId) + ')');
|
|
305
|
+
if (!/^[\x21-\x7e]+$/.test(token))
|
|
306
|
+
throw new SynthIdError('auth', 'SynthID did not provide a reusable login credential');
|
|
307
|
+
return token;
|
|
308
|
+
}
|
|
309
|
+
/** Read metadata from the live Firebase user, falling back to persisted auth. */
|
|
310
|
+
async function readAccount(page) {
|
|
311
|
+
return page.evaluate(accountScript);
|
|
312
|
+
}
|
|
313
|
+
export async function launchSynthIdBrowser(options) {
|
|
314
|
+
const { profileDir, headed, timeout, http, signal } = options;
|
|
315
|
+
if (signal.aborted)
|
|
316
|
+
throw new SynthIdError('cancelled', 'SynthID browser startup was cancelled');
|
|
317
|
+
await mkdir(profileDir, { recursive: true, mode: 0o700 });
|
|
318
|
+
let context;
|
|
319
|
+
let nativeBrowser;
|
|
320
|
+
let child;
|
|
321
|
+
let childDone;
|
|
322
|
+
let transport;
|
|
323
|
+
let startupFailure;
|
|
324
|
+
let starting = true;
|
|
325
|
+
let closeTask;
|
|
326
|
+
let closed = false;
|
|
327
|
+
const abort = new AbortController();
|
|
328
|
+
const closing = new AbortController();
|
|
329
|
+
const close = () => {
|
|
330
|
+
if (closeTask)
|
|
331
|
+
return closeTask;
|
|
332
|
+
closed = true;
|
|
333
|
+
closing.abort();
|
|
334
|
+
signal.removeEventListener('abort', onAbort);
|
|
335
|
+
closeTask = (async () => {
|
|
336
|
+
// Closing through CDP flushes the profile. Playwright close only disconnects an attached browser.
|
|
337
|
+
if (transport)
|
|
338
|
+
await transport.shutdown();
|
|
339
|
+
else if (nativeBrowser) {
|
|
340
|
+
const cdp = await nativeBrowser.newBrowserCDPSession().catch(() => undefined);
|
|
341
|
+
await cdp?.send('Browser.close').catch(() => { });
|
|
342
|
+
}
|
|
343
|
+
else
|
|
344
|
+
child?.kill();
|
|
345
|
+
abort.abort();
|
|
346
|
+
transport?.close();
|
|
347
|
+
await nativeBrowser?.close().catch(() => { });
|
|
348
|
+
if (child && child.exitCode === null) {
|
|
349
|
+
await Promise.race([childDone, delay(3000)]);
|
|
350
|
+
if (child.exitCode === null)
|
|
351
|
+
child.kill();
|
|
352
|
+
await childDone;
|
|
353
|
+
}
|
|
354
|
+
})();
|
|
355
|
+
return closeTask;
|
|
356
|
+
};
|
|
357
|
+
const onAbort = () => { void close(); };
|
|
358
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
359
|
+
try {
|
|
360
|
+
const proxy = nativeProxy(http);
|
|
361
|
+
const port = await unusedPort();
|
|
362
|
+
if (signal.aborted)
|
|
363
|
+
throw new SynthIdError('cancelled', 'SynthID browser startup was cancelled');
|
|
364
|
+
// Use an ordinary installed browser with its sandbox, dedicated profile, and nonzero debugging port.
|
|
365
|
+
// Playwright's launch flags (including its pipe) mark even the visible login window as a test browser.
|
|
366
|
+
child = spawn(browserExecutable(), [
|
|
367
|
+
'--user-data-dir=' + profileDir, '--remote-debugging-address=127.0.0.1', '--remote-debugging-port=' + port,
|
|
368
|
+
'--no-first-run', '--no-default-browser-check', '--window-size=1280,900', '--lang=en-US',
|
|
369
|
+
'--disable-background-networking', '--disable-component-update', '--disable-popup-blocking',
|
|
370
|
+
// Native Chromium requests retain their headers, TLS and worker networking. Older hosts
|
|
371
|
+
// without proxy resolution keep the existing fail-closed HTTP bridge.
|
|
372
|
+
...(proxy?.server === '' ? ['--no-proxy-server'] : [
|
|
373
|
+
'--proxy-server=' + (proxy?.server ?? 'http://127.0.0.1:1'), '--proxy-bypass-list=<-loopback>',
|
|
374
|
+
]),
|
|
375
|
+
...(headed ? [] : ['--headless=new']), 'about:blank',
|
|
376
|
+
], { stdio: 'ignore', windowsHide: !headed });
|
|
377
|
+
childDone = new Promise(resolve => { child.once('exit', () => resolve()); child.once('error', () => resolve()); });
|
|
378
|
+
const endpoint = await browserEndpoint(port, child, abort.signal, timeout);
|
|
379
|
+
// Connect only to the browser process started above, on its loopback endpoint.
|
|
380
|
+
nativeBrowser = await chromium.connectOverCDP(endpoint, { timeout });
|
|
381
|
+
context = nativeBrowser.contexts()[0];
|
|
382
|
+
if (!context)
|
|
383
|
+
throw new Error('Browser context missing');
|
|
384
|
+
if (closed || signal.aborted) {
|
|
385
|
+
closeTask = undefined;
|
|
386
|
+
await close();
|
|
387
|
+
throw new SynthIdError('cancelled', 'SynthID browser startup was cancelled');
|
|
388
|
+
}
|
|
389
|
+
context.on('close', () => { closed = true; closing.abort(); abort.abort(); signal.removeEventListener('abort', onAbort); });
|
|
390
|
+
if (!proxy || proxy.credentials) {
|
|
391
|
+
transport = await forwardBrowser(endpoint, http, abort.signal, timeout, error => {
|
|
392
|
+
if (starting)
|
|
393
|
+
startupFailure = navigationFailure(error);
|
|
394
|
+
}, proxy?.credentials);
|
|
395
|
+
}
|
|
396
|
+
const landing = context.pages()[0] || await context.newPage();
|
|
397
|
+
await landing.goto(ORIGIN + '/', { waitUntil: 'domcontentloaded', timeout });
|
|
398
|
+
// Wait for the application, including its initial consent state, to be mounted.
|
|
399
|
+
await landing.locator('input[type="file"]').first().waitFor({ state: 'attached', timeout });
|
|
400
|
+
starting = false;
|
|
401
|
+
const browser = context;
|
|
402
|
+
const account = async () => {
|
|
403
|
+
if (closed)
|
|
404
|
+
throw new SynthIdError('cancelled', 'SynthID browser was closed');
|
|
405
|
+
const page = browser.pages().find(isSynthIdPage);
|
|
406
|
+
if (!page)
|
|
407
|
+
return { loggedIn: false, accepted: false };
|
|
408
|
+
try {
|
|
409
|
+
return await readAccount(page);
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
if (closed)
|
|
413
|
+
throw failure(error, true);
|
|
414
|
+
// OAuth redirects replace execution contexts; the login manager polls again after navigation.
|
|
415
|
+
return { loggedIn: false, accepted: false };
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
return {
|
|
419
|
+
account, close, isClosed: () => closed,
|
|
420
|
+
async captureCredentials(_captureTimeout) {
|
|
421
|
+
if (closed)
|
|
422
|
+
throw new SynthIdError('cancelled', 'SynthID browser was closed');
|
|
423
|
+
const page = browser.pages().find(isSynthIdPage);
|
|
424
|
+
if (!page || closed)
|
|
425
|
+
throw new SynthIdError('auth', 'Sign in to SynthID first');
|
|
426
|
+
const info = await readAccount(page);
|
|
427
|
+
if (!info.loggedIn || !info.accepted)
|
|
428
|
+
throw new SynthIdError('auth', 'Complete SynthID sign-in first');
|
|
429
|
+
return { refreshToken: await readRefreshToken(page), pushFilename: '', bgToken: '' };
|
|
430
|
+
},
|
|
431
|
+
async bringToFront() {
|
|
432
|
+
if (closed)
|
|
433
|
+
throw new SynthIdError('cancelled', 'SynthID browser was closed');
|
|
434
|
+
try {
|
|
435
|
+
// OAuth can open a popup. Bring that window forward while the user signs in.
|
|
436
|
+
const page = browser.pages().filter(page => !page.isClosed()).at(-1);
|
|
437
|
+
if (page)
|
|
438
|
+
await page.bringToFront();
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
throw failure(error, closed);
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
const problem = (!closed && !signal.aborted && startupFailure) || failure(error, closed);
|
|
448
|
+
await close();
|
|
449
|
+
throw problem;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Public CSS named attributes independently collected on owned pristine Chrome 157.0.8103.38.
|
|
2
|
+
// Mappings use synthetic initial declarations: single canonical cssText, or
|
|
3
|
+
// CSSOM camel conversion verified against the written shorthand declaration.
|
|
4
|
+
// Native descriptor attributes unsupported as inline declarations use CSSOM
|
|
5
|
+
// name conversion for read projection only; writes retain backend behavior.
|
|
6
|
+
// No website/challenge data.
|
|
7
|
+
export const chromiumCssPropertyCatalog = Object.freeze([["accentColor","accent-color"],["additiveSymbols","additive-symbols"],["alignContent","align-content"],["alignItems","align-items"],["alignSelf","align-self"],["alignmentBaseline","alignment-baseline"],["all","all"],["anchorName","anchor-name"],["anchorScope","anchor-scope"],["animation","animation"],["animationComposition","animation-composition"],["animationDelay","animation-delay"],["animationDirection","animation-direction"],["animationDuration","animation-duration"],["animationFillMode","animation-fill-mode"],["animationIterationCount","animation-iteration-count"],["animationName","animation-name"],["animationPlayState","animation-play-state"],["animationRange","animation-range"],["animationRangeEnd","animation-range-end"],["animationRangeStart","animation-range-start"],["animationTimeline","animation-timeline"],["animationTimingFunction","animation-timing-function"],["animationTrigger","animation-trigger"],["appRegion","app-region"],["appearance","appearance"],["ascentOverride","ascent-override"],["aspectRatio","aspect-ratio"],["backdropFilter","backdrop-filter"],["backfaceVisibility","backface-visibility"],["background","background"],["backgroundAttachment","background-attachment"],["backgroundBlendMode","background-blend-mode"],["backgroundClip","background-clip"],["backgroundColor","background-color"],["backgroundImage","background-image"],["backgroundOrigin","background-origin"],["backgroundPosition","background-position"],["backgroundPositionX","background-position-x"],["backgroundPositionY","background-position-y"],["backgroundRepeat","background-repeat"],["backgroundSize","background-size"],["basePalette","base-palette"],["baselineShift","baseline-shift"],["baselineSource","baseline-source"],["blockSize","block-size"],["border","border"],["borderBlock","border-block"],["borderBlockColor","border-block-color"],["borderBlockEnd","border-block-end"],["borderBlockEndColor","border-block-end-color"],["borderBlockEndStyle","border-block-end-style"],["borderBlockEndWidth","border-block-end-width"],["borderBlockStart","border-block-start"],["borderBlockStartColor","border-block-start-color"],["borderBlockStartStyle","border-block-start-style"],["borderBlockStartWidth","border-block-start-width"],["borderBlockStyle","border-block-style"],["borderBlockWidth","border-block-width"],["borderBottom","border-bottom"],["borderBottomColor","border-bottom-color"],["borderBottomLeftRadius","border-bottom-left-radius"],["borderBottomRightRadius","border-bottom-right-radius"],["borderBottomStyle","border-bottom-style"],["borderBottomWidth","border-bottom-width"],["borderCollapse","border-collapse"],["borderColor","border-color"],["borderEndEndRadius","border-end-end-radius"],["borderEndStartRadius","border-end-start-radius"],["borderImage","border-image"],["borderImageOutset","border-image-outset"],["borderImageRepeat","border-image-repeat"],["borderImageSlice","border-image-slice"],["borderImageSource","border-image-source"],["borderImageWidth","border-image-width"],["borderInline","border-inline"],["borderInlineColor","border-inline-color"],["borderInlineEnd","border-inline-end"],["borderInlineEndColor","border-inline-end-color"],["borderInlineEndStyle","border-inline-end-style"],["borderInlineEndWidth","border-inline-end-width"],["borderInlineStart","border-inline-start"],["borderInlineStartColor","border-inline-start-color"],["borderInlineStartStyle","border-inline-start-style"],["borderInlineStartWidth","border-inline-start-width"],["borderInlineStyle","border-inline-style"],["borderInlineWidth","border-inline-width"],["borderLeft","border-left"],["borderLeftColor","border-left-color"],["borderLeftStyle","border-left-style"],["borderLeftWidth","border-left-width"],["borderRadius","border-radius"],["borderRight","border-right"],["borderRightColor","border-right-color"],["borderRightStyle","border-right-style"],["borderRightWidth","border-right-width"],["borderShape","border-shape"],["borderSpacing","border-spacing"],["borderStartEndRadius","border-start-end-radius"],["borderStartStartRadius","border-start-start-radius"],["borderStyle","border-style"],["borderTop","border-top"],["borderTopColor","border-top-color"],["borderTopLeftRadius","border-top-left-radius"],["borderTopRightRadius","border-top-right-radius"],["borderTopStyle","border-top-style"],["borderTopWidth","border-top-width"],["borderWidth","border-width"],["bottom","bottom"],["boxDecorationBreak","box-decoration-break"],["boxShadow","box-shadow"],["boxSizing","box-sizing"],["breakAfter","break-after"],["breakBefore","break-before"],["breakInside","break-inside"],["bufferedRendering","buffered-rendering"],["captionSide","caption-side"],["caretAnimation","caret-animation"],["caretColor","caret-color"],["caretShape","caret-shape"],["clear","clear"],["clip","clip"],["clipPath","clip-path"],["clipRule","clip-rule"],["color","color"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorRendering","color-rendering"],["colorScheme","color-scheme"],["columnCount","column-count"],["columnFill","column-fill"],["columnGap","column-gap"],["columnHeight","column-height"],["columnRule","column-rule"],["columnRuleBreak","column-rule-break"],["columnRuleColor","column-rule-color"],["columnRuleInset","column-rule-inset"],["columnRuleInsetCap","column-rule-inset-cap"],["columnRuleInsetCapEnd","column-rule-inset-cap-end"],["columnRuleInsetCapStart","column-rule-inset-cap-start"],["columnRuleInsetEnd","column-rule-inset-end"],["columnRuleInsetJunction","column-rule-inset-junction"],["columnRuleInsetJunctionEnd","column-rule-inset-junction-end"],["columnRuleInsetJunctionStart","column-rule-inset-junction-start"],["columnRuleInsetStart","column-rule-inset-start"],["columnRuleStyle","column-rule-style"],["columnRuleVisibilityItems","column-rule-visibility-items"],["columnRuleWidth","column-rule-width"],["columnSpan","column-span"],["columnWidth","column-width"],["columnWrap","column-wrap"],["columns","columns"],["contain","contain"],["containIntrinsicBlockSize","contain-intrinsic-block-size"],["containIntrinsicHeight","contain-intrinsic-height"],["containIntrinsicInlineSize","contain-intrinsic-inline-size"],["containIntrinsicSize","contain-intrinsic-size"],["containIntrinsicWidth","contain-intrinsic-width"],["container","container"],["containerName","container-name"],["containerType","container-type"],["content","content"],["contentVisibility","content-visibility"],["cornerBlockEndShape","corner-block-end-shape"],["cornerBlockStartShape","corner-block-start-shape"],["cornerBottomLeftShape","corner-bottom-left-shape"],["cornerBottomRightShape","corner-bottom-right-shape"],["cornerBottomShape","corner-bottom-shape"],["cornerEndEndShape","corner-end-end-shape"],["cornerEndStartShape","corner-end-start-shape"],["cornerInlineEndShape","corner-inline-end-shape"],["cornerInlineStartShape","corner-inline-start-shape"],["cornerLeftShape","corner-left-shape"],["cornerRightShape","corner-right-shape"],["cornerShape","corner-shape"],["cornerStartEndShape","corner-start-end-shape"],["cornerStartStartShape","corner-start-start-shape"],["cornerTopLeftShape","corner-top-left-shape"],["cornerTopRightShape","corner-top-right-shape"],["cornerTopShape","corner-top-shape"],["counterIncrement","counter-increment"],["counterReset","counter-reset"],["counterSet","counter-set"],["cssFloat","float"],["cursor","cursor"],["cx","cx"],["cy","cy"],["d","d"],["descentOverride","descent-override"],["direction","direction"],["display","display"],["dominantBaseline","dominant-baseline"],["dynamicRangeLimit","dynamic-range-limit"],["emptyCells","empty-cells"],["fallback","fallback"],["fieldSizing","field-sizing"],["fill","fill"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["filter","filter"],["flex","flex"],["flexBasis","flex-basis"],["flexDirection","flex-direction"],["flexFlow","flex-flow"],["flexGrow","flex-grow"],["flexLineCount","flex-line-count"],["flexShrink","flex-shrink"],["flexWrap","flex-wrap"],["float","float"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["font","font"],["fontDisplay","font-display"],["fontFamily","font-family"],["fontFeatureSettings","font-feature-settings"],["fontKerning","font-kerning"],["fontLanguageOverride","font-language-override"],["fontOpticalSizing","font-optical-sizing"],["fontPalette","font-palette"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontSynthesis","font-synthesis"],["fontSynthesisSmallCaps","font-synthesis-small-caps"],["fontSynthesisStyle","font-synthesis-style"],["fontSynthesisWeight","font-synthesis-weight"],["fontVariant","font-variant"],["fontVariantAlternates","font-variant-alternates"],["fontVariantCaps","font-variant-caps"],["fontVariantEastAsian","font-variant-east-asian"],["fontVariantEmoji","font-variant-emoji"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantNumeric","font-variant-numeric"],["fontVariantPosition","font-variant-position"],["fontVariationSettings","font-variation-settings"],["fontWeight","font-weight"],["forcedColorAdjust","forced-color-adjust"],["frameSizing","frame-sizing"],["gap","gap"],["grid","grid"],["gridArea","grid-area"],["gridAutoColumns","grid-auto-columns"],["gridAutoFlow","grid-auto-flow"],["gridAutoRows","grid-auto-rows"],["gridColumn","grid-column"],["gridColumnEnd","grid-column-end"],["gridColumnGap","column-gap"],["gridColumnStart","grid-column-start"],["gridGap","gap"],["gridRow","grid-row"],["gridRowEnd","grid-row-end"],["gridRowGap","row-gap"],["gridRowStart","grid-row-start"],["gridTemplate","grid-template"],["gridTemplateAreas","grid-template-areas"],["gridTemplateColumns","grid-template-columns"],["gridTemplateRows","grid-template-rows"],["height","height"],["hyphenateCharacter","hyphenate-character"],["hyphenateLimitChars","hyphenate-limit-chars"],["hyphens","hyphens"],["imageOrientation","image-orientation"],["imageRendering","image-rendering"],["inherits","inherits"],["initialLetter","initial-letter"],["initialValue","initial-value"],["inlineSize","inline-size"],["inset","inset"],["insetBlock","inset-block"],["insetBlockEnd","inset-block-end"],["insetBlockStart","inset-block-start"],["insetInline","inset-inline"],["insetInlineEnd","inset-inline-end"],["insetInlineStart","inset-inline-start"],["interactivity","interactivity"],["interestDelay","interest-delay"],["interestDelayEnd","interest-delay-end"],["interestDelayStart","interest-delay-start"],["interpolateSize","interpolate-size"],["isolation","isolation"],["justifyContent","justify-content"],["justifyItems","justify-items"],["justifySelf","justify-self"],["left","left"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["lineBreak","line-break"],["lineGapOverride","line-gap-override"],["lineHeight","line-height"],["listStyle","list-style"],["listStyleImage","list-style-image"],["listStylePosition","list-style-position"],["listStyleType","list-style-type"],["margin","margin"],["marginBlock","margin-block"],["marginBlockEnd","margin-block-end"],["marginBlockStart","margin-block-start"],["marginBottom","margin-bottom"],["marginInline","margin-inline"],["marginInlineEnd","margin-inline-end"],["marginInlineStart","margin-inline-start"],["marginLeft","margin-left"],["marginRight","margin-right"],["marginTop","margin-top"],["marginTrim","margin-trim"],["marker","marker"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["mask","mask"],["maskClip","mask-clip"],["maskComposite","mask-composite"],["maskImage","mask-image"],["maskMode","mask-mode"],["maskOrigin","mask-origin"],["maskPosition","mask-position"],["maskRepeat","mask-repeat"],["maskSize","mask-size"],["maskType","mask-type"],["mathDepth","math-depth"],["mathShift","math-shift"],["mathStyle","math-style"],["maxBlockSize","max-block-size"],["maxHeight","max-height"],["maxInlineSize","max-inline-size"],["maxWidth","max-width"],["minBlockSize","min-block-size"],["minHeight","min-height"],["minInlineSize","min-inline-size"],["minWidth","min-width"],["mixBlendMode","mix-blend-mode"],["navigation","navigation"],["negative","negative"],["objectFit","object-fit"],["objectPosition","object-position"],["objectViewBox","object-view-box"],["offset","offset"],["offsetAnchor","offset-anchor"],["offsetDistance","offset-distance"],["offsetPath","offset-path"],["offsetPosition","offset-position"],["offsetRotate","offset-rotate"],["opacity","opacity"],["order","order"],["orphans","orphans"],["outline","outline"],["outlineColor","outline-color"],["outlineOffset","outline-offset"],["outlineStyle","outline-style"],["outlineWidth","outline-width"],["overflow","overflow"],["overflowAnchor","overflow-anchor"],["overflowBlock","overflow-block"],["overflowClipMargin","overflow-clip-margin"],["overflowInline","overflow-inline"],["overflowWrap","overflow-wrap"],["overflowX","overflow-x"],["overflowY","overflow-y"],["overlay","overlay"],["overrideColors","override-colors"],["overscrollBehavior","overscroll-behavior"],["overscrollBehaviorBlock","overscroll-behavior-block"],["overscrollBehaviorInline","overscroll-behavior-inline"],["overscrollBehaviorX","overscroll-behavior-x"],["overscrollBehaviorY","overscroll-behavior-y"],["pad","pad"],["padding","padding"],["paddingBlock","padding-block"],["paddingBlockEnd","padding-block-end"],["paddingBlockStart","padding-block-start"],["paddingBottom","padding-bottom"],["paddingInline","padding-inline"],["paddingInlineEnd","padding-inline-end"],["paddingInlineStart","padding-inline-start"],["paddingLeft","padding-left"],["paddingRight","padding-right"],["paddingTop","padding-top"],["page","page"],["pageBreakAfter","break-after"],["pageBreakBefore","break-before"],["pageBreakInside","break-inside"],["pageMarginSafety","page-margin-safety"],["pageOrientation","page-orientation"],["paintOrder","paint-order"],["perspective","perspective"],["perspectiveOrigin","perspective-origin"],["placeContent","place-content"],["placeItems","place-items"],["placeSelf","place-self"],["pointerEvents","pointer-events"],["position","position"],["positionAnchor","position-anchor"],["positionArea","position-area"],["positionTry","position-try"],["positionTryFallbacks","position-try-fallbacks"],["positionTryOrder","position-try-order"],["positionVisibility","position-visibility"],["prefix","prefix"],["printColorAdjust","print-color-adjust"],["quotes","quotes"],["r","r"],["range","range"],["readingFlow","reading-flow"],["readingOrder","reading-order"],["resize","resize"],["result","result"],["right","right"],["rotate","rotate"],["rowGap","row-gap"],["rowRule","row-rule"],["rowRuleBreak","row-rule-break"],["rowRuleColor","row-rule-color"],["rowRuleInset","row-rule-inset"],["rowRuleInsetCap","row-rule-inset-cap"],["rowRuleInsetCapEnd","row-rule-inset-cap-end"],["rowRuleInsetCapStart","row-rule-inset-cap-start"],["rowRuleInsetEnd","row-rule-inset-end"],["rowRuleInsetJunction","row-rule-inset-junction"],["rowRuleInsetJunctionEnd","row-rule-inset-junction-end"],["rowRuleInsetJunctionStart","row-rule-inset-junction-start"],["rowRuleInsetStart","row-rule-inset-start"],["rowRuleStyle","row-rule-style"],["rowRuleVisibilityItems","row-rule-visibility-items"],["rowRuleWidth","row-rule-width"],["rubyAlign","ruby-align"],["rubyOverhang","ruby-overhang"],["rubyPosition","ruby-position"],["rule","rule"],["ruleBreak","rule-break"],["ruleColor","rule-color"],["ruleInset","rule-inset"],["ruleInsetCap","rule-inset-cap"],["ruleInsetEnd","rule-inset-end"],["ruleInsetJunction","rule-inset-junction"],["ruleInsetStart","rule-inset-start"],["ruleOverlap","rule-overlap"],["ruleStyle","rule-style"],["ruleVisibilityItems","rule-visibility-items"],["ruleWidth","rule-width"],["rx","rx"],["ry","ry"],["scale","scale"],["scrollAxisLock","scroll-axis-lock"],["scrollBehavior","scroll-behavior"],["scrollInitialTarget","scroll-initial-target"],["scrollMargin","scroll-margin"],["scrollMarginBlock","scroll-margin-block"],["scrollMarginBlockEnd","scroll-margin-block-end"],["scrollMarginBlockStart","scroll-margin-block-start"],["scrollMarginBottom","scroll-margin-bottom"],["scrollMarginInline","scroll-margin-inline"],["scrollMarginInlineEnd","scroll-margin-inline-end"],["scrollMarginInlineStart","scroll-margin-inline-start"],["scrollMarginLeft","scroll-margin-left"],["scrollMarginRight","scroll-margin-right"],["scrollMarginTop","scroll-margin-top"],["scrollMarkerGroup","scroll-marker-group"],["scrollPadding","scroll-padding"],["scrollPaddingBlock","scroll-padding-block"],["scrollPaddingBlockEnd","scroll-padding-block-end"],["scrollPaddingBlockStart","scroll-padding-block-start"],["scrollPaddingBottom","scroll-padding-bottom"],["scrollPaddingInline","scroll-padding-inline"],["scrollPaddingInlineEnd","scroll-padding-inline-end"],["scrollPaddingInlineStart","scroll-padding-inline-start"],["scrollPaddingLeft","scroll-padding-left"],["scrollPaddingRight","scroll-padding-right"],["scrollPaddingTop","scroll-padding-top"],["scrollSnapAlign","scroll-snap-align"],["scrollSnapStop","scroll-snap-stop"],["scrollSnapType","scroll-snap-type"],["scrollTargetGroup","scroll-target-group"],["scrollTimeline","scroll-timeline"],["scrollTimelineAxis","scroll-timeline-axis"],["scrollTimelineName","scroll-timeline-name"],["scrollbarColor","scrollbar-color"],["scrollbarGutter","scrollbar-gutter"],["scrollbarWidth","scrollbar-width"],["shapeImageThreshold","shape-image-threshold"],["shapeMargin","shape-margin"],["shapeOutside","shape-outside"],["shapeRendering","shape-rendering"],["size","size"],["sizeAdjust","size-adjust"],["speak","speak"],["speakAs","speak-as"],["src","src"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["stroke","stroke"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["suffix","suffix"],["symbols","symbols"],["syntax","syntax"],["system","system"],["tabSize","tab-size"],["tableLayout","table-layout"],["textAlign","text-align"],["textAlignLast","text-align-last"],["textAnchor","text-anchor"],["textAutospace","text-autospace"],["textBox","text-box"],["textBoxEdge","text-box-edge"],["textBoxTrim","text-box-trim"],["textCombineUpright","text-combine-upright"],["textDecoration","text-decoration"],["textDecorationColor","text-decoration-color"],["textDecorationInset","text-decoration-inset"],["textDecorationLine","text-decoration-line"],["textDecorationSkipInk","text-decoration-skip-ink"],["textDecorationStyle","text-decoration-style"],["textDecorationThickness","text-decoration-thickness"],["textEmphasis","text-emphasis"],["textEmphasisColor","text-emphasis-color"],["textEmphasisPosition","text-emphasis-position"],["textEmphasisStyle","text-emphasis-style"],["textFit","text-fit"],["textIndent","text-indent"],["textJustify","text-justify"],["textOrientation","text-orientation"],["textOverflow","text-overflow"],["textRendering","text-rendering"],["textShadow","text-shadow"],["textSizeAdjust","text-size-adjust"],["textSpacingTrim","text-spacing-trim"],["textTransform","text-transform"],["textUnderlineOffset","text-underline-offset"],["textUnderlinePosition","text-underline-position"],["textWrap","text-wrap"],["textWrapMode","text-wrap-mode"],["textWrapStyle","text-wrap-style"],["timelineScope","timeline-scope"],["timelineTrigger","timeline-trigger"],["timelineTriggerActivationRange","timeline-trigger-activation-range"],["timelineTriggerActivationRangeEnd","timeline-trigger-activation-range-end"],["timelineTriggerActivationRangeStart","timeline-trigger-activation-range-start"],["timelineTriggerActiveRange","timeline-trigger-active-range"],["timelineTriggerActiveRangeEnd","timeline-trigger-active-range-end"],["timelineTriggerActiveRangeStart","timeline-trigger-active-range-start"],["timelineTriggerName","timeline-trigger-name"],["timelineTriggerSource","timeline-trigger-source"],["top","top"],["touchAction","touch-action"],["transform","transform"],["transformBox","transform-box"],["transformOrigin","transform-origin"],["transformStyle","transform-style"],["transition","transition"],["transitionBehavior","transition-behavior"],["transitionDelay","transition-delay"],["transitionDuration","transition-duration"],["transitionProperty","transition-property"],["transitionTimingFunction","transition-timing-function"],["translate","translate"],["triggerScope","trigger-scope"],["types","types"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["userSelect","user-select"],["vectorEffect","vector-effect"],["verticalAlign","vertical-align"],["viewTimeline","view-timeline"],["viewTimelineAxis","view-timeline-axis"],["viewTimelineInset","view-timeline-inset"],["viewTimelineName","view-timeline-name"],["viewTransitionClass","view-transition-class"],["viewTransitionGroup","view-transition-group"],["viewTransitionName","view-transition-name"],["viewTransitionScope","view-transition-scope"],["visibility","visibility"],["webkitAlignContent","align-content"],["webkitAlignItems","align-items"],["webkitAlignSelf","align-self"],["webkitAnimation","animation"],["webkitAnimationDelay","animation-delay"],["webkitAnimationDirection","animation-direction"],["webkitAnimationDuration","animation-duration"],["webkitAnimationFillMode","animation-fill-mode"],["webkitAnimationIterationCount","animation-iteration-count"],["webkitAnimationName","animation-name"],["webkitAnimationPlayState","animation-play-state"],["webkitAnimationTimingFunction","animation-timing-function"],["webkitAppRegion","app-region"],["webkitAppearance","appearance"],["webkitBackfaceVisibility","backface-visibility"],["webkitBackgroundClip","background-clip"],["webkitBackgroundOrigin","background-origin"],["webkitBackgroundSize","background-size"],["webkitBorderAfter","border-block-end"],["webkitBorderAfterColor","border-block-end-color"],["webkitBorderAfterStyle","border-block-end-style"],["webkitBorderAfterWidth","border-block-end-width"],["webkitBorderBefore","border-block-start"],["webkitBorderBeforeColor","border-block-start-color"],["webkitBorderBeforeStyle","border-block-start-style"],["webkitBorderBeforeWidth","border-block-start-width"],["webkitBorderBottomLeftRadius","border-bottom-left-radius"],["webkitBorderBottomRightRadius","border-bottom-right-radius"],["webkitBorderEnd","border-inline-end"],["webkitBorderEndColor","border-inline-end-color"],["webkitBorderEndStyle","border-inline-end-style"],["webkitBorderEndWidth","border-inline-end-width"],["webkitBorderHorizontalSpacing","-webkit-border-horizontal-spacing"],["webkitBorderImage","-webkit-border-image"],["webkitBorderRadius","border-radius"],["webkitBorderStart","border-inline-start"],["webkitBorderStartColor","border-inline-start-color"],["webkitBorderStartStyle","border-inline-start-style"],["webkitBorderStartWidth","border-inline-start-width"],["webkitBorderTopLeftRadius","border-top-left-radius"],["webkitBorderTopRightRadius","border-top-right-radius"],["webkitBorderVerticalSpacing","-webkit-border-vertical-spacing"],["webkitBoxAlign","-webkit-box-align"],["webkitBoxDecorationBreak","-webkit-box-decoration-break"],["webkitBoxDirection","-webkit-box-direction"],["webkitBoxFlex","-webkit-box-flex"],["webkitBoxOrdinalGroup","-webkit-box-ordinal-group"],["webkitBoxOrient","-webkit-box-orient"],["webkitBoxPack","-webkit-box-pack"],["webkitBoxReflect","-webkit-box-reflect"],["webkitBoxShadow","box-shadow"],["webkitBoxSizing","box-sizing"],["webkitClipPath","clip-path"],["webkitColumnBreakAfter","break-after"],["webkitColumnBreakBefore","break-before"],["webkitColumnBreakInside","break-inside"],["webkitColumnCount","column-count"],["webkitColumnGap","column-gap"],["webkitColumnRule","column-rule"],["webkitColumnRuleColor","column-rule-color"],["webkitColumnRuleStyle","column-rule-style"],["webkitColumnRuleWidth","column-rule-width"],["webkitColumnSpan","column-span"],["webkitColumnWidth","column-width"],["webkitColumns","columns"],["webkitFilter","filter"],["webkitFlex","flex"],["webkitFlexBasis","flex-basis"],["webkitFlexDirection","flex-direction"],["webkitFlexFlow","flex-flow"],["webkitFlexGrow","flex-grow"],["webkitFlexShrink","flex-shrink"],["webkitFlexWrap","flex-wrap"],["webkitFontFeatureSettings","font-feature-settings"],["webkitFontSmoothing","-webkit-font-smoothing"],["webkitHyphenateCharacter","hyphenate-character"],["webkitJustifyContent","justify-content"],["webkitLineBreak","-webkit-line-break"],["webkitLineClamp","-webkit-line-clamp"],["webkitLocale","-webkit-locale"],["webkitLogicalHeight","block-size"],["webkitLogicalWidth","inline-size"],["webkitMarginAfter","margin-block-end"],["webkitMarginBefore","margin-block-start"],["webkitMarginEnd","margin-inline-end"],["webkitMarginStart","margin-inline-start"],["webkitMask","mask"],["webkitMaskBoxImage","-webkit-mask-box-image"],["webkitMaskBoxImageOutset","-webkit-mask-box-image-outset"],["webkitMaskBoxImageRepeat","-webkit-mask-box-image-repeat"],["webkitMaskBoxImageSlice","-webkit-mask-box-image-slice"],["webkitMaskBoxImageSource","-webkit-mask-box-image-source"],["webkitMaskBoxImageWidth","-webkit-mask-box-image-width"],["webkitMaskClip","mask-clip"],["webkitMaskComposite","mask-composite"],["webkitMaskImage","mask-image"],["webkitMaskOrigin","mask-origin"],["webkitMaskPosition","mask-position"],["webkitMaskPositionX","-webkit-mask-position-x"],["webkitMaskPositionY","-webkit-mask-position-y"],["webkitMaskRepeat","mask-repeat"],["webkitMaskSize","mask-size"],["webkitMaxLogicalHeight","max-block-size"],["webkitMaxLogicalWidth","max-inline-size"],["webkitMinLogicalHeight","min-block-size"],["webkitMinLogicalWidth","min-inline-size"],["webkitOpacity","opacity"],["webkitOrder","order"],["webkitPaddingAfter","padding-block-end"],["webkitPaddingBefore","padding-block-start"],["webkitPaddingEnd","padding-inline-end"],["webkitPaddingStart","padding-inline-start"],["webkitPerspective","perspective"],["webkitPerspectiveOrigin","perspective-origin"],["webkitPerspectiveOriginX","-webkit-perspective-origin-x"],["webkitPerspectiveOriginY","-webkit-perspective-origin-y"],["webkitPrintColorAdjust","print-color-adjust"],["webkitRtlOrdering","-webkit-rtl-ordering"],["webkitRubyPosition","-webkit-ruby-position"],["webkitShapeImageThreshold","shape-image-threshold"],["webkitShapeMargin","shape-margin"],["webkitShapeOutside","shape-outside"],["webkitTapHighlightColor","-webkit-tap-highlight-color"],["webkitTextCombine","-webkit-text-combine"],["webkitTextDecorationsInEffect","-webkit-text-decorations-in-effect"],["webkitTextEmphasis","text-emphasis"],["webkitTextEmphasisColor","text-emphasis-color"],["webkitTextEmphasisPosition","text-emphasis-position"],["webkitTextEmphasisStyle","text-emphasis-style"],["webkitTextFillColor","-webkit-text-fill-color"],["webkitTextOrientation","-webkit-text-orientation"],["webkitTextSecurity","-webkit-text-security"],["webkitTextSizeAdjust","text-size-adjust"],["webkitTextStroke","-webkit-text-stroke"],["webkitTextStrokeColor","-webkit-text-stroke-color"],["webkitTextStrokeWidth","-webkit-text-stroke-width"],["webkitTransform","transform"],["webkitTransformOrigin","transform-origin"],["webkitTransformOriginX","-webkit-transform-origin-x"],["webkitTransformOriginY","-webkit-transform-origin-y"],["webkitTransformOriginZ","-webkit-transform-origin-z"],["webkitTransformStyle","transform-style"],["webkitTransition","transition"],["webkitTransitionDelay","transition-delay"],["webkitTransitionDuration","transition-duration"],["webkitTransitionProperty","transition-property"],["webkitTransitionTimingFunction","transition-timing-function"],["webkitUserDrag","-webkit-user-drag"],["webkitUserModify","-webkit-user-modify"],["webkitUserSelect","user-select"],["webkitWritingMode","-webkit-writing-mode"],["whiteSpace","white-space"],["whiteSpaceCollapse","white-space-collapse"],["widows","widows"],["width","width"],["willChange","will-change"],["windowDrag","window-drag"],["wordBreak","word-break"],["wordSpacing","word-spacing"],["wordWrap","overflow-wrap"],["writingMode","writing-mode"],["x","x"],["y","y"],["zIndex","z-index"],["zoom","zoom"]].map(row => Object.freeze(row)));
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Public jspb representation only. No interpreter execution or network access.
|
|
2
|
+
// Source: readiness-public-0.js:130-135 ($c/Mc), 604-607 (EH/Zf), 104 (ia/ja).
|
|
3
|
+
const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
4
|
+
const isPlainObject = value => value !== null && typeof value === 'object'
|
|
5
|
+
&& !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
6
|
+
|
|
7
|
+
export function readJspbField(message, field, marked = false) {
|
|
8
|
+
if (!Array.isArray(message) || !Number.isSafeInteger(field) || field < 1) {
|
|
9
|
+
throw new TypeError('Invalid jspb message or field');
|
|
10
|
+
}
|
|
11
|
+
const index = field + (marked ? 0 : -1);
|
|
12
|
+
const lastIndex = message.length - 1;
|
|
13
|
+
if (lastIndex < (marked ? 1 : 0)) return undefined;
|
|
14
|
+
if (isPlainObject(message[lastIndex])) {
|
|
15
|
+
// Mc moves numbered fields below the sparse pivot into dense slots first.
|
|
16
|
+
// Reading the sparse value first reproduces that normalization without mutation.
|
|
17
|
+
if (own(message[lastIndex], field)) return message[lastIndex][field];
|
|
18
|
+
if (index >= lastIndex) return undefined;
|
|
19
|
+
}
|
|
20
|
+
return message[index];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function int32(value) {
|
|
24
|
+
if (typeof value === 'string' && value) value = Number(value);
|
|
25
|
+
else if (typeof value !== 'number') return 0;
|
|
26
|
+
return Number.isFinite(value) ? value | 0 : 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function parseOfficialExperimentState(serialized) {
|
|
30
|
+
const state = typeof serialized === 'string' && serialized ? JSON.parse(serialized) : [];
|
|
31
|
+
if (!Array.isArray(state)) throw new TypeError('Invalid experiment message');
|
|
32
|
+
const field5 = readJspbField(state, 5);
|
|
33
|
+
const entries = readJspbField(state, 6) ?? [];
|
|
34
|
+
if (!Array.isArray(entries) || entries.some(entry => !Array.isArray(entry))) {
|
|
35
|
+
throw new TypeError('Invalid experiment entries');
|
|
36
|
+
}
|
|
37
|
+
const ordinary = [], extended = [];
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
const value = int32(readJspbField(entry, 1));
|
|
40
|
+
(int32(readJspbField(entry, 2)) <= 53 ? ordinary : extended).push(value);
|
|
41
|
+
}
|
|
42
|
+
return { field5: typeof field5 === 'string' ? field5 : '',
|
|
43
|
+
values: [...ordinary, ...extended],
|
|
44
|
+
kinds: [...ordinary.map(() => 1), ...extended.map(() => 2)],
|
|
45
|
+
inputShape: { trailingObject: isPlainObject(state.at(-1)),
|
|
46
|
+
entryTrailingObjects: entries.filter(entry => isPlainObject(entry.at(-1))).length } };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Adapts only the fields used by the existing realm-init to canonical dense form.
|
|
50
|
+
// Values are grouped equivalently to official ia/ja, without exposing them to logs.
|
|
51
|
+
export function normalizeOfficialExperimentState(serialized) {
|
|
52
|
+
const parsed = parseOfficialExperimentState(serialized);
|
|
53
|
+
return JSON.stringify([null, null, null, null, parsed.field5,
|
|
54
|
+
parsed.values.map((value, index) => [value, parsed.kinds[index] === 1 ? 0 : 54])]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function parseOfficialChallenge(rawData) {
|
|
58
|
+
if (!Array.isArray(rawData)) throw new TypeError('Invalid challenge response');
|
|
59
|
+
const encoded = readJspbField(rawData, 2);
|
|
60
|
+
let data;
|
|
61
|
+
if (typeof encoded === 'string' && encoded) {
|
|
62
|
+
const base64 = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\./g, '=');
|
|
63
|
+
const bytes = Uint8Array.from(atob(base64), character => (character.charCodeAt(0) + 97) & 255);
|
|
64
|
+
if (bytes.length) data = JSON.parse(new TextDecoder().decode(bytes));
|
|
65
|
+
}
|
|
66
|
+
data ??= readJspbField(rawData, 1);
|
|
67
|
+
if (!Array.isArray(data) || data[0] !== 'bfkj') throw new TypeError('Invalid challenge message');
|
|
68
|
+
const get = field => readJspbField(data, field, true);
|
|
69
|
+
const script = get(1), resource = get(2);
|
|
70
|
+
// SafeScriptProto uses field 6; TrustedResourceUrlProto uses field 4.
|
|
71
|
+
// Source: readiness-public-0.js:171-172, Uf (Qf(a,6)) and Sf (Qf(a,4)).
|
|
72
|
+
const scriptValue = Array.isArray(script) ? readJspbField(script, 6) : undefined;
|
|
73
|
+
const resourceValue = Array.isArray(resource) ? readJspbField(resource, 4) : undefined;
|
|
74
|
+
const program = get(4), globalName = get(5);
|
|
75
|
+
if (typeof program !== 'string' || !program || typeof globalName !== 'string' || !globalName) {
|
|
76
|
+
throw new TypeError('Incomplete challenge message');
|
|
77
|
+
}
|
|
78
|
+
const experiments = get(7);
|
|
79
|
+
if (experiments != null && typeof experiments !== 'string') throw new TypeError('Invalid experiment blob');
|
|
80
|
+
const output = { messageId: data[0], program, globalName, interpreterHash: get(3),
|
|
81
|
+
clientExperimentsStateBlob: experiments,
|
|
82
|
+
shape: { responseTrailingObject: isPlainObject(rawData.at(-1)), challengeTrailingObject: isPlainObject(data.at(-1)),
|
|
83
|
+
scriptTrailingObject: Array.isArray(script) && isPlainObject(script.at(-1)),
|
|
84
|
+
urlTrailingObject: Array.isArray(resource) && isPlainObject(resource.at(-1)) } };
|
|
85
|
+
if (typeof scriptValue === 'string' && scriptValue) output.interpreterJavascript = { privateDoNotAccessOrElseSafeScriptWrappedValue: scriptValue };
|
|
86
|
+
if (typeof resourceValue === 'string' && resourceValue) output.interpreterUrl = { privateDoNotAccessOrElseTrustedResourceUrlWrappedValue: resourceValue };
|
|
87
|
+
return output;
|
|
88
|
+
}
|