@anionex/dsh-eye-care 0.1.0 → 0.1.2

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 CHANGED
@@ -5,9 +5,8 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
9
- //#region \0dsh-eye-care-css:/Users/davidyang/.codex/worktrees/dsh-eye-care-anionex/src/client/EyeCareRow.module.css.mjs
10
- const css = ".akRDxW_row{border-bottom:1px solid var(--dsw-alias-border-l2);grid-template-columns:minmax(170px,.8fr) minmax(360px,1.2fr);gap:20px;padding:16px 0;display:grid}.akRDxW_copy{min-width:0}.akRDxW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500;line-height:22px}.akRDxW_description{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.akRDxW_controls{align-content:start;gap:8px;display:grid}.akRDxW_controlGroup{flex-wrap:wrap;gap:6px;display:flex}.akRDxW_option,.akRDxW_smallOption{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer}.akRDxW_option:focus-visible,.akRDxW_smallOption:focus-visible{outline:2px solid var(--dsw-alias-button-info-fill);outline-offset:2px}.akRDxW_option{border-radius:9px;min-width:68px;padding:7px 11px;font-size:12px;line-height:18px}.akRDxW_smallOption{border-radius:7px;padding:4px 9px;font-size:11px;line-height:16px}.akRDxW_option:hover:not(:disabled),.akRDxW_smallOption:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.akRDxW_selected{border-color:var(--dsw-alias-button-info-fill);background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary)}.akRDxW_option:disabled,.akRDxW_smallOption:disabled{cursor:wait;opacity:.65}.akRDxW_primaryLine,.akRDxW_settingLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.akRDxW_settingLabel,.akRDxW_status{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.akRDxW_settingLabel{min-width:56px}.akRDxW_advanced{border:1px solid var(--dsw-alias-border-l2);border-radius:9px;overflow:hidden}.akRDxW_advanced>summary{color:var(--dsw-alias-label-secondary);cursor:pointer;padding:8px 10px;font-size:11px;line-height:16px}.akRDxW_advancedBody{gap:8px;padding:0 10px 10px;display:grid}.akRDxW_status{min-height:16px}@media (width<=640px){.akRDxW_row{grid-template-columns:1fr;gap:10px}}";
8
+ //#region \0dsh-eye-care-css:/Users/davidyang/dsh-worktrees/dsh-eye-care/compat-20261001/src/client/EyeCareRow.module.css.mjs
9
+ const css = "._5STowG_row{border-bottom:1px solid var(--dsw-alias-border-l2);grid-template-columns:minmax(170px,.8fr) minmax(360px,1.2fr);gap:20px;padding:16px 0;display:grid}._5STowG_copy{min-width:0}._5STowG_title{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:500;line-height:22px}._5STowG_description{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}._5STowG_controls{align-content:start;gap:8px;display:grid}._5STowG_controlGroup{flex-wrap:wrap;gap:6px;display:flex}._5STowG_option,._5STowG_smallOption{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer}._5STowG_option:focus-visible,._5STowG_smallOption:focus-visible{outline:2px solid var(--dsw-alias-button-info-fill);outline-offset:2px}._5STowG_option{border-radius:9px;min-width:68px;padding:7px 11px;font-size:12px;line-height:18px}._5STowG_smallOption{border-radius:7px;padding:4px 9px;font-size:11px;line-height:16px}._5STowG_option:hover:not(:disabled),._5STowG_smallOption:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}._5STowG_selected{border-color:var(--dsw-alias-button-info-fill);background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary)}._5STowG_option:disabled,._5STowG_smallOption:disabled{cursor:wait;opacity:.65}._5STowG_primaryLine,._5STowG_settingLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._5STowG_settingLabel,._5STowG_status{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}._5STowG_settingLabel{min-width:56px}._5STowG_advanced{border:1px solid var(--dsw-alias-border-l2);border-radius:9px;overflow:hidden}._5STowG_advanced>summary{color:var(--dsw-alias-label-secondary);cursor:pointer;padding:8px 10px;font-size:11px;line-height:16px}._5STowG_advancedBody{gap:8px;padding:0 10px 10px;display:grid}._5STowG_status{min-height:16px}@media (width<=640px){._5STowG_row{grid-template-columns:1fr;gap:10px}}";
11
10
  const tagId = "@anionex/dsh-eye-care/EyeCareRow.module.css";
