@drincs/pixi-vn 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +3 -47
  2. package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
  3. package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
  4. package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
  5. package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
  6. package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
  7. package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
  8. package/dist/characters.cjs +1 -1
  9. package/dist/characters.d.cts +54 -50
  10. package/dist/characters.d.ts +54 -50
  11. package/dist/characters.mjs +1 -1
  12. package/dist/chunk-K7JIC2F2.mjs +1 -0
  13. package/dist/{chunk-36I5IN5S.mjs → chunk-V34PMA2H.mjs} +1 -1
  14. package/dist/history.d.cts +2 -2
  15. package/dist/history.d.ts +2 -2
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.d.cts +21 -6
  18. package/dist/index.d.ts +21 -6
  19. package/dist/index.mjs +2 -2
  20. package/dist/narration.d.cts +3 -3
  21. package/dist/narration.d.ts +3 -3
  22. package/dist/storage.cjs +1 -1
  23. package/dist/storage.d.cts +3 -3
  24. package/dist/storage.d.ts +3 -3
  25. package/dist/storage.mjs +1 -1
  26. package/dist/vite-listener.cjs +1 -1
  27. package/dist/vite-listener.d.cts +13 -4
  28. package/dist/vite-listener.d.ts +13 -4
  29. package/dist/vite-listener.mjs +1 -1
  30. package/dist/vite.cjs +1 -1
  31. package/dist/vite.d.cts +66 -36
  32. package/dist/vite.d.ts +66 -36
  33. package/dist/vite.mjs +1 -1
  34. package/package.json +14 -6
  35. package/dist/chunk-TTRUPDAB.mjs +0 -1
@@ -1,37 +1,45 @@
1
- import { S as StoredClassModel } from './StoredClassModel-a4pvgJXD.js';
1
+ import { S as StoredClassModel } from './StoredClassModel-upXPNQTp.js';
2
2
  import { CharacterInterface as CharacterInterface$1 } from '@drincs/pixi-vn';
3
- import './StorageElementType-DkJ394kq.js';
3
+ import './StorageElementType-C7ETezlL.js';
4
+
5
+ declare class CharacterStoredClass extends StoredClassModel {
6
+ private sourceId;
7
+ constructor(id: string, emotion?: string);
8
+ getStorageProperty<T>(propertyName: string): T | undefined;
9
+ }
4
10
 
5
11
  /**
6
12
  * CharacterBaseModelProps is an interface that is used to create a character model.
7
13
  */
8
14
  interface CharacterBaseModelProps {
9
15
  /**
10
- * The name of the character.
16
+ * The character's name.
11
17
  */
12
18
  name?: string;
13
19
  /**
14
- * The surname of the character.
20
+ * The character's surname.
15
21
  */
16
22
  surname?: string;
17
23
  /**
18
- * The age of the character.
24
+ * The character's age.
19
25
  */
20
26
  age?: number;
21
27
  /**
22
- * The icon of the character.
28
+ * The character's icon image URL.
23
29
  */
24
30
  icon?: string;
25
31
  /**
26
- * The color of the character.
32
+ * The character's color.
27
33
  */
28
34
  color?: string;
29
35
  }
30
36
 
