@drincs/pixi-vn 1.8.11 → 1.8.12

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.
Files changed (39) hide show
  1. package/dist/{ContainerMemory-BjcfYRU7.d.cts → ContainerMemory-D2HtgX7w.d.cts} +1 -1
  2. package/dist/{ContainerMemory-BjcfYRU7.d.ts → ContainerMemory-D2HtgX7w.d.ts} +1 -1
  3. package/dist/{HistoryChoiceMenuOption-CEmjDDJH.d.cts → HistoryChoiceMenuOption-BMsYentw.d.cts} +1 -1
  4. package/dist/{HistoryChoiceMenuOption-CN7NkcxU.d.ts → HistoryChoiceMenuOption-DQ-pnuPU.d.ts} +1 -1
  5. package/dist/{HistoryGameState-3ztYdv84.d.cts → HistoryGameState-C28NcKKl.d.cts} +1 -1
  6. package/dist/{HistoryGameState-D4t2fY9x.d.ts → HistoryGameState-CmjUtlkV.d.ts} +1 -1
  7. package/dist/{HistoryStep-DtOryKAZ.d.cts → HistoryStep-G9dUn0Lf.d.cts} +36 -4
  8. package/dist/{HistoryStep-DtOryKAZ.d.ts → HistoryStep-G9dUn0Lf.d.ts} +36 -4
  9. package/dist/{OpenedLabel-t6PvSzaL.d.cts → OpenedLabel-BxfL31aQ.d.cts} +1 -1
  10. package/dist/{OpenedLabel-DJby8qPc.d.ts → OpenedLabel-DLfFuZgk.d.ts} +1 -1
  11. package/dist/{SoundManagerInterface-TgOPqm2L.d.cts → SoundManagerInterface-Dd0b88_N.d.cts} +2 -2
  12. package/dist/{SoundManagerInterface-TgOPqm2L.d.ts → SoundManagerInterface-Dd0b88_N.d.ts} +2 -2
  13. package/dist/canvas.d.cts +2 -2
  14. package/dist/canvas.d.ts +2 -2
  15. package/dist/characters.cjs +1 -1
  16. package/dist/characters.d.cts +43 -5
  17. package/dist/characters.d.ts +43 -5
  18. package/dist/characters.mjs +1 -1
  19. package/dist/history.d.cts +3 -3
  20. package/dist/history.d.ts +3 -3
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +7 -7
  23. package/dist/index.d.ts +7 -7
  24. package/dist/index.mjs +1 -1
  25. package/dist/narration.cjs +1 -1
  26. package/dist/narration.d.cts +11 -10
  27. package/dist/narration.d.ts +11 -10
  28. package/dist/narration.mjs +2 -2
  29. package/dist/sound.d.cts +2 -2
  30. package/dist/sound.d.ts +2 -2
  31. package/dist/vite-listener.cjs +1 -1
  32. package/dist/vite-listener.d.cts +1 -1
  33. package/dist/vite-listener.d.ts +1 -1
  34. package/dist/vite-listener.mjs +1 -1
  35. package/dist/vite.cjs +2 -1
  36. package/dist/vite.d.cts +47 -2
  37. package/dist/vite.d.ts +47 -2
  38. package/dist/vite.mjs +2 -1
  39. package/package.json +1 -1
@@ -389,4 +389,4 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
389
389
  elements: CanvasBaseItemMemory[];
390
390
  }
391
391
 
392
- export { type AdditionalPositionsExtension as A, CanvasBaseItem as C, type ListenerExtension as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type Ticker as T, type AdditionalPositionsExtensionProps as a, type CanvasBaseItemMemory as b, type CanvasGameState as c, type ContainerChild as d, type ContainerMemory as e, type ListenerExtensionMemory as f, type TickerArgs as g, type TickerHistory as h, type TickerInfo as i, type TickersSequence as j, addListenerHandler as k, analizePositionsExtensionProps as l };
392
+ export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
@@ -389,4 +389,4 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
389
389
  elements: CanvasBaseItemMemory[];
390
390
  }
391
391
 
392
- export { type AdditionalPositionsExtension as A, CanvasBaseItem as C, type ListenerExtension as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type Ticker as T, type AdditionalPositionsExtensionProps as a, type CanvasBaseItemMemory as b, type CanvasGameState as c, type ContainerChild as d, type ContainerMemory as e, type ListenerExtensionMemory as f, type TickerArgs as g, type TickerHistory as h, type TickerInfo as i, type TickersSequence as j, addListenerHandler as k, analizePositionsExtensionProps as l };
392
+ export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
@@ -1,5 +1,5 @@
1
1
  import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
2
- import { D as DialogueInterface } from './HistoryStep-DtOryKAZ.cjs';
2
+ import { D as DialogueInterface } from './HistoryStep-G9dUn0Lf.cjs';
3
3
 
4
4
  type CloseType = "close";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
2
- import { D as DialogueInterface } from './HistoryStep-DtOryKAZ.js';
2
+ import { D as DialogueInterface } from './HistoryStep-G9dUn0Lf.js';
3
3
 
4
4
  type CloseType = "close";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { GameStepState } from '@drincs/pixi-vn';
2
- import { H as HistoryStep } from './HistoryStep-DtOryKAZ.cjs';
2
+ import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.cjs';
3
3
 
4
4
  /**
5
5
  * Interface exported step data
@@ -1,5 +1,5 @@
1
1
  import { GameStepState } from '@drincs/pixi-vn';
2
- import { H as HistoryStep } from './HistoryStep-DtOryKAZ.js';
2
+ import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.js';
3
3
 
4
4
  /**
5
5
  * Interface exported step data
@@ -3,10 +3,42 @@ import { StoredChoiceInterface, StorageElementType, OpenedLabel } from '@drincs/
3
3
  import { CharacterInterface } from '@drincs/pixi-vn';
4
4
 
5
5
  /**
6
- * is a string containing the name of the label.
7
- * It is used to {@link narration.registeredLabels} to get the label class.
6
+ * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/narration'`
7
+ * to constrain the set of valid label IDs to a known union of string literals.
8
+ *
9
+ * When this interface has no keys (the default), {@link LabelIdType} resolves to `string`,
10
+ * preserving full backwards compatibility. Once you augment it, {@link LabelIdType} becomes
11
+ * the union of the declared keys and the compiler will reject any unknown label ID.
12
+ *
13
+ * The augmentation is typically written into an auto-generated declaration file by the
14
+ * Vite plugin (see the `labelTypeFilePath` option of `vitePluginPixivn`), but it can
15
+ * also be written by hand.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // pixi-vn.gen.d.ts (auto-generated — do not edit manually)
20
+ * declare module "@drincs/pixi-vn/narration" {
21
+ * interface PixivnLabelIds {
22
+ * startLabel: never;
23
+ * menuLabel: never;
24
+ * }
25
+ * }
26
+ * export {};
27
+ * ```
8
28
  */
9
- type LabelIdType = string;
29
+ interface PixivnLabelIds {
30
+ }
31
+ /**
32
+ * The type used wherever a label ID is expected (e.g. `narration.call`, `narration.jump`,
33
+ * `newLabel`, choice options, …).
34
+ *
35
+ * - **Default** — resolves to `string` so that existing code that passes arbitrary strings
36
+ * continues to compile without any changes.
37
+ * - **Augmented** — when {@link PixivnLabelIds} has been extended via
38
+ * `declare module "@drincs/pixi-vn/narration"`, this type resolves to the union of the
39
+ * declared keys, giving you compile-time safety against typos and unknown label IDs.
40
+ */
41
+ type LabelIdType = [keyof PixivnLabelIds] extends [never] ? string : keyof PixivnLabelIds;
10
42
 