12
11
  if (typeof document !== "undefined" && document.querySelector(`style[data-plugin-css=${JSON.stringify(tagId)}]`) === null) {
13
12
  const tag = document.createElement("style");
@@ -17,21 +16,21 @@ window.__ModuleLoader__.load({
17
16
  document.head.appendChild(tag);
18
17
  }
19
18
  var EyeCareRow_module_css_default = {
20
- "advancedBody": "akRDxW_advancedBody",
21
- "controls": "akRDxW_controls",
22
- "controlGroup": "akRDxW_controlGroup",
23
- "copy": "akRDxW_copy",
24
- "description": "akRDxW_description",
25
- "smallOption": "akRDxW_smallOption",
26
- "settingLine": "akRDxW_settingLine",
27
- "option": "akRDxW_option",
28
- "advanced": "akRDxW_advanced",
29
- "selected": "akRDxW_selected",
30
- "row": "akRDxW_row",
31
- "title": "akRDxW_title",
32
- "primaryLine": "akRDxW_primaryLine",
33
- "status": "akRDxW_status",
34
- "settingLabel": "akRDxW_settingLabel"
19
+ "description": "_5STowG_description",
20
+ "advancedBody": "_5STowG_advancedBody",
21
+ "selected": "_5STowG_selected",
22
+ "primaryLine": "_5STowG_primaryLine",
23
+ "copy": "_5STowG_copy",
24
+ "title": "_5STowG_title",
25
+ "option": "_5STowG_option",
26
+ "settingLine": "_5STowG_settingLine",
27
+ "settingLabel": "_5STowG_settingLabel",
28
+ "controls": "_5STowG_controls",
29
+ "status": "_5STowG_status",
30
+ "smallOption": "_5STowG_smallOption",
31
+ "row": "_5STowG_row",
32
+ "controlGroup": "_5STowG_controlGroup",
33
+ "advanced": "_5STowG_advanced"
35
34
  };
36
35
  //#endregion
37
36
  //#region src/client/EyeCareRow.tsx
@@ -177,6 +176,678 @@ window.__ModuleLoader__.load({
177
176
  });
178
177
  }
179
178
  //#endregion
179
+ //#region node_modules/.pnpm/zustand@4.4.7_@types+react@18.3.31_immer@10.1.1_react@18.3.1/node_modules/zustand/esm/vanilla.mjs
180
+ const createStoreImpl = (createState) => {
181
+ let state;
182
+ const listeners = /* @__PURE__ */ new Set();
183
+ const setState = (partial, replace) => {
184
+ const nextState = typeof partial === "function" ? partial(state) : partial;
185
+ if (!Object.is(nextState, state)) {
186
+ const previousState = state;
187
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
188
+ listeners.forEach((listener) => listener(state, previousState));
189
+ }
190
+ };
191
+ const getState = () => state;
192
+ const subscribe = (listener) => {
193
+ listeners.add(listener);
194
+ return () => listeners.delete(listener);
195
+ };
196
+ const destroy = () => {
197
+ if (({}.env ? "production" : void 0) !== "production") console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");
198
+ listeners.clear();
199
+ };
200
+ const api = {
201
+ setState,
202
+ getState,
203
+ subscribe,
204
+ destroy
205
+ };
206
+ state = createState(setState, getState, api);
207
+ return api;
208
+ };
209
+ const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
210
+ //#endregion
211
+ //#region node_modules/.pnpm/zustand@4.4.7_@types+react@18.3.31_immer@10.1.1_react@18.3.1/node_modules/zustand/esm/middleware.mjs
212
+ const subscribeWithSelectorImpl = (fn) => (set, get, api) => {
213
+ const origSubscribe = api.subscribe;
214
+ api.subscribe = (selector, optListener, options) => {
215
+ let listener = selector;
216
+ if (optListener) {
217
+ const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
218
+ let currentSlice = selector(api.getState());
219
+ listener = (state) => {
220
+ const nextSlice = selector(state);
221
+ if (!equalityFn(currentSlice, nextSlice)) {
222
+ const previousSlice = currentSlice;
223
+ optListener(currentSlice = nextSlice, previousSlice);
224
+ }
225
+ };
226
+ if (options == null ? void 0 : options.fireImmediately) optListener(currentSlice, currentSlice);
227
+ }
228
+ return origSubscribe(listener);
229
+ };
230
+ return fn(set, get, api);
231
+ };
232
+ const subscribeWithSelector = subscribeWithSelectorImpl;
233
+ //#endregion
234
+ //#region node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.mjs
235
+ var NOTHING = Symbol.for("immer-nothing");
236
+ var DRAFTABLE = Symbol.for("immer-draftable");
237
+ var DRAFT_STATE = Symbol.for("immer-state");
238
+ function die(error, ...args) {
239
+ throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
240
+ }
241
+ var getPrototypeOf = Object.getPrototypeOf;
242
+ function isDraft(value) {
243
+ return !!value && !!value[DRAFT_STATE];
244
+ }
245
+ function isDraftable(value) {
246
+ if (!value) return false;
247
+ return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
248
+ }
249
+ var objectCtorString = Object.prototype.constructor.toString();
250
+ function isPlainObject(value) {
251
+ if (!value || typeof value !== "object") return false;
252
+ const proto = getPrototypeOf(value);
253
+ if (proto === null) return true;
254
+ const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
255
+ if (Ctor === Object) return true;
256
+ return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
257
+ }
258
+ function each(obj, iter) {
259
+ if (getArchtype(obj) === 0) Reflect.ownKeys(obj).forEach((key) => {
260
+ iter(key, obj[key], obj);
261
+ });
262
+ else obj.forEach((entry, index) => iter(index, entry, obj));
263
+ }
264
+ function getArchtype(thing) {
265
+ const state = thing[DRAFT_STATE];
266
+ return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
267
+ }
268
+ function has(thing, prop) {
269
+ return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
270
+ }
271
+ function set(thing, propOrOldValue, value) {
272
+ const t = getArchtype(thing);
273
+ if (t === 2) thing.set(propOrOldValue, value);
274
+ else if (t === 3) thing.add(value);
275
+ else thing[propOrOldValue] = value;
276
+ }
277
+ function is(x, y) {
278
+ if (x === y) return x !== 0 || 1 / x === 1 / y;
279
+ else return x !== x && y !== y;
280
+ }
281
+ function isMap(target) {
282
+ return target instanceof Map;
283
+ }
284
+ function isSet(target) {
285
+ return target instanceof Set;
286
+ }
287
+ function latest(state) {
288
+ return state.copy_ || state.base_;
289
+ }
290
+ function shallowCopy(base, strict) {
291
+ if (isMap(base)) return new Map(base);
292
+ if (isSet(base)) return new Set(base);
293
+ if (Array.isArray(base)) return Array.prototype.slice.call(base);
294
+ const isPlain = isPlainObject(base);
295
+ if (strict === true || strict === "class_only" && !isPlain) {
296
+ const descriptors = Object.getOwnPropertyDescriptors(base);
297
+ delete descriptors[DRAFT_STATE];
298
+ let keys = Reflect.ownKeys(descriptors);
299
+ for (let i = 0; i < keys.length; i++) {
300
+ const key = keys[i];
301
+ const desc = descriptors[key];
302
+ if (desc.writable === false) {
303
+ desc.writable = true;
304
+ desc.configurable = true;
305
+ }
306
+ if (desc.get || desc.set) descriptors[key] = {
307
+ configurable: true,
308
+ writable: true,
309
+ enumerable: desc.enumerable,
310
+ value: base[key]
311
+ };
312
+ }
313
+ return Object.create(getPrototypeOf(base), descriptors);
314
+ } else {
315
+ const proto = getPrototypeOf(base);
316
+ if (proto !== null && isPlain) return { ...base };
317
+ const obj = Object.create(proto);
318
+ return Object.assign(obj, base);
319
+ }
320
+ }
321
+ function freeze(obj, deep = false) {
322
+ if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
323
+ if (getArchtype(obj) > 1) obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
324
+ Object.freeze(obj);
325
+ if (deep) Object.entries(obj).forEach(([key, value]) => freeze(value, true));
326
+ return obj;
327
+ }
328
+ function dontMutateFrozenCollections() {
329
+ die(2);
330
+ }
331
+ function isFrozen(obj) {
332
+ return Object.isFrozen(obj);
333
+ }
334
+ var plugins = {};
335
+ function getPlugin(pluginKey) {
336
+ const plugin = plugins[pluginKey];
337
+ if (!plugin) die(0, pluginKey);
338
+ return plugin;
339
+ }
340
+ var currentScope;
341
+ function getCurrentScope() {
342
+ return currentScope;
343
+ }
344
+ function createScope(parent_, immer_) {
345
+ return {
346
+ drafts_: [],
347
+ parent_,
348
+ immer_,
349
+ canAutoFreeze_: true,
350
+ unfinalizedDrafts_: 0
351
+ };
352
+ }
353
+ function usePatchesInScope(scope, patchListener) {
354
+ if (patchListener) {
355
+ getPlugin("Patches");
356
+ scope.patches_ = [];
357
+ scope.inversePatches_ = [];
358
+ scope.patchListener_ = patchListener;
359
+ }
360
+ }
361
+ function revokeScope(scope) {
362
+ leaveScope(scope);
363
+ scope.drafts_.forEach(revokeDraft);
364
+ scope.drafts_ = null;
365
+ }
366
+ function leaveScope(scope) {
367
+ if (scope === currentScope) currentScope = scope.parent_;
368
+ }
369
+ function enterScope(immer2) {
370
+ return currentScope = createScope(currentScope, immer2);
371
+ }
372
+ function revokeDraft(draft) {
373
+ const state = draft[DRAFT_STATE];
374
+ if (state.type_ === 0 || state.type_ === 1) state.revoke_();
375
+ else state.revoked_ = true;
376
+ }
377
+ function processResult(result, scope) {
378
+ scope.unfinalizedDrafts_ = scope.drafts_.length;
379
+ const baseDraft = scope.drafts_[0];
380
+ if (result !== void 0 && result !== baseDraft) {
381
+ if (baseDraft[DRAFT_STATE].modified_) {
382
+ revokeScope(scope);
383
+ die(4);
384
+ }
385
+ if (isDraftable(result)) {
386
+ result = finalize(scope, result);
387
+ if (!scope.parent_) maybeFreeze(scope, result);
388
+ }
389
+ if (scope.patches_) getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope.patches_, scope.inversePatches_);
390
+ } else result = finalize(scope, baseDraft, []);
391
+ revokeScope(scope);
392
+ if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
393
+ return result !== NOTHING ? result : void 0;
394
+ }
395
+ function finalize(rootScope, value, path) {
396
+ if (isFrozen(value)) return value;
397
+ const state = value[DRAFT_STATE];
398
+ if (!state) {
399
+ each(value, (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path));
400
+ return value;
401
+ }
402
+ if (state.scope_ !== rootScope) return value;
403
+ if (!state.modified_) {
404
+ maybeFreeze(rootScope, state.base_, true);
405
+ return state.base_;
406
+ }
407
+ if (!state.finalized_) {
408
+ state.finalized_ = true;
409
+ state.scope_.unfinalizedDrafts_--;
410
+ const result = state.copy_;
411
+ let resultEach = result;
412
+ let isSet2 = false;
413
+ if (state.type_ === 3) {
414
+ resultEach = new Set(result);
415
+ result.clear();
416
+ isSet2 = true;
417
+ }
418
+ each(resultEach, (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2));
419
+ maybeFreeze(rootScope, result, false);
420
+ if (path && rootScope.patches_) getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
421
+ }
422
+ return state.copy_;
423
+ }
424
+ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
425
+ if (isDraft(childValue)) {
426
+ const res = finalize(rootScope, childValue, rootPath && parentState && parentState.type_ !== 3 && !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0);
427
+ set(targetObject, prop, res);
428
+ if (isDraft(res)) rootScope.canAutoFreeze_ = false;
429
+ else return;
430
+ } else if (targetIsSet) targetObject.add(childValue);
431
+ if (isDraftable(childValue) && !isFrozen(childValue)) {
432
+ if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return;
433
+ finalize(rootScope, childValue);
434
+ if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop)) maybeFreeze(rootScope, childValue);
435
+ }
436
+ }
437
+ function maybeFreeze(scope, value, deep = false) {
438
+ if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
439
+ }
440
+ function createProxyProxy(base, parent) {
441
+ const isArray = Array.isArray(base);
442
+ const state = {
443
+ type_: isArray ? 1 : 0,
444
+ scope_: parent ? parent.scope_ : getCurrentScope(),
445
+ modified_: false,
446
+ finalized_: false,
447
+ assigned_: {},
448
+ parent_: parent,
449
+ base_: base,
450
+ draft_: null,
451
+ copy_: null,
452
+ revoke_: null,
453
+ isManual_: false
454
+ };
455
+ let target = state;
456
+ let traps = objectTraps;
457
+ if (isArray) {
458
+ target = [state];
459
+ traps = arrayTraps;
460
+ }
461
+ const { revoke, proxy } = Proxy.revocable(target, traps);
462
+ state.draft_ = proxy;
463
+ state.revoke_ = revoke;
464
+ return proxy;
465
+ }
466
+ var objectTraps = {
467
+ get(state, prop) {
468
+ if (prop === DRAFT_STATE) return state;
469
+ const source = latest(state);
470
+ if (!has(source, prop)) return readPropFromProto(state, source, prop);
471
+ const value = source[prop];
472
+ if (state.finalized_ || !isDraftable(value)) return value;
473
+ if (value === peek(state.base_, prop)) {
474
+ prepareCopy(state);
475
+ return state.copy_[prop] = createProxy(value, state);
476
+ }
477
+ return value;
478
+ },
479
+ has(state, prop) {
480
+ return prop in latest(state);
481
+ },
482
+ ownKeys(state) {
483
+ return Reflect.ownKeys(latest(state));
484
+ },
485
+ set(state, prop, value) {
486
+ const desc = getDescriptorFromProto(latest(state), prop);
487
+ if (desc?.set) {
488
+ desc.set.call(state.draft_, value);
489
+ return true;
490
+ }
491
+ if (!state.modified_) {
492
+ const current2 = peek(latest(state), prop);
493
+ const currentState = current2?.[DRAFT_STATE];
494
+ if (currentState && currentState.base_ === value) {
495
+ state.copy_[prop] = value;
496
+ state.assigned_[prop] = false;
497
+ return true;
498
+ }
499
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) return true;
500
+ prepareCopy(state);
501
+ markChanged(state);
502
+ }
503
+ if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
504
+ state.copy_[prop] = value;
505
+ state.assigned_[prop] = true;
506
+ return true;
507
+ },
508
+ deleteProperty(state, prop) {
509
+ if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
510
+ state.assigned_[prop] = false;
511
+ prepareCopy(state);
512
+ markChanged(state);
513
+ } else delete state.assigned_[prop];
514
+ if (state.copy_) delete state.copy_[prop];
515
+ return true;
516
+ },
517
+ getOwnPropertyDescriptor(state, prop) {
518
+ const owner = latest(state);
519
+ const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
520
+ if (!desc) return desc;
521
+ return {
522
+ writable: true,
523
+ configurable: state.type_ !== 1 || prop !== "length",
524
+ enumerable: desc.enumerable,
525
+ value: owner[prop]
526
+ };
527
+ },
528
+ defineProperty() {
529
+ die(11);
530
+ },
531
+ getPrototypeOf(state) {
532
+ return getPrototypeOf(state.base_);
533
+ },
534
+ setPrototypeOf() {
535
+ die(12);
536
+ }
537
+ };
538
+ var arrayTraps = {};
539
+ each(objectTraps, (key, fn) => {
540
+ arrayTraps[key] = function() {
541
+ arguments[0] = arguments[0][0];
542
+ return fn.apply(this, arguments);
543
+ };
544
+ });
545
+ arrayTraps.deleteProperty = function(state, prop) {
546
+ return arrayTraps.set.call(this, state, prop, void 0);
547
+ };
548
+ arrayTraps.set = function(state, prop, value) {
549
+ return objectTraps.set.call(this, state[0], prop, value, state[0]);
550
+ };
551
+ function peek(draft, prop) {
552
+ const state = draft[DRAFT_STATE];
553
+ return (state ? latest(state) : draft)[prop];
554
+ }
555
+ function readPropFromProto(state, source, prop) {
556
+ const desc = getDescriptorFromProto(source, prop);
557
+ return desc ? `value` in desc ? desc.value : desc.get?.call(state.draft_) : void 0;
558
+ }
559
+ function getDescriptorFromProto(source, prop) {
560
+ if (!(prop in source)) return void 0;
561
+ let proto = getPrototypeOf(source);
562
+ while (proto) {
563
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
564
+ if (desc) return desc;
565
+ proto = getPrototypeOf(proto);
566
+ }
567
+ }
568
+ function markChanged(state) {
569
+ if (!state.modified_) {
570
+ state.modified_ = true;
571
+ if (state.parent_) markChanged(state.parent_);
572
+ }
573
+ }
574
+ function prepareCopy(state) {
575
+ if (!state.copy_) state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
576
+ }
577
+ var Immer2 = class {
578
+ constructor(config) {
579
+ this.autoFreeze_ = true;
580
+ this.useStrictShallowCopy_ = false;
581
+ /**
582
+ * The `produce` function takes a value and a "recipe function" (whose
583
+ * return value often depends on the base state). The recipe function is
584
+ * free to mutate its first argument however it wants. All mutations are
585
+ * only ever applied to a __copy__ of the base state.
586
+ *
587
+ * Pass only a function to create a "curried producer" which relieves you
588
+ * from passing the recipe function every time.
589
+ *
590
+ * Only plain objects and arrays are made mutable. All other objects are
591
+ * considered uncopyable.
592
+ *
593
+ * Note: This function is __bound__ to its `Immer` instance.
594
+ *
595
+ * @param {any} base - the initial state
596
+ * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
597
+ * @param {Function} patchListener - optional function that will be called with all the patches produced here
598
+ * @returns {any} a new state, or the initial state if nothing was modified
599
+ */
600
+ this.produce = (base, recipe, patchListener) => {
601
+ if (typeof base === "function" && typeof recipe !== "function") {
602
+ const defaultBase = recipe;
603
+ recipe = base;
604
+ const self = this;
605
+ return function curriedProduce(base2 = defaultBase, ...args) {
606
+ return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
607
+ };
608
+ }
609
+ if (typeof recipe !== "function") die(6);
610
+ if (patchListener !== void 0 && typeof patchListener !== "function") die(7);
611
+ let result;
612
+ if (isDraftable(base)) {
613
+ const scope = enterScope(this);
614
+ const proxy = createProxy(base, void 0);
615
+ let hasError = true;
616
+ try {
617
+ result = recipe(proxy);
618
+ hasError = false;
619
+ } finally {
620
+ if (hasError) revokeScope(scope);
621
+ else leaveScope(scope);
622
+ }
623
+ usePatchesInScope(scope, patchListener);
624
+ return processResult(result, scope);
625
+ } else if (!base || typeof base !== "object") {
626
+ result = recipe(base);
627
+ if (result === void 0) result = base;
628
+ if (result === NOTHING) result = void 0;
629
+ if (this.autoFreeze_) freeze(result, true);
630
+ if (patchListener) {
631
+ const p = [];
632
+ const ip = [];
633
+ getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
634
+ patchListener(p, ip);
635
+ }
636
+ return result;
637
+ } else die(1, base);
638
+ };
639
+ this.produceWithPatches = (base, recipe) => {
640
+ if (typeof base === "function") return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
641
+ let patches, inversePatches;
642
+ return [
643
+ this.produce(base, recipe, (p, ip) => {
644
+ patches = p;
645
+ inversePatches = ip;
646
+ }),
647
+ patches,
648
+ inversePatches
649
+ ];
650
+ };
651
+ if (typeof config?.autoFreeze === "boolean") this.setAutoFreeze(config.autoFreeze);
652
+ if (typeof config?.useStrictShallowCopy === "boolean") this.setUseStrictShallowCopy(config.useStrictShallowCopy);
653
+ }
654
+ createDraft(base) {
655
+ if (!isDraftable(base)) die(8);
656
+ if (isDraft(base)) base = current(base);
657
+ const scope = enterScope(this);
658
+ const proxy = createProxy(base, void 0);
659
+ proxy[DRAFT_STATE].isManual_ = true;
660
+ leaveScope(scope);
661
+ return proxy;
662
+ }
663
+ finishDraft(draft, patchListener) {
664
+ const state = draft && draft[DRAFT_STATE];
665
+ if (!state || !state.isManual_) die(9);
666
+ const { scope_: scope } = state;
667
+ usePatchesInScope(scope, patchListener);
668
+ return processResult(void 0, scope);
669
+ }
670
+ /**
671
+ * Pass true to automatically freeze all copies created by Immer.
672
+ *
673
+ * By default, auto-freezing is enabled.
674
+ */
675
+ setAutoFreeze(value) {
676
+ this.autoFreeze_ = value;
677
+ }
678
+ /**
679
+ * Pass true to enable strict shallow copy.
680
+ *
681
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
682
+ */
683
+ setUseStrictShallowCopy(value) {
684
+ this.useStrictShallowCopy_ = value;
685
+ }
686
+ applyPatches(base, patches) {
687
+ let i;
688
+ for (i = patches.length - 1; i >= 0; i--) {
689
+ const patch = patches[i];
690
+ if (patch.path.length === 0 && patch.op === "replace") {
691
+ base = patch.value;
692
+ break;
693
+ }
694
+ }
695
+ if (i > -1) patches = patches.slice(i + 1);
696
+ const applyPatchesImpl = getPlugin("Patches").applyPatches_;
697
+ if (isDraft(base)) return applyPatchesImpl(base, patches);
698
+ return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
699
+ }
700
+ };
701
+ function createProxy(value, parent) {
702
+ const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
703
+ (parent ? parent.scope_ : getCurrentScope()).drafts_.push(draft);
704
+ return draft;
705
+ }
706
+ function current(value) {
707
+ if (!isDraft(value)) die(10, value);
708
+ return currentImpl(value);
709
+ }
710
+ function currentImpl(value) {
711
+ if (!isDraftable(value) || isFrozen(value)) return value;
712
+ const state = value[DRAFT_STATE];
713
+ let copy;
714
+ if (state) {
715
+ if (!state.modified_) return state.base_;
716
+ state.finalized_ = true;
717
+ copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
718
+ } else copy = shallowCopy(value, true);
719
+ each(copy, (key, childValue) => {
720
+ set(copy, key, currentImpl(childValue));
721
+ });
722
+ if (state) state.finalized_ = false;
723
+ return copy;
724
+ }
725
+ var immer = new Immer2();
726
+ var produce = immer.produce;
727
+ immer.produceWithPatches.bind(immer);
728
+ immer.setAutoFreeze.bind(immer);
729
+ immer.setUseStrictShallowCopy.bind(immer);
730
+ immer.applyPatches.bind(immer);
731
+ immer.createDraft.bind(immer);
732
+ immer.finishDraft.bind(immer);
733
+ //#endregion
734
+ //#region node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.2.0-rc.2_@deepseek-ai+cordis@4.0.4/node_modules/@deepseek-ai/dsh-client-store/lib/index.js
735
+ /**
736
+ * React-free snapshot store engine (zustand vanilla + immer + subscribeWithSelector +
737
+ * rafFlush middleware + opt-in persist + dev freeze) plus the declarative
738
+ * shell over it: {@link defineStore} bakes an init/persist/actions literal
739
+ * into a {@link StoreHandle}, the registration-side store seat of slot
740
+ * terminals. Engine products are bare observables — subscribe/getSnapshot/
741
+ * update/set, NO selector hook. Hook synthesis is ui-renderer's (the one
742
+ * uSES bridge, cached per source at the binding site).
743
+ */
744
+ /**
745
+ * Notify an observer set without allowing one callback to starve the rest.
746
+ * @param listeners - current observer callbacks; copied before dispatch.
747
+ * @param label - diagnostic owner prefix.
748
+ * @param args - callback arguments.
749
+ */
750
+ function notifySubscribers(listeners, label, ...args) {
751
+ for (const listener of [...listeners]) try {
752
+ listener(...args);
753
+ } catch (error) {
754
+ console.error(`${label} subscriber failed:`, error);
755
+ }
756
+ }
757
+ /** Batches subscriber notification into one flush per animation frame. */
758
+ function rafBatch(notify) {
759
+ const schedule = typeof requestAnimationFrame === "function" ? (fn) => {
760
+ requestAnimationFrame(() => {
761
+ fn();
762
+ });
763
+ } : (fn) => {
764
+ queueMicrotask(fn);
765
+ };
766
+ let scheduled = false;
767
+ return () => {
768
+ if (scheduled) return;
769
+ scheduled = true;
770
+ schedule(() => {
771
+ scheduled = false;
772
+ notify();
773
+ });
774
+ };
775
+ }
776
+ /**
777
+ * Create a snapshot store.
778
+ *
779
+ * Flush default is 'sync' (controlled inputs need same-tick echo); frame-driven
780
+ * stores opt into 'raf', where a frame's worth of updates coalesces into one
781
+ * notification. Known raf-mode tradeoff: a component mounting mid-frame reads
782
+ * fresh state while existing subscribers hear it next flush — transient
783
+ * frame-level skew, same nature as the object layer's microtask batching.
784
+ *
785
+ * @param init - initial state.
786
+ * @param opts - flush mode and opt-in persistence (localStorage, keyed by name).
787
+ * @returns the store.
788
+ */
789
+ function createSnapshotStore(init, opts) {
790
+ const withSelector = subscribeWithSelector(() => init);
791
+ const api = createStore()(withSelector);
792
+ if (opts?.persist) attachPersistence(api, opts.persist.name);
793
+ let subscribe = (fn) => api.subscribe(() => {
794
+ notifySubscribers([fn], "[client-store]");
795
+ });
796
+ if (opts?.flush === "raf") {
797
+ const listeners = /* @__PURE__ */ new Set();
798
+ const flush = rafBatch(() => {
799
+ notifySubscribers(listeners, "[client-store]");
800
+ });
801
+ api.subscribe(flush);
802
+ subscribe = (fn) => {
803
+ listeners.add(fn);
804
+ return () => {
805
+ listeners.delete(fn);
806
+ };
807
+ };
808
+ }
809
+ return {
810
+ getSnapshot: () => api.getState(),
811
+ subscribe: (fn) => subscribe(fn),
812
+ update: (mutator) => {
813
+ api.setState(produce(api.getState(), (draft) => {
814
+ mutator(draft);
815
+ }), true);
816
+ },
817
+ set: (next) => {
818
+ api.setState(devFreeze(next), true);
819
+ }
820
+ };
821
+ }
822
+ /**
823
+ * Whole-value JSON persistence to localStorage. Hand-rolled instead of the
824
+ * zustand persist middleware: its write path spreads state into an object
825
+ * (`partialize({ ...get() })`), exploding primitive state (a persisted string
826
+ * draft becomes {0:'h',1:'e',...}) — not fixable via merge/deserialize options
827
+ * because the corruption happens before serialization. Storage failures
828
+ * (quota, private mode) only disable persistence, never break the store.
829
+ */
830
+ function attachPersistence(api, name) {
831
+ if (typeof localStorage === "undefined") return;
832
+ try {
833
+ const raw = localStorage.getItem(name);
834
+ if (raw !== null) api.setState(devFreeze(JSON.parse(raw)), true);
835
+ } catch (error) {
836
+ console.error(`snapshot store '${name}' rehydration failed:`, error);
837
+ }
838
+ api.subscribe((state) => {
839
+ try {
840
+ localStorage.setItem(name, JSON.stringify(state));
841
+ } catch (error) {
842
+ console.error(`snapshot store '${name}' persistence failed:`, error);
843
+ }
844
+ });
845
+ }
846
+ /** Deep-freeze draftable wholesale-set state outside production: set() bypasses immer's freeze. */
847
+ function devFreeze(value) {
848
+ return freeze(value, true);
849
+ }
850
+ //#endregion
180
851
  //#region src/shared.ts