31
- declare class CharacterStoredClass extends StoredClassModel {
32
- private sourceId;
33
- constructor(id: string, emotion?: string);
34
- getStorageProperty<T>(propertyName: string): T | undefined;
37
+ /**
38
+ * CharacterEmotionId is used to identify a character together with an emotion.
39
+ */
40
+ interface CharacterEmotionId {
41
+ id: string;
42
+ emotion: string;
35
43
  }
36
44
 
37
45
  /**
@@ -39,64 +47,63 @@ declare class CharacterStoredClass extends StoredClassModel {
39
47
  * You must use the {@link RegisteredCharacters.add} function to save the character in the game.
40
48
  * It is raccomended to create your own class Character, read more here: https://pixi-vn.web.app/start/character.html#custom-character
41
49
  * @example
42
- * ```typescript
43
- * export const liam = new CharacterBaseModel('liam', {
44
- * name: 'Liam',
45
- * surname: 'Smith',
50
+ * ```ts
51
+ * import { CharacterBaseModel, RegisteredCharacters } from "@drincs/pixi-vn";
52
+ *
53
+ * export const liam = new CharacterBaseModel("liam", {
54
+ * name: "Liam",
55
+ * surname: "Smith",
46
56
  * age: 25,
47
- * icon: "https://pixijs.com/assets/eggHead.png",
48
- * color: "#9e2e12"
57
+ * icon: "https://example.com/liam.png",
58
+ * color: "#9e2e12",
49
59
  * });
50
- * export const alice = new CharacterBaseModel('alice', {
51
- * name: 'Alice',
52
- * surname: 'Smith',
53
- * age: 25,
54
- * icon: "https://pixijs.com/assets/eggHead.png",
55
- * color: "#9e2e12"
60
+ *
61
+ * export const emma = new CharacterBaseModel("emma", {
62
+ * name: "Emma",
63
+ * surname: "Johnson",
64
+ * age: 23,
65
+ * icon: "https://example.com/emma.png",
66
+ * color: "#9e2e12",
56
67
  * });
57
- * RegisteredCharacters.add([liam, alice]);
68
+ *
69
+ * RegisteredCharacters.add([liam, emma]);
58
70
  * ```
59
71
  */
60
72
  declare class CharacterBaseModel extends CharacterStoredClass {
61
73
  /**
62
- * @param id The id of the character.
74
+ * @param id A unique identifier (string). It is used to reference the character in the game (must be unique). If you want to create a character with an "emotion", you can pass an object.
63
75
  * @param props The properties of the character.
64
76
  */
65
- constructor(id: string | {
66
- id: string;
67
- emotion: string;
68
- }, props: CharacterBaseModelProps);
69
- private defaultName?;
77
+ constructor(id: string | CharacterEmotionId, props: CharacterBaseModelProps);
78
+ readonly defaultName?: string;
70
79
  /***
71
80
  * The name of the character.
72
81
  * If you set undefined, it will return the default name.
73
82
  */
74
83
  get name(): string;
75
84
  set name(value: string | undefined);
76
- private defaultSurname?;
85
+ readonly defaultSurname?: string;
77
86
  /**
78
87
  * The surname of the character.
79
88
  * If you set undefined, it will return the default surname.
80
89
  */
81
90
  get surname(): string | undefined;
82
91
  set surname(value: string | undefined);
83
- private defaultAge?;
92
+ readonly defaultAge?: number | undefined;
84
93
  /**
85
94
  * The age of the character.
86
95
  * If you set undefined, it will return the default age.
87
96
  */
88
97
  get age(): number | undefined;
89
98
  set age(value: number | undefined);
90
- private _icon?;
91
99
  /**
92
100
  * The icon of the character.
93
101
  */
94
- get icon(): string | undefined;
95
- private _color?;
102
+ readonly icon?: string;
96
103
  /**
97
104
  * The color of the character.
98
105
  */
99
- get color(): string | undefined;
106
+ readonly color?: string | undefined;
100
107
  }
101
108
 
102
109
  declare namespace RegisteredCharacters {
@@ -167,38 +174,35 @@ declare namespace RegisteredCharacters {
167
174
  * this.defaultName = props.name
168
175
  * this.defaultSurname = props.surname
169
176
  * this.defaultAge = props.age
170
- * this._icon = props.icon
171
- * this._color = props.color
177
+ * this.icon = props.icon
178
+ * this.color = props.color
172
179
  * }
173
- * private defaultName: string = ""
180
+ * readonly defaultName: string = ""
174
181
  * get name(): string {
175
182
  * return this.getStorageProperty<string>("name") || this.defaultName
176
183
  * }
177
184
  * set name(value: string | undefined) {
178
- * this.setStorageProperty<string>("name", value)
185
+ * this.setStorageProperty("name", value)
179
186
  * }
180
- * private defaultSurname?: string
187
+ * readonly defaultSurname?: string
181
188
  * get surname(): string | undefined {
182
189
  * return this.getStorageProperty<string>("surname") || this.defaultSurname
183
190
  * }
184
191
  * set surname(value: string | undefined) {
185
- * this.setStorageProperty<string>("surname", value)
192
+ * this.setStorageProperty("surname", value)
186
193
  * }
187
- * private defaultAge?: number | undefined
194
+ * readonly defaultAge?: number | undefined
188
195
  * get age(): number | undefined {
189
196
  * return this.getStorageProperty<number>("age") || this.defaultAge
190
197
  * }
191
198
  * set age(value: number | undefined) {
192
- * this.setStorageProperty<number>("age", value)
199
+ * this.setStorageProperty("age", value)
193
200
  * }
194
- * private _icon?: string
201
+ * readonly icon?: string
195
202
  * get icon(): string | undefined {
196
203
  * return this._icon
197
204
  * }
198
- * private _color?: string | undefined
199
- * get color(): string | undefined {
200
- * return this._color
201
- * }
205
+ * readonly color?: string | undefined
202
206
  * }
203
207
  * ```
204
208
  */
@@ -209,4 +213,4 @@ interface CharacterInterface {
209
213
  id: string;
210
214
  }
211
215
 
212
- export { CharacterBaseModel, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
216
+ export { CharacterBaseModel, type CharacterEmotionId, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
@@ -1 +1 @@
1
- import {b}from'./chunk-36I5IN5S.mjs';import {n}from'./chunk-IWAXXFXE.mjs';import {e,f,d as d$1}from'./chunk-Z4GZCINS.mjs';var l="@",i=class extends b{constructor(e,r=""){super(n.CHARACTER_CATEGORY_KEY,e+(r?l+r:""));d$1(this,"sourceId");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 u=class extends i{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);d$1(this,"defaultName");d$1(this,"defaultSurname");d$1(this,"defaultAge");d$1(this,"_icon");d$1(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var s=new e({cacheSize:10}),d;(y=>{function f$1(t){try{let n=s.get(t);if(!n){f.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){f.error(`Error while getting Character "${t}"`,n);return}}y.get=f$1;function g(t){if(Array.isArray(t)){t.forEach(n=>{g(n);});return}s.get(t.id)&&f.info(`Character id "${t.id}" already exists, it will be overwritten`),s.set(t.id,t);}y.add=g;function e(){return Array.from(s.values())}y.values=e;function r(t){return s.has(t)}y.has=r;function C(){return Array.from(s.keys())}y.keys=C;})(d||(d={}));var p=d;export{u as CharacterBaseModel,i as CharacterStoredClass,p as RegisteredCharacters};
1
+ import {b}from'./chunk-V34PMA2H.mjs';import {n}from'./chunk-IWAXXFXE.mjs';import {e,f as f$1,d as d$1}from'./chunk-Z4GZCINS.mjs';var l="@",o=class extends b{constructor(e,r=""){super(n.CHARACTER_CATEGORY_KEY,e+(r?l+r:""));d$1(this,"sourceId");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 d=class extends o{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);d$1(this,"defaultName");d$1(this,"defaultSurname");d$1(this,"defaultAge");d$1(this,"icon");d$1(this,"color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}};var s=new e({cacheSize:10}),f;(C=>{function c(t){try{let n=s.get(t);if(!n){f$1.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return n}catch(n){f$1.error(`Error while getting Character "${t}"`,n);return}}C.get=c;function u(t){if(Array.isArray(t)){t.forEach(n=>{u(n);});return}s.get(t.id)&&f$1.info(`Character id "${t.id}" already exists, it will be overwritten`),s.set(t.id,t);}C.add=u;function e(){return Array.from(s.values())}C.values=e;function r(t){return s.has(t)}C.has=r;function y(){return Array.from(s.keys())}C.keys=y;})(f||(f={}));var p=f;export{d as CharacterBaseModel,o as CharacterStoredClass,p as RegisteredCharacters};
@@ -0,0 +1 @@
1
+ var i=Object.create;var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var h=b=>{throw TypeError(b)};var n=(b,a,c)=>a in b?f(b,a,{enumerable:true,configurable:true,writable:true,value:c}):b[a]=c;var r=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports),s=(b,a)=>{for(var c in a)f(b,c,{get:a[c],enumerable:true});},o=(b,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of k(a))!m.call(b,e)&&e!==c&&f(b,e,{get:()=>a[e],enumerable:!(d=j(a,e))||d.enumerable});return b};var t=(b,a,c)=>(c=b!=null?i(l(b)):{},o(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:true}):c,b));var u=(b,a,c)=>n(b,typeof a!="symbol"?a+"":a,c),g=(b,a,c)=>a.has(b)||h("Cannot "+c);var p=(b,a,c)=>(g(b,a,"read from private field"),c?c.call(b):a.get(b)),v=(b,a,c)=>a.has(b)?h("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(b):a.set(b,c),q=(b,a,c,d)=>(g(b,a,"write to private field"),d?d.call(b,c):a.set(b,c),c),w=(b,a,c)=>(g(b,a,"access private method"),c);var x=(b,a,c,d)=>({set _(e){q(b,a,e,c);},get _(){return p(b,a,d)}});export{r as a,s as b,t as c,u as d,p as e,v as f,q as g,w as h,x as i};
@@ -1 +1 @@
1
- import {k as k$1,m,j,l,n}from'./chunk-IWAXXFXE.mjs';import {e,g,f as f$1,d}from'./chunk-Z4GZCINS.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';var T;(n=>{n.storage=new e({cacheSize:50}),n.defaultStorage=new e({cacheSize:10}),n.tempStorageDeadlines=new Map;let s;function c(r){n.tempStorageDeadlines.forEach((l,o)=>{l>r&&(n.storage.delete(`${k$1}:${o}`),s?.onClearOldTempVariable?.(o),n.tempStorageDeadlines.delete(o));});}n.clearOldTempVariables=c;function h(r){s=r;}n.setExternalStoreHandler=h;function V(r,l,o){o==null?n.storage.delete(`${r}:${l}`):n.storage.set(`${r}:${l}`,o),s?.onSetVariable?.(l,o);}n.setVariable=V;function O(r,l){let o=n.storage.get(`${r}:${l}`);return g(o)}n.getVariable=O;function M(r,l){n.storage.delete(`${r}:${l}`),s?.onRemoveVariable?.(l);}n.removeVariable=M;function D(r,l){let o=n.storage.get(m)||[];if(l)o.includes(r)||o.push(r);else {let x=o.indexOf(r);x>-1&&o.splice(x,1);}n.storage.set(m,o);}n.setFlag=D;function R(r){return (n.storage.get(m)||[]).includes(r)}n.getFlag=R;})(T||(T={}));var a=T;var S=class{get base(){return a.storage.map}get cache(){return a.storage.cache}get tempStorageDeadlines(){return a.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([e,s])=>{a.defaultStorage.map.set(e,s);});}set(t,e){return a.setVariable(j,t,e)}get(t){let e=a.getVariable(k$1,t);return e===void 0&&(e=a.getVariable(j,t)),e===void 0&&(e=g(a.defaultStorage.get(t))),e}remove(t){return this.removeTempVariable(t),a.removeVariable(j,t)}setTempVariable(t,e){if(e==null){this.removeTempVariable(t);return}else a.setVariable(k$1,t,e),this.tempStorageDeadlines.has(t)||this.tempStorageDeadlines.set(t,GameUnifier.openedLabels);}removeTempVariable(t){a.removeVariable(k$1,t),this.tempStorageDeadlines.has(t)&&this.tempStorageDeadlines.delete(t);}setFlag(t,e){return a.setFlag(t,e)}getFlag(t){return a.getFlag(t)}setStorageHandler(t){a.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let e=[];return [...a.tempStorageDeadlines.keys()].forEach(s=>{e.push({key:s,value:this.tempStorageDeadlines.get(s)});}),g({main:t,tempDeadlines:e})}restore(t){this.clear();try{t?(t.base?.forEach(e=>{switch(e.key){case "___current_dialogue_memory___":a.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,e.value);break;case "___last_dialogue_added_in_step_memory___":a.setVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_menu_options_memory___":a.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,e.value);break;case "___last_menu_options_added_in_step_memory___":a.setVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "_input_value_":a.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,e.value);break;case "___last_input_added_in_step_memory___":a.setVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_input_info_memory___":a.setVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY,e.value);break;case "___opened_labels_counter___":a.setVariable(l,n.OPENED_LABELS_COUNTER_KEY,e.value);break;case "___all_choices_made___":a.setVariable(l,n.ALL_CHOICES_MADE_KEY,e.value);break;case "___current_step_times_counter___":a.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,e.value);break;case "___last_step_glued___":a.setVariable(l,n.LAST_STEP_GLUED,e.value);break;default:a.setVariable(j,e.key,e.value);}}),t.temp?.forEach(e=>{a.setVariable(k$1,e.key,e.value);}),t.flags?.forEach(e=>{a.setFlag(e,!0);}),t.main?.forEach(e=>{this.base.set(e.key,e.value);}),t.tempDeadlines?.forEach(e=>{this.tempStorageDeadlines.set(e.key,e.value);})):f$1.warn("No storage data found");}catch(e){f$1.error("Error importing data",e);}}};var f=class{constructor(t,e){d(this,"id");d(this,"categoryId");this.categoryId=t,this.id=e,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let e=a.getVariable(j,t);e&&(Object.entries(e).forEach(([s,c])=>{typeof c=="object"&&c!==null&&Object.entries(c).forEach(([h,V])=>{a.setVariable(this.categoryId,`${s}:${h}`,V);});}),a.removeVariable(j,t));}setStorageProperty(t,e){a.setVariable(this.categoryId,`${this.id}:${t}`,e);}getStorageProperty(t,e=this.id){return a.getVariable(this.categoryId,`${e}:${t}`)}};var k=new S;export{a,f as b,k as c};
1
+ import {k as k$1,m,j,l,n}from'./chunk-IWAXXFXE.mjs';import {e,g,f as f$1,d}from'./chunk-Z4GZCINS.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';var T;(n=>{n.storage=new e({cacheSize:50}),n.defaultStorage=new e({cacheSize:10}),n.tempStorageDeadlines=new Map;let s;function c(r){n.tempStorageDeadlines.forEach((l,o)=>{l>r&&(n.storage.delete(`${k$1}:${o}`),s?.onClearOldTempVariable?.(o),n.tempStorageDeadlines.delete(o));});}n.clearOldTempVariables=c;function y(r){s=r;}n.setExternalStoreHandler=y;function V(r,l,o){o==null?n.storage.delete(`${r}:${l}`):n.storage.set(`${r}:${l}`,o),s?.onSetVariable?.(l,o);}n.setVariable=V;function O(r,l){let o=n.storage.get(`${r}:${l}`);return g(o)}n.getVariable=O;function M(r,l){n.storage.delete(`${r}:${l}`),s?.onRemoveVariable?.(l);}n.removeVariable=M;function D(r,l){let o=n.storage.get(m)||[];if(l)o.includes(r)||o.push(r);else {let x=o.indexOf(r);x>-1&&o.splice(x,1);}n.storage.set(m,o);}n.setFlag=D;function R(r){return (n.storage.get(m)||[]).includes(r)}n.getFlag=R;})(T||(T={}));var a=T;var S=class{get base(){return a.storage.map}get cache(){return a.storage.cache}get tempStorageDeadlines(){return a.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([e,s])=>{a.defaultStorage.map.set(e,s);});}set(t,e){return a.setVariable(j,t,e)}get(t){let e=a.getVariable(k$1,t);return e===void 0&&(e=a.getVariable(j,t)),e===void 0&&(e=g(a.defaultStorage.get(t))),e}remove(t){return this.removeTempVariable(t),a.removeVariable(j,t)}setTempVariable(t,e){if(e==null){this.removeTempVariable(t);return}else a.setVariable(k$1,t,e),this.tempStorageDeadlines.has(t)||this.tempStorageDeadlines.set(t,GameUnifier.openedLabels);}removeTempVariable(t){a.removeVariable(k$1,t),this.tempStorageDeadlines.has(t)&&this.tempStorageDeadlines.delete(t);}setFlag(t,e){return a.setFlag(t,e)}getFlag(t){return a.getFlag(t)}setStorageHandler(t){a.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let e=[];return [...a.tempStorageDeadlines.keys()].forEach(s=>{e.push({key:s,value:this.tempStorageDeadlines.get(s)});}),g({main:t,tempDeadlines:e})}restore(t){this.clear();try{t?(t.base?.forEach(e=>{switch(e.key){case "___current_dialogue_memory___":a.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,e.value);break;case "___last_dialogue_added_in_step_memory___":a.setVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_menu_options_memory___":a.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,e.value);break;case "___last_menu_options_added_in_step_memory___":a.setVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "_input_value_":a.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,e.value);break;case "___last_input_added_in_step_memory___":a.setVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_input_info_memory___":a.setVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY,e.value);break;case "___opened_labels_counter___":a.setVariable(l,n.OPENED_LABELS_COUNTER_KEY,e.value);break;case "___all_choices_made___":a.setVariable(l,n.ALL_CHOICES_MADE_KEY,e.value);break;case "___current_step_times_counter___":a.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,e.value);break;case "___last_step_glued___":a.setVariable(l,n.LAST_STEP_GLUED,e.value);break;default:a.setVariable(j,e.key,e.value);}}),t.temp?.forEach(e=>{a.setVariable(k$1,e.key,e.value);}),t.flags?.forEach(e=>{a.setFlag(e,!0);}),t.main?.forEach(e=>{this.base.set(e.key,e.value);}),t.tempDeadlines?.forEach(e=>{this.tempStorageDeadlines.set(e.key,e.value);})):f$1.warn("No storage data found");}catch(e){f$1.error("Error importing data",e);}}};var f=class{constructor(t,e){d(this,"id");d(this,"categoryId");this.categoryId=t,this.id=e,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let e=a.getVariable(j,t);e&&(Object.entries(e).forEach(([s,c])=>{typeof c=="object"&&c!==null&&Object.entries(c).forEach(([y,V])=>{a.setVariable(this.categoryId,`${s}:${y}`,V);});}),a.removeVariable(j,t));}setStorageProperty(t,e){a.setVariable(this.categoryId,`${this.id}:${t}`,e);}getStorageProperty(t,e=this.id){return a.getVariable(this.categoryId,`${e}:${t}`)}};var k=new S;export{a,f as b,k as c};
@@ -1,9 +1,9 @@
1
1
  import { GameStepState, HistoryInfo } 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, N as NarrationHistory, d as StepLabelPropsType, e as StepLabelResultType } from './HistoryChoiceMenuOption-DSSNUXEq.cjs';
4
+ import { c as HistoryStep, N as NarrationHistory, S as StepLabelPropsType, e as StepLabelResultType } from './HistoryChoiceMenuOption-DdwePsOm.cjs';
5
5
  import 'lru-cache';
6
- import './StorageElementType-DkJ394kq.cjs';
6
+ import './StorageElementType-C7ETezlL.cjs';
7
7
 
8
8
  /**
9
9
  * Interface exported step data
package/dist/history.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { GameStepState, HistoryInfo } 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, N as NarrationHistory, d as StepLabelPropsType, e as StepLabelResultType } from './HistoryChoiceMenuOption-BP9Tsbyd.js';
4
+ import { c as HistoryStep, N as NarrationHistory, S as StepLabelPropsType, e as StepLabelResultType } from './HistoryChoiceMenuOption-CS41KG13.js';
5
5
  import 'lru-cache';
6
- import './StorageElementType-DkJ394kq.js';
6
+ import './StorageElementType-C7ETezlL.js';
7
7
 
8
8
  /**
9
9
  * Interface exported step data
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),C=require('@drincs/pixi-vn/narration'),ut=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var C__namespace=/*#__PURE__*/_interopNamespace(C);var ut__namespace=/*#__PURE__*/_interopNamespace(ut);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Jt=Object.defineProperty;var Qt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Jt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Jt(h,i,{get:e[i],enumerable:true});};var E=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Qt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Gt=typeof process=="object"&&process?process:{},se=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof Nt>"u"){Zt=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){E(this,"signal",new Zt);e();}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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,se("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 ge=h=>!ie.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),re=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=re(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),te,ee,K,M,q,ft,$,yt,xt,B,U,X,T,b,m,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,Et,l,It,mt,ot,Ot,Y,ne,gt,wt,Tt,lt,ht,Mt,Lt,Ct,w,zt,At,ct,Vt,bt,oe=(bt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ft);_(this,$);_(this,yt);_(this,xt);_(this,B);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");_(this,U);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,D);_(this,J);_(this,L);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,mt,()=>{});_(this,ot,()=>{});_(this,Ot,()=>{});_(this,Y,()=>false);_(this,gt,e=>{});_(this,wt,(e,i,s)=>{});_(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?re(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=A||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,D,0),u(this,J,_e.create(i)),u(this,U,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof R=="function"&&u(this,ft,R),typeof S=="function"?(u(this,$,S),u(this,L,[])):(u(this,$,void 0),u(this,L,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ft)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))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");d(this,l,ne).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ie.add(Pt),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,bt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,D)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,w).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,U)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,w).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,w).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,w).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,w).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,w).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,A;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=t(this,Tt).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&R>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,U)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,U)===0?t(this,D):t(this,J).length!==0?t(this,J).pop():t(this,U)===t(this,K)?d(this,l,Lt).call(this,false):t(this,U),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,D)]=S,t(this,z)[S]=t(this,D),u(this,D,S),Rt(this,U)._++,t(this,wt).call(this,S,R,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ft))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,w).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,L)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,L)?.push([y,e,"set"]));if(t(this,gt).call(this,S),t(this,wt).call(this,S,R,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,w).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Ot).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,L)){let y=t(this,L),a;for(;a=y?.shift();)(A=t(this,$))==null||A.call(this,...a);}return this}pop(){var e;try{for(;t(this,U);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,L)){let i=t(this,L),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,w).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,mt).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,w).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,O,A);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,w).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,mt).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,w).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,mt).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Ot,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,mt,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],R=i[p];if(!v||!R)return;c.ttl=v,c.start=R,c.now=n||o();let S=c.now-R;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],R=i[p];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,ne=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,gt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Tt,(i,s,r,n)=>{if(d(this,l,w).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(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}),u(this,wt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},gt=new WeakMap,wt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,D);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,D)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,L)?.push([r,s,"evict"])),t(this,gt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,U)===1?(u(this,N,u(this,D,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,w).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(A===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,p.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,f=O||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},w=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,D)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,D),e),u(this,D,e));},ct=function(e,i){var r,n;let s=false;if(t(this,U)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,U)===1)d(this,l,Vt).call(this,i);else {t(this,gt).call(this,o);let c=t(this,m)[o];if(d(this,l,w).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,L)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,D))u(this,D,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,U)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,L)?.length){let o=t(this,L),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,w).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,L)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,D,0),t(this,J).length=0,u(this,X,0),u(this,U,0),t(this,j)&&t(this,L)){let r=t(this,L),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},bt);var Ft=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new oe({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 Ut="1.8.1";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 le={};var kt={};fe(kt,{createExportableElement:()=>he});var pt;(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)))(pt||(pt={}));function he(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",ce=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],de=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",we="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function pe(){if(!ye)return;let h=[],e=[];for(let i=0;i<ce.length;i++){let s=ce[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,de),c=n.slice(de),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(we,qt);}console.info(h.join(`
2
- `),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}pe();exports.Game=void 0;(y=>{async function h(a,x,O){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:ut__namespace.sound.export(),labelIndex:C__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,C__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await ut__namespace.sound.restore(f.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>C__namespace.narration.stepCounter,setStepCounter:f=>{C__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>C__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=C__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,O)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}ut__namespace.sound.clear(),C__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:ut__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let O=et__namespace.stepHistory.lastKey;if(typeof O=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(O)||null;await C__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await ut__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function A(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=A;})(exports.Game||(exports.Game={}));var Ze={characterUtils:Xt__namespace,canvasUtils:nt__namespace,narrationUtils:C__namespace,soundUtils:ut__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...le,canvas:nt__namespace.canvas,narration:C__namespace.narration,sound:ut__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=he;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Xt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Xt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(C).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return C[k]}})});Object.keys(ut).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ut[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),C=require('@drincs/pixi-vn/narration'),ut=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var C__namespace=/*#__PURE__*/_interopNamespace(C);var ut__namespace=/*#__PURE__*/_interopNamespace(ut);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Jt=Object.defineProperty;var Qt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Jt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Jt(h,i,{get:e[i],enumerable:true});};var E=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Qt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Gt=typeof process=="object"&&process?process:{},se=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof Nt>"u"){Zt=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){E(this,"signal",new Zt);e();}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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,se("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 ge=h=>!ie.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),re=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=re(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),te,ee,K,M,q,ft,$,yt,xt,B,U,X,T,w,m,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,Et,l,It,mt,ot,Ot,Y,ne,gt,bt,Tt,lt,ht,Mt,Lt,Ct,b,zt,At,ct,Vt,wt,oe=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ft);_(this,$);_(this,yt);_(this,xt);_(this,B);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");_(this,U);_(this,X);_(this,T);_(this,w);_(this,m);_(this,P);_(this,z);_(this,N);_(this,D);_(this,J);_(this,L);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,mt,()=>{});_(this,ot,()=>{});_(this,Ot,()=>{});_(this,Y,()=>false);_(this,gt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?re(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=A||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,w,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,D,0),u(this,J,_e.create(i)),u(this,U,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof R=="function"&&u(this,ft,R),typeof S=="function"?(u(this,$,S),u(this,L,[])):(u(this,$,void 0),u(this,L,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ft)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))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");d(this,l,ne).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ie.add(Pt),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,w),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,D)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,U)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,w)[e];i!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,w)[e];i!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,w)[i],r=t(this,m)[i],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,A;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=t(this,Tt).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&R>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,U)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,U)===0?t(this,D):t(this,J).length!==0?t(this,J).pop():t(this,U)===t(this,K)?d(this,l,Lt).call(this,false):t(this,U),t(this,w)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,D)]=S,t(this,z)[S]=t(this,D),u(this,D,S),Rt(this,U)._++,t(this,bt).call(this,S,R,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ft))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,L)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,L)?.push([y,e,"set"]));if(t(this,gt).call(this,S),t(this,bt).call(this,S,R,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Ot).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,L)){let y=t(this,L),a;for(;a=y?.shift();)(A=t(this,$))==null||A.call(this,...a);}return this}pop(){var e;try{for(;t(this,U);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,L)){let i=t(this,L),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,mt).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,O,A);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,b).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,mt).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,b).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,mt).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,w=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Ot,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,mt,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,w)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],R=i[p];if(!v||!R)return;c.ttl=v,c.start=R,c.now=n||o();let S=c.now-R;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],R=i[p];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,ne=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,gt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Tt,(i,s,r,n)=>{if(d(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(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}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},gt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,D);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,D)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,w)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,w)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,L)?.push([r,s,"evict"])),t(this,gt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,w)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,U)===1?(u(this,N,u(this,D,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,b).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(A===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,p.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,f=O||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},b=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,D)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,D),e),u(this,D,e));},ct=function(e,i){var r,n;let s=false;if(t(this,U)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,U)===1)d(this,l,Vt).call(this,i);else {t(this,gt).call(this,o);let c=t(this,m)[o];if(d(this,l,b).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,L)?.push([c,e,i])),t(this,T).delete(e),t(this,w)[o]=void 0,t(this,m)[o]=void 0,o===t(this,D))u(this,D,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,U)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,L)?.length){let o=t(this,L),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,w)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,L)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,w).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,D,0),t(this,J).length=0,u(this,X,0),u(this,U,0),t(this,j)&&t(this,L)){let r=t(this,L),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new oe({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 Ut="1.8.2";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 le={};var kt={};fe(kt,{createExportableElement:()=>he});var pt;(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)))(pt||(pt={}));function he(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",ce=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],de=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function pe(){if(!ye)return;let h=[],e=[];for(let i=0;i<ce.length;i++){let s=ce[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,de),c=n.slice(de),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
2
+ `),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}pe();exports.Game=void 0;(y=>{async function h(a,x,O){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:ut__namespace.sound.export(),labelIndex:C__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,C__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await ut__namespace.sound.restore(f.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>C__namespace.narration.stepCounter,setStepCounter:f=>{C__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>C__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=C__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,O)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}ut__namespace.sound.clear(),C__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:ut__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let O=et__namespace.stepHistory.lastKey;if(typeof O=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(O)||null;await C__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await ut__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function A(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=A;})(exports.Game||(exports.Game={}));var ti={characterUtils:Xt__namespace,canvasUtils:nt__namespace,narrationUtils:C__namespace,soundUtils:ut__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...le,canvas:nt__namespace.canvas,narration:C__namespace.narration,sound:ut__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=he;exports.default=ti;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Xt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Xt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(C).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return C[k]}})});Object.keys(ut).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ut[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
package/dist/index.d.cts CHANGED
@@ -709,7 +709,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
709
709
  elements: CanvasBaseItemMemory[];
710
710
  }
