dsh-plugin-completion-notify 0.1.0

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/lib/client.js ADDED
@@ -0,0 +1,1107 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-plugin-completion-notify",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ //#region node_modules/@deepseek-ai/cosmokit/lib/index.js
9
+ /** Return true when a value is `null` or `undefined`. */
10
+ function isNullable(value) {
11
+ return value === null || value === void 0;
12
+ }
13
+ /** Return true for non-array object values. */
14
+ function isPlainObject(data) {
15
+ return data && typeof data === "object" && !Array.isArray(data);
16
+ }
17
+ /** Filter object entries and return a new object. */
18
+ function filterKeys(object, filter) {
19
+ return Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));
20
+ }
21
+ /** Map object values while preserving the original key set. */
22
+ function mapValues(object, transform) {
23
+ return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));
24
+ }
25
+ /** Pick selected keys from an object, optionally including `undefined` values. */
26
+ function pick(source, keys, forced) {
27
+ if (!keys) return { ...source };
28
+ const result = {};
29
+ for (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];
30
+ return result;
31
+ }
32
+ /** Test values using `instanceof` with a `toStringTag` fallback. */
33
+ function is(type, value) {
34
+ if (arguments.length === 1) return (value) => is(type, value);
35
+ return type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;
36
+ }
37
+ function isArrayBufferLike(value) {
38
+ return is("ArrayBuffer", value) || is("SharedArrayBuffer", value);
39
+ }
40
+ function isArrayBufferSource(value) {
41
+ return isArrayBufferLike(value) || ArrayBuffer.isView(value);
42
+ }
43
+ /** Binary source detection and base64/hex conversion helpers. */
44
+ var Binary;
45
+ (function(Binary) {
46
+ Binary.is = isArrayBufferLike;
47
+ Binary.isSource = isArrayBufferSource;
48
+ function fromSource(source) {
49
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
50
+ else return source;
51
+ }
52
+ Binary.fromSource = fromSource;
53
+ function toBase64(source) {
54
+ source = fromSource(source);
55
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("base64");
56
+ let binary = "";
57
+ const bytes = new Uint8Array(source);
58
+ for (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);
59
+ return btoa(binary);
60
+ }
61
+ Binary.toBase64 = toBase64;
62
+ function fromBase64(source) {
63
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "base64"));
64
+ return Uint8Array.from(atob(source), (c) => c.charCodeAt(0));
65
+ }
66
+ Binary.fromBase64 = fromBase64;
67
+ function toHex(source) {
68
+ source = fromSource(source);
69
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("hex");
70
+ return Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, "0")).join("");
71
+ }
72
+ Binary.toHex = toHex;
73
+ function fromHex(source) {
74
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "hex"));
75
+ const hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);
76
+ const buffer = [];
77
+ for (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));
78
+ return Uint8Array.from(buffer).buffer;
79
+ }
80
+ Binary.fromHex = fromHex;
81
+ })(Binary || (Binary = {}));
82
+ Binary.fromBase64;
83
+ Binary.toBase64;
84
+ Binary.fromHex;
85
+ Binary.toHex;
86
+ /** Deep-clone common JavaScript values while preserving prototypes and cycles. */
87
+ function clone(source, refs = /* @__PURE__ */ new Map()) {
88
+ if (!source || typeof source !== "object") return source;
89
+ if (is("Date", source)) return new Date(source.valueOf());
90
+ if (is("RegExp", source)) return new RegExp(source.source, source.flags);
91
+ if (isArrayBufferLike(source)) return source.slice(0);
92
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
93
+ const cached = refs.get(source);
94
+ if (cached) return cached;
95
+ if (Array.isArray(source)) {
96
+ const result = [];
97
+ refs.set(source, result);
98
+ source.forEach((value, index) => {
99
+ result[index] = Reflect.apply(clone, null, [value, refs]);
100
+ });
101
+ return result;
102
+ }
103
+ const result = Object.create(Object.getPrototypeOf(source));
104
+ refs.set(source, result);
105
+ for (const key of Reflect.ownKeys(source)) {
106
+ const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };
107
+ if ("value" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);
108
+ Reflect.defineProperty(result, key, descriptor);
109
+ }
110
+ return result;
111
+ }
112
+ /** Deeply compare arrays, dates, regexps, buffers, and plain object fields. */
113
+ function deepEqual(a, b, strict) {
114
+ if (a === b) return true;
115
+ if (!strict && isNullable(a) && isNullable(b)) return true;
116
+ if (typeof a !== typeof b) return false;
117
+ if (typeof a !== "object") return false;
118
+ if (!a || !b) return false;
119
+ function check(test, then) {
120
+ return test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;
121
+ }
122
+ return check(Array.isArray, (a, b) => a.length === b.length && a.every((item, index) => deepEqual(item, b[index]))) ?? check(is("Date"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is("RegExp"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {
123
+ if (a.byteLength !== b.byteLength) return false;
124
+ const viewA = new Uint8Array(a);
125
+ const viewB = new Uint8Array(b);
126
+ for (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;
127
+ return true;
128
+ }) ?? Object.keys({
129
+ ...a,
130
+ ...b
131
+ }).every((key) => deepEqual(a[key], b[key], strict));
132
+ }
133
+ /** Time constants plus parsing and formatting helpers. */
134
+ var Time;
135
+ (function(Time) {
136
+ Time.millisecond = 1;
137
+ Time.second = 1e3;
138
+ Time.minute = Time.second * 60;
139
+ Time.hour = Time.minute * 60;
140
+ Time.day = Time.hour * 24;
141
+ Time.week = Time.day * 7;
142
+ let timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
143
+ function setTimezoneOffset(offset) {
144
+ timezoneOffset = offset;
145
+ }
146
+ Time.setTimezoneOffset = setTimezoneOffset;
147
+ function getTimezoneOffset() {
148
+ return timezoneOffset;
149
+ }
150
+ Time.getTimezoneOffset = getTimezoneOffset;
151
+ function getDateNumber(date = /* @__PURE__ */ new Date(), offset) {
152
+ if (typeof date === "number") date = new Date(date);
153
+ if (offset === void 0) offset = timezoneOffset;
154
+ return Math.floor((date.valueOf() / Time.minute - offset) / 1440);
155
+ }
156
+ Time.getDateNumber = getDateNumber;
157
+ function fromDateNumber(value, offset) {
158
+ const date = new Date(value * Time.day);
159
+ if (offset === void 0) offset = timezoneOffset;
160
+ return new Date(+date + offset * Time.minute);
161
+ }
162
+ Time.fromDateNumber = fromDateNumber;
163
+ const numeric = /\d+(?:\.\d+)?/.source;
164
+ const timeRegExp = new RegExp(`^${[
165
+ "w(?:eek(?:s)?)?",
166
+ "d(?:ay(?:s)?)?",
167
+ "h(?:our(?:s)?)?",
168
+ "m(?:in(?:ute)?(?:s)?)?",
169
+ "s(?:ec(?:ond)?(?:s)?)?"
170
+ ].map((unit) => `(${numeric}${unit})?`).join("")}$`);
171
+ function parseTime(source) {
172
+ const capture = timeRegExp.exec(source);
173
+ if (!capture) return 0;
174
+ return (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);
175
+ }
176
+ Time.parseTime = parseTime;
177
+ function parseDate(date) {
178
+ const parsed = parseTime(date);
179
+ if (parsed) date = Date.now() + parsed;
180
+ else if (/^\d{1,2}(:\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;
181
+ else if (/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;
182
+ return date ? new Date(date) : /* @__PURE__ */ new Date();
183
+ }
184
+ Time.parseDate = parseDate;
185
+ function format(ms) {
186
+ const abs = Math.abs(ms);
187
+ if (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + "d";
188
+ else if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + "h";
189
+ else if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + "m";
190
+ else if (abs >= Time.second) return Math.round(ms / Time.second) + "s";
191
+ return ms + "ms";
192
+ }
193
+ Time.format = format;
194
+ function toDigits(source, length = 2) {
195
+ return source.toString().padStart(length, "0");
196
+ }
197
+ Time.toDigits = toDigits;
198
+ function template(template, time = /* @__PURE__ */ new Date()) {
199
+ return template.replace("yyyy", time.getFullYear().toString()).replace("yy", time.getFullYear().toString().slice(2)).replace("MM", toDigits(time.getMonth() + 1)).replace("dd", toDigits(time.getDate())).replace("hh", toDigits(time.getHours())).replace("mm", toDigits(time.getMinutes())).replace("ss", toDigits(time.getSeconds())).replace("SSS", toDigits(time.getMilliseconds(), 3));
200
+ }
201
+ Time.template = template;
202
+ })(Time || (Time = {}));
203
+ //#endregion
204
+ //#region node_modules/@deepseek-ai/schemastery/lib/index.mjs
205
+ const kSchema = Symbol.for("schemastery");
206
+ const kValidationError = Symbol.for("ValidationError");
207
+ globalThis.__schemastery_index__ ??= 0;
208
+ globalThis.__schemastery_refs__ = void 0;
209
+ var ValidationError = class extends TypeError {
210
+ options;
211
+ name = "ValidationError";
212
+ constructor(message, options) {
213
+ let prefix = "$";
214
+ for (const segment of options.path || []) if (typeof segment === "string") prefix += "." + segment;
215
+ else if (typeof segment === "number") prefix += "[" + segment + "]";
216
+ else if (typeof segment === "symbol") prefix += `[Symbol(${segment.toString()})]`;
217
+ if (prefix.startsWith(".")) prefix = prefix.slice(1);
218
+ super((prefix === "$" ? "" : `${prefix} `) + message);
219
+ this.options = options;
220
+ }
221
+ static is(error) {
222
+ return !!error?.[kValidationError];
223
+ }
224
+ };
225
+ Object.defineProperty(ValidationError.prototype, kValidationError, { value: true });
226
+ const Schema = function(options) {
227
+ const schema = function(data, options = {}) {
228
+ return Schema.resolve(data, schema, options)[0];
229
+ };
230
+ if (options.refs) {
231
+ const refs = mapValues(options.refs, (options) => new Schema(options));
232
+ const getRef = (uid) => refs[uid];
233
+ for (const key in refs) {
234
+ const options = refs[key];
235
+ options.sKey = getRef(options.sKey);
236
+ options.inner = getRef(options.inner);
237
+ options.list = options.list && options.list.map(getRef);
238
+ options.dict = options.dict && mapValues(options.dict, getRef);
239
+ }
240
+ return refs[options.uid];
241
+ }
242
+ Object.assign(schema, options);
243
+ if (typeof schema.callback === "string") try {
244
+ schema.callback = new Function("return " + schema.callback)();
245
+ } catch {}
246
+ Object.defineProperty(schema, "uid", { value: globalThis.__schemastery_index__++ });
247
+ Object.setPrototypeOf(schema, Schema.prototype);
248
+ schema.meta ||= {};
249
+ schema.toString = schema.toString.bind(schema);
250
+ return schema;
251
+ };
252
+ Schema.prototype = Object.create(Function.prototype);
253
+ Schema.prototype[kSchema] = true;
254
+ Object.defineProperty(Schema.prototype, "~standard", { get() {
255
+ return {
256
+ version: 1,
257
+ vendor: "schemastery",
258
+ validate: (value) => {
259
+ try {
260
+ return { value: Schema.resolve(value, this, {})[0] };
261
+ } catch (error) {
262
+ if (ValidationError.is(error)) return { issues: [{
263
+ message: error.message,
264
+ path: error.options.path
265
+ }] };
266
+ throw error;
267
+ }
268
+ }
269
+ };
270
+ } });
271
+ Schema.ValidationError = ValidationError;
272
+ Schema.prototype.toJSON = function toJSON() {
273
+ if (globalThis.__schemastery_refs__) {
274
+ globalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));
275
+ return this.uid;
276
+ }
277
+ globalThis.__schemastery_refs__ = { [this.uid]: { ...this } };
278
+ globalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));
279
+ const result = {
280
+ uid: this.uid,
281
+ refs: globalThis.__schemastery_refs__
282
+ };
283
+ globalThis.__schemastery_refs__ = void 0;
284
+ return result;
285
+ };
286
+ Schema.prototype.set = function set(key, value) {
287
+ this.dict[key] = value;
288
+ return this;
289
+ };
290
+ Schema.prototype.push = function push(value) {
291
+ this.list.push(value);
292
+ return this;
293
+ };
294
+ function mergeDesc(original, messages) {
295
+ const result = typeof original === "string" ? { "": original } : { ...original };
296
+ for (const locale in messages) {
297
+ const value = messages[locale];
298
+ if (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;
299
+ else if (typeof value === "string") result[locale] = value;
300
+ }
301
+ return result;
302
+ }
303
+ function getInner(value) {
304
+ return value?.$value ?? value?.$inner;
305
+ }
306
+ function extractKeys(data) {
307
+ return filterKeys(data ?? {}, (key) => !key.startsWith("$"));
308
+ }
309
+ Schema.prototype.i18n = function i18n(messages) {
310
+ const schema = Schema(this);
311
+ const desc = mergeDesc(schema.meta.description, messages);
312
+ if (Object.keys(desc).length) schema.meta.description = desc;
313
+ if (schema.dict) schema.dict = mapValues(schema.dict, (inner, key) => {
314
+ return inner.i18n(mapValues(messages, (data) => getInner(data)?.[key] ?? data?.[key]));
315
+ });
316
+ if (schema.list) schema.list = schema.list.map((inner, index) => {
317
+ return inner.i18n(mapValues(messages, (data = {}) => {
318
+ if (Array.isArray(getInner(data))) return getInner(data)[index];
319
+ if (Array.isArray(data)) return data[index];
320
+ return extractKeys(data);
321
+ }));
322
+ });
323
+ if (schema.inner) schema.inner = schema.inner.i18n(mapValues(messages, (data) => {
324
+ if (getInner(data)) return getInner(data);
325
+ return extractKeys(data);
326
+ }));
327
+ if (schema.sKey) schema.sKey = schema.sKey.i18n(mapValues(messages, (data) => data?.$key));
328
+ return schema;
329
+ };
330
+ Schema.prototype.extra = function extra(key, value) {
331
+ const schema = Schema(this);
332
+ schema.meta = {
333
+ ...schema.meta,
334
+ [key]: value
335
+ };
336
+ return schema;
337
+ };
338
+ for (const key of [
339
+ "required",
340
+ "disabled",
341
+ "collapse",
342
+ "hidden",
343
+ "loose"
344
+ ]) Object.assign(Schema.prototype, { [key](value = true) {
345
+ const schema = Schema(this);
346
+ schema.meta = {
347
+ ...schema.meta,
348
+ [key]: value
349
+ };
350
+ return schema;
351
+ } });
352
+ Schema.prototype.deprecated = function deprecated() {
353
+ const schema = Schema(this);
354
+ schema.meta.badges ||= [];
355
+ schema.meta.badges.push({
356
+ text: "deprecated",
357
+ type: "danger"
358
+ });
359
+ return schema;
360
+ };
361
+ Schema.prototype.experimental = function experimental() {
362
+ const schema = Schema(this);
363
+ schema.meta.badges ||= [];
364
+ schema.meta.badges.push({
365
+ text: "experimental",
366
+ type: "warning"
367
+ });
368
+ return schema;
369
+ };
370
+ Schema.prototype.pattern = function pattern(regexp) {
371
+ const schema = Schema(this);
372
+ const pattern = pick(regexp, ["source", "flags"]);
373
+ schema.meta = {
374
+ ...schema.meta,
375
+ pattern
376
+ };
377
+ return schema;
378
+ };
379
+ Schema.prototype.simplify = function simplify(value) {
380
+ if (deepEqual(value, this.meta.default, this.type === "dict")) return null;
381
+ if (isNullable(value)) return value;
382
+ if (this.type === "object" || this.type === "dict") {
383
+ const result = {};
384
+ for (const key in value) {
385
+ const item = (this.type === "object" ? this.dict[key] : this.inner)?.simplify(value[key]);
386
+ if (this.type === "dict" || !isNullable(item)) result[key] = item;
387
+ }
388
+ if (deepEqual(result, this.meta.default, this.type === "dict")) return null;
389
+ return result;
390
+ } else if (this.type === "array" || this.type === "tuple") {
391
+ const result = [];
392
+ value.forEach((value, index) => {
393
+ const schema = this.type === "array" ? this.inner : this.list[index];
394
+ const item = schema ? schema.simplify(value) : value;
395
+ result.push(item);
396
+ });
397
+ return result;
398
+ } else if (this.type === "intersect") {
399
+ const result = {};
400
+ for (const item of this.list) Object.assign(result, item.simplify(value));
401
+ return result;
402
+ } else if (this.type === "union") for (const schema of this.list) try {
403
+ Schema.resolve(value, schema, {});
404
+ return schema.simplify(value);
405
+ } catch {}
406
+ return value;
407
+ };
408
+ Schema.prototype.toString = function toString(inline) {
409
+ return formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;
410
+ };
411
+ Schema.prototype.role = function role(role, extra) {
412
+ const schema = Schema(this);
413
+ schema.meta = {
414
+ ...schema.meta,
415
+ role,
416
+ extra
417
+ };
418
+ return schema;
419
+ };
420
+ for (const key of [
421
+ "default",
422
+ "link",
423
+ "comment",
424
+ "description",
425
+ "max",
426
+ "min",
427
+ "step"
428
+ ]) Object.assign(Schema.prototype, { [key](value) {
429
+ const schema = Schema(this);
430
+ schema.meta = {
431
+ ...schema.meta,
432
+ [key]: value
433
+ };
434
+ return schema;
435
+ } });
436
+ const resolvers = {};
437
+ Schema.extend = function extend(type, resolve) {
438
+ resolvers[type] = resolve;
439
+ };
440
+ Schema.resolve = function resolve(data, schema, options = {}, strict = false) {
441
+ if (!schema) return [data];
442
+ if (options.ignore?.(data, schema)) return [data];
443
+ if (isNullable(data) && schema.type !== "lazy") {
444
+ if (schema.meta.required) throw new ValidationError(`missing required value`, options);
445
+ let current = schema;
446
+ let fallback = schema.meta.default;
447
+ while (current?.type === "intersect" && isNullable(fallback)) {
448
+ current = current.list[0];
449
+ fallback = current?.meta.default;
450
+ }
451
+ if (isNullable(fallback)) return [data];
452
+ data = clone(fallback);
453
+ }
454
+ const callback = resolvers[schema.type];
455
+ if (!callback) throw new ValidationError(`unsupported type "${schema.type}"`, options);
456
+ try {
457
+ return callback(data, schema, options, strict);
458
+ } catch (error) {
459
+ if (!schema.meta.loose) throw error;
460
+ return [schema.meta.default];
461
+ }
462
+ };
463
+ Schema.from = function from(source) {
464
+ if (isNullable(source)) return Schema.any();
465
+ else if ([
466
+ "string",
467
+ "number",
468
+ "boolean"
469
+ ].includes(typeof source)) return Schema.const(source).required();
470
+ else if (source[kSchema]) return source;
471
+ else if (typeof source === "function") switch (source) {
472
+ case String: return Schema.string().required();
473
+ case Number: return Schema.number().required();
474
+ case Boolean: return Schema.boolean().required();
475
+ case Function: return Schema.function().required();
476
+ default: return Schema.is(source).required();
477
+ }
478
+ else throw new TypeError(`cannot infer schema from ${source}`);
479
+ };
480
+ Schema.lazy = function lazy(builder) {
481
+ const toJSON = () => {
482
+ if (!schema.inner[kSchema]) {
483
+ schema.inner = schema.builder();
484
+ schema.inner.meta = {
485
+ ...schema.meta,
486
+ ...schema.inner.meta
487
+ };
488
+ }
489
+ return schema.inner.toJSON();
490
+ };
491
+ const schema = new Schema({
492
+ type: "lazy",
493
+ builder,
494
+ inner: { toJSON }
495
+ });
496
+ return schema;
497
+ };
498
+ Schema.natural = function natural() {
499
+ return Schema.number().step(1).min(0);
500
+ };
501
+ Schema.percent = function percent() {
502
+ return Schema.number().step(.01).min(0).max(1).role("slider");
503
+ };
504
+ Schema.date = function date() {
505
+ return Schema.union([Schema.is(Date), Schema.transform(Schema.string().role("datetime"), (value, options) => {
506
+ const date = new Date(value);
507
+ if (isNaN(+date)) throw new ValidationError(`invalid date "${value}"`, options);
508
+ return date;
509
+ }, true)]);
510
+ };
511
+ Schema.regExp = function regExp(flag = "") {
512
+ return Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role("regexp", { flag }), (value, options) => {
513
+ try {
514
+ return new RegExp(value, flag);
515
+ } catch (e) {
516
+ throw new ValidationError(e.message, options);
517
+ }
518
+ }, true)]);
519
+ };
520
+ Schema.arrayBuffer = function arrayBuffer(encoding) {
521
+ return Schema.union([
522
+ Schema.is(ArrayBuffer),
523
+ Schema.is(SharedArrayBuffer),
524
+ Schema.transform(Schema.any(), (value, options) => {
525
+ if (Binary.isSource(value)) return Binary.fromSource(value);
526
+ throw new ValidationError(`expected ArrayBufferSource but got ${value}`, options);
527
+ }, true),
528
+ ...encoding ? [Schema.transform(Schema.string(), (value, options) => {
529
+ try {
530
+ return encoding === "base64" ? Binary.fromBase64(value) : Binary.fromHex(value);
531
+ } catch (e) {
532
+ throw new ValidationError(e.message, options);
533
+ }
534
+ }, true)] : []
535
+ ]);
536
+ };
537
+ Schema.extend("lazy", (data, schema, options, strict) => {
538
+ if (!schema.inner[kSchema]) {
539
+ schema.inner = schema.builder();
540
+ schema.inner.meta = {
541
+ ...schema.meta,
542
+ ...schema.inner.meta
543
+ };
544
+ }
545
+ return Schema.resolve(data, schema.inner, options, strict);
546
+ });
547
+ Schema.extend("any", (data) => {
548
+ return [data];
549
+ });
550
+ Schema.extend("never", (data, _, options) => {
551
+ throw new ValidationError(`expected nullable but got ${data}`, options);
552
+ });
553
+ Schema.extend("const", (data, { value }, options) => {
554
+ if (deepEqual(data, value)) return [value];
555
+ throw new ValidationError(`expected ${value} but got ${data}`, options);
556
+ });
557
+ function checkWithinRange(data, meta, description, options, skipMin = false) {
558
+ const { max = Infinity, min = -Infinity } = meta;
559
+ if (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);
560
+ if (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);
561
+ }
562
+ Schema.extend("string", (data, { meta }, options) => {
563
+ if (typeof data !== "string") throw new ValidationError(`expected string but got ${data}`, options);
564
+ if (meta.pattern) {
565
+ const regexp = new RegExp(meta.pattern.source, meta.pattern.flags);
566
+ if (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);
567
+ }
568
+ checkWithinRange(data.length, meta, "string length", options);
569
+ return [data];
570
+ });
571
+ function decimalShift(data, digits) {
572
+ const str = data.toString();
573
+ if (str.includes("e")) return data * Math.pow(10, digits);
574
+ const index = str.indexOf(".");
575
+ if (index === -1) return data * Math.pow(10, digits);
576
+ const frac = str.slice(index + 1);
577
+ const integer = str.slice(0, index);
578
+ if (frac.length <= digits) return +(integer + frac.padEnd(digits, "0"));
579
+ return +(integer + frac.slice(0, digits) + "." + frac.slice(digits));
580
+ }
581
+ function isMultipleOf(data, min, step) {
582
+ step = Math.abs(step);
583
+ if (!/^\d+\.\d+$/.test(step.toString())) return (data - min) % step === 0;
584
+ const index = step.toString().indexOf(".");
585
+ const digits = step.toString().slice(index + 1).length;
586
+ return Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;
587
+ }
588
+ Schema.extend("number", (data, { meta }, options) => {
589
+ if (typeof data !== "number") throw new ValidationError(`expected number but got ${data}`, options);
590
+ checkWithinRange(data, meta, "number", options);
591
+ const { step } = meta;
592
+ if (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);
593
+ return [data];
594
+ });
595
+ Schema.extend("boolean", (data, _, options) => {
596
+ if (typeof data === "boolean") return [data];
597
+ throw new ValidationError(`expected boolean but got ${data}`, options);
598
+ });
599
+ Schema.extend("bitset", (data, { bits, meta }, options) => {
600
+ let value = 0, keys = [];
601
+ if (typeof data === "number") {
602
+ value = data;
603
+ for (const key in bits) if (data & bits[key]) keys.push(key);
604
+ } else if (Array.isArray(data)) {
605
+ keys = data;
606
+ for (const key of keys) {
607
+ if (typeof key !== "string") throw new ValidationError(`expected string but got ${key}`, options);
608
+ if (key in bits) value |= bits[key];
609
+ }
610
+ } else throw new ValidationError(`expected number or array but got ${data}`, options);
611
+ if (value === meta.default) return [value];
612
+ return [value, keys];
613
+ });
614
+ Schema.extend("function", (data, _, options) => {
615
+ if (typeof data === "function") return [data];
616
+ throw new ValidationError(`expected function but got ${data}`, options);
617
+ });
618
+ Schema.extend("is", (data, { constructor }, options) => {
619
+ if (typeof constructor === "function") {
620
+ if (data instanceof constructor) return [data];
621
+ throw new ValidationError(`expected ${constructor.name} but got ${data}`, options);
622
+ } else {
623
+ if (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);
624
+ let prototype = Object.getPrototypeOf(data);
625
+ while (prototype) {
626
+ if (prototype.constructor?.name === constructor) return [data];
627
+ prototype = Object.getPrototypeOf(prototype);
628
+ }
629
+ throw new ValidationError(`expected ${constructor} but got ${data}`, options);
630
+ }
631
+ });
632
+ function property(data, key, schema, options) {
633
+ try {
634
+ const [value, adapted] = Schema.resolve(data[key], schema, {
635
+ ...options,
636
+ path: [...options.path || [], key]
637
+ });
638
+ if (adapted !== void 0) data[key] = adapted;
639
+ return value;
640
+ } catch (e) {
641
+ if (!options?.autofix) throw e;
642
+ delete data[key];
643
+ return schema.meta.default;
644
+ }
645
+ }
646
+ Schema.extend("array", (data, { inner, meta }, options) => {
647
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
648
+ checkWithinRange(data.length, meta, "array length", options, !isNullable(inner.meta.default));
649
+ return [data.map((_, index) => property(data, index, inner, options))];
650
+ });
651
+ Schema.extend("dict", (data, { inner, sKey }, options, strict) => {
652
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
653
+ const result = {};
654
+ for (const key in data) {
655
+ let rKey;
656
+ try {
657
+ rKey = Schema.resolve(key, sKey, options)[0];
658
+ } catch (error) {
659
+ if (strict) continue;
660
+ throw error;
661
+ }
662
+ result[rKey] = property(data, key, inner, options);
663
+ data[rKey] = data[key];
664
+ if (key !== rKey) delete data[key];
665
+ }
666
+ return [result];
667
+ });
668
+ Schema.extend("tuple", (data, { list }, options, strict) => {
669
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
670
+ const result = list.map((inner, index) => property(data, index, inner, options));
671
+ if (strict) return [result];
672
+ result.push(...data.slice(list.length));
673
+ return [result];
674
+ });
675
+ function merge(result, data) {
676
+ for (const key in data) {
677
+ if (key in result) continue;
678
+ result[key] = data[key];
679
+ }
680
+ }
681
+ Schema.extend("object", (data, { dict }, options, strict) => {
682
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
683
+ const result = {};
684
+ for (const key in dict) {
685
+ const value = property(data, key, dict[key], options);
686
+ if (!isNullable(value) || key in data) result[key] = value;
687
+ }
688
+ if (!strict) merge(result, data);
689
+ return [result];
690
+ });
691
+ Schema.extend("union", (data, { list, toString }, options, strict) => {
692
+ const messages = [];
693
+ for (const inner of list) try {
694
+ return Schema.resolve(data, inner, options, strict);
695
+ } catch (error) {
696
+ messages.push(error);
697
+ }
698
+ throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
699
+ });
700
+ Schema.extend("intersect", (data, { list, toString }, options, strict) => {
701
+ if (!list.length) return [data];
702
+ let result;
703
+ for (const inner of list) {
704
+ const value = Schema.resolve(data, inner, options, true)[0];
705
+ if (isNullable(value)) continue;
706
+ if (isNullable(result)) result = value;
707
+ else if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
708
+ else if (typeof value === "object") merge(result ??= {}, value);
709
+ else if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
710
+ }
711
+ if (!strict && isPlainObject(data)) merge(result, data);
712
+ return [result];
713
+ });
714
+ Schema.extend("transform", (data, { inner, callback, preserve }, options) => {
715
+ const [result, adapted = data] = Schema.resolve(data, inner, options, true);
716
+ if (preserve) return [callback(result)];
717
+ else return [callback(result), callback(adapted)];
718
+ });
719
+ const formatters = {};
720
+ function defineMethod(name, keys, format) {
721
+ formatters[name] = format;
722
+ Object.assign(Schema, { [name](...args) {
723
+ const schema = new Schema({ type: name });
724
+ keys.forEach((key, index) => {
725
+ switch (key) {
726
+ case "sKey":
727
+ schema.sKey = args[index] ?? Schema.string();
728
+ break;
729
+ case "inner":
730
+ schema.inner = Schema.from(args[index]);
731
+ break;
732
+ case "list":
733
+ schema.list = args[index].map(Schema.from);
734
+ break;
735
+ case "dict":
736
+ schema.dict = mapValues(args[index], Schema.from);
737
+ break;
738
+ case "bits":
739
+ schema.bits = {};
740
+ for (const key in args[index]) {
741
+ if (typeof args[index][key] !== "number") continue;
742
+ schema.bits[key] = args[index][key];
743
+ }
744
+ break;
745
+ case "callback": {
746
+ const callback = schema.callback = args[index];
747
+ callback["toJSON"] ||= () => callback.toString();
748
+ break;
749
+ }
750
+ case "constructor": {
751
+ const constructor = schema.constructor = args[index];
752
+ if (typeof constructor === "function") constructor["toJSON"] ||= () => constructor["name"];
753
+ break;
754
+ }
755
+ default: schema[key] = args[index];
756
+ }
757
+ });
758
+ if (name === "object" || name === "dict") schema.meta.default = {};
759
+ else if (name === "array" || name === "tuple") schema.meta.default = [];
760
+ else if (name === "bitset") schema.meta.default = 0;
761
+ return schema;
762
+ } });
763
+ }
764
+ defineMethod("is", ["constructor"], ({ constructor }) => {
765
+ if (typeof constructor === "function") return constructor.name;
766
+ else return constructor;
767
+ });
768
+ defineMethod("any", [], () => "any");
769
+ defineMethod("never", [], () => "never");
770
+ defineMethod("const", ["value"], ({ value }) => typeof value === "string" ? JSON.stringify(value) : value);
771
+ defineMethod("string", [], () => "string");
772
+ defineMethod("number", [], () => "number");
773
+ defineMethod("boolean", [], () => "boolean");
774
+ defineMethod("bitset", ["bits"], () => "bitset");
775
+ defineMethod("function", [], () => "function");
776
+ defineMethod("array", ["inner"], ({ inner }) => `${inner.toString(true)}[]`);
777
+ defineMethod("dict", ["inner", "sKey"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);
778
+ defineMethod("tuple", ["list"], ({ list }) => `[${list.map((inner) => inner.toString()).join(", ")}]`);
779
+ defineMethod("object", ["dict"], ({ dict }) => {
780
+ if (Object.keys(dict).length === 0) return "{}";
781
+ return `{ ${Object.entries(dict).map(([key, inner]) => {
782
+ return `${key}${inner.meta.required ? "" : "?"}: ${inner.toString()}`;
783
+ }).join(", ")} }`;
784
+ });
785
+ defineMethod("union", ["list"], ({ list }, inline) => {
786
+ const result = list.map(({ toString: format }) => format()).join(" | ");
787
+ return inline ? `(${result})` : result;
788
+ });
789
+ defineMethod("intersect", ["list"], ({ list }) => {
790
+ return `${list.map((inner) => inner.toString(true)).join(" & ")}`;
791
+ });
792
+ defineMethod("transform", [
793
+ "inner",
794
+ "callback",
795
+ "preserve"
796
+ ], ({ inner }, isInner) => inner.toString(isInner));
797
+ //#endregion
798
+ //#region src/completion-notify-settings.ts
799
+ /** Completion-notify preferences stored in the Host user-settings document. */
800
+ /** Settings namespace owned by the completion-notify plugin. */
801
+ const COMPLETION_NOTIFY_SETTINGS_NAMESPACE = "ui-completion-notify";
802
+ /** Field carrying whether desktop completion notifications are enabled. */
803
+ const COMPLETION_NOTIFY_ENABLED_FIELD = "enabled";
804
+ Schema.object({ [COMPLETION_NOTIFY_ENABLED_FIELD]: Schema.boolean().default(true) });
805
+ //#endregion
806
+ //#region src/client/CompletionNotifyRow.tsx
807
+ const rowStyle = {
808
+ display: "flex",
809
+ alignItems: "center",
810
+ justifyContent: "space-between",
811
+ gap: 16,
812
+ padding: "16px 0",
813
+ borderBottom: "1px solid var(--dsw-alias-border-l2)",
814
+ cursor: "pointer"
815
+ };
816
+ const rowTextStyle = {
817
+ display: "flex",
818
+ flexDirection: "column",
819
+ gap: 4
820
+ };
821
+ const titleStyle = {
822
+ fontSize: 14,
823
+ fontWeight: 400,
824
+ lineHeight: "22px",
825
+ color: "var(--dsw-alias-label-primary)"
826
+ };
827
+ const descStyle = {
828
+ fontSize: 12,
829
+ lineHeight: "18px",
830
+ color: "var(--dsw-alias-label-secondary)"
831
+ };
832
+ const switchStyle = {
833
+ width: 16,
834
+ height: 16,
835
+ accentColor: "var(--dsw-static-neutral-bluish-400)",
836
+ cursor: "pointer"
837
+ };
838
+ /**
839
+ * Render the completion-notify enable switch row.
840
+ * @param props - composed slot props.
841
+ * @returns the row element tree.
842
+ */
843
+ function CompletionNotifyRow({ t, setEnabled, useStore }) {
844
+ const enabled = useStore((s) => s.enabled);
845
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
846
+ style: rowStyle,
847
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
848
+ style: rowTextStyle,
849
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
850
+ style: titleStyle,
851
+ children: t("row.title")
852
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
853
+ style: descStyle,
854
+ children: t("row.desc")
855
+ })]
856
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
857
+ type: "checkbox",
858
+ style: switchStyle,
859
+ checked: enabled,
860
+ "aria-label": t("row.title"),
861
+ onChange: (event) => {
862
+ setEnabled(event.target.checked);
863
+ }
864
+ })]
865
+ });
866
+ }
867
+ //#endregion
868
+ //#region src/client/settings-store.ts
869
+ /**
870
+ * Build a live engine instance over a fresh state and the declared actions.
871
+ * Minimal mirror of the harness `defineStore().create()`: a snapshot source
872
+ * with Set-based subscribers plus the draft-stripped action callbacks.
873
+ * @param spec - init factory plus the actions write set.
874
+ * @returns the live instance (actions, getSnapshot, subscribe, clearPersisted).
875
+ */
876
+ function createInstance(spec) {
877
+ let state = spec.init();
878
+ const listeners = /* @__PURE__ */ new Set();
879
+ const actions = {};
880
+ for (const key of Object.keys(spec.actions)) {
881
+ const mutate = spec.actions[key];
882
+ actions[key] = (...params) => {
883
+ const next = structuredClone(state);
884
+ mutate(next, ...params);
885
+ state = next;
886
+ for (const listener of [...listeners]) listener();
887
+ };
888
+ }
889
+ return {
890
+ actions,
891
+ getSnapshot: () => state,
892
+ subscribe: (fn) => {
893
+ listeners.add(fn);
894
+ return () => {
895
+ listeners.delete(fn);
896
+ };
897
+ },
898
+ clearPersisted: () => {}
899
+ };
900
+ }
901
+ /**
902
+ * Declares the completion-notify row state and write surface.
903
+ * @returns the store handle.
904
+ */
905
+ function createCompletionNotifyRowStore() {
906
+ const spec = {
907
+ init: () => ({
908
+ enabled: true,
909
+ revision: -1
910
+ }),
911
+ actions: { sync: (d, enabled, revision) => {
912
+ if (revision <= d.revision) return;
913
+ d.enabled = enabled;
914
+ d.revision = revision;
915
+ } }
916
+ };
917
+ return {
918
+ spec,
919
+ create: () => createInstance(spec)
920
+ };
921
+ }
922
+ //#endregion
923
+ //#region src/client/locales.ts
924
+ /** `settings.completionNotify` namespace dictionaries (the settings row's and notification's copy). */
925
+ /** Simplified Chinese dictionary (the key-set source of truth). */
926
+ const zh = {
927
+ "row.title": "任务完成时发送桌面通知",
928
+ "row.desc": "非当前会话的任务完成后,在系统通知中心弹出提示。",
929
+ "notification.title": "任务完成",
930
+ "notification.body": "会话「{title}」已完成。"
931
+ };
932
+ /** English dictionary, checked complete against the zh key set. */
933
+ const en = {
934
+ "row.title": "Desktop notification when a task completes",
935
+ "row.desc": "Show a system notification when a non-selected session finishes.",
936
+ "notification.title": "Task complete",
937
+ "notification.body": "Session \"{title}\" has finished."
938
+ };
939
+ //#endregion
940
+ //#region src/client/index.ts
941
+ /** Dictionary namespace owned by this plugin. */
942
+ const NS = "settings.completionNotify";
943
+ /** Required services: the settings row slot, sessions list, locale, and the settings scope. */
944
+ const inject = [
945
+ "slots",
946
+ "sessions",
947
+ "locale",
948
+ "settingsScope"
949
+ ];
950
+ /** Notification title shown for one completed session. */
951
+ const NOTIFY_TITLE = "notification.title";
952
+ /** Notification body key; `{title}` is the completed session's display title. */
953
+ const NOTIFY_BODY = "notification.body";
954
+ /**
955
+ * Resolve the browser Notification constructor, or undefined where absent
956
+ * (old browsers, restricted environments, non-browser test hosts). The
957
+ * returned surface adapts the constructor: `create` wraps `new
958
+ * Notification(title, options)`, because the native constructor carries no
959
+ * `create` method.
960
+ * @returns the Notification surface when available.
961
+ */
962
+ function browserNotification() {
963
+ const ctor = globalThis.Notification;
964
+ if (typeof ctor !== "function") return void 0;
965
+ const native = ctor;
966
+ if (typeof native.permission !== "string" || typeof native.requestPermission !== "function") return;
967
+ return {
968
+ get permission() {
969
+ return native.permission;
970
+ },
971
+ requestPermission: () => native.requestPermission(),
972
+ create: (title, options) => new native(title, options)
973
+ };
974
+ }
975
+ /**
976
+ * Raise one completion notification through the browser Notification API.
977
+ * Permission must already be granted — requesting it here would run in a
978
+ * non-user-gesture context (a backgrounded completion), which browsers
979
+ * silently ignore; the first interaction and the settings switch request
980
+ * permission instead. Any missing grant stays silent.
981
+ * @param api - the browser Notification surface.
982
+ * @param title - the notification title.
983
+ * @param body - the notification body.
984
+ */
985
+ async function notifyCompletion(api, title, body) {
986
+ if (api.permission !== "granted") return;
987
+ api.create(title, { body });
988
+ }
989
+ /**
990
+ * Request the browser notification permission, meant to run inside a user
991
+ * gesture (the settings switch's click, or the first interaction). Browsers
992
+ * require transient user activation for `Notification.requestPermission` and
993
+ * silently ignore it otherwise.
994
+ * @param api - the browser Notification surface.
995
+ * @returns whether the permission is granted afterwards.
996
+ */
997
+ async function requestNotificationPermission(api) {
998
+ if (api.permission === "granted") return true;
999
+ if (api.permission === "denied") return false;
1000
+ return await api.requestPermission() === "granted";
1001
+ }
1002
+ /**
1003
+ * Whether the page is currently in the background (hidden tab or minimized
1004
+ * window). The selected session's completion is only notified while this is
1005
+ * true — when the page is visible the user is watching the completion.
1006
+ * @returns whether the document is hidden.
1007
+ */
1008
+ function pageIsHidden() {
1009
+ return typeof document !== "undefined" && document.hidden === true;
1010
+ }
1011
+ /**
1012
+ * Client plugin body: subscribe to the sessions list snapshot and raise a
1013
+ * desktop notification when a session completes — the non-selected session
1014
+ * via its runtime `completed` marker, the selected session via its
1015
+ * running→idle edge while the page is hidden — plus register the
1016
+ * General-settings enable switch.
1017
+ * @param ctx - client root context.
1018
+ */
1019
+ function apply(ctx) {
1020
+ const locale = ctx.locale;
1021
+ const sessions = ctx.sessions;
1022
+ const scope = ctx.settingsScope.bind({ namespace: COMPLETION_NOTIFY_SETTINGS_NAMESPACE });
1023
+ ctx.effect(() => locale.register(NS, {
1024
+ zh,
1025
+ en
1026
+ }), "dsh-plugin-completion-notify: dictionaries");
1027
+ const t = locale.bind(NS);
1028
+ const notify = browserNotification();
1029
+ if (notify !== void 0 && notify.permission === "default" && typeof document !== "undefined") {
1030
+ const requestOnce = () => {
1031
+ document.removeEventListener("pointerdown", requestOnce);
1032
+ document.removeEventListener("keydown", requestOnce);
1033
+ requestNotificationPermission(notify);
1034
+ };
1035
+ document.addEventListener("pointerdown", requestOnce, { once: true });
1036
+ document.addEventListener("keydown", requestOnce, { once: true });
1037
+ }
1038
+ const notified = /* @__PURE__ */ new Set();
1039
+ const prevRunning = /* @__PURE__ */ new Map();
1040
+ const sync = () => {
1041
+ const snapshot = sessions.list.getSnapshot();
1042
+ const enabled = scope.getSnapshot().value?.enabled ?? true;
1043
+ const hidden = pageIsHidden();
1044
+ const raise = (id, title) => {
1045
+ if (notified.has(id) || !enabled || notify === void 0) return;
1046
+ notified.add(id);
1047
+ notifyCompletion(notify, t(NOTIFY_TITLE), t(NOTIFY_BODY, { title }));
1048
+ };
1049
+ for (const [id, entry] of Object.entries(snapshot.byId)) {
1050
+ const sessionId = id;
1051
+ if (sessionId !== snapshot.current && entry.completed === true) {
1052
+ raise(sessionId, entry.displayTitle || sessionId);
1053
+ continue;
1054
+ }
1055
+ const prev = prevRunning.get(sessionId);
1056
+ prevRunning.set(sessionId, entry.running);
1057
+ if (prev === void 0) continue;
1058
+ if (prev && !entry.running) {
1059
+ if (hidden && sessionId === snapshot.current) raise(sessionId, entry.displayTitle || sessionId);
1060
+ }
1061
+ }
1062
+ for (const id of notified) {
1063
+ const entry = snapshot.byId[id];
1064
+ if (entry === void 0 || entry.running === true) notified.delete(id);
1065
+ }
1066
+ for (const id of [...prevRunning.keys()]) if (snapshot.byId[id] === void 0) prevRunning.delete(id);
1067
+ };
1068
+ const disposeList = sessions.list.subscribe(sync);
1069
+ ctx.effect(() => disposeList, "dsh-plugin-completion-notify: completion subscription");
1070
+ const store = createCompletionNotifyRowStore();
1071
+ let bound;
1072
+ const syncRow = () => {
1073
+ const snapshot = scope.getSnapshot();
1074
+ bound?.sync(snapshot.value?.enabled ?? true, snapshot.revision ?? -1);
1075
+ };
1076
+ const disposeScope = scope.subscribe(syncRow);
1077
+ ctx.effect(() => disposeScope, "dsh-plugin-completion-notify: settings scope subscription");
1078
+ const injected = (actions) => {
1079
+ bound = actions;
1080
+ syncRow();
1081
+ return { setEnabled: (enabled) => {
1082
+ if (enabled && notify !== void 0) requestNotificationPermission(notify);
1083
+ scope.set(COMPLETION_NOTIFY_ENABLED_FIELD, enabled);
1084
+ } };
1085
+ };
1086
+ ctx.slots.inject("settings.general.item", () => ctx.slots.register({
1087
+ name: "settings.general.item",
1088
+ id: "completion-notify",
1089
+ order: 15,
1090
+ store,
1091
+ locale: NS,
1092
+ inject: injected
1093
+ }, CompletionNotifyRow));
1094
+ }
1095
+ //#endregion
1096
+ exports.CompletionNotifyRow = CompletionNotifyRow;
1097
+ exports.apply = apply;
1098
+ exports.browserNotification = browserNotification;
1099
+ exports.inject = inject;
1100
+ exports.notifyCompletion = notifyCompletion;
1101
+ exports.pageIsHidden = pageIsHidden;
1102
+ exports.requestNotificationPermission = requestNotificationPermission;
1103
+ return module.exports;
1104
+ }
1105
+ });
1106
+
1107
+ //# sourceMappingURL=client.js.map