181
852
  /** Browser-safe eye-care settings and RPC wire values. */
182
853
  /** User-selectable eye-care operating modes. */
@@ -220,9 +891,12 @@ window.__ModuleLoader__.load({
220
891
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
221
892
  const record = value;
222
893
  if (!isEyeCareMode(record["mode"]) || !isEyeCareIntensity(record["intensity"])) return void 0;
894
+ const restoreTheme = record["restoreTheme"];
895
+ if (restoreTheme !== void 0 && restoreTheme !== "light" && restoreTheme !== "dark" && restoreTheme !== "system") return void 0;
223
896
  return {
224
897
  mode: record[MODE_FIELD],
225
- intensity: record[INTENSITY_FIELD]
898
+ intensity: record[INTENSITY_FIELD],
899
+ ...restoreTheme === void 0 ? {} : { restoreTheme }
226
900
  };
227
901
  }
228
902
  /** Decode one complete Host snapshot from the RPC boundary. */
@@ -639,7 +1313,7 @@ window.__ModuleLoader__.load({
639
1313
  /** Stateful controller shared by theme listeners and the Settings row. */
640
1314
  var EyeCareController = class {
641
1315
  /** Reactive row source. */
642
- store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)(INITIAL_STATE);
1316
+ store = createSnapshotStore(INITIAL_STATE);
643
1317
  theme;
644
1318
  rpc;
645
1319
  media;
@@ -657,6 +1331,8 @@ window.__ModuleLoader__.load({
657
1331
  acceptedRemoteSnapshot = false;
658
1332
  startupBaseTheme;
659
1333
  startupBaseThemeDeadline = 0;
1334
+ removeTokenLayer;
1335
+ activeBaseTheme;
660
1336
  /**
661
1337
  * Register the concrete themes and lifecycle listeners.
662
1338
  * @param options - theme, transport, and system-scheme collaborators.
@@ -756,7 +1432,10 @@ window.__ModuleLoader__.load({
756
1432
  this.unsubscribeMedia = void 0;
757
1433
  this.unsubscribeTheme = void 0;
758
1434
  await this.tail;
759
- if (isEyeCareThemeId(this.theme.getTheme().preference)) try {
1435
+ const current = this.theme.getTheme();
1436
+ this.removeTokenLayer?.();
1437
+ this.removeTokenLayer = void 0;
1438
+ if (isEyeCareThemeId(current.preference) || current.preference === this.activeBaseTheme) try {
760
1439
  this.setTheme(this.resolveRestoreTheme());
761
1440
  } catch (error) {
762
1441
  failures.push(error);
@@ -802,7 +1481,11 @@ window.__ModuleLoader__.load({
802
1481
  this.setUnavailable(state.error);
803
1482
  return Promise.resolve();
804
1483
  }
805
- this.pendingSettings = { ...settings };
1484
+ this.pendingSettings = {
1485
+ mode: settings.mode,
1486
+ intensity: settings.intensity
1487
+ };
1488
+ if (this.theme.overrideTokens !== void 0 && settings.mode !== "off" && (this.restoreTheme === "light" || this.restoreTheme === "dark" || this.restoreTheme === "system")) this.pendingSettings.restoreTheme = this.restoreTheme;
806
1489
  return this.enqueue(async () => {
807
1490
  await this.flushPending();
808
1491
  });
@@ -900,7 +1583,7 @@ window.__ModuleLoader__.load({
900
1583
  this.hasRestoreTheme = true;
901
1584
  }
902
1585
  } else if (firstRemote) {
903
- const base = snapshot.baseThemePreference;
1586
+ const base = next.restoreTheme ?? snapshot.baseThemePreference;
904
1587
  if (base === void 0) {
905
1588
  if (!this.hasRestoreTheme) this.captureRestoreTheme();
906
1589
  } else {
@@ -943,12 +1626,36 @@ window.__ModuleLoader__.load({
943
1626
  const { mode, intensity } = this.store.getSnapshot().settings;
944
1627
  const current = this.theme.getTheme().preference;
945
1628
  if (mode === "off") {
946
- if (isEyeCareThemeId(current)) this.setTheme(this.resolveRestoreTheme());
1629
+ this.applyingTheme += 1;
1630
+ try {
1631
+ this.removeTokenLayer?.();
1632
+ this.removeTokenLayer = void 0;
1633
+ if (isEyeCareThemeId(current) || current === this.activeBaseTheme) this.setTheme(this.resolveRestoreTheme());
1634
+ this.activeBaseTheme = void 0;
1635
+ } finally {
1636
+ this.applyingTheme -= 1;
1637
+ }
947
1638
  this.hasRestoreTheme = false;
948
1639
  return;
949
1640
  }
950
1641
  if (!this.hasRestoreTheme) this.captureRestoreTheme();
951
1642
  const scheme = mode === "auto" ? this.media?.matches === true ? "dark" : "light" : mode;
1643
+ if (this.theme.overrideTokens !== void 0) {
1644
+ const definition = EYE_CARE_THEMES.find((theme) => theme.id === eyeCareThemeId(scheme, intensity));
1645
+ const tokens = Object.fromEntries(Object.entries(definition.tokens).map(([name, value]) => [name, {
1646
+ light: value,
1647
+ dark: value
1648
+ }]));
1649
+ this.applyingTheme += 1;
1650
+ try {
1651
+ this.activeBaseTheme = mode === "auto" ? "system" : mode;
1652
+ this.removeTokenLayer = this.theme.overrideTokens("@anionex/dsh-eye-care", tokens);
1653
+ this.setTheme(this.activeBaseTheme);
1654
+ } finally {
1655
+ this.applyingTheme -= 1;
1656
+ }
1657
+ return;
1658
+ }
952
1659
  this.setTheme(eyeCareThemeId(scheme, intensity));
953
1660
  }
954
1661
  setTheme(id) {
@@ -962,6 +1669,7 @@ window.__ModuleLoader__.load({
962
1669
  }
963
1670
  onThemeChanged(snapshot) {
964
1671
  if (this.disposed || this.applyingTheme > 0 || isEyeCareThemeId(snapshot.preference)) return;
1672
+ if (snapshot.preference === this.activeBaseTheme) return;
965
1673
  if (this.startupBaseTheme !== void 0) {
966
1674
  const expected = this.startupBaseTheme;
967
1675
  const withinStartupWindow = this.now() <= this.startupBaseThemeDeadline;
@@ -986,6 +1694,7 @@ window.__ModuleLoader__.load({
986
1694
  next.settings = settings;
987
1695
  next.error = null;
988
1696
  });
1697
+ this.applyCurrentTheme();
989
1698
  this.persist(settings);
990
1699
  }
991
1700
  };
@@ -1067,7 +1776,7 @@ window.__ModuleLoader__.load({
1067
1776
  }), "dsh-eye-care: dictionaries");
1068
1777
  ctx.effect(() => {
1069
1778
  const refresh = (namespace) => {
1070
- if (namespace !== void 0 && namespace !== "eye-care") return;
1779
+ if (namespace !== void 0 && namespace !== "eye-care" && namespace !== "dsh-eye-care") return;
1071
1780
  controller.refresh();
1072
1781
  };
1073
1782
  const disposers = [ctx.remote.$on("settings/document-updated", refresh), ctx.on("connection/reset", () => {