711
711
 
712
- var version = "1.8.1";
712
+ var version = "1.8.2";
713
713
 
714
714
  /**
715
715
  * @deprecated
@@ -964,8 +964,11 @@ declare namespace Game {
964
964
  * @param element The html element where I will put the canvas. Example: document.body
965
965
  * @param width The width of the canvas
966
966
  * @param height The height of the canvas
967
- * @param options The options of PixiJS Application and other options
968
- * @param devtoolsOptions The options of the devtools. You can read more about it in the [PixiJS Devtools documentation](https://pixijs.io/devtools/docs/plugin/)
967
+ * @param options Equivalent to the options you can use when initializing a [PixiJS Application](https://pixijs.com/8.x/guides/components/application). Additionally, it supports the following options:
968
+ * - `id`: The id of the canvas element.
969
+ * - `navigate`: The route navigate function.
970
+ * - `resizeMode`: The resize mode of the canvas.
971
+ * @param devtoolsOptions Equivalent to the options you can use when initializing the [PixiJS Devtools](https://pixi-vn.web.app/start/canvas#use-pixijs-devtools-with-pixivn).
969
972
  * @example
970
973
  * ```typescript
971
974
  * const body = document.body
@@ -985,7 +988,7 @@ declare namespace Game {
985
988
  */