11
43
  interface DialogueInterface {
12
44
  /**
@@ -73,4 +105,4 @@ interface HistoryStep {
73
105
  openedLabels?: OpenedLabel[];
74
106
  }
75
107
 
76
- export type { DialogueInterface as D, HistoryStep as H, LabelIdType as L };
108
+ export type { DialogueInterface as D, HistoryStep as H, LabelIdType as L, PixivnLabelIds as P };
@@ -3,10 +3,42 @@ import { StoredChoiceInterface, StorageElementType, OpenedLabel } from '@drincs/
3
3
  import { CharacterInterface } from '@drincs/pixi-vn';
4
4
 
5
5
  /**
6
- * is a string containing the name of the label.
7
- * It is used to {@link narration.registeredLabels} to get the label class.
6
+ * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/narration'`
7
+ * to constrain the set of valid label IDs to a known union of string literals.
8
+ *
9
+ * When this interface has no keys (the default), {@link LabelIdType} resolves to `string`,
10
+ * preserving full backwards compatibility. Once you augment it, {@link LabelIdType} becomes
11
+ * the union of the declared keys and the compiler will reject any unknown label ID.
12
+ *
13
+ * The augmentation is typically written into an auto-generated declaration file by the
14
+ * Vite plugin (see the `labelTypeFilePath` option of `vitePluginPixivn`), but it can
15
+ * also be written by hand.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // pixi-vn.gen.d.ts (auto-generated — do not edit manually)
20
+ * declare module "@drincs/pixi-vn/narration" {
21
+ * interface PixivnLabelIds {
22
+ * startLabel: never;
23
+ * menuLabel: never;
24
+ * }
25
+ * }
26
+ * export {};
27
+ * ```
8
28
  */
9
- type LabelIdType = string;
29
+ interface PixivnLabelIds {
30
+ }
31
+ /**
32
+ * The type used wherever a label ID is expected (e.g. `narration.call`, `narration.jump`,
33
+ * `newLabel`, choice options, …).
34
+ *
35
+ * - **Default** — resolves to `string` so that existing code that passes arbitrary strings
36
+ * continues to compile without any changes.
37
+ * - **Augmented** — when {@link PixivnLabelIds} has been extended via
38
+ * `declare module "@drincs/pixi-vn/narration"`, this type resolves to the union of the
39
+ * declared keys, giving you compile-time safety against typos and unknown label IDs.
40
+ */
41
+ type LabelIdType = [keyof PixivnLabelIds] extends [never] ? string : keyof PixivnLabelIds;
10
42
 
11
43
  interface DialogueInterface {
12
44
  /**
@@ -73,4 +105,4 @@ interface HistoryStep {
73
105
  openedLabels?: OpenedLabel[];
74
106
  }
75
107
 
76
- export type { DialogueInterface as D, HistoryStep as H, LabelIdType as L };
108
+ export type { DialogueInterface as D, HistoryStep as H, LabelIdType as L, PixivnLabelIds as P };
@@ -1,4 +1,4 @@
1
- import { L as LabelIdType } from './HistoryStep-DtOryKAZ.cjs';
1
+ import { L as LabelIdType } from './HistoryStep-G9dUn0Lf.cjs';
2
2
 
3
3
  interface OpenedLabel {
4
4
  label: LabelIdType;
@@ -1,4 +1,4 @@
1
- import { L as LabelIdType } from './HistoryStep-DtOryKAZ.js';
1
+ import { L as LabelIdType } from './HistoryStep-G9dUn0Lf.js';
2
2
 
3
3
  interface OpenedLabel {
4
4
  label: LabelIdType;
@@ -1,4 +1,4 @@
1
- import { Player, PlayerOptions, ToneAudioNode, Param, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
1
+ import { PlayerOptions, Player, ToneAudioNode, Param, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
2
2
 
3
3
  interface MediaInterface extends Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state"> {
4
4
  /**
@@ -433,4 +433,4 @@ interface SoundManagerInterface {
433
433
  restore(data: object): Promise<void>;
434
434
  }
435
435
 
436
- export type { AudioChannelInterface as A, ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, ExportedSoundPlay as a, MediaMemory as b, SoundManagerInterface as c, SoundOptions as d, SoundPlay as e, SoundPlayOptions as f, SoundPlayOptionsWithChannel as g };
436
+ export type { AudioChannelInterface as A, ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, SoundManagerInterface as a, MediaMemory as b, ExportedSoundPlay as c, SoundOptions as d, SoundPlay as e, SoundPlayOptions as f, SoundPlayOptionsWithChannel as g };
@@ -1,4 +1,4 @@
1
- import { Player, PlayerOptions, ToneAudioNode, Param, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
1
+ import { PlayerOptions, Player, ToneAudioNode, Param, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
2
2
 
3
3
  interface MediaInterface extends Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state"> {
4
4
  /**
@@ -433,4 +433,4 @@ interface SoundManagerInterface {
433
433
  restore(data: object): Promise<void>;
434
434
  }
435
435
 
436
- export type { AudioChannelInterface as A, ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, ExportedSoundPlay as a, MediaMemory as b, SoundManagerInterface as c, SoundOptions as d, SoundPlay as e, SoundPlayOptions as f, SoundPlayOptionsWithChannel as g };
436
+ export type { AudioChannelInterface as A, ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, SoundManagerInterface as a, MediaMemory as b, ExportedSoundPlay as c, SoundOptions as d, SoundPlay as e, SoundPlayOptions as f, SoundPlayOptionsWithChannel as g };
package/dist/canvas.d.cts CHANGED
@@ -3,8 +3,8 @@ import _drincs_pixi_vn_pixi_js__default, { Container as Container$1, ContainerCh
3
3
  export { TextureSourceLike, Ticker as TickerValue } from '@drincs/pixi-vn/pixi.js';
4
4
  import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
5
5
  import { Devtools } from '@pixi/devtools';
6
- import { g as TickerArgs, T as Ticker$1, b as CanvasBaseItemMemory, C as CanvasBaseItem, i as TickerInfo, j as TickersSequence, R as RepeatType, P as PauseType, c as CanvasGameState, d as ContainerChild$1, a as AdditionalPositionsExtensionProps, f as ListenerExtensionMemory, L as ListenerExtension, A as AdditionalPositionsExtension, O as OnEventsHandlers, e as ContainerMemory, h as TickerHistory } from './ContainerMemory-BjcfYRU7.cjs';
7
- export { k as addListenerHandler, l as analizePositionsExtensionProps } from './ContainerMemory-BjcfYRU7.cjs';
6
+ import { T as TickerArgs, a as Ticker$1, C as CanvasBaseItemMemory, b as CanvasBaseItem, c as TickerInfo, d as TickersSequence, R as RepeatType, P as PauseType, e as CanvasGameState, f as ContainerChild$1, A as AdditionalPositionsExtensionProps, L as ListenerExtensionMemory, g as ListenerExtension, h as AdditionalPositionsExtension, O as OnEventsHandlers, i as ContainerMemory, j as TickerHistory } from './ContainerMemory-D2HtgX7w.cjs';
7
+ export { k as addListenerHandler, l as analizePositionsExtensionProps } from './ContainerMemory-D2HtgX7w.cjs';
8
8
  export { AnimationOptions as MotionAnimationOptions } from 'motion';
9
9
  import { OnErrorHandler } from '@drincs/pixi-vn/core';
10
10
 
package/dist/canvas.d.ts CHANGED
@@ -3,8 +3,8 @@ import _drincs_pixi_vn_pixi_js__default, { Container as Container$1, ContainerCh
3
3
  export { TextureSourceLike, Ticker as TickerValue } from '@drincs/pixi-vn/pixi.js';
4
4
  import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
5
5
  import { Devtools } from '@pixi/devtools';
6
- import { g as TickerArgs, T as Ticker$1, b as CanvasBaseItemMemory, C as CanvasBaseItem, i as TickerInfo, j as TickersSequence, R as RepeatType, P as PauseType, c as CanvasGameState, d as ContainerChild$1, a as AdditionalPositionsExtensionProps, f as ListenerExtensionMemory, L as ListenerExtension, A as AdditionalPositionsExtension, O as OnEventsHandlers, e as ContainerMemory, h as TickerHistory } from './ContainerMemory-BjcfYRU7.js';
7
- export { k as addListenerHandler, l as analizePositionsExtensionProps } from './ContainerMemory-BjcfYRU7.js';
6
+ import { T as TickerArgs, a as Ticker$1, C as CanvasBaseItemMemory, b as CanvasBaseItem, c as TickerInfo, d as TickersSequence, R as RepeatType, P as PauseType, e as CanvasGameState, f as ContainerChild$1, A as AdditionalPositionsExtensionProps, L as ListenerExtensionMemory, g as ListenerExtension, h as AdditionalPositionsExtension, O as OnEventsHandlers, i as ContainerMemory, j as TickerHistory } from './ContainerMemory-D2HtgX7w.js';
7
+ export { k as addListenerHandler, l as analizePositionsExtensionProps } from './ContainerMemory-D2HtgX7w.js';
8
8
  export { AnimationOptions as MotionAnimationOptions } from 'motion';
9
9
  import { OnErrorHandler } from '@drincs/pixi-vn/core';
10
10
 
@@ -1 +1 @@
1
- 'use strict';var core=require('./core.cjs');var se=Object.defineProperty;var kt=c=>{throw TypeError(c)};var ae=(c,t,i)=>t in c?se(c,t,{enumerable:true,configurable:true,writable:true,value:i}):c[t]=i;var N=(c,t,i)=>ae(c,typeof t!="symbol"?t+"":t,i),Yt=(c,t,i)=>t.has(c)||kt("Cannot "+i);var e=(c,t,i)=>(Yt(c,t,"read from private field"),i?i.call(c):t.get(c)),_=(c,t,i)=>t.has(c)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,i),f=(c,t,i,r)=>(Yt(c,t,"write to private field"),t.set(c,i),i),h=(c,t,i)=>(Yt(c,t,"access private method"),i);var Mt=(c,t,i,r)=>({set _(a){f(c,t,a);},get _(){return e(c,t,r)}});var st="storage",ut="temp",Ft="flags",z={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(c,t,i,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(c,t,i,r):console.error(`[${i}] ${t}: ${c}`);},Ut=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Ut>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},Ut=class{constructor(){t();}signal=new Bt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let c=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{c&&(c=false,Qt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ne=c=>!qt.has(c);var at=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),Zt=c=>at(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(c){super(c),this.fill(0);}},et,St,le=(et=class{heap;length;static create(t){let i=Zt(t);if(!i)return [];f(et,St,true);let r=new et(t,i);return f(et,St,false),r}constructor(t,i){if(!e(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(et,St,false),et),Xt,Jt,j,P,k,ft,B,Et,Tt,X,R,J,x,v,g,V,Y,M,I,q,D,Q,Z,K,W,tt,ht,L,yt,n,Wt,gt,rt,Ct,H,ee,dt,bt,It,ot,nt,Ht,Vt,Lt,O,$t,Rt,lt,jt,At,te=(At=class{constructor(t){_(this,n);_(this,j);_(this,P);_(this,k);_(this,ft);_(this,B);_(this,Et);_(this,Tt);_(this,X);N(this,"ttl");N(this,"ttlResolution");N(this,"ttlAutopurge");N(this,"updateAgeOnGet");N(this,"updateAgeOnHas");N(this,"allowStale");N(this,"noDisposeOnSet");N(this,"noUpdateTTL");N(this,"maxEntrySize");N(this,"sizeCalculation");N(this,"noDeleteOnFetchRejection");N(this,"noDeleteOnStaleGet");N(this,"allowStaleOnFetchAbort");N(this,"allowStaleOnFetchRejection");N(this,"ignoreFetchAbort");_(this,R);_(this,J);_(this,x);_(this,v);_(this,g);_(this,V);_(this,Y);_(this,M);_(this,I);_(this,q);_(this,D);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,ht);_(this,L);_(this,yt);_(this,gt,()=>{});_(this,rt,()=>{});_(this,Ct,()=>{});_(this,H,()=>false);_(this,dt,t=>{});_(this,bt,(t,i,r)=>{});_(this,It,(t,i,r,a)=>{if(r||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});N(this,Xt,"LRUCache");let{max:i=0,ttl:r,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:u,dispose:S,onInsert:C,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:pt,perf:_t}=t;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??oe),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let mt=i?Zt(i):Array;if(!mt)throw new Error("invalid max value: "+i);if(f(this,j,i),f(this,P,E),this.maxEntrySize=b||e(this,P),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,P)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Tt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Et,p),f(this,ht,!!p),f(this,x,new Map),f(this,v,new Array(i).fill(void 0)),f(this,g,new Array(i).fill(void 0)),f(this,V,new mt(i)),f(this,Y,new mt(i)),f(this,M,0),f(this,I,0),f(this,q,le.create(i)),f(this,R,0),f(this,J,0),typeof S=="function"&&f(this,k,S),typeof C=="function"&&f(this,ft,C),typeof d=="function"?(f(this,B,d),f(this,D,[])):(f(this,B,void 0),f(this,D,void 0)),f(this,tt,!!e(this,k)),f(this,yt,!!e(this,ft)),f(this,L,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(e(this,P)!==0&&!at(e(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,n,ee).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=at(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,P)){let Pt="LRU_CACHE_UNBOUNDED";ne(Pt)&&(qt.add(Pt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,At));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,v),valList:e(t,g),next:e(t,V),prev:e(t,Y),get head(){return e(t,M)},get tail(){return e(t,I)},free:e(t,q),isBackgroundFetch:i=>{var r;return h(r=t,n,O).call(r,i)},backgroundFetch:(i,r,a,o)=>{var s;return h(s=t,n,Lt).call(s,i,r,a,o)},moveToTail:i=>{var r;return h(r=t,n,Rt).call(r,i)},indexes:i=>{var r;return h(r=t,n,ot).call(r,i)},rindexes:i=>{var r;return h(r=t,n,nt).call(r,i)},isStale:i=>{var r;return e(r=t,H).call(r,i)}}}get max(){return e(this,j)}get maxSize(){return e(this,P)}get calculatedSize(){return e(this,J)}get size(){return e(this,R)}get fetchMethod(){return e(this,Et)}get memoMethod(){return e(this,Tt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of h(this,n,ot).call(this))e(this,g)[t]!==void 0&&e(this,v)[t]!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield [e(this,v)[t],e(this,g)[t]]);}*rentries(){for(let t of h(this,n,nt).call(this))e(this,g)[t]!==void 0&&e(this,v)[t]!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield [e(this,v)[t],e(this,g)[t]]);}*keys(){for(let t of h(this,n,ot).call(this)){let i=e(this,v)[t];i!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield i);}}*rkeys(){for(let t of h(this,n,nt).call(this)){let i=e(this,v)[t];i!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield i);}}*values(){for(let t of h(this,n,ot).call(this))e(this,g)[t]!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of h(this,n,nt).call(this))e(this,g)[t]!==void 0&&!h(this,n,O).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,i={}){for(let r of h(this,n,ot).call(this)){let a=e(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o!==void 0&&t(o,e(this,v)[r],this))return this.get(e(this,v)[r],i)}}forEach(t,i=this){for(let r of h(this,n,ot).call(this)){let a=e(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&t.call(i,o,e(this,v)[r],this);}}rforEach(t,i=this){for(let r of h(this,n,nt).call(this)){let a=e(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&t.call(i,o,e(this,v)[r],this);}}purgeStale(){let t=false;for(let i of h(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,i)&&(h(this,n,lt).call(this,e(this,v)[i],"expire"),t=true);return t}info(t){let i=e(this,x).get(t);if(i===void 0)return;let r=e(this,g)[i],a=h(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0)return;let o={value:a};if(e(this,K)&&e(this,Z)){let s=e(this,K)[i],l=e(this,Z)[i];if(s&&l){let u=s-(e(this,X).now()-l);o.ttl=u,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[i]),o}dump(){let t=[];for(let i of h(this,n,ot).call(this,{allowStale:true})){let r=e(this,v)[i],a=e(this,g)[i],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o===void 0||r===void 0)continue;let s={value:o};if(e(this,K)&&e(this,Z)){s.ttl=e(this,K)[i];let l=e(this,X).now()-e(this,Z)[i];s.start=Math.floor(Date.now()-l);}e(this,Q)&&(s.size=e(this,Q)[i]),t.unshift([r,s]);}return t}load(t){this.clear();for(let[i,r]of t){if(r.start){let a=Date.now()-r.start;r.start=e(this,X).now()-a;}this.set(i,r.value,r);}}set(t,i,r={}){var y,T,E,b;if(i===void 0)return this.delete(t),this;let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=r,{noUpdateTTL:S=this.noUpdateTTL}=r,C=e(this,It).call(this,t,i,r.size||0,l);if(this.maxEntrySize&&C>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,n,lt).call(this,t,"set"),this;let d=e(this,R)===0?void 0:e(this,x).get(t);if(d===void 0)d=e(this,R)===0?e(this,I):e(this,q).length!==0?e(this,q).pop():e(this,R)===e(this,j)?h(this,n,Vt).call(this,false):e(this,R),e(this,v)[d]=t,e(this,g)[d]=i,e(this,x).set(t,d),e(this,V)[e(this,I)]=d,e(this,Y)[d]=e(this,I),f(this,I,d),Mt(this,R)._++,e(this,bt).call(this,d,C,u),u&&(u.set="add"),S=false,e(this,yt)&&((y=e(this,ft))==null||y.call(this,i,t,"add"));else {h(this,n,Rt).call(this,d);let A=e(this,g)[d];if(i!==A){if(e(this,ht)&&h(this,n,O).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!s&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,L)&&e(this,D)?.push([p,t,"set"]));}else s||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,L)&&e(this,D)?.push([A,t,"set"]));if(e(this,dt).call(this,d),e(this,bt).call(this,d,C,u),e(this,g)[d]=i,u){u.set="replace";let p=A&&h(this,n,O).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");e(this,yt)&&this.onInsert?.(i,t,i===A?"update":"replace");}if(a!==0&&!e(this,K)&&h(this,n,Wt).call(this),e(this,K)&&(S||e(this,Ct).call(this,d,a,o),u&&e(this,rt).call(this,u,d)),!s&&e(this,L)&&e(this,D)){let A=e(this,D),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,g)[e(this,M)];if(h(this,n,Vt).call(this,!0),h(this,n,O).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,L)&&e(this,D)){let i=e(this,D),r;for(;r=i?.shift();)(t=e(this,B))==null||t.call(this,...r);}}}has(t,i={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:a}=i,o=e(this,x).get(t);if(o!==void 0){let s=e(this,g)[o];if(h(this,n,O).call(this,s)&&s.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))a&&(a.has="stale",e(this,rt).call(this,a,o));else return r&&e(this,gt).call(this,o),a&&(a.has="hit",e(this,rt).call(this,a,o)),true}else a&&(a.has="miss");return false}peek(t,i={}){let{allowStale:r=this.allowStale}=i,a=e(this,x).get(t);if(a===void 0||!r&&e(this,H).call(this,a))return;let o=e(this,g)[a];return h(this,n,O).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:C=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:F}=i;if(!e(this,ht))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,status:p});let U={allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:S,noUpdateTTL:C,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:F},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=h(this,n,Lt).call(this,t,G,U,b);return w.__returned=w}else {let w=e(this,g)[G];if(h(this,n,O).call(this,w)){let mt=r&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",mt&&(p.returnedStale=true)),mt?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),h(this,n,Rt).call(this,G),a&&e(this,gt).call(this,G),p&&e(this,rt).call(this,p,G),w;let pt=h(this,n,Lt).call(this,t,G,U,b),_t=pt.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",_t&&xt&&(p.returnedStale=true)),_t?pt.__staleWhileFetching:pt.__returned=pt}}async forceFetch(t,i={}){let r=await this.fetch(t,i);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,i={}){let r=e(this,Tt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:o,...s}=i,l=this.get(t,s);if(!o&&l!==void 0)return l;let u=r(t,l,{options:s,context:a});return this.set(t,u,s),u}get(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=i,l=e(this,x).get(t);if(l!==void 0){let u=e(this,g)[l],S=h(this,n,O).call(this,u);return s&&e(this,rt).call(this,s,l),e(this,H).call(this,l)?(s&&(s.get="stale"),S?(s&&r&&u.__staleWhileFetching!==void 0&&(s.returnedStale=true),r?u.__staleWhileFetching:void 0):(o||h(this,n,lt).call(this,t,"expire"),s&&r&&(s.returnedStale=true),r?u:void 0)):(s&&(s.get="hit"),S?u.__staleWhileFetching:(h(this,n,Rt).call(this,l),a&&e(this,gt).call(this,l),u))}else s&&(s.get="miss");}delete(t){return h(this,n,lt).call(this,t,"delete")}clear(){return h(this,n,jt).call(this,"delete")}},j=new WeakMap,P=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Et=new WeakMap,Tt=new WeakMap,X=new WeakMap,R=new WeakMap,J=new WeakMap,x=new WeakMap,v=new WeakMap,g=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,I=new WeakMap,q=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,ht=new WeakMap,L=new WeakMap,yt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Gt(e(this,j)),i=new Gt(e(this,j));f(this,K,t),f(this,Z,i);let r=this.ttlAutopurge?new Array(e(this,j)):void 0;f(this,W,r),f(this,Ct,(l,u,S=e(this,X).now())=>{i[l]=u!==0?S:0,t[l]=u,a(l,u);}),f(this,gt,l=>{i[l]=t[l]!==0?e(this,X).now():0,a(l,t[l]);});let a=this.ttlAutopurge?(l,u)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),u&&u!==0&&r){let S=setTimeout(()=>{e(this,H).call(this,l)&&h(this,n,lt).call(this,e(this,v)[l],"expire");},u+1);S.unref&&S.unref(),r[l]=S;}}:()=>{};f(this,rt,(l,u)=>{if(t[u]){let S=t[u],C=i[u];if(!S||!C)return;l.ttl=S,l.start=C,l.now=o||s();let d=l.now-C;l.remainingTTL=S-d;}});let o=0,s=()=>{let l=e(this,X).now();if(this.ttlResolution>0){o=l;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=e(this,x).get(l);if(u===void 0)return 0;let S=t[u],C=i[u];if(!S||!C)return 1/0;let d=(o||s())-C;return S-d},f(this,H,l=>{let u=i[l],S=t[l];return !!S&&!!u&&(o||s())-u>S});},gt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,ee=function(){let t=new Gt(e(this,j));f(this,J,0),f(this,Q,t),f(this,dt,i=>{f(this,J,e(this,J)-t[i]),t[i]=0;}),f(this,It,(i,r,a,o)=>{if(h(this,n,O).call(this,r))return 0;if(!at(a))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(a=o(r,i),!at(a))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return a}),f(this,bt,(i,r,a)=>{if(t[i]=r,e(this,P)){let o=e(this,P)-t[i];for(;e(this,J)>o;)h(this,n,Vt).call(this,true);}f(this,J,e(this,J)+t[i]),a&&(a.entrySize=r,a.totalCalculatedSize=e(this,J));});},dt=new WeakMap,bt=new WeakMap,It=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,I);!(!h(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,M)));)i=e(this,Y)[i];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,M);!(!h(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,I)));)i=e(this,V)[i];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,v)[t])===t},Vt=function(t){var o;let i=e(this,M),r=e(this,v)[i],a=e(this,g)[i];return e(this,ht)&&h(this,n,O).call(this,a)?a.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,a,r,"evict")),e(this,L)&&e(this,D)?.push([a,r,"evict"])),e(this,dt).call(this,i),e(this,W)?.[i]&&(clearTimeout(e(this,W)[i]),e(this,W)[i]=void 0),t&&(e(this,v)[i]=void 0,e(this,g)[i]=void 0,e(this,q).push(i)),e(this,R)===1?(f(this,M,f(this,I,0)),e(this,q).length=0):f(this,M,e(this,V)[i]),e(this,x).delete(r),Mt(this,R)._--,i},Lt=function(t,i,r,a){let o=i===void 0?void 0:e(this,g)[i];if(h(this,n,O).call(this,o))return o;let s=new Ut,{signal:l}=r;l?.addEventListener("abort",()=>s.abort(l.reason),{signal:s.signal});let u={signal:s.signal,options:r,context:a},S=(b,A=false)=>{let{aborted:p}=s.signal,F=r.ignoreFetchAbort&&b!==void 0,U=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&b!==void 0);if(r.status&&(p&&!A?(r.status.fetchAborted=true,r.status.fetchError=s.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!A)return d(s.signal.reason,U);let G=T,w=e(this,g)[i];return (w===T||F&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,g)[i]=G.__staleWhileFetching:h(this,n,lt).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,b,u.options))),b},C=b=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=b),d(b,false)),d=(b,A)=>{let{aborted:p}=s.signal,F=p&&r.allowStaleOnFetchAbort,U=F||r.allowStaleOnFetchRejection,G=U||r.noDeleteOnFetchRejection,w=T;if(e(this,g)[i]===T&&(!G||!A&&w.__staleWhileFetching===void 0?h(this,n,lt).call(this,t,"fetch"):F||(e(this,g)[i]=w.__staleWhileFetching)),U)return r.status&&w.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var F;let p=(F=e(this,Et))==null?void 0:F.call(this,t,o,u);p&&p instanceof Promise&&p.then(U=>b(U===void 0?void 0:U),A),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=U=>S(U,true)));});};r.status&&(r.status.fetchDispatched=true);let T=new Promise(y).then(S,C),E=Object.assign(T,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(t,E,{...u.options,status:void 0}),i=e(this,x).get(t)):e(this,g)[i]=E,E},O=function(t){if(!e(this,ht))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ut},$t=function(t,i){e(this,Y)[i]=t,e(this,V)[t]=i;},Rt=function(t){t!==e(this,I)&&(t===e(this,M)?f(this,M,e(this,V)[t]):h(this,n,$t).call(this,e(this,Y)[t],e(this,V)[t]),h(this,n,$t).call(this,e(this,I),t),f(this,I,t));},lt=function(t,i){var a,o;let r=false;if(e(this,R)!==0){let s=e(this,x).get(t);if(s!==void 0)if(e(this,W)?.[s]&&(clearTimeout(e(this,W)?.[s]),e(this,W)[s]=void 0),r=true,e(this,R)===1)h(this,n,jt).call(this,i);else {e(this,dt).call(this,s);let l=e(this,g)[s];if(h(this,n,O).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((a=e(this,k))==null||a.call(this,l,t,i)),e(this,L)&&e(this,D)?.push([l,t,i])),e(this,x).delete(t),e(this,v)[s]=void 0,e(this,g)[s]=void 0,s===e(this,I))f(this,I,e(this,Y)[s]);else if(s===e(this,M))f(this,M,e(this,V)[s]);else {let u=e(this,Y)[s];e(this,V)[u]=e(this,V)[s];let S=e(this,V)[s];e(this,Y)[S]=e(this,Y)[s];}Mt(this,R)._--,e(this,q).push(s);}}if(e(this,L)&&e(this,D)?.length){let s=e(this,D),l;for(;l=s?.shift();)(o=e(this,B))==null||o.call(this,...l);}return r},jt=function(t){var i,r;for(let a of h(this,n,nt).call(this,{allowStale:true})){let o=e(this,g)[a];if(h(this,n,O).call(this,o))o.__abortController.abort(new Error("deleted"));else {let s=e(this,v)[a];e(this,tt)&&((i=e(this,k))==null||i.call(this,o,s,t)),e(this,L)&&e(this,D)?.push([o,s,t]);}}if(e(this,x).clear(),e(this,g).fill(void 0),e(this,v).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let a of e(this,W)??[])a!==void 0&&clearTimeout(a);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),f(this,M,0),f(this,I,0),e(this,q).length=0,f(this,J,0),f(this,R,0),e(this,L)&&e(this,D)){let a=e(this,D),o;for(;o=a?.shift();)(r=e(this,B))==null||r.call(this,...o);}},At);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var it;(a=>(a.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),a.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),a.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),a.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(it||={});function Dt(c){try{if(typeof c>"u")return c;let t=JSON.stringify(c);return JSON.parse(t)}catch(t){throw it.error("Error creating exportable element",c,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ie;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let r;function a(y){d.tempStorageDeadlines.forEach((T,E)=>{T>y&&(d.storage.delete(`${ut}:${E}`),r?.onClearOldTempVariable?.(E),d.tempStorageDeadlines.delete(E));});}d.clearOldTempVariables=a;function o(y){r=y;}d.setExternalStoreHandler=o;function s(y,T,E){E==null?d.storage.delete(`${y}:${T}`):d.storage.set(`${y}:${T}`,E),r?.onSetVariable?.(T,E);}d.setVariable=s;function l(y,T){let E=d.storage.get(`${y}:${T}`);return Dt(E)}d.getVariable=l;function u(y,T){d.storage.delete(`${y}:${T}`),r?.onRemoveVariable?.(T);}d.removeVariable=u;function S(y,T){let E=d.storage.get(Ft)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}d.storage.set(Ft,E);}d.setFlag=S;function C(y){return (d.storage.get(Ft)||[]).includes(y)}d.getFlag=C;})(ie||={});var m=ie;var Ot=class{constructor(t,i){this.categoryId=t,this.id=i,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let i=m.getVariable(st,t);i&&(Object.entries(i).forEach(([r,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([o,s])=>{m.setVariable(this.categoryId,`${r}:${o}`,s);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,i){m.setVariable(this.categoryId,`${this.id}:${t}`,i);}getStorageProperty(t,i=this.id){return m.getVariable(this.categoryId,`${i}:${t}`)}};var ue="@",vt=class extends Ot{sourceId;constructor(t,i=""){super(z.CHARACTER_CATEGORY_KEY,t+(i?ue+i:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let i=super.getStorageProperty(t);return i===void 0&&(i=super.getStorageProperty(t,this.sourceId)),i}};var zt=class extends vt{constructor(t,i){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=i.name,this.defaultSurname=i.surname,this.defaultAge=i.age,this.icon=i.icon,this.color=i.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var wt=new ct({cacheSize:10}),re;(o=>{function c(s){try{let l=wt.get(s);if(!l){it.warn(`Character "${s}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){it.error(`Error while getting Character "${s}"`,l);return}}o.get=c;function t(s){if(Array.isArray(s)){s.forEach(l=>{t(l);});return}wt.get(s.id)&&it.info(`Character id "${s.id}" already exists, it will be overwritten`),wt.set(s.id,s);}o.add=t;function i(){return Array.from(wt.values())}o.values=i;function r(s){return wt.has(s)}o.has=r;function a(){return Array.from(wt.keys())}o.keys=a;})(re||={});var fe=re;exports.CharacterBaseModel=zt;exports.CharacterStoredClass=vt;exports.RegisteredCharacters=fe;
1
+ 'use strict';var core=require('./core.cjs');var se=Object.defineProperty;var kt=c=>{throw TypeError(c)};var ae=(c,t,i)=>t in c?se(c,t,{enumerable:true,configurable:true,writable:true,value:i}):c[t]=i;var N=(c,t,i)=>ae(c,typeof t!="symbol"?t+"":t,i),Yt=(c,t,i)=>t.has(c)||kt("Cannot "+i);var e=(c,t,i)=>(Yt(c,t,"read from private field"),i?i.call(c):t.get(c)),_=(c,t,i)=>t.has(c)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,i),f=(c,t,i,r)=>(Yt(c,t,"write to private field"),t.set(c,i),i),l=(c,t,i)=>(Yt(c,t,"access private method"),i);var Mt=(c,t,i,r)=>({set _(a){f(c,t,a);},get _(){return e(c,t,r)}});var st="storage",ut="temp",Ft="flags",U={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(c,t,i,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(c,t,i,r):console.error(`[${i}] ${t}: ${c}`);},Pt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Pt>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},Pt=class{constructor(){t();}signal=new Bt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let c=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{c&&(c=false,Qt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ne=c=>!qt.has(c);var at=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),Zt=c=>at(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(c){super(c),this.fill(0);}},et,St,he=(et=class{heap;length;static create(t){let i=Zt(t);if(!i)return [];f(et,St,true);let r=new et(t,i);return f(et,St,false),r}constructor(t,i){if(!e(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(et,St,false),et),Xt,Jt,j,z,k,ft,B,Et,Tt,X,R,J,x,O,d,V,Y,M,I,q,D,Q,Z,K,W,tt,lt,L,yt,n,Wt,dt,rt,Ct,H,ee,gt,bt,It,ot,nt,Ht,Vt,Lt,v,$t,Rt,ht,jt,At,te=(At=class{constructor(t){_(this,n);_(this,j);_(this,z);_(this,k);_(this,ft);_(this,B);_(this,Et);_(this,Tt);_(this,X);N(this,"ttl");N(this,"ttlResolution");N(this,"ttlAutopurge");N(this,"updateAgeOnGet");N(this,"updateAgeOnHas");N(this,"allowStale");N(this,"noDisposeOnSet");N(this,"noUpdateTTL");N(this,"maxEntrySize");N(this,"sizeCalculation");N(this,"noDeleteOnFetchRejection");N(this,"noDeleteOnStaleGet");N(this,"allowStaleOnFetchAbort");N(this,"allowStaleOnFetchRejection");N(this,"ignoreFetchAbort");_(this,R);_(this,J);_(this,x);_(this,O);_(this,d);_(this,V);_(this,Y);_(this,M);_(this,I);_(this,q);_(this,D);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,lt);_(this,L);_(this,yt);_(this,dt,()=>{});_(this,rt,()=>{});_(this,Ct,()=>{});_(this,H,()=>false);_(this,gt,t=>{});_(this,bt,(t,i,r)=>{});_(this,It,(t,i,r,a)=>{if(r||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});N(this,Xt,"LRUCache");let{max:i=0,ttl:r,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:h,allowStale:u,dispose:S,onInsert:C,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:pt,perf:_t}=t;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??oe),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let mt=i?Zt(i):Array;if(!mt)throw new Error("invalid max value: "+i);if(f(this,j,i),f(this,z,E),this.maxEntrySize=b||e(this,z),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Tt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Et,p),f(this,lt,!!p),f(this,x,new Map),f(this,O,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,V,new mt(i)),f(this,Y,new mt(i)),f(this,M,0),f(this,I,0),f(this,q,he.create(i)),f(this,R,0),f(this,J,0),typeof S=="function"&&f(this,k,S),typeof C=="function"&&f(this,ft,C),typeof g=="function"?(f(this,B,g),f(this,D,[])):(f(this,B,void 0),f(this,D,void 0)),f(this,tt,!!e(this,k)),f(this,yt,!!e(this,ft)),f(this,L,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(e(this,z)!==0&&!at(e(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,ee).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!h,this.ttlResolution=at(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,z)){let zt="LRU_CACHE_UNBOUNDED";ne(zt)&&(qt.add(zt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",zt,At));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,O),valList:e(t,d),next:e(t,V),prev:e(t,Y),get head(){return e(t,M)},get tail(){return e(t,I)},free:e(t,q),isBackgroundFetch:i=>{var r;return l(r=t,n,v).call(r,i)},backgroundFetch:(i,r,a,o)=>{var s;return l(s=t,n,Lt).call(s,i,r,a,o)},moveToTail:i=>{var r;return l(r=t,n,Rt).call(r,i)},indexes:i=>{var r;return l(r=t,n,ot).call(r,i)},rindexes:i=>{var r;return l(r=t,n,nt).call(r,i)},isStale:i=>{var r;return e(r=t,H).call(r,i)}}}get max(){return e(this,j)}get maxSize(){return e(this,z)}get calculatedSize(){return e(this,J)}get size(){return e(this,R)}get fetchMethod(){return e(this,Et)}get memoMethod(){return e(this,Tt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of l(this,n,ot).call(this))e(this,d)[t]!==void 0&&e(this,O)[t]!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield [e(this,O)[t],e(this,d)[t]]);}*rentries(){for(let t of l(this,n,nt).call(this))e(this,d)[t]!==void 0&&e(this,O)[t]!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield [e(this,O)[t],e(this,d)[t]]);}*keys(){for(let t of l(this,n,ot).call(this)){let i=e(this,O)[t];i!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield i);}}*rkeys(){for(let t of l(this,n,nt).call(this)){let i=e(this,O)[t];i!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield i);}}*values(){for(let t of l(this,n,ot).call(this))e(this,d)[t]!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}*rvalues(){for(let t of l(this,n,nt).call(this))e(this,d)[t]!==void 0&&!l(this,n,v).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,i={}){for(let r of l(this,n,ot).call(this)){let a=e(this,d)[r],o=l(this,n,v).call(this,a)?a.__staleWhileFetching:a;if(o!==void 0&&t(o,e(this,O)[r],this))return this.get(e(this,O)[r],i)}}forEach(t,i=this){for(let r of l(this,n,ot).call(this)){let a=e(this,d)[r],o=l(this,n,v).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&t.call(i,o,e(this,O)[r],this);}}rforEach(t,i=this){for(let r of l(this,n,nt).call(this)){let a=e(this,d)[r],o=l(this,n,v).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&t.call(i,o,e(this,O)[r],this);}}purgeStale(){let t=false;for(let i of l(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,i)&&(l(this,n,ht).call(this,e(this,O)[i],"expire"),t=true);return t}info(t){let i=e(this,x).get(t);if(i===void 0)return;let r=e(this,d)[i],a=l(this,n,v).call(this,r)?r.__staleWhileFetching:r;if(a===void 0)return;let o={value:a};if(e(this,K)&&e(this,Z)){let s=e(this,K)[i],h=e(this,Z)[i];if(s&&h){let u=s-(e(this,X).now()-h);o.ttl=u,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[i]),o}dump(){let t=[];for(let i of l(this,n,ot).call(this,{allowStale:true})){let r=e(this,O)[i],a=e(this,d)[i],o=l(this,n,v).call(this,a)?a.__staleWhileFetching:a;if(o===void 0||r===void 0)continue;let s={value:o};if(e(this,K)&&e(this,Z)){s.ttl=e(this,K)[i];let h=e(this,X).now()-e(this,Z)[i];s.start=Math.floor(Date.now()-h);}e(this,Q)&&(s.size=e(this,Q)[i]),t.unshift([r,s]);}return t}load(t){this.clear();for(let[i,r]of t){if(r.start){let a=Date.now()-r.start;r.start=e(this,X).now()-a;}this.set(i,r.value,r);}}set(t,i,r={}){var y,T,E,b;if(i===void 0)return this.delete(t),this;let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:u}=r,{noUpdateTTL:S=this.noUpdateTTL}=r,C=e(this,It).call(this,t,i,r.size||0,h);if(this.maxEntrySize&&C>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),l(this,n,ht).call(this,t,"set"),this;let g=e(this,R)===0?void 0:e(this,x).get(t);if(g===void 0)g=e(this,R)===0?e(this,I):e(this,q).length!==0?e(this,q).pop():e(this,R)===e(this,j)?l(this,n,Vt).call(this,false):e(this,R),e(this,O)[g]=t,e(this,d)[g]=i,e(this,x).set(t,g),e(this,V)[e(this,I)]=g,e(this,Y)[g]=e(this,I),f(this,I,g),Mt(this,R)._++,e(this,bt).call(this,g,C,u),u&&(u.set="add"),S=false,e(this,yt)&&((y=e(this,ft))==null||y.call(this,i,t,"add"));else {l(this,n,Rt).call(this,g);let A=e(this,d)[g];if(i!==A){if(e(this,lt)&&l(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!s&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,L)&&e(this,D)?.push([p,t,"set"]));}else s||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,L)&&e(this,D)?.push([A,t,"set"]));if(e(this,gt).call(this,g),e(this,bt).call(this,g,C,u),e(this,d)[g]=i,u){u.set="replace";let p=A&&l(this,n,v).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");e(this,yt)&&this.onInsert?.(i,t,i===A?"update":"replace");}if(a!==0&&!e(this,K)&&l(this,n,Wt).call(this),e(this,K)&&(S||e(this,Ct).call(this,g,a,o),u&&e(this,rt).call(this,u,g)),!s&&e(this,L)&&e(this,D)){let A=e(this,D),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,d)[e(this,M)];if(l(this,n,Vt).call(this,!0),l(this,n,v).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,L)&&e(this,D)){let i=e(this,D),r;for(;r=i?.shift();)(t=e(this,B))==null||t.call(this,...r);}}}has(t,i={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:a}=i,o=e(this,x).get(t);if(o!==void 0){let s=e(this,d)[o];if(l(this,n,v).call(this,s)&&s.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))a&&(a.has="stale",e(this,rt).call(this,a,o));else return r&&e(this,dt).call(this,o),a&&(a.has="hit",e(this,rt).call(this,a,o)),true}else a&&(a.has="miss");return false}peek(t,i={}){let{allowStale:r=this.allowStale}=i,a=e(this,x).get(t);if(a===void 0||!r&&e(this,H).call(this,a))return;let o=e(this,d)[a];return l(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:u=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:C=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:F}=i;if(!e(this,lt))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,status:p});let P={allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:h,size:u,sizeCalculation:S,noUpdateTTL:C,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:F},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=l(this,n,Lt).call(this,t,G,P,b);return w.__returned=w}else {let w=e(this,d)[G];if(l(this,n,v).call(this,w)){let mt=r&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",mt&&(p.returnedStale=true)),mt?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),l(this,n,Rt).call(this,G),a&&e(this,dt).call(this,G),p&&e(this,rt).call(this,p,G),w;let pt=l(this,n,Lt).call(this,t,G,P,b),_t=pt.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",_t&&xt&&(p.returnedStale=true)),_t?pt.__staleWhileFetching:pt.__returned=pt}}async forceFetch(t,i={}){let r=await this.fetch(t,i);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,i={}){let r=e(this,Tt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:o,...s}=i,h=this.get(t,s);if(!o&&h!==void 0)return h;let u=r(t,h,{options:s,context:a});return this.set(t,u,s),u}get(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=i,h=e(this,x).get(t);if(h!==void 0){let u=e(this,d)[h],S=l(this,n,v).call(this,u);return s&&e(this,rt).call(this,s,h),e(this,H).call(this,h)?(s&&(s.get="stale"),S?(s&&r&&u.__staleWhileFetching!==void 0&&(s.returnedStale=true),r?u.__staleWhileFetching:void 0):(o||l(this,n,ht).call(this,t,"expire"),s&&r&&(s.returnedStale=true),r?u:void 0)):(s&&(s.get="hit"),S?u.__staleWhileFetching:(l(this,n,Rt).call(this,h),a&&e(this,dt).call(this,h),u))}else s&&(s.get="miss");}delete(t){return l(this,n,ht).call(this,t,"delete")}clear(){return l(this,n,jt).call(this,"delete")}},j=new WeakMap,z=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Et=new WeakMap,Tt=new WeakMap,X=new WeakMap,R=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,d=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,I=new WeakMap,q=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,yt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Gt(e(this,j)),i=new Gt(e(this,j));f(this,K,t),f(this,Z,i);let r=this.ttlAutopurge?new Array(e(this,j)):void 0;f(this,W,r),f(this,Ct,(h,u,S=e(this,X).now())=>{i[h]=u!==0?S:0,t[h]=u,a(h,u);}),f(this,dt,h=>{i[h]=t[h]!==0?e(this,X).now():0,a(h,t[h]);});let a=this.ttlAutopurge?(h,u)=>{if(r?.[h]&&(clearTimeout(r[h]),r[h]=void 0),u&&u!==0&&r){let S=setTimeout(()=>{e(this,H).call(this,h)&&l(this,n,ht).call(this,e(this,O)[h],"expire");},u+1);S.unref&&S.unref(),r[h]=S;}}:()=>{};f(this,rt,(h,u)=>{if(t[u]){let S=t[u],C=i[u];if(!S||!C)return;h.ttl=S,h.start=C,h.now=o||s();let g=h.now-C;h.remainingTTL=S-g;}});let o=0,s=()=>{let h=e(this,X).now();if(this.ttlResolution>0){o=h;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return h};this.getRemainingTTL=h=>{let u=e(this,x).get(h);if(u===void 0)return 0;let S=t[u],C=i[u];if(!S||!C)return 1/0;let g=(o||s())-C;return S-g},f(this,H,h=>{let u=i[h],S=t[h];return !!S&&!!u&&(o||s())-u>S});},dt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,ee=function(){let t=new Gt(e(this,j));f(this,J,0),f(this,Q,t),f(this,gt,i=>{f(this,J,e(this,J)-t[i]),t[i]=0;}),f(this,It,(i,r,a,o)=>{if(l(this,n,v).call(this,r))return 0;if(!at(a))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(a=o(r,i),!at(a))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return a}),f(this,bt,(i,r,a)=>{if(t[i]=r,e(this,z)){let o=e(this,z)-t[i];for(;e(this,J)>o;)l(this,n,Vt).call(this,true);}f(this,J,e(this,J)+t[i]),a&&(a.entrySize=r,a.totalCalculatedSize=e(this,J));});},gt=new WeakMap,bt=new WeakMap,It=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,I);!(!l(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,M)));)i=e(this,Y)[i];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,M);!(!l(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,I)));)i=e(this,V)[i];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,O)[t])===t},Vt=function(t){var o;let i=e(this,M),r=e(this,O)[i],a=e(this,d)[i];return e(this,lt)&&l(this,n,v).call(this,a)?a.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,a,r,"evict")),e(this,L)&&e(this,D)?.push([a,r,"evict"])),e(this,gt).call(this,i),e(this,W)?.[i]&&(clearTimeout(e(this,W)[i]),e(this,W)[i]=void 0),t&&(e(this,O)[i]=void 0,e(this,d)[i]=void 0,e(this,q).push(i)),e(this,R)===1?(f(this,M,f(this,I,0)),e(this,q).length=0):f(this,M,e(this,V)[i]),e(this,x).delete(r),Mt(this,R)._--,i},Lt=function(t,i,r,a){let o=i===void 0?void 0:e(this,d)[i];if(l(this,n,v).call(this,o))return o;let s=new Pt,{signal:h}=r;h?.addEventListener("abort",()=>s.abort(h.reason),{signal:s.signal});let u={signal:s.signal,options:r,context:a},S=(b,A=false)=>{let{aborted:p}=s.signal,F=r.ignoreFetchAbort&&b!==void 0,P=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&b!==void 0);if(r.status&&(p&&!A?(r.status.fetchAborted=true,r.status.fetchError=s.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!A)return g(s.signal.reason,P);let G=T,w=e(this,d)[i];return (w===T||F&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,d)[i]=G.__staleWhileFetching:l(this,n,ht).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,b,u.options))),b},C=b=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=b),g(b,false)),g=(b,A)=>{let{aborted:p}=s.signal,F=p&&r.allowStaleOnFetchAbort,P=F||r.allowStaleOnFetchRejection,G=P||r.noDeleteOnFetchRejection,w=T;if(e(this,d)[i]===T&&(!G||!A&&w.__staleWhileFetching===void 0?l(this,n,ht).call(this,t,"fetch"):F||(e(this,d)[i]=w.__staleWhileFetching)),P)return r.status&&w.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var F;let p=(F=e(this,Et))==null?void 0:F.call(this,t,o,u);p&&p instanceof Promise&&p.then(P=>b(P===void 0?void 0:P),A),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=P=>S(P,true)));});};r.status&&(r.status.fetchDispatched=true);let T=new Promise(y).then(S,C),E=Object.assign(T,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(t,E,{...u.options,status:void 0}),i=e(this,x).get(t)):e(this,d)[i]=E,E},v=function(t){if(!e(this,lt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Pt},$t=function(t,i){e(this,Y)[i]=t,e(this,V)[t]=i;},Rt=function(t){t!==e(this,I)&&(t===e(this,M)?f(this,M,e(this,V)[t]):l(this,n,$t).call(this,e(this,Y)[t],e(this,V)[t]),l(this,n,$t).call(this,e(this,I),t),f(this,I,t));},ht=function(t,i){var a,o;let r=false;if(e(this,R)!==0){let s=e(this,x).get(t);if(s!==void 0)if(e(this,W)?.[s]&&(clearTimeout(e(this,W)?.[s]),e(this,W)[s]=void 0),r=true,e(this,R)===1)l(this,n,jt).call(this,i);else {e(this,gt).call(this,s);let h=e(this,d)[s];if(l(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((a=e(this,k))==null||a.call(this,h,t,i)),e(this,L)&&e(this,D)?.push([h,t,i])),e(this,x).delete(t),e(this,O)[s]=void 0,e(this,d)[s]=void 0,s===e(this,I))f(this,I,e(this,Y)[s]);else if(s===e(this,M))f(this,M,e(this,V)[s]);else {let u=e(this,Y)[s];e(this,V)[u]=e(this,V)[s];let S=e(this,V)[s];e(this,Y)[S]=e(this,Y)[s];}Mt(this,R)._--,e(this,q).push(s);}}if(e(this,L)&&e(this,D)?.length){let s=e(this,D),h;for(;h=s?.shift();)(o=e(this,B))==null||o.call(this,...h);}return r},jt=function(t){var i,r;for(let a of l(this,n,nt).call(this,{allowStale:true})){let o=e(this,d)[a];if(l(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let s=e(this,O)[a];e(this,tt)&&((i=e(this,k))==null||i.call(this,o,s,t)),e(this,L)&&e(this,D)?.push([o,s,t]);}}if(e(this,x).clear(),e(this,d).fill(void 0),e(this,O).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let a of e(this,W)??[])a!==void 0&&clearTimeout(a);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),f(this,M,0),f(this,I,0),e(this,q).length=0,f(this,J,0),f(this,R,0),e(this,L)&&e(this,D)){let a=e(this,D),o;for(;o=a?.shift();)(r=e(this,B))==null||r.call(this,...o);}},At);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var it;(a=>(a.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),a.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),a.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),a.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(it||={});function Dt(c){try{if(typeof c>"u")return c;let t=JSON.stringify(c);return JSON.parse(t)}catch(t){throw it.error("Error creating exportable element",c,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ie;(g=>{g.storage=new ct({cacheSize:50}),g.defaultStorage=new ct({cacheSize:10}),g.tempStorageDeadlines=new Map;let r;function a(y){g.tempStorageDeadlines.forEach((T,E)=>{T>y&&(g.storage.delete(`${ut}:${E}`),r?.onClearOldTempVariable?.(E),g.tempStorageDeadlines.delete(E));});}g.clearOldTempVariables=a;function o(y){r=y;}g.setExternalStoreHandler=o;function s(y,T,E){E==null?g.storage.delete(`${y}:${T}`):g.storage.set(`${y}:${T}`,E),r?.onSetVariable?.(T,E);}g.setVariable=s;function h(y,T){let E=g.storage.get(`${y}:${T}`);return Dt(E)}g.getVariable=h;function u(y,T){g.storage.delete(`${y}:${T}`),r?.onRemoveVariable?.(T);}g.removeVariable=u;function S(y,T){let E=g.storage.get(Ft)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}g.storage.set(Ft,E);}g.setFlag=S;function C(y){return (g.storage.get(Ft)||[]).includes(y)}g.getFlag=C;})(ie||={});var m=ie;var vt=class{constructor(t,i){this.categoryId=t,this.id=i,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let i=m.getVariable(st,t);i&&(Object.entries(i).forEach(([r,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([o,s])=>{m.setVariable(this.categoryId,`${r}:${o}`,s);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,i){m.setVariable(this.categoryId,`${this.id}:${t}`,i);}getStorageProperty(t,i=this.id){return m.getVariable(this.categoryId,`${i}:${t}`)}};var ue="@",Ot=class extends vt{sourceId;constructor(t,i=""){super(U.CHARACTER_CATEGORY_KEY,t+(i?ue+i:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let i=super.getStorageProperty(t);return i===void 0&&(i=super.getStorageProperty(t,this.sourceId)),i}};var Ut=class extends Ot{constructor(t,i){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=i.name,this.defaultSurname=i.surname,this.defaultAge=i.age,this.icon=i.icon,this.color=i.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var wt=new ct({cacheSize:10}),re;(o=>{function c(s){try{let h=wt.get(s);if(!h){it.warn(`Character "${s}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return h}catch(h){it.error(`Error while getting Character "${s}"`,h);return}}o.get=c;function t(s){if(Array.isArray(s)){s.forEach(h=>{t(h);});return}wt.get(s.id)&&it.info(`Character id "${s.id}" already exists, it will be overwritten`),wt.set(s.id,s);}o.add=t;function i(){return Array.from(wt.values())}o.values=i;function r(s){return wt.has(s)}o.has=r;function a(){return Array.from(wt.keys())}o.keys=a;})(re||={});var fe=re;exports.CharacterBaseModel=Ut;exports.CharacterStoredClass=Ot;exports.RegisteredCharacters=fe;
@@ -34,11 +34,49 @@ interface CharacterBaseModelProps {
34
34
  color?: string;
35
35
  }
36
36
 
37
+ /**
38
+ * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/characters'`
39
+ * to constrain the set of valid character IDs to a known union of string literals.
40
+ *
41
+ * When this interface has no keys (the default), {@link CharacterIdType} resolves to `string`,
42
+ * preserving full backwards compatibility. Once you augment it, {@link CharacterIdType} becomes
43
+ * the union of the declared keys and the compiler will reject any unknown character ID.
44
+ *
45
+ * The augmentation is typically written into an auto-generated declaration file by the
46
+ * Vite plugin (see the `typeFilePath` option of `vitePluginPixivn`), but it can
47
+ * also be written by hand.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // pixi-vn.gen.d.ts (auto-generated — do not edit manually)
52
+ * declare module "@drincs/pixi-vn/characters" {
53
+ * interface PixivnCharacterIds {
54
+ * liam: never;
55
+ * emma: never;
56
+ * }
57
+ * }
58
+ * export {};
59
+ * ```
60
+ */
61
+ interface PixivnCharacterIds {
62
+ }
63
+ /**
64
+ * The type used wherever a character ID is expected (e.g. `RegisteredCharacters.get`,
65
+ * `RegisteredCharacters.has`, character constructors, …).
66
+ *
67
+ * - **Default** — resolves to `string` so that existing code that passes arbitrary strings
68
+ * continues to compile without any changes.
69
+ * - **Augmented** — when {@link PixivnCharacterIds} has been extended via
70
+ * `declare module "@drincs/pixi-vn/characters"`, this type resolves to the union of the
71
+ * declared keys, giving you compile-time safety against typos and unknown character IDs.
72
+ */
73
+ type CharacterIdType = [keyof PixivnCharacterIds] extends [never] ? string : keyof PixivnCharacterIds;
74
+
37
75
  /**
38
76
  * CharacterEmotionId is used to identify a character together with an emotion.
39
77
  */
40
78
  interface CharacterEmotionId {
41
- id: string;
79
+ id: CharacterIdType;
42
80
  emotion: string;
43
81
  }
44
82
 
@@ -116,7 +154,7 @@ declare namespace RegisteredCharacters {
116
154
  * const liam = RegisteredCharacters.get('liam');
117
155
  * ```
118
156
  */
119
- function get<T = CharacterInterface$1>(id: string): T | undefined;
157
+ function get<T = CharacterInterface$1, T2 extends CharacterIdType | string = CharacterIdType>(id: T2): T | undefined;
120
158
  /**
121
159
  * Is a function that saves the character. If the character already exists, it will be overwritten.
122
160
  * @param character is the character to save
@@ -146,9 +184,9 @@ declare namespace RegisteredCharacters {
146
184
  function has(id: string): boolean;
147
185
  /**
148
186
  * Get a list of all character ids registered.
149
- * @returns An array of label ids.
187
+ * @returns An array of character ids.
150
188
  */
151
- function keys(): string[];
189
+ function keys(): CharacterIdType[];
152
190
  }
153
191
 
154
192
  /**
@@ -213,4 +251,4 @@ interface CharacterInterface {
213
251
  id: string;
214
252
  }
215
253
 
216
- export { CharacterBaseModel, type CharacterEmotionId, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
254
+ export { CharacterBaseModel, type CharacterEmotionId, type CharacterIdType, type CharacterInterface, CharacterStoredClass, type PixivnCharacterIds, RegisteredCharacters };
@@ -34,11 +34,49 @@ interface CharacterBaseModelProps {
34
34
  color?: string;
35
35
  }
36
36
 
37
+ /**
38
+ * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/characters'`
39
+ * to constrain the set of valid character IDs to a known union of string literals.
40
+ *
41
+ * When this interface has no keys (the default), {@link CharacterIdType} resolves to `string`,
42
+ * preserving full backwards compatibility. Once you augment it, {@link CharacterIdType} becomes
43
+ * the union of the declared keys and the compiler will reject any unknown character ID.
44
+ *
45
+ * The augmentation is typically written into an auto-generated declaration file by the
46
+ * Vite plugin (see the `typeFilePath` option of `vitePluginPixivn`), but it can
47
+ * also be written by hand.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // pixi-vn.gen.d.ts (auto-generated — do not edit manually)
52
+ * declare module "@drincs/pixi-vn/characters" {
53
+ * interface PixivnCharacterIds {
54
+ * liam: never;
55
+ * emma: never;
56
+ * }
57
+ * }
58
+ * export {};
59
+ * ```
60
+ */
61
+ interface PixivnCharacterIds {
62
+ }
63
+ /**
64
+ * The type used wherever a character ID is expected (e.g. `RegisteredCharacters.get`,
65
+ * `RegisteredCharacters.has`, character constructors, …).
66
+ *
67
+ * - **Default** — resolves to `string` so that existing code that passes arbitrary strings
68
+ * continues to compile without any changes.
69
+ * - **Augmented** — when {@link PixivnCharacterIds} has been extended via
70
+ * `declare module "@drincs/pixi-vn/characters"`, this type resolves to the union of the
71
+ * declared keys, giving you compile-time safety against typos and unknown character IDs.
72
+ */
73
+ type CharacterIdType = [keyof PixivnCharacterIds] extends [never] ? string : keyof PixivnCharacterIds;
74
+
37
75
  /**
38
76
  * CharacterEmotionId is used to identify a character together with an emotion.
39
77
  */
40
78
  interface CharacterEmotionId {
41
- id: string;
79
+ id: CharacterIdType;
42
80
  emotion: string;
43
81
  }
44
82
 
@@ -116,7 +154,7 @@ declare namespace RegisteredCharacters {
116
154
  * const liam = RegisteredCharacters.get('liam');
117
155
  * ```
118
156
  */
119
- function get<T = CharacterInterface$1>(id: string): T | undefined;
157
+ function get<T = CharacterInterface$1, T2 extends CharacterIdType | string = CharacterIdType>(id: T2): T | undefined;
120
158
  /**
121
159
  * Is a function that saves the character. If the character already exists, it will be overwritten.
122
160
  * @param character is the character to save
@@ -146,9 +184,9 @@ declare namespace RegisteredCharacters {
146
184
  function has(id: string): boolean;
147
185
  /**
148
186
  * Get a list of all character ids registered.
149
- * @returns An array of label ids.
187
+ * @returns An array of character ids.
150
188
  */
151
- function keys(): string[];
189
+ function keys(): CharacterIdType[];
152
190
  }
153
191
 
154
192
  /**
@@ -213,4 +251,4 @@ interface CharacterInterface {
213
251
  id: string;
214
252
  }
215
253
 
216
- export { CharacterBaseModel, type CharacterEmotionId, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
254
+ export { CharacterBaseModel, type CharacterEmotionId, type CharacterIdType, type CharacterInterface, CharacterStoredClass, type PixivnCharacterIds, RegisteredCharacters };
@@ -1 +1 @@
1
- import {b}from'./chunk-GIYMPXBT.mjs';import {n as n$1}from'./chunk-IWAXXFXE.mjs';import {d,e}from'./chunk-HQQ5WH6C.mjs';var m="@",n=class extends b{sourceId;constructor(e,r=""){super(n$1.CHARACTER_CATEGORY_KEY,e+(r?m+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new d({cacheSize:10}),g;(y=>{function d(t){try{let a=o.get(t);if(!a){e.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return a}catch(a){e.error(`Error while getting Character "${t}"`,a);return}}y.get=d;function e$1(t){if(Array.isArray(t)){t.forEach(a=>{e$1(a);});return}o.get(t.id)&&e.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}y.add=e$1;function r(){return Array.from(o.values())}y.values=r;function l(t){return o.has(t)}y.has=l;function p(){return Array.from(o.keys())}y.keys=p;})(g||={});var h=g;export{i as CharacterBaseModel,n as CharacterStoredClass,h as RegisteredCharacters};
1
+ import {b}from'./chunk-GIYMPXBT.mjs';import {n as n$1}from'./chunk-IWAXXFXE.mjs';import {d,e}from'./chunk-HQQ5WH6C.mjs';var g="@",n=class extends b{sourceId;constructor(e,r=""){super(n$1.CHARACTER_CATEGORY_KEY,e+(r?g+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new d({cacheSize:10}),h;(y=>{function d(t){try{let a=o.get(t);if(!a){e.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return a}catch(a){e.error(`Error while getting Character "${t}"`,a);return}}y.get=d;function e$1(t){if(Array.isArray(t)){t.forEach(a=>{e$1(a);});return}o.get(t.id)&&e.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}y.add=e$1;function r(){return Array.from(o.values())}y.values=r;function m(t){return o.has(t)}y.has=m;function l(){return Array.from(o.keys())}y.keys=l;})(h||={});var p=h;export{i as CharacterBaseModel,n as CharacterStoredClass,p as RegisteredCharacters};
@@ -1,10 +1,10 @@
1
1
  import { HistoryInfo, GameStepState } from '@drincs/pixi-vn';
2
2
  import { Difference } from 'microdiff';
3
3
  import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
4
- import { H as HistoryStep } from './HistoryStep-DtOryKAZ.cjs';
5
- import { H as HistoryGameState } from './HistoryGameState-3ztYdv84.cjs';
4
+ import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.cjs';
5
+ import { H as HistoryGameState } from './HistoryGameState-C28NcKKl.cjs';
6
6
  import { S as StepLabelPropsType, a as StepLabelResultType } from './StepLabelType-CN97wZzm.cjs';
7
- import { N as NarrationHistory } from './HistoryChoiceMenuOption-CEmjDDJH.cjs';
7
+ import { N as NarrationHistory } from './HistoryChoiceMenuOption-BMsYentw.cjs';
8
8
  import 'lru-cache';
9
9
  import '@drincs/pixi-vn/canvas';
10
10
  import './StorageElementType-C7ETezlL.cjs';
package/dist/history.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { HistoryInfo, GameStepState } from '@drincs/pixi-vn';
2
2
  import { Difference } from 'microdiff';
3
3
  import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
4
- import { H as HistoryStep } from './HistoryStep-DtOryKAZ.js';
5
- import { H as HistoryGameState } from './HistoryGameState-D4t2fY9x.js';
4
+ import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.js';
5
+ import { H as HistoryGameState } from './HistoryGameState-CmjUtlkV.js';
6
6
  import { S as StepLabelPropsType, a as StepLabelResultType } from './StepLabelType-CN97wZzm.js';
7
- import { N as NarrationHistory } from './HistoryChoiceMenuOption-CN7NkcxU.js';
7
+ import { N as NarrationHistory } from './HistoryChoiceMenuOption-DQ-pnuPU.js';
8
8
  import 'lru-cache';
9
9
  import '@drincs/pixi-vn/canvas';
10
10
  import './StorageElementType-C7ETezlL.js';