@drincs/pixi-vn 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -34
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +2 -2
- package/dist/canvas.d.ts +2 -2
- package/dist/canvas.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +121 -1
- package/dist/index.d.ts +121 -1
- package/dist/index.mjs +2 -2
- package/dist/pixi/browser.js +163 -152
- package/dist/vite.cjs +4 -2
- package/dist/vite.d.cts +19 -0
- package/dist/vite.d.ts +19 -0
- package/dist/vite.mjs +4 -2
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -29,7 +29,7 @@ import 'microdiff';
|
|
|
29
29
|
import 'tone';
|
|
30
30
|
import './StorageElementType-C7ETezlL.cjs';
|
|
31
31
|
|
|
32
|
-
var version = "1.9.
|
|
32
|
+
var version = "1.9.1";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Is a special alias to indicate the game layer.
|
|
@@ -364,6 +364,126 @@ declare namespace Game {
|
|
|
364
364
|
*/
|
|
365
365
|
function addOnPreContinue(handler: () => Promise<void> | void): void;
|
|
366
366
|
function removeOnPreContinue(handler: () => Promise<void> | void): void;
|
|
367
|
+
/**
|
|
368
|
+
* Lets an AI agent (or any external script/browser console) drive and inspect a running game
|
|
369
|
+
* through `window`, without needing to know the app's own UI wiring. Not enabled by default —
|
|
370
|
+
* something must opt in, typically only in development. Two pieces are needed:
|
|
371
|
+
* - `enable()`/`disable()` turn the `window` bridge on/off — the `@drincs/pixi-vn/vite` plugin's
|
|
372
|
+
* `testing` option does this automatically while its dev server is running, with no extra code.
|
|
373
|
+
* - `setProps(props)` keeps the live app props (`navigate`/`t`/`toast`/etc.) available to every
|
|
374
|
+
* action — call it unconditionally from wherever your app builds those props (e.g. at the end
|
|
375
|
+
* of a `useGameProps()`-style hook), since every action needs up-to-date props whether or not
|
|
376
|
+
* testing happens to be enabled right now.
|
|
377
|
+
* See the `pixi-vn-testing` skill for the full guide (activation patterns, the complete command
|
|
378
|
+
* surface, and cookbook snippets for a browser-driven test session).
|
|
379
|
+
*/
|
|
380
|
+
namespace testing {
|
|
381
|
+
/**
|
|
382
|
+
* One error captured by {@link enable} while testing is active, via {@link Game.addOnError}.
|
|
383
|
+
*/
|
|
384
|
+
interface GameTestingErrorEntry {
|
|
385
|
+
error: unknown;
|
|
386
|
+
timestamp: number;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* A read-only snapshot of everything a test session typically needs to decide its next
|
|
390
|
+
* action, gathered from {@link narrationUtils.narration} and {@link historyUtils.stepHistory}
|
|
391
|
+
* in a single call instead of reading several properties one by one.
|
|
392
|
+
*/
|
|
393
|
+
interface GameTestingState {
|
|
394
|
+
dialogue: narrationUtils.DialogueInterface | undefined;
|
|
395
|
+
dialogueGlue: boolean;
|
|
396
|
+
choices: narrationUtils.StoredIndexedChoiceInterface[] | undefined;
|
|
397
|
+
input: {
|
|
398
|
+
isRequired: boolean;
|
|
399
|
+
type: string | undefined;
|
|
400
|
+
value: storageUtils.StorageElementType;
|
|
401
|
+
};
|
|
402
|
+
canContinue: boolean;
|
|
403
|
+
canGoBack: boolean;
|
|
404
|
+
labelsOpened: narrationUtils.OpenedLabel[];
|
|
405
|
+
currentLabelId: string | undefined;
|
|
406
|
+
stepCounter: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The object attached to `window` (and returned) by {@link enable}. Every action method
|
|
410
|
+
* merges the most recent props passed to {@link setProps} with any `extraProps` given here,
|
|
411
|
+
* then delegates to the matching narration/history call — so calling these behaves exactly
|
|
412
|
+
* like a real player action (the same `navigate`/`t`/`toast`/etc. the real UI uses).
|
|
413
|
+
*
|
|
414
|
+
* `narration`, `storage`, `stepHistory` and `Game` are also exposed directly for anything not
|
|
415
|
+
* covered by the action methods (e.g. `storage.set(...)`, `Game.exportGameState()`).
|
|
416
|
+
*/
|
|
417
|
+
interface GameTestingAPI<T extends {} = {}> {
|
|
418
|
+
readonly Game: typeof Game;
|
|
419
|
+
readonly narration: narrationUtils.NarrationManagerInterface;
|
|
420
|
+
readonly storage: storageUtils.StorageManagerInterface;
|
|
421
|
+
readonly stepHistory: historyUtils.HistoryManagerInterface;
|
|
422
|
+
/**
|
|
423
|
+
* The most recent props passed to {@link setProps} — whatever your app's `StepLabelProps`
|
|
424
|
+
* augmentation defines (e.g. `navigate`, `toast`). Useful to drive the app's UI directly
|
|
425
|
+
* during a test session — e.g. `pixiVN.props.navigate("/settings")` — not just narration,
|
|
426
|
+
* for full control over what's on screen.
|
|
427
|
+
*/
|
|
428
|
+
readonly props: narrationUtils.StepLabelPropsType<T>;
|
|
429
|
+
/** {@link Game.start} using the live props plus any `extraProps`. */
|
|
430
|
+
start(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
431
|
+
/** {@link narrationUtils.NarrationManagerInterface.continue} using the live props plus any `extraProps`. */
|
|
432
|
+
continue(extraProps?: Partial<T>, options?: {
|
|
433
|
+
steps?: number;
|
|
434
|
+
runNow?: boolean;
|
|
435
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
436
|
+
/** {@link narrationUtils.NarrationManagerInterface.call} using the live props plus any `extraProps`. */
|
|
437
|
+
call(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
438
|
+
/** {@link narrationUtils.NarrationManagerInterface.jump} using the live props plus any `extraProps`. */
|
|
439
|
+
jump(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
440
|
+
/**
|
|
441
|
+
* Selects the currently open choice with this `choiceIndex` (as seen in
|
|
442
|
+
* `getState().choices`), using the live props plus any `extraProps`.
|
|
443
|
+
* @throws when no open choice has that index.
|
|
444
|
+
*/
|
|
445
|
+
selectChoice(choiceIndex: number, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
446
|
+
/** Resolves a pending `narration.input.request(...)` with `value`, exactly like the player typing an answer and confirming. */
|
|
447
|
+
setInput(value: storageUtils.StorageElementType): void;
|
|
448
|
+
/** {@link historyUtils.HistoryManagerInterface.back} using the live props plus any `extraProps`. */
|
|
449
|
+
goBack(extraProps?: Partial<T>, options?: {
|
|
450
|
+
steps?: number;
|
|
451
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
452
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeCurrent} */
|
|
453
|
+
closeCurrentLabel(): void;
|
|
454
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeAll}. **Can end the game.** */
|
|
455
|
+
closeAllLabels(): void;
|
|
456
|
+
/** A snapshot of dialogue/choices/input/canContinue/canGoBack/labels — see {@link GameTestingState}. */
|
|
457
|
+
getState(): GameTestingState;
|
|
458
|
+
/** Errors caught via {@link Game.addOnError} since `enable()` was called (or since the last {@link clearErrors}). */
|
|
459
|
+
readonly errors: GameTestingErrorEntry[];
|
|
460
|
+
clearErrors(): void;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Updates the live props every {@link GameTestingAPI} action merges `extraProps` on top of.
|
|
464
|
+
* Call this unconditionally from wherever your app builds its `StepLabelProps` (e.g. the end
|
|
465
|
+
* of a `useGameProps()`-style hook that already runs throughout the app) — it's a cheap
|
|
466
|
+
* assignment, safe to call whether or not testing is currently {@link enable}d.
|
|
467
|
+
* @param props The app's current `StepLabelProps` (the same object your UI passes to
|
|
468
|
+
* `narration.continue`/`Game.start`).
|
|
469
|
+
*/
|
|
470
|
+
function setProps<T extends {} = {}>(props: narrationUtils.StepLabelPropsType<T>): void;
|
|
471
|
+
/**
|
|
472
|
+
* Enables the testing API: builds it, attaches it to `window[windowKey]` (default
|
|
473
|
+
* `"pixiVN"`), and returns it. Calling this again replaces the previous session.
|
|
474
|
+
* @param options.windowKey The property name to attach the API under on `window`. @default "pixiVN"
|
|
475
|
+
*/
|
|
476
|
+
function enable<T extends {} = {}>(options?: {
|
|
477
|
+
windowKey?: string;
|
|
478
|
+
}): GameTestingAPI<T>;
|
|
479
|
+
/**
|
|
480
|
+
* Disables a session started with {@link enable}: removes the error handler and, if it's
|
|
481
|
+
* still the current value, deletes `window[windowKey]`. No-op if testing isn't enabled.
|
|
482
|
+
*/
|
|
483
|
+
function disable(): void;
|
|
484
|
+
/** Whether a testing session is currently active. */
|
|
485
|
+
function isEnabled(): boolean;
|
|
486
|
+
}
|
|
367
487
|
}
|
|
368
488
|
declare const _default: {
|
|
369
489
|
canvas: canvasUtils.CanvasManagerInterface;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ import 'microdiff';
|
|
|
29
29
|
import 'tone';
|
|
30
30
|
import './StorageElementType-C7ETezlL.js';
|
|
31
31
|
|
|
32
|
-
var version = "1.9.
|
|
32
|
+
var version = "1.9.1";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Is a special alias to indicate the game layer.
|
|
@@ -364,6 +364,126 @@ declare namespace Game {
|
|
|
364
364
|
*/
|
|
365
365
|
function addOnPreContinue(handler: () => Promise<void> | void): void;
|
|
366
366
|
function removeOnPreContinue(handler: () => Promise<void> | void): void;
|
|
367
|
+
/**
|
|
368
|
+
* Lets an AI agent (or any external script/browser console) drive and inspect a running game
|
|
369
|
+
* through `window`, without needing to know the app's own UI wiring. Not enabled by default —
|
|
370
|
+
* something must opt in, typically only in development. Two pieces are needed:
|
|
371
|
+
* - `enable()`/`disable()` turn the `window` bridge on/off — the `@drincs/pixi-vn/vite` plugin's
|
|
372
|
+
* `testing` option does this automatically while its dev server is running, with no extra code.
|
|
373
|
+
* - `setProps(props)` keeps the live app props (`navigate`/`t`/`toast`/etc.) available to every
|
|
374
|
+
* action — call it unconditionally from wherever your app builds those props (e.g. at the end
|
|
375
|
+
* of a `useGameProps()`-style hook), since every action needs up-to-date props whether or not
|
|
376
|
+
* testing happens to be enabled right now.
|
|
377
|
+
* See the `pixi-vn-testing` skill for the full guide (activation patterns, the complete command
|
|
378
|
+
* surface, and cookbook snippets for a browser-driven test session).
|
|
379
|
+
*/
|
|
380
|
+
namespace testing {
|
|
381
|
+
/**
|
|
382
|
+
* One error captured by {@link enable} while testing is active, via {@link Game.addOnError}.
|
|
383
|
+
*/
|
|
384
|
+
interface GameTestingErrorEntry {
|
|
385
|
+
error: unknown;
|
|
386
|
+
timestamp: number;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* A read-only snapshot of everything a test session typically needs to decide its next
|
|
390
|
+
* action, gathered from {@link narrationUtils.narration} and {@link historyUtils.stepHistory}
|
|
391
|
+
* in a single call instead of reading several properties one by one.
|
|
392
|
+
*/
|
|
393
|
+
interface GameTestingState {
|
|
394
|
+
dialogue: narrationUtils.DialogueInterface | undefined;
|
|
395
|
+
dialogueGlue: boolean;
|
|
396
|
+
choices: narrationUtils.StoredIndexedChoiceInterface[] | undefined;
|
|
397
|
+
input: {
|
|
398
|
+
isRequired: boolean;
|
|
399
|
+
type: string | undefined;
|
|
400
|
+
value: storageUtils.StorageElementType;
|
|
401
|
+
};
|
|
402
|
+
canContinue: boolean;
|
|
403
|
+
canGoBack: boolean;
|
|
404
|
+
labelsOpened: narrationUtils.OpenedLabel[];
|
|
405
|
+
currentLabelId: string | undefined;
|
|
406
|
+
stepCounter: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The object attached to `window` (and returned) by {@link enable}. Every action method
|
|
410
|
+
* merges the most recent props passed to {@link setProps} with any `extraProps` given here,
|
|
411
|
+
* then delegates to the matching narration/history call — so calling these behaves exactly
|
|
412
|
+
* like a real player action (the same `navigate`/`t`/`toast`/etc. the real UI uses).
|
|
413
|
+
*
|
|
414
|
+
* `narration`, `storage`, `stepHistory` and `Game` are also exposed directly for anything not
|
|
415
|
+
* covered by the action methods (e.g. `storage.set(...)`, `Game.exportGameState()`).
|
|
416
|
+
*/
|
|
417
|
+
interface GameTestingAPI<T extends {} = {}> {
|
|
418
|
+
readonly Game: typeof Game;
|
|
419
|
+
readonly narration: narrationUtils.NarrationManagerInterface;
|
|
420
|
+
readonly storage: storageUtils.StorageManagerInterface;
|
|
421
|
+
readonly stepHistory: historyUtils.HistoryManagerInterface;
|
|
422
|
+
/**
|
|
423
|
+
* The most recent props passed to {@link setProps} — whatever your app's `StepLabelProps`
|
|
424
|
+
* augmentation defines (e.g. `navigate`, `toast`). Useful to drive the app's UI directly
|
|
425
|
+
* during a test session — e.g. `pixiVN.props.navigate("/settings")` — not just narration,
|
|
426
|
+
* for full control over what's on screen.
|
|
427
|
+
*/
|
|
428
|
+
readonly props: narrationUtils.StepLabelPropsType<T>;
|
|
429
|
+
/** {@link Game.start} using the live props plus any `extraProps`. */
|
|
430
|
+
start(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
431
|
+
/** {@link narrationUtils.NarrationManagerInterface.continue} using the live props plus any `extraProps`. */
|
|
432
|
+
continue(extraProps?: Partial<T>, options?: {
|
|
433
|
+
steps?: number;
|
|
434
|
+
runNow?: boolean;
|
|
435
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
436
|
+
/** {@link narrationUtils.NarrationManagerInterface.call} using the live props plus any `extraProps`. */
|
|
437
|
+
call(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
438
|
+
/** {@link narrationUtils.NarrationManagerInterface.jump} using the live props plus any `extraProps`. */
|
|
439
|
+
jump(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
440
|
+
/**
|
|
441
|
+
* Selects the currently open choice with this `choiceIndex` (as seen in
|
|
442
|
+
* `getState().choices`), using the live props plus any `extraProps`.
|
|
443
|
+
* @throws when no open choice has that index.
|
|
444
|
+
*/
|
|
445
|
+
selectChoice(choiceIndex: number, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
446
|
+
/** Resolves a pending `narration.input.request(...)` with `value`, exactly like the player typing an answer and confirming. */
|
|
447
|
+
setInput(value: storageUtils.StorageElementType): void;
|
|
448
|
+
/** {@link historyUtils.HistoryManagerInterface.back} using the live props plus any `extraProps`. */
|
|
449
|
+
goBack(extraProps?: Partial<T>, options?: {
|
|
450
|
+
steps?: number;
|
|
451
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
452
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeCurrent} */
|
|
453
|
+
closeCurrentLabel(): void;
|
|
454
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeAll}. **Can end the game.** */
|
|
455
|
+
closeAllLabels(): void;
|
|
456
|
+
/** A snapshot of dialogue/choices/input/canContinue/canGoBack/labels — see {@link GameTestingState}. */
|
|
457
|
+
getState(): GameTestingState;
|
|
458
|
+
/** Errors caught via {@link Game.addOnError} since `enable()` was called (or since the last {@link clearErrors}). */
|
|
459
|
+
readonly errors: GameTestingErrorEntry[];
|
|
460
|
+
clearErrors(): void;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Updates the live props every {@link GameTestingAPI} action merges `extraProps` on top of.
|
|
464
|
+
* Call this unconditionally from wherever your app builds its `StepLabelProps` (e.g. the end
|
|
465
|
+
* of a `useGameProps()`-style hook that already runs throughout the app) — it's a cheap
|
|
466
|
+
* assignment, safe to call whether or not testing is currently {@link enable}d.
|
|
467
|
+
* @param props The app's current `StepLabelProps` (the same object your UI passes to
|
|
468
|
+
* `narration.continue`/`Game.start`).
|
|
469
|
+
*/
|
|
470
|
+
function setProps<T extends {} = {}>(props: narrationUtils.StepLabelPropsType<T>): void;
|
|
471
|
+
/**
|
|
472
|
+
* Enables the testing API: builds it, attaches it to `window[windowKey]` (default
|
|
473
|
+
* `"pixiVN"`), and returns it. Calling this again replaces the previous session.
|
|
474
|
+
* @param options.windowKey The property name to attach the API under on `window`. @default "pixiVN"
|
|
475
|
+
*/
|
|
476
|
+
function enable<T extends {} = {}>(options?: {
|
|
477
|
+
windowKey?: string;
|
|
478
|
+
}): GameTestingAPI<T>;
|
|
479
|
+
/**
|
|
480
|
+
* Disables a session started with {@link enable}: removes the error handler and, if it's
|
|
481
|
+
* still the current value, deletes `window[windowKey]`. No-op if testing isn't enabled.
|
|
482
|
+
*/
|
|
483
|
+
function disable(): void;
|
|
484
|
+
/** Whether a testing session is currently active. */
|
|
485
|
+
function isEnabled(): boolean;
|
|
486
|
+
}
|
|
367
487
|
}
|
|
368
488
|
declare const _default: {
|
|
369
489
|
canvas: canvasUtils.CanvasManagerInterface;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {f as f$1,b as b$1,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as M from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as kt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as st from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as O from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as ut from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as z from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var he=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,jt=typeof process=="object"&&process?process:{},Jt=(g,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(g,e,i,s):console.error(`[${i}] ${e}: ${g}`);},Nt=globalThis.AbortController,qt=globalThis.AbortSignal;if(typeof Nt>"u"){qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new qt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let g=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{g&&(g=false,Jt("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",e));};}var ce=g=>!Xt.has(g);var lt=g=>g&&g===Math.floor(g)&&g>0&&isFinite(g),Qt=g=>lt(g)?g<=Math.pow(2,8)?Uint8Array:g<=Math.pow(2,16)?Uint16Array:g<=Math.pow(2,32)?Uint32Array:g<=Number.MAX_SAFE_INTEGER?Lt:null:null,Lt=class extends Array{constructor(g){super(g),this.fill(0);}},rt,vt,de=(rt=class{heap;length;static create(e){let i=Qt(e);if(!i)return [];g(rt,vt,true);let s=new rt(e,i);return g(rt,vt,false),s}constructor(e$1,i){if(!e(rt,vt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},vt=new WeakMap,f$1(rt,vt,false),rt),$t,Bt,q,V,B,ft,X,St,yt,J,R,Q,U,x,f,j,W,F,D,Z,C,tt,et,Y,H,it,pt,P,bt,a,Pt,mt,nt,Tt,K,te,gt,xt,Ut,ht,ct,Mt,Dt,Ct,b,zt,At,dt,Gt,Et,Zt=(Et=class{constructor(e$1){f$1(this,a);f$1(this,q);f$1(this,V);f$1(this,B);f$1(this,ft);f$1(this,X);f$1(this,St);f$1(this,yt);f$1(this,J);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f$1(this,R);f$1(this,Q);f$1(this,U);f$1(this,x);f$1(this,f);f$1(this,j);f$1(this,W);f$1(this,F);f$1(this,D);f$1(this,Z);f$1(this,C);f$1(this,tt);f$1(this,et);f$1(this,Y);f$1(this,H);f$1(this,it);f$1(this,pt);f$1(this,P);f$1(this,bt);f$1(this,mt,()=>{});f$1(this,nt,()=>{});f$1(this,Tt,()=>{});f$1(this,K,()=>false);f$1(this,gt,e=>{});f$1(this,xt,(e,i,s)=>{});f$1(this,Ut,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,$t,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:c,dispose:v,onInsert:L,disposeAfter:S,noDisposeOnSet:ot,noUpdateTTL:G,maxSize:$=0,maxEntrySize:E=0,sizeCalculation:y,fetchMethod:m,memoMethod:u,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:d$1,allowStaleOnFetchAbort:A,ignoreFetchAbort:I,perf:k}=e$1;if(k!==void 0&&typeof k?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,J,k??he),i!==0&&!lt(i))throw new TypeError("max option must be a nonnegative integer");let _t=i?Qt(i):Array;if(!_t)throw new Error("invalid max value: "+i);if(g(this,q,i),g(this,V,$),this.maxEntrySize=E||e(this,V),this.sizeCalculation=y,this.sizeCalculation){if(!e(this,V)&&!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(u!==void 0&&typeof u!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,yt,u),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,St,m),g(this,pt,!!m),g(this,U,new Map),g(this,x,new Array(i).fill(void 0)),g(this,f,new Array(i).fill(void 0)),g(this,j,new _t(i)),g(this,W,new _t(i)),g(this,F,0),g(this,D,0),g(this,Z,de.create(i)),g(this,R,0),g(this,Q,0),typeof v=="function"&&g(this,B,v),typeof L=="function"&&g(this,ft,L),typeof S=="function"?(g(this,X,S),g(this,C,[])):(g(this,X,void 0),g(this,C,void 0)),g(this,it,!!e(this,B)),g(this,bt,!!e(this,ft)),g(this,P,!!e(this,X)),this.noDisposeOnSet=!!ot,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!d$1,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(e(this,V)!==0&&!lt(e(this,V)))throw new TypeError("maxSize must be a positive integer if specified");if(!lt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,te).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=lt(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!lt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Pt).call(this);}if(e(this,q)===0&&this.ttl===0&&e(this,V)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,q)&&!e(this,V)){let Ft="LRU_CACHE_UNBOUNDED";ce(Ft)&&(Xt.add(Ft),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ft,Et));}}get perf(){return e(this,J)}static unsafeExposeInternals(e$1){return {starts:e(e$1,et),ttls:e(e$1,Y),autopurgeTimers:e(e$1,H),sizes:e(e$1,tt),keyMap:e(e$1,U),keyList:e(e$1,x),valList:e(e$1,f),next:e(e$1,j),prev:e(e$1,W),get head(){return e(e$1,F)},get tail(){return e(e$1,D)},free:e(e$1,Z),isBackgroundFetch:i=>{var s;return h(s=e$1,a,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return h(o=e$1,a,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return h(s=e$1,a,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,ht).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,ct).call(s,i)},isStale:i=>{var s;return e(s=e$1,K).call(s,i)}}}get max(){return e(this,q)}get maxSize(){return e(this,V)}get calculatedSize(){return e(this,Q)}get size(){return e(this,R)}get fetchMethod(){return e(this,St)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,B)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,X)}getRemainingTTL(e$1){return e(this,U).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,ht).call(this))e(this,f)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield [e(this,x)[e$1],e(this,f)[e$1]]);}*rentries(){for(let e$1 of h(this,a,ct).call(this))e(this,f)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield [e(this,x)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,a,ht).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,ct).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,ht).call(this))e(this,f)[e$1]!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}*rvalues(){for(let e$1 of h(this,a,ct).call(this))e(this,f)[e$1]!==void 0&&!h(this,a,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Bt=Symbol.iterator,$t=Symbol.toStringTag,Bt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,ht).call(this)){let r=e(this,f)[s],n=h(this,a,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,x)[s],this))return this.get(e(this,x)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,ht).call(this)){let r=e(this,f)[s],n=h(this,a,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,x)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,ct).call(this)){let r=e(this,f)[s],n=h(this,a,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,x)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,ct).call(this,{allowStale:true}))e(this,K).call(this,i)&&(h(this,a,dt).call(this,e(this,x)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,U).get(e$1);if(i===void 0)return;let s=e(this,f)[i],r=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(e(this,Y)&&e(this,et)){let o=e(this,Y)[i],l=e(this,et)[i];if(o&&l){let c=o-(e(this,J).now()-l);n.ttl=c,n.start=Date.now();}}return e(this,tt)&&(n.size=e(this,tt)[i]),n}dump(){let e$1=[];for(let i of h(this,a,ht).call(this,{allowStale:true})){let s=e(this,x)[i],r=e(this,f)[i],n=h(this,a,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(e(this,Y)&&e(this,et)){o.ttl=e(this,Y)[i];let l=e(this,J).now()-e(this,et)[i];o.start=Math.floor(Date.now()-l);}e(this,tt)&&(o.size=e(this,tt)[i]),e$1.unshift([s,o]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,J).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var ot,G,$,E;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,L=e(this,Ut).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&L>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,a,dt).call(this,e$1,"set"),this;let S=e(this,R)===0?void 0:e(this,U).get(e$1);if(S===void 0)S=e(this,R)===0?e(this,D):e(this,Z).length!==0?e(this,Z).pop():e(this,R)===e(this,q)?h(this,a,Dt).call(this,false):e(this,R),e(this,x)[S]=e$1,e(this,f)[S]=i$1,e(this,U).set(e$1,S),e(this,j)[e(this,D)]=S,e(this,W)[S]=e(this,D),g(this,D,S),i(this,R)._++,e(this,xt).call(this,S,L,c),c&&(c.set="add"),v=false,e(this,bt)&&((ot=e(this,ft))==null||ot.call(this,i$1,e$1,"add"));else {h(this,a,At).call(this,S);let y=e(this,f)[S];if(i$1!==y){if(e(this,pt)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!o&&(e(this,it)&&((G=e(this,B))==null||G.call(this,m,e$1,"set")),e(this,P)&&e(this,C)?.push([m,e$1,"set"]));}else o||(e(this,it)&&(($=e(this,B))==null||$.call(this,y,e$1,"set")),e(this,P)&&e(this,C)?.push([y,e$1,"set"]));if(e(this,gt).call(this,S),e(this,xt).call(this,S,L,c),e(this,f)[S]=i$1,c){c.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(c.oldValue=m);}}else c&&(c.set="update");e(this,bt)&&this.onInsert?.(i$1,e$1,i$1===y?"update":"replace");}if(r!==0&&!e(this,Y)&&h(this,a,Pt).call(this),e(this,Y)&&(v||e(this,Tt).call(this,S,r,n),c&&e(this,nt).call(this,c,S)),!o&&e(this,P)&&e(this,C)){let y=e(this,C),m;for(;m=y?.shift();)(E=e(this,X))==null||E.call(this,...m);}return this}pop(){var e$1;try{for(;e(this,R);){let i=e(this,f)[e(this,F)];if(h(this,a,Dt).call(this,!0),h(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,P)&&e(this,C)){let i=e(this,C),s;for(;s=i?.shift();)(e$1=e(this,X))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=e(this,U).get(e$1);if(n!==void 0){let o=e(this,f)[n];if(h(this,a,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(e(this,K).call(this,n))r&&(r.has="stale",e(this,nt).call(this,r,n));else return s&&e(this,mt).call(this,n),r&&(r.has="hit",e(this,nt).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,U).get(e$1);if(r===void 0||!s&&e(this,K).call(this,r))return;let n=e(this,f)[r];return h(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:c=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:L=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:ot=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:$=this.allowStaleOnFetchAbort,context:E,forceRefresh:y=false,status:m,signal:u}=i;if(!e(this,pt))return m&&(m.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:m});let w={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:l,size:c,sizeCalculation:v,noUpdateTTL:L,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:ot,allowStaleOnFetchAbort:$,ignoreFetchAbort:G,status:m,signal:u},T=e(this,U).get(e$1);if(T===void 0){m&&(m.fetch="miss");let d=h(this,a,Ct).call(this,e$1,T,w,E);return d.__returned=d}else {let d=e(this,f)[T];if(h(this,a,b).call(this,d)){let _t=s&&d.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",_t&&(m.returnedStale=true)),_t?d.__staleWhileFetching:d.__returned=d}let A=e(this,K).call(this,T);if(!y&&!A)return m&&(m.fetch="hit"),h(this,a,At).call(this,T),r&&e(this,mt).call(this,T),m&&e(this,nt).call(this,m,T),d;let I=h(this,a,Ct).call(this,e$1,T,w,E),k=I.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=A?"stale":"refresh",k&&A&&(m.returnedStale=true)),k?I.__staleWhileFetching:I.__returned=I}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,yt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,l=this.get(e$1,o);if(!n&&l!==void 0)return l;let c=s(e$1,l,{options:o,context:r});return this.set(e$1,c,o),c}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,l=e(this,U).get(e$1);if(l!==void 0){let c=e(this,f)[l],v=h(this,a,b).call(this,c);return o&&e(this,nt).call(this,o,l),e(this,K).call(this,l)?(o&&(o.get="stale"),v?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(n||h(this,a,dt).call(this,e$1,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),v?c.__staleWhileFetching:(h(this,a,At).call(this,l),r&&e(this,mt).call(this,l),c))}else o&&(o.get="miss");}delete(e){return h(this,a,dt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}},q=new WeakMap,V=new WeakMap,B=new WeakMap,ft=new WeakMap,X=new WeakMap,St=new WeakMap,yt=new WeakMap,J=new WeakMap,R=new WeakMap,Q=new WeakMap,U=new WeakMap,x=new WeakMap,f=new WeakMap,j=new WeakMap,W=new WeakMap,F=new WeakMap,D=new WeakMap,Z=new WeakMap,C=new WeakMap,tt=new WeakMap,et=new WeakMap,Y=new WeakMap,H=new WeakMap,it=new WeakMap,pt=new WeakMap,P=new WeakMap,bt=new WeakMap,a=new WeakSet,Pt=function(){let e$1=new Lt(e(this,q)),i=new Lt(e(this,q));g(this,Y,e$1),g(this,et,i);let s=this.ttlAutopurge?new Array(e(this,q)):void 0;g(this,H,s),g(this,Tt,(l,c,v=e(this,J).now())=>{i[l]=c!==0?v:0,e$1[l]=c,r(l,c);}),g(this,mt,l=>{i[l]=e$1[l]!==0?e(this,J).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,c)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),c&&c!==0&&s){let v=setTimeout(()=>{e(this,K).call(this,l)&&h(this,a,dt).call(this,e(this,x)[l],"expire");},c+1);v.unref&&v.unref(),s[l]=v;}}:()=>{};g(this,nt,(l,c)=>{if(e$1[c]){let v=e$1[c],L=i[c];if(!v||!L)return;l.ttl=v,l.start=L,l.now=n||o();let S=l.now-L;l.remainingTTL=v-S;}});let n=0,o=()=>{let l=e(this,J).now();if(this.ttlResolution>0){n=l;let c=setTimeout(()=>n=0,this.ttlResolution);c.unref&&c.unref();}return l};this.getRemainingTTL=l=>{let c=e(this,U).get(l);if(c===void 0)return 0;let v=e$1[c],L=i[c];if(!v||!L)return 1/0;let S=(n||o())-L;return v-S},g(this,K,l=>{let c=i[l],v=e$1[l];return !!v&&!!c&&(n||o())-c>v});},mt=new WeakMap,nt=new WeakMap,Tt=new WeakMap,K=new WeakMap,te=function(){let e$1=new Lt(e(this,q));g(this,Q,0),g(this,tt,e$1),g(this,gt,i=>{g(this,Q,e(this,Q)-e$1[i]),e$1[i]=0;}),g(this,Ut,(i,s,r,n)=>{if(h(this,a,b).call(this,s))return 0;if(!lt(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!lt(r))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 r}),g(this,xt,(i,s,r)=>{if(e$1[i]=s,e(this,V)){let n=e(this,V)-e$1[i];for(;e(this,Q)>n;)h(this,a,Dt).call(this,true);}g(this,Q,e(this,Q)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,Q));});},gt=new WeakMap,xt=new WeakMap,Ut=new WeakMap,ht=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,D);!(!h(this,a,Mt).call(this,i)||((e$1||!e(this,K).call(this,i))&&(yield i),i===e(this,F)));)i=e(this,W)[i];},ct=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,F);!(!h(this,a,Mt).call(this,i)||((e$1||!e(this,K).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,j)[i];},Mt=function(e$1){return e$1!==void 0&&e(this,U).get(e(this,x)[e$1])===e$1},Dt=function(e$1){var n;let i$1=e(this,F),s=e(this,x)[i$1],r=e(this,f)[i$1];return e(this,pt)&&h(this,a,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,it)||e(this,P))&&(e(this,it)&&((n=e(this,B))==null||n.call(this,r,s,"evict")),e(this,P)&&e(this,C)?.push([r,s,"evict"])),e(this,gt).call(this,i$1),e(this,H)?.[i$1]&&(clearTimeout(e(this,H)[i$1]),e(this,H)[i$1]=void 0),e$1&&(e(this,x)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,Z).push(i$1)),e(this,R)===1?(g(this,F,g(this,D,0)),e(this,Z).length=0):g(this,F,e(this,j)[i$1]),e(this,U).delete(s),i(this,R)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,a,b).call(this,n))return n;let o=new Nt,{signal:l}=s;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:r},v=(E,y=false)=>{let{aborted:m}=o.signal,u=s.ignoreFetchAbort&&E!==void 0,w=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&E!==void 0);if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,u&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!u&&!y)return S(o.signal.reason,w);let T=G,d=e(this,f)[i];return (d===G||u&&y&&d===void 0)&&(E===void 0?T.__staleWhileFetching!==void 0?e(this,f)[i]=T.__staleWhileFetching:h(this,a,dt).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,E,c.options))),E},L=E=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=E),S(E,false)),S=(E,y)=>{let{aborted:m}=o.signal,u=m&&s.allowStaleOnFetchAbort,w=u||s.allowStaleOnFetchRejection,T=w||s.noDeleteOnFetchRejection,d=G;if(e(this,f)[i]===G&&(!T||!y&&d.__staleWhileFetching===void 0?h(this,a,dt).call(this,e$1,"fetch"):u||(e(this,f)[i]=d.__staleWhileFetching)),w)return s.status&&d.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),d.__staleWhileFetching;if(d.__returned===d)throw E},ot=(E,y)=>{var u;let m=(u=e(this,St))==null?void 0:u.call(this,e$1,n,c);m&&m instanceof Promise&&m.then(w=>E(w===void 0?void 0:w),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(E(void 0),s.allowStaleOnFetchAbort&&(E=w=>v(w,true)));});};s.status&&(s.status.fetchDispatched=true);let G=new Promise(ot).then(v,L),$=Object.assign(G,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e$1,$,{...c.options,status:void 0}),i=e(this,U).get(e$1)):e(this,f)[i]=$,$},b=function(e$1){if(!e(this,pt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e$1,i){e(this,W)[i]=e$1,e(this,j)[e$1]=i;},At=function(e$1){e$1!==e(this,D)&&(e$1===e(this,F)?g(this,F,e(this,j)[e$1]):h(this,a,zt).call(this,e(this,W)[e$1],e(this,j)[e$1]),h(this,a,zt).call(this,e(this,D),e$1),g(this,D,e$1));},dt=function(e$1,i$1){var r,n;let s=false;if(e(this,R)!==0){let o=e(this,U).get(e$1);if(o!==void 0)if(e(this,H)?.[o]&&(clearTimeout(e(this,H)?.[o]),e(this,H)[o]=void 0),s=true,e(this,R)===1)h(this,a,Gt).call(this,i$1);else {e(this,gt).call(this,o);let l=e(this,f)[o];if(h(this,a,b).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,it)||e(this,P))&&(e(this,it)&&((r=e(this,B))==null||r.call(this,l,e$1,i$1)),e(this,P)&&e(this,C)?.push([l,e$1,i$1])),e(this,U).delete(e$1),e(this,x)[o]=void 0,e(this,f)[o]=void 0,o===e(this,D))g(this,D,e(this,W)[o]);else if(o===e(this,F))g(this,F,e(this,j)[o]);else {let c=e(this,W)[o];e(this,j)[c]=e(this,j)[o];let v=e(this,j)[o];e(this,W)[v]=e(this,W)[o];}i(this,R)._--,e(this,Z).push(o);}}if(e(this,P)&&e(this,C)?.length){let o=e(this,C),l;for(;l=o?.shift();)(n=e(this,X))==null||n.call(this,...l);}return s},Gt=function(e$1){var i,s;for(let r of h(this,a,ct).call(this,{allowStale:true})){let n=e(this,f)[r];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,x)[r];e(this,it)&&((i=e(this,B))==null||i.call(this,n,o,e$1)),e(this,P)&&e(this,C)?.push([n,o,e$1]);}}if(e(this,U).clear(),e(this,f).fill(void 0),e(this,x).fill(void 0),e(this,Y)&&e(this,et)){e(this,Y).fill(0),e(this,et).fill(0);for(let r of e(this,H)??[])r!==void 0&&clearTimeout(r);e(this,H)?.fill(void 0);}if(e(this,tt)&&e(this,tt).fill(0),g(this,F,0),g(this,D,0),e(this,Z).length=0,g(this,Q,0),g(this,R,0),e(this,P)&&e(this,C)){let r=e(this,C),n;for(;n=r?.shift();)(s=e(this,X))==null||s.call(this,...n);}},Et);var It=class{cache;map=new Map;constructor(e){this.cache=new Zt({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ot="1.9.0";var Vt={version:Ot};var Wt="__game_layer__";var pe={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie={};var Yt={};b$1(Yt,{createExportableElement:()=>se});var wt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(wt||={});function se(g){try{if(typeof g>"u")return g;let e=JSON.stringify(g);return JSON.parse(e)}catch(e){throw wt.error("Error creating exportable element",g,e),new PixiError("not_json_serializable","Error creating exportable element")}}var fe=typeof window<"u"&&typeof document<"u",re=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],oe=31,me="background:#2f90da;color:#fff;font-weight:bold;",ge="background:#c832bb;color:#fff;font-weight:bold;",_e="background:transparent;font-weight:bold;",Ht=` v${Vt.version}`;function ne(){if(!fe)return;let g=[],e=[];for(let i=0;i<re.length;i++){let s=re[i],r=s.endsWith(Ht),n=r?s.slice(0,-Ht.length):s,o=n.slice(0,oe),l=n.slice(oe),c=r?"%c%s%c%s%c%s":"%c%s%c%s";g.push(c),e.push(me,o,ge,l),r&&e.push(_e,Ht);}console.info(g.join(`
|
|
2
|
-
`),...e);}function
|
|
1
|
+
import {f,b,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as V from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Qt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as H from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as m from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as mt from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as z from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var ye=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ne=new Set,Ht=typeof process=="object"&&process?process:{},oe=(_,e,i,s)=>{typeof Ht.emitWarning=="function"?Ht.emitWarning(_,e,i,s):console.error(`[${i}] ${e}: ${_}`);},jt=globalThis.AbortController,ie=globalThis.AbortSignal;if(typeof jt>"u"){ie=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new ie;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let _=Ht.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{_&&(_=false,oe("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",e));};}var Se=_=>!ne.has(_);var dt=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),ae=_=>dt(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(_){super(_),this.fill(0);}},at,xt,be=(at=class{heap;length;static create(e){let i=ae(e);if(!i)return [];g(at,xt,true);let s=new at(e,i);return g(at,xt,false),s}constructor(e$1,i){if(!e(at,xt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},xt=new WeakMap,f(at,xt,false),at),se,re,X,W,Z,vt,tt,Et,Ut,et,R,it,L,T,u,F,Y,j,I,st,D,rt,nt,q,B,ot,gt,M,Tt,a,kt,yt,ht,Rt,$,he,St,At,Pt,pt,ut,Kt,Nt,Gt,U,Wt,Lt,ft,Yt,Ot,le=(Ot=class{constructor(e$1){f(this,a);f(this,X);f(this,W);f(this,Z);f(this,vt);f(this,tt);f(this,Et);f(this,Ut);f(this,et);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f(this,R);f(this,it);f(this,L);f(this,T);f(this,u);f(this,F);f(this,Y);f(this,j);f(this,I);f(this,st);f(this,D);f(this,rt);f(this,nt);f(this,q);f(this,B);f(this,ot);f(this,gt);f(this,M);f(this,Tt);f(this,yt,()=>{});f(this,ht,()=>{});f(this,Rt,()=>{});f(this,$,()=>false);f(this,St,e=>{});f(this,At,(e,i,s)=>{});f(this,Pt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,se,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:l,allowStale:d$1,dispose:y,onInsert:P,disposeAfter:S,noDisposeOnSet:lt,noUpdateTTL:k,maxSize:J=0,maxEntrySize:A=0,sizeCalculation:x,fetchMethod:f$1,memoMethod:O,noDeleteOnFetchRejection:c,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:g$1,ignoreFetchAbort:E,perf:N}=e$1;if(N!==void 0&&typeof N?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,et,N??ye),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let K=i?ae(i):Array;if(!K)throw new Error("invalid max value: "+i);if(g(this,X,i),g(this,W,J),this.maxEntrySize=A||e(this,W),this.sizeCalculation=x,this.sizeCalculation){if(!e(this,W)&&!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(O!==void 0&&typeof O!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,Ut,O),f$1!==void 0&&typeof f$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,Et,f$1),g(this,gt,!!f$1),g(this,L,new Map),g(this,T,new Array(i).fill(void 0)),g(this,u,new Array(i).fill(void 0)),g(this,F,new K(i)),g(this,Y,new K(i)),g(this,j,0),g(this,I,0),g(this,st,be.create(i)),g(this,R,0),g(this,it,0),typeof y=="function"&&g(this,Z,y),typeof P=="function"&&g(this,vt,P),typeof S=="function"?(g(this,tt,S),g(this,D,[])):(g(this,tt,void 0),g(this,D,void 0)),g(this,ot,!!e(this,Z)),g(this,Tt,!!e(this,vt)),g(this,M,!!e(this,tt)),this.noDisposeOnSet=!!lt,this.noUpdateTTL=!!k,this.noDeleteOnFetchRejection=!!c,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!g$1,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(e(this,W)!==0&&!dt(e(this,W)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,he).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!l,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,kt).call(this);}if(e(this,X)===0&&this.ttl===0&&e(this,W)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,X)&&!e(this,W)){let _t="LRU_CACHE_UNBOUNDED";Se(_t)&&(ne.add(_t),oe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",_t,Ot));}}get perf(){return e(this,et)}static unsafeExposeInternals(e$1){return {starts:e(e$1,nt),ttls:e(e$1,q),autopurgeTimers:e(e$1,B),sizes:e(e$1,rt),keyMap:e(e$1,L),keyList:e(e$1,T),valList:e(e$1,u),next:e(e$1,F),prev:e(e$1,Y),get head(){return e(e$1,j)},get tail(){return e(e$1,I)},free:e(e$1,st),isBackgroundFetch:i=>{var s;return h(s=e$1,a,U).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return h(n=e$1,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return h(s=e$1,a,Lt).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,pt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,ut).call(s,i)},isStale:i=>{var s;return e(s=e$1,$).call(s,i)}}}get max(){return e(this,X)}get maxSize(){return e(this,W)}get calculatedSize(){return e(this,it)}get size(){return e(this,R)}get fetchMethod(){return e(this,Et)}get memoMethod(){return e(this,Ut)}get dispose(){return e(this,Z)}get onInsert(){return e(this,vt)}get disposeAfter(){return e(this,tt)}getRemainingTTL(e$1){return e(this,L).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,pt).call(this))e(this,u)[e$1]!==void 0&&e(this,T)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield [e(this,T)[e$1],e(this,u)[e$1]]);}*rentries(){for(let e$1 of h(this,a,ut).call(this))e(this,u)[e$1]!==void 0&&e(this,T)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield [e(this,T)[e$1],e(this,u)[e$1]]);}*keys(){for(let e$1 of h(this,a,pt).call(this)){let i=e(this,T)[e$1];i!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,ut).call(this)){let i=e(this,T)[e$1];i!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,pt).call(this))e(this,u)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}*rvalues(){for(let e$1 of h(this,a,ut).call(this))e(this,u)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}[(re=Symbol.iterator,se=Symbol.toStringTag,re)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,pt).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e$1(o,e(this,T)[s],this))return this.get(e(this,T)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,pt).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,T)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,ut).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,T)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,ut).call(this,{allowStale:true}))e(this,$).call(this,i)&&(h(this,a,ft).call(this,e(this,T)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,L).get(e$1);if(i===void 0)return;let s=e(this,u)[i],r=h(this,a,U).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,q)&&e(this,nt)){let n=e(this,q)[i],l=e(this,nt)[i];if(n&&l){let d=n-(e(this,et).now()-l);o.ttl=d,o.start=Date.now();}}return e(this,rt)&&(o.size=e(this,rt)[i]),o}dump(){let e$1=[];for(let i of h(this,a,pt).call(this,{allowStale:true})){let s=e(this,T)[i],r=e(this,u)[i],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,q)&&e(this,nt)){n.ttl=e(this,q)[i];let l=e(this,et).now()-e(this,nt)[i];n.start=Math.floor(Date.now()-l);}e(this,rt)&&(n.size=e(this,rt)[i]),e$1.unshift([s,n]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,et).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var lt,k,J,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,P=e(this,Pt).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&P>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,a,ft).call(this,e$1,"set"),this;let S=e(this,R)===0?void 0:e(this,L).get(e$1);if(S===void 0)S=e(this,R)===0?e(this,I):e(this,st).length!==0?e(this,st).pop():e(this,R)===e(this,X)?h(this,a,Nt).call(this,false):e(this,R),e(this,T)[S]=e$1,e(this,u)[S]=i$1,e(this,L).set(e$1,S),e(this,F)[e(this,I)]=S,e(this,Y)[S]=e(this,I),g(this,I,S),i(this,R)._++,e(this,At).call(this,S,P,d),d&&(d.set="add"),y=false,e(this,Tt)&&((lt=e(this,vt))==null||lt.call(this,i$1,e$1,"add"));else {h(this,a,Lt).call(this,S);let x=e(this,u)[S];if(i$1!==x){if(e(this,gt)&&h(this,a,U).call(this,x)){x.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=x;f!==void 0&&!n&&(e(this,ot)&&((k=e(this,Z))==null||k.call(this,f,e$1,"set")),e(this,M)&&e(this,D)?.push([f,e$1,"set"]));}else n||(e(this,ot)&&((J=e(this,Z))==null||J.call(this,x,e$1,"set")),e(this,M)&&e(this,D)?.push([x,e$1,"set"]));if(e(this,St).call(this,S),e(this,At).call(this,S,P,d),e(this,u)[S]=i$1,d){d.set="replace";let f=x&&h(this,a,U).call(this,x)?x.__staleWhileFetching:x;f!==void 0&&(d.oldValue=f);}}else d&&(d.set="update");e(this,Tt)&&this.onInsert?.(i$1,e$1,i$1===x?"update":"replace");}if(r!==0&&!e(this,q)&&h(this,a,kt).call(this),e(this,q)&&(y||e(this,Rt).call(this,S,r,o),d&&e(this,ht).call(this,d,S)),!n&&e(this,M)&&e(this,D)){let x=e(this,D),f;for(;f=x?.shift();)(A=e(this,tt))==null||A.call(this,...f);}return this}pop(){var e$1;try{for(;e(this,R);){let i=e(this,u)[e(this,j)];if(h(this,a,Nt).call(this,!0),h(this,a,U).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,M)&&e(this,D)){let i=e(this,D),s;for(;s=i?.shift();)(e$1=e(this,tt))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,L).get(e$1);if(o!==void 0){let n=e(this,u)[o];if(h(this,a,U).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,$).call(this,o))r&&(r.has="stale",e(this,ht).call(this,r,o));else return s&&e(this,yt).call(this,o),r&&(r.has="hit",e(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,L).get(e$1);if(r===void 0||!s&&e(this,$).call(this,r))return;let o=e(this,u)[r];return h(this,a,U).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:P=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:lt=this.allowStaleOnFetchRejection,ignoreFetchAbort:k=this.ignoreFetchAbort,allowStaleOnFetchAbort:J=this.allowStaleOnFetchAbort,context:A,forceRefresh:x=false,status:f,signal:O}=i;if(!e(this,gt))return f&&(f.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:f});let c={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:l,size:d,sizeCalculation:y,noUpdateTTL:P,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:lt,allowStaleOnFetchAbort:J,ignoreFetchAbort:k,status:f,signal:O},b=e(this,L).get(e$1);if(b===void 0){f&&(f.fetch="miss");let w=h(this,a,Gt).call(this,e$1,b,c,A);return w.__returned=w}else {let w=e(this,u)[b];if(h(this,a,U).call(this,w)){let K=s&&w.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",K&&(f.returnedStale=true)),K?w.__staleWhileFetching:w.__returned=w}let g=e(this,$).call(this,b);if(!x&&!g)return f&&(f.fetch="hit"),h(this,a,Lt).call(this,b),r&&e(this,yt).call(this,b),f&&e(this,ht).call(this,f,b),w;let E=h(this,a,Gt).call(this,e$1,b,c,A),N=E.__staleWhileFetching!==void 0&&s;return f&&(f.fetch=g?"stale":"refresh",N&&g&&(f.returnedStale=true)),N?E.__staleWhileFetching:E.__returned=E}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,Ut);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,l=this.get(e$1,n);if(!o&&l!==void 0)return l;let d=s(e$1,l,{options:n,context:r});return this.set(e$1,d,n),d}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,l=e(this,L).get(e$1);if(l!==void 0){let d=e(this,u)[l],y=h(this,a,U).call(this,d);return n&&e(this,ht).call(this,n,l),e(this,$).call(this,l)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||h(this,a,ft).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(h(this,a,Lt).call(this,l),r&&e(this,yt).call(this,l),d))}else n&&(n.get="miss");}delete(e){return h(this,a,ft).call(this,e,"delete")}clear(){return h(this,a,Yt).call(this,"delete")}},X=new WeakMap,W=new WeakMap,Z=new WeakMap,vt=new WeakMap,tt=new WeakMap,Et=new WeakMap,Ut=new WeakMap,et=new WeakMap,R=new WeakMap,it=new WeakMap,L=new WeakMap,T=new WeakMap,u=new WeakMap,F=new WeakMap,Y=new WeakMap,j=new WeakMap,I=new WeakMap,st=new WeakMap,D=new WeakMap,rt=new WeakMap,nt=new WeakMap,q=new WeakMap,B=new WeakMap,ot=new WeakMap,gt=new WeakMap,M=new WeakMap,Tt=new WeakMap,a=new WeakSet,kt=function(){let e$1=new Dt(e(this,X)),i=new Dt(e(this,X));g(this,q,e$1),g(this,nt,i);let s=this.ttlAutopurge?new Array(e(this,X)):void 0;g(this,B,s),g(this,Rt,(l,d,y=e(this,et).now())=>{i[l]=d!==0?y:0,e$1[l]=d,r(l,d);}),g(this,yt,l=>{i[l]=e$1[l]!==0?e(this,et).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,d)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{e(this,$).call(this,l)&&h(this,a,ft).call(this,e(this,T)[l],"expire");},d+1);y.unref&&y.unref(),s[l]=y;}}:()=>{};g(this,ht,(l,d)=>{if(e$1[d]){let y=e$1[d],P=i[d];if(!y||!P)return;l.ttl=y,l.start=P,l.now=o||n();let S=l.now-P;l.remainingTTL=y-S;}});let o=0,n=()=>{let l=e(this,et).now();if(this.ttlResolution>0){o=l;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return l};this.getRemainingTTL=l=>{let d=e(this,L).get(l);if(d===void 0)return 0;let y=e$1[d],P=i[d];if(!y||!P)return 1/0;let S=(o||n())-P;return y-S},g(this,$,l=>{let d=i[l],y=e$1[l];return !!y&&!!d&&(o||n())-d>y});},yt=new WeakMap,ht=new WeakMap,Rt=new WeakMap,$=new WeakMap,he=function(){let e$1=new Dt(e(this,X));g(this,it,0),g(this,rt,e$1),g(this,St,i=>{g(this,it,e(this,it)-e$1[i]),e$1[i]=0;}),g(this,Pt,(i,s,r,o)=>{if(h(this,a,U).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(r))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 r}),g(this,At,(i,s,r)=>{if(e$1[i]=s,e(this,W)){let o=e(this,W)-e$1[i];for(;e(this,it)>o;)h(this,a,Nt).call(this,true);}g(this,it,e(this,it)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,it));});},St=new WeakMap,At=new WeakMap,Pt=new WeakMap,pt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,I);!(!h(this,a,Kt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,j)));)i=e(this,Y)[i];},ut=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,j);!(!h(this,a,Kt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,I)));)i=e(this,F)[i];},Kt=function(e$1){return e$1!==void 0&&e(this,L).get(e(this,T)[e$1])===e$1},Nt=function(e$1){var o;let i$1=e(this,j),s=e(this,T)[i$1],r=e(this,u)[i$1];return e(this,gt)&&h(this,a,U).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,ot)||e(this,M))&&(e(this,ot)&&((o=e(this,Z))==null||o.call(this,r,s,"evict")),e(this,M)&&e(this,D)?.push([r,s,"evict"])),e(this,St).call(this,i$1),e(this,B)?.[i$1]&&(clearTimeout(e(this,B)[i$1]),e(this,B)[i$1]=void 0),e$1&&(e(this,T)[i$1]=void 0,e(this,u)[i$1]=void 0,e(this,st).push(i$1)),e(this,R)===1?(g(this,j,g(this,I,0)),e(this,st).length=0):g(this,j,e(this,F)[i$1]),e(this,L).delete(s),i(this,R)._--,i$1},Gt=function(e$1,i,s,r){let o=i===void 0?void 0:e(this,u)[i];if(h(this,a,U).call(this,o))return o;let n=new jt,{signal:l}=s;l?.addEventListener("abort",()=>n.abort(l.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(A,x=false)=>{let{aborted:f}=n.signal,O=s.ignoreFetchAbort&&A!==void 0,c=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(f&&!x?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,O&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),f&&!O&&!x)return S(n.signal.reason,c);let b=k,w=e(this,u)[i];return (w===k||O&&x&&w===void 0)&&(A===void 0?b.__staleWhileFetching!==void 0?e(this,u)[i]=b.__staleWhileFetching:h(this,a,ft).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,d.options))),A},P=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,x)=>{let{aborted:f}=n.signal,O=f&&s.allowStaleOnFetchAbort,c=O||s.allowStaleOnFetchRejection,b=c||s.noDeleteOnFetchRejection,w=k;if(e(this,u)[i]===k&&(!b||!x&&w.__staleWhileFetching===void 0?h(this,a,ft).call(this,e$1,"fetch"):O||(e(this,u)[i]=w.__staleWhileFetching)),c)return s.status&&w.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw A},lt=(A,x)=>{var O;let f=(O=e(this,Et))==null?void 0:O.call(this,e$1,o,d);f&&f instanceof Promise&&f.then(c=>A(c===void 0?void 0:c),x),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=c=>y(c,true)));});};s.status&&(s.status.fetchDispatched=true);let k=new Promise(lt).then(y,P),J=Object.assign(k,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,J,{...d.options,status:void 0}),i=e(this,L).get(e$1)):e(this,u)[i]=J,J},U=function(e$1){if(!e(this,gt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Wt=function(e$1,i){e(this,Y)[i]=e$1,e(this,F)[e$1]=i;},Lt=function(e$1){e$1!==e(this,I)&&(e$1===e(this,j)?g(this,j,e(this,F)[e$1]):h(this,a,Wt).call(this,e(this,Y)[e$1],e(this,F)[e$1]),h(this,a,Wt).call(this,e(this,I),e$1),g(this,I,e$1));},ft=function(e$1,i$1){var r,o;let s=false;if(e(this,R)!==0){let n=e(this,L).get(e$1);if(n!==void 0)if(e(this,B)?.[n]&&(clearTimeout(e(this,B)?.[n]),e(this,B)[n]=void 0),s=true,e(this,R)===1)h(this,a,Yt).call(this,i$1);else {e(this,St).call(this,n);let l=e(this,u)[n];if(h(this,a,U).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,ot)||e(this,M))&&(e(this,ot)&&((r=e(this,Z))==null||r.call(this,l,e$1,i$1)),e(this,M)&&e(this,D)?.push([l,e$1,i$1])),e(this,L).delete(e$1),e(this,T)[n]=void 0,e(this,u)[n]=void 0,n===e(this,I))g(this,I,e(this,Y)[n]);else if(n===e(this,j))g(this,j,e(this,F)[n]);else {let d=e(this,Y)[n];e(this,F)[d]=e(this,F)[n];let y=e(this,F)[n];e(this,Y)[y]=e(this,Y)[n];}i(this,R)._--,e(this,st).push(n);}}if(e(this,M)&&e(this,D)?.length){let n=e(this,D),l;for(;l=n?.shift();)(o=e(this,tt))==null||o.call(this,...l);}return s},Yt=function(e$1){var i,s;for(let r of h(this,a,ut).call(this,{allowStale:true})){let o=e(this,u)[r];if(h(this,a,U).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,T)[r];e(this,ot)&&((i=e(this,Z))==null||i.call(this,o,n,e$1)),e(this,M)&&e(this,D)?.push([o,n,e$1]);}}if(e(this,L).clear(),e(this,u).fill(void 0),e(this,T).fill(void 0),e(this,q)&&e(this,nt)){e(this,q).fill(0),e(this,nt).fill(0);for(let r of e(this,B)??[])r!==void 0&&clearTimeout(r);e(this,B)?.fill(void 0);}if(e(this,rt)&&e(this,rt).fill(0),g(this,j,0),g(this,I,0),e(this,st).length=0,g(this,it,0),g(this,R,0),e(this,M)&&e(this,D)){let r=e(this,D),o;for(;o=r?.shift();)(s=e(this,tt))==null||s.call(this,...o);}},Ot);var Ft=class{cache;map=new Map;constructor(e){this.cache=new le({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ct="1.9.1";var qt={version:Ct};var Bt="__game_layer__";var we={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var de={};var $t={};b($t,{createExportableElement:()=>pe});var bt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(bt||={});function pe(_){try{if(typeof _>"u")return _;let e=JSON.stringify(_);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",_,e),new PixiError("not_json_serializable","Error creating exportable element")}}var Ee=typeof window<"u"&&typeof document<"u",ue=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${qt.version}`],fe=31,Ue="background:#2f90da;color:#fff;font-weight:bold;",Te="background:#c832bb;color:#fff;font-weight:bold;",Ae="background:transparent;font-weight:bold;",Xt=` v${qt.version}`;function ge(){if(!Ee)return;let _=[],e=[];for(let i=0;i<ue.length;i++){let s=ue[i],r=s.endsWith(Xt),o=r?s.slice(0,-Xt.length):s,n=o.slice(0,fe),l=o.slice(fe),d=r?"%c%s%c%s%c%s":"%c%s%c%s";_.push(d),e.push(Ue,n,Te,l),r&&e.push(Ae,Xt);}console.info(_.join(`
|
|
2
|
+
`),...e);}function Jt(){let _=window.location.pathname+window.location.hash;return _.includes("#")&&(_=_.split("#")[1]),_}ge();var me;(O=>{async function _(c,b,w){if(GameUnifier.init({navigate:b?.navigate,getCurrentGameStepState:()=>{let g=V.canvas.isInitialized?V.canvas.export():{};return {path:Jt(),storage:z.storage.export(),canvas:g,sound:mt.sound.export(),labelIndex:m.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:m.narration.openedLabels}},restoreGameStepState:async(g,E)=>{H.HistoryManagerStatic._originalStepData=g,m.NarrationManagerStatic.openedLabels=g.openedLabels,z.storage.restore(g.storage);try{V.canvas.isInitialized&&await V.canvas.restore(g.canvas),await mt.sound.restore(g.sound);}catch(N){bt.error("Error restoring game step state:",N);}await E(g.path);},getStepCounter:()=>m.narration.stepCounter,setStepCounter:g=>{m.NarrationManagerStatic._stepCounter=g;},getOpenedLabels:()=>m.narration.openedLabels.length,addHistoryItem:(g,E)=>H.stepHistory.add(g,E),getCharacter:g=>Qt.RegisteredCharacters.get(g),processNavigationRequests:(g,E)=>{let N=g,K=Promise.resolve();return g>0?(N--,K=m.narration.continue(E)):g<0&&(N=0,K=H.stepHistory.back(E,{steps:g*-1})),{newValue:N,result:K}},animate:(g,E,N,K)=>motion.animate(g,E,N,K),getVariable:(g,E)=>z.StorageRegistry.getVariable(g,E),setVariable:(g,E,N)=>z.StorageRegistry.setVariable(g,E,N),removeVariable:(g,E)=>z.StorageRegistry.removeVariable(g,E),getFlag:g=>z.storage.flags.get(g),setFlag:(g,E)=>z.storage.flags.set(g,E),onLabelClosing:g=>z.StorageRegistry.clearOldTempVariables(g)}),!c||!b){bt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await V.canvas.init(c,b,w)}O.init=_;function e(){z.storage.clear(),V.canvas.isInitialized&&V.canvas.clear(),mt.sound.clear(),m.narration.clear(),H.stepHistory.clear();}O.clear=e;function i(){let c=V.canvas.isInitialized?V.canvas.export():{};return {pixivn_version:Ct,stepData:m.narration.export(),storageData:z.storage.export(),canvasData:c,soundData:mt.sound.export(),historyData:H.stepHistory.export(),path:Jt()}}O.exportGameState=i;async function s(c){H.stepHistory.restore(c.historyData);let b=H.stepHistory.lastKey;if(typeof b=="number"){let w=H.stepHistory.stepsInfoMap.get(b)||null;await m.narration.restore(c.stepData,w);}z.storage.restore(c.storageData);try{V.canvas.isInitialized&&await V.canvas.restore(c.canvasData),await mt.sound.restore(c.soundData);}catch{}await GameUnifier.navigate(c.path);}O.restoreGameState=s;async function r(c,b){return O.clear(),await m.narration.call(c,b)}O.start=r;function o(c){return JSON.parse(c)}O.jsonToGameState=o;function n(c){GameUnifier.onEnd=c;}O.onEnd=n;function l(c){return GameUnifier.addOnError(c)}O.addOnError=l;function d(c){return GameUnifier.removeOnError(c)}O.removeOnError=d;function y(c){m.NarrationManagerStatic.onStepStart=c;}O.onStepStart=y;function P(c){m.NarrationManagerStatic.onLoadingLabel=c;}O.onLoadingLabel=P;function S(c){m.NarrationManagerStatic.onStepEnd=c;}O.onStepEnd=S;function lt(c){m.NarrationManagerStatic.onLabelStarting=c;}O.onLabelStarting=lt;function k(c){m.NarrationManagerStatic.onLabelClosing=c;}O.onLabelClosing=k;function J(c){GameUnifier.navigate=c;}O.onNavigate=J;function A(c){return GameUnifier.addOnPreContinue(c)}O.addOnPreContinue=A;function x(c){return GameUnifier.removeOnPreContinue(c)}O.removeOnPreContinue=x;(K=>{let c,b={};function w(_t){b=_t;}K.setProps=w;function g(_t){c&&E();let Zt=_t?.windowKey??"pixiVN",Mt=[],wt=C=>({...b,...C}),zt={Game:O,narration:m.narration,storage:z.storage,stepHistory:H.stepHistory,get props(){return b},start:(C,Q)=>O.start(C,wt(Q)),continue:(C,Q)=>m.narration.continue(wt(C),Q),call:(C,Q)=>m.narration.call(C,wt(Q)),jump:(C,Q)=>m.narration.jump(C,wt(Q)),selectChoice:(C,Q)=>{let ee=m.narration.choices.list?.find(Vt=>Vt.choiceIndex===C);if(!ee){let Vt=m.narration.choices.list?.map(_e=>_e.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${C}. Available: ${Vt}`)}return m.narration.choices.select(ee,wt(Q))},setInput:C=>{m.narration.input.value=C;},goBack:(C,Q)=>H.stepHistory.back(wt(C),Q),closeCurrentLabel:()=>m.narration.labels.closeCurrent(),closeAllLabels:()=>m.narration.labels.closeAll(),getState:()=>({dialogue:m.narration.dialogue,dialogueGlue:m.narration.dialogGlue,choices:m.narration.choices.list,input:{isRequired:m.narration.input.isRequired,type:m.narration.input.type,value:m.narration.input.value},canContinue:m.narration.canContinue,canGoBack:H.stepHistory.canGoBack,labelsOpened:m.narration.labels.opened,currentLabelId:m.narration.labels.current?.id,stepCounter:m.narration.stepCounter}),get errors(){return Mt.slice()},clearErrors:()=>{Mt.length=0;}},te=C=>{Mt.push({error:C,timestamp:Date.now()});};return O.addOnError(te),typeof window<"u"?window[Zt]=zt:bt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),c={api:zt,windowKey:Zt,errorHandler:te},zt}K.enable=g;function E(){c&&(O.removeOnError(c.errorHandler),typeof window<"u"&&window[c.windowKey]===c.api&&delete window[c.windowKey],c=void 0);}K.disable=E;function N(){return c!==void 0}K.isEnabled=N;})(O.testing||={});})(me||={});var ii={characterUtils:Qt,canvasUtils:V,narrationUtils:m,soundUtils:mt,CANVAS_APP_GAME_LAYER_ALIAS:Bt,PIXIVN_VERSION:Ct,...$t,...de,canvas:V.canvas,narration:m.narration,sound:mt.sound,storage:z.storage,history:H.stepHistory,Game:me,GameUnifier:GameUnifier};export{Bt as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,me as Game,Ct as PIXIVN_VERSION,we as SYSTEM_RESERVED_STORAGE_KEYS,pe as createExportableElement,ii as default};
|