986
989
  function init(element: HTMLElement, options: Partial<ApplicationOptions> & {
987
990
  /**
988
- * The id of the canvas element.
991
+ * The id of the canvas element. It will be used to create the canvas element and to reference it.
989
992
  * @default "pixi-vn-canvas"
990
993
  */
991
994
  id?: string;
@@ -997,7 +1000,9 @@ declare namespace Game {
997
1000
  */
998
1001
  navigate?: (path: string) => void | Promise<void>;
999
1002
  /**
1000
- * The resize mode of the canvas.
1003
+ * The resize mode of the canvas. Possible values are:
1004
+ * - `none`: No resizing.
1005
+ * - `contain`: The canvas will be resized to fit within the parent element while maintaining its aspect ratio. (default)
1001
1006
  * @default "contain"
1002
1007
  */
1003
1008
  resizeMode?: "contain" | "none";
@@ -1058,6 +1063,9 @@ declare namespace Game {
1058
1063
  /**
1059
1064
  * Register an error handler. Multiple handlers can be registered; they
1060
1065
  * will be executed in registration order.
1066
+ *
1067
+ * You can also check if the error is an instance of {@link PixiError} to handle specific errors related to Pixi’VN.
1068
+ *
1061
1069
  * @example
1062
1070
  * ```typescript
1063
1071
  * // Register a synchronous error handler
@@ -1066,6 +1074,13 @@ declare namespace Game {
1066
1074
  * // send a notification to GlitchTip, Sentry, etc...
1067
1075
  * })
1068
1076
  *
1077
+ * // Register an error handler for Pixi’VN specific errors
1078
+ * Game.addOnError((error, { notify }) => {
1079
+ * if (error instanceof PixiError) {
1080
+ * // ...
1081
+ * }
1082
+ * });
1083
+ *
1069
1084
  * // Register an asynchronous error handler
1070
1085
  * Game.addOnError(async (error, props) => {
1071
1086
  * await logErrorToServer(error)
@@ -1093,7 +1108,7 @@ declare namespace Game {
1093
1108
  */
1094
1109
  function onStepStart(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
1095
1110
  /**
1096
- * Is a function that will be executed in {@link Game.onStepStart} if the id of the step is 0
1111
+ * Is a function that will be executed in {@link onStepStart} if the id of the step is 0
1097
1112
  * and when the user laods a save file.
1098
1113
  * When you load a save file, will be executed all onLoadingLabel functions of the {@link narrationUtils.narration}.openedLabels.
1099
1114
  * It is useful for example to make sure all images used have been cached
package/dist/index.d.ts CHANGED
@@ -709,7 +709,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
709
709
  elements: CanvasBaseItemMemory[];
710
710
  }
711
711
 
712
- var version = "1.8.1";
712
+ var version = "1.8.2";
713
713
 
714
714
  /**
715
715
  * @deprecated
@@ -964,8 +964,11 @@ declare namespace Game {
964
964
  * @param element The html element where I will put the canvas. Example: document.body
965
965
  * @param width The width of the canvas
966
966
  * @param height The height of the canvas
967
- * @param options The options of PixiJS Application and other options
968
- * @param devtoolsOptions The options of the devtools. You can read more about it in the [PixiJS Devtools documentation](https://pixijs.io/devtools/docs/plugin/)
967
+ * @param options Equivalent to the options you can use when initializing a [PixiJS Application](https://pixijs.com/8.x/guides/components/application). Additionally, it supports the following options:
968
+ * - `id`: The id of the canvas element.
969
+ * - `navigate`: The route navigate function.
970
+ * - `resizeMode`: The resize mode of the canvas.
971
+ * @param devtoolsOptions Equivalent to the options you can use when initializing the [PixiJS Devtools](https://pixi-vn.web.app/start/canvas#use-pixijs-devtools-with-pixivn).
969
972
  * @example
970
973
  * ```typescript
971
974
  * const body = document.body
@@ -985,7 +988,7 @@ declare namespace Game {
985
988
  */
986
989
  function init(element: HTMLElement, options: Partial<ApplicationOptions> & {
987
990
  /**
988
- * The id of the canvas element.
991
+ * The id of the canvas element. It will be used to create the canvas element and to reference it.
989
992
  * @default "pixi-vn-canvas"
990
993
  */
991
994
  id?: string;
@@ -997,7 +1000,9 @@ declare namespace Game {
997
1000
  */
998
1001
  navigate?: (path: string) => void | Promise<void>;
999
1002
  /**
1000
- * The resize mode of the canvas.
1003
+ * The resize mode of the canvas. Possible values are:
1004
+ * - `none`: No resizing.
1005
+ * - `contain`: The canvas will be resized to fit within the parent element while maintaining its aspect ratio. (default)
1001
1006
  * @default "contain"
1002
1007
  */
1003
1008
  resizeMode?: "contain" | "none";
@@ -1058,6 +1063,9 @@ declare namespace Game {
1058
1063
  /**
1059
1064
  * Register an error handler. Multiple handlers can be registered; they
1060
1065
  * will be executed in registration order.
1066
+ *
1067
+ * You can also check if the error is an instance of {@link PixiError} to handle specific errors related to Pixi’VN.
1068
+ *
1061
1069
  * @example
1062
1070
  * ```typescript
1063
1071
  * // Register a synchronous error handler
@@ -1066,6 +1074,13 @@ declare namespace Game {
1066
1074
  * // send a notification to GlitchTip, Sentry, etc...
1067
1075
  * })
1068
1076
  *
1077
+ * // Register an error handler for Pixi’VN specific errors
1078
+ * Game.addOnError((error, { notify }) => {
1079
+ * if (error instanceof PixiError) {
1080
+ * // ...
1081
+ * }
1082
+ * });
1083
+ *
1069
1084
  * // Register an asynchronous error handler
1070
1085
  * Game.addOnError(async (error, props) => {
1071
1086
  * await logErrorToServer(error)
@@ -1093,7 +1108,7 @@ declare namespace Game {
1093
1108
  */
1094
1109
  function onStepStart(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
1095
1110
  /**
1096
- * Is a function that will be executed in {@link Game.onStepStart} if the id of the step is 0
1111
+ * Is a function that will be executed in {@link onStepStart} if the id of the step is 0
1097
1112
  * and when the user laods a save file.
1098
1113
  * When you load a save file, will be executed all onLoadingLabel functions of the {@link narrationUtils.narration}.openedLabels.
1099
1114
  * It is useful for example to make sure all images used have been cached