@drincs/nqtr 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,415 @@
1
+ import { R as RoomInterface, h as LocationInterface, M as MapInterface, C as CommitmentInterface, c as ActiveScheduling, Q as QuestInterface } from './StageInterface-B8NCX3T6.mjs';
2
+ import { OnRunProps } from '@drincs/nqtr';
3
+ import { CharacterInterface, CharacterIdType } from '@drincs/pixi-vn';
4
+ import { RoomIdType, CommitmentIdType } from '@drincs/nqtr/registries';
5
+
6
+ type TimeSlotInterface = {
7
+ name: string;
8
+ startTime: number;
9
+ };
10
+ /**
11
+ * Time Settings, which can be set using {@link timeTracker.editSettings}
12
+ */
13
+ type TimeSettings = {
14
+ /**
15
+ * Minimum time of the day
16
+ * @default 0
17
+ */
18
+ dayStartTime?: number;
19
+ /**
20
+ * Maximum time of the day
21
+ * @default 24
22
+ */
23
+ dayEndTime?: number;
24
+ /**
25
+ * Default time spent
26
+ * @default 1
27
+ */
28
+ defaultTimeSpent?: number;
29
+ /**
30
+ * Time slots
31
+ * @default []
32
+ * @example
33
+ * ```ts
34
+ * [
35
+ * { name: 'Morning', startTime: 5 },
36
+ * { name: 'Afternoon', startTime: 12 },
37
+ * { name: 'Evening', startTime: 18 },
38
+ * { name: 'Night', startTime: 22 }
39
+ * ]
40
+ */
41
+ timeSlots?: TimeSlotInterface[];
42
+ /**
43
+ * Week length
44
+ * @default 7
45
+ */
46
+ weekLength?: number;
47
+ /**
48
+ * Weekend start day. For example, if the real life weekend starts on Saturday, then the value should be 6
49
+ * @default weekLength - 1
50
+ */
51
+ weekendStartDay?: number;
52
+ /**
53
+ * Week days name
54
+ * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1).
55
+ * @returns The name of the week day.
56
+ * @example
57
+ * ```ts
58
+ * (weekDayNumber: number) => {
59
+ * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
60
+ * return weekDaysNames[weekDayNumber];
61
+ * }
62
+ * ```
63
+ */
64
+ getDayName?: (weekDayNumber: number) => string;
65
+ };
66
+
67
+ /**
68
+ * Handler that manages the navigation system: it gives access to all the registered
69
+ * rooms, locations and maps, and keeps track of the room where the player currently is.
70
+ */
71
+ interface NavigatorHandlerInterface {
72
+ /**
73
+ * All the registered rooms.
74
+ */
75
+ readonly rooms: RoomInterface[];
76
+ /**
77
+ * All the registered locations.
78
+ */
79
+ readonly locations: LocationInterface[];
80
+ /**
81
+ * All the registered maps.
82
+ */
83
+ readonly maps: MapInterface[];
84
+ /**
85
+ * The id of the room where the player currently is, read from the game storage.
86
+ * It is `undefined` if the current room has not been set yet.
87
+ */
88
+ readonly currentRoomId: string | undefined;
89
+ /**
90
+ * The room where the player currently is.
91
+ * Getting it returns `undefined` (and logs an error) if the current room has not been set
92
+ * or if it is not registered.
93
+ *
94
+ * Setting it accepts a room or a room id. If the room is not registered, an error is logged
95
+ * and nothing changes. If it is already the current room, nothing happens; otherwise
96
+ * the change is stored and tracked as the last event.
97
+ */
98
+ get currentRoom(): RoomInterface | undefined;
99
+ set currentRoom(room: RoomInterface | RoomIdType);
100
+ /**
101
+ * The location that contains the current room, or `undefined` if there is no current room.
102
+ */
103
+ readonly currentLocation: LocationInterface | undefined;
104
+ /**
105
+ * The map that contains the current location, or `undefined` if there is no current room.
106
+ */
107
+ readonly currentMap: MapInterface | undefined;
108
+ /**
109
+ * Clear all the expired activities from every registered room.
110
+ */
111
+ clearExpiredActivities(): void;
112
+ }
113
+
114
+ /**
115
+ * Handler that manages the routine of the characters: the commitments (fixed or added during the
116
+ * game session) and the rooms where they take place.
117
+ */
118
+ interface RoutineHandlerInterface {
119
+ /**
120
+ * The ids of all the commitments: the fixed ones and the ones added during the game session.
121
+ */
122
+ readonly commitmentsIds: string[];
123
+ /**
124
+ * The commitments that are currently active, grouped by character id.
125
+ * Each value is a tuple with the commitment and the id of the room where it takes place.
126
+ * If a character has two or more commitments at the same time, only the one with the highest priority is kept.
127
+ */
128
+ readonly characterCommitments: {
129
+ [character: string]: [CommitmentInterface, string];
130
+ };
131
+ /**
132
+ * The current commitments. The hidden commitments are not included.
133
+ * In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority.
134
+ * Higher priority commitments are calculated using the following steps:
135
+ * 1. The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.
136
+ * 2. If there are commitments with the same priority, the commitments that are not fixed will be selected first.
137
+ * 3. If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index.
138
+ */
139
+ readonly currentRoutine: CommitmentInterface[];
140
+ /**
141
+ * The current commitments grouped by the id of the room where they take place.
142
+ */
143
+ readonly roomCommitments: {
144
+ [roomId: string]: CommitmentInterface[];
145
+ };
146
+ /**
147
+ * Add commitments during the game session.
148
+ * @param commitment The commitment or commitments (or their ids) to add.
149
+ * @param roomId The id of the room where the commitment is.
150
+ * @param options The scheduling options of the commitment (e.g. when it starts and ends).
151
+ */
152
+ add(commitment: (CommitmentInterface | CommitmentIdType)[] | CommitmentInterface | CommitmentIdType, roomId: string, options?: ActiveScheduling): void;
153
+ /**
154
+ * Get a registered commitment by its id.
155
+ * @param id The id of the commitment.
156
+ * @returns The commitment or undefined if not found.
157
+ */
158
+ find(id: string): CommitmentInterface | undefined;
159
+ /**
160
+ * Remove a commitment added during the game session. Fixed commitments can't be removed.
161
+ * @param commitment The commitment or commitment id to remove.
162
+ * @param roomId If set, the commitment is removed only if it was added to this room.
163
+ */
164
+ remove(commitment: CommitmentInterface | CommitmentIdType, roomId?: string): void;
165
+ /**
166
+ * Clear all the expired commitments.
167
+ */
168
+ clearExpiredRoutine(): void;
169
+ /**
170
+ * Get the current commitment of a character.
171
+ * @param character The character or the character id.
172
+ * @returns The commitment or undefined if not found.
173
+ */
174
+ getCommitmentByCharacter(character: CharacterInterface | CharacterIdType): CommitmentInterface | undefined;
175
+ }
176
+
177
+ /**
178
+ * Handler that manages the quests registered in the game.
179
+ */
180
+ interface QuestHandlerInterface {
181
+ /**
182
+ * The quests registered in the game.
183
+ */
184
+ readonly quests: QuestInterface[];
185
+ /**
186
+ * The quests that are started, so they are in progress or completed or failed.
187
+ */
188
+ readonly startedQuests: QuestInterface[];
189
+ /**
190
+ * The quests that are in progress.
191
+ */
192
+ readonly inProgressQuests: QuestInterface[];
193
+ /**
194
+ * The quests that are completed.
195
+ */
196
+ readonly completedQuests: QuestInterface[];
197
+ /**
198
+ * The quests that are failed.
199
+ */
200
+ readonly failedQuests: QuestInterface[];
201
+ /**
202
+ * The quests that are not started.
203
+ */
204
+ readonly notStartedQuests: QuestInterface[];
205
+ /**
206
+ * Get the quest by the id.
207
+ * @param id The id of the quest.
208
+ * @returns The quest with the id, or `undefined` if not found.
209
+ */
210
+ find(id: string): QuestInterface | undefined;
211
+ /**
212
+ * Start the current stage of every quest whose current stage must be started automatically.
213
+ * @param props The props passed to the functions triggered by the stages. See {@link OnRunProps}.
214
+ */
215
+ startsStageMustBeStarted(props: OnRunProps): Promise<void>;
216
+ }
217
+
218
+ /**
219
+ * Handler that manages the time of the game: the current time and date, the day/week structure
220
+ * and the time slots.
221
+ */
222
+ interface TimeHandlerInterface {
223
+ /**
224
+ * Set the time settings. Omitted values fall back to their defaults.
225
+ * @param settings The time settings.
226
+ */
227
+ initialize(settings: TimeSettings): void;
228
+ /**
229
+ * The time at which a day starts.
230
+ */
231
+ readonly dayStartTime: number;
232
+ /**
233
+ * The time at which a day ends. When the time reaches it, the date increases.
234
+ */
235
+ readonly dayEndTime: number;
236
+ /**
237
+ * The default time spent by {@link increaseTime} when no delta is given.
238
+ */
239
+ readonly defaultTimeSpent: number;
240
+ /**
241
+ * The time slots of a day (e.g. morning, afternoon, evening).
242
+ */
243
+ readonly timeSlots: TimeSlotInterface[];
244
+ /**
245
+ * The number of days in a week.
246
+ */
247
+ readonly weekLength: number;
248
+ /**
249
+ * The week day (starting from 0) from which the weekend starts.
250
+ */
251
+ readonly weekendStartDay: number;
252
+ /**
253
+ * Week days name
254
+ * @param weekDayNumber The current week day number (from: 0 - to: {@link weekLength} - 1).
255
+ * @returns The name of the week day.
256
+ * @example
257
+ * ```ts
258
+ * (weekDayNumber: number) => {
259
+ * const weekDaysNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
260
+ * return weekDaysNames[weekDayNumber];
261
+ * }
262
+ * ```
263
+ */
264
+ readonly getDayName: ((weekDayNumber: number) => string) | undefined;
265
+ /**
266
+ * The current time. Time is a numeric variable used to determine and manage time during a day/date.
267
+ * It's recommended to use currentTime as if it were the current time. If you also want to manage minutes, you can use a float value.
268
+ * Setting it to `undefined` resets it to {@link dayStartTime}.
269
+ */
270
+ get currentTime(): number;
271
+ set currentTime(value: number | undefined);
272
+ /**
273
+ * The current date. Date is a numeric variable used to determine and manage the number of days passed.
274
+ * It's recommended to use currentDate as if it were the current day.
275
+ * Setting it to `undefined` resets it to 0.
276
+ */
277
+ get currentDate(): number;
278
+ set currentDate(value: number | undefined);
279
+ /**
280
+ * If the current day is greater than or equal to the weekend start day, then it will return true.
281
+ */
282
+ readonly isWeekend: boolean;
283
+ /**
284
+ * The current week day number (from: 1 - to: {@link weekLength}).
285
+ * For example, if the week length is 7 and the current day is 10, then the result will be 4.
286
+ */
287
+ readonly currentWeekDayNumber: number;
288
+ /**
289
+ * The current week day name. If the week days names are not defined, then it will return an empty string.
290
+ * For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.
291
+ * @default ""
292
+ */
293
+ readonly currentDayName: string;
294
+ /**
295
+ * The index of the current time slot in {@link timeSlots}.
296
+ * You can use this property to create "Image that changes based on the time period":
297
+ * @example
298
+ * ```tsx
299
+ * import { timeTracker } from '@drincs/nqtr';
300
+ *
301
+ * function changeBackground() {
302
+ * return (
303
+ * <img src={`background-${timeTracker.currentTimeSlot}.png`} />
304
+ * )
305
+ * }
306
+ * ```
307
+ */
308
+ readonly currentTimeSlot: number;
309
+ /**
310
+ * Increase the current time by the given time spent.
311
+ * If the new time is greater than or equal to {@link dayEndTime}, then it will increase the day and set the new time.
312
+ * @param delta The time spent (default: {@link defaultTimeSpent}).
313
+ * @returns The new current time.
314
+ */
315
+ increaseTime(delta?: number): number;
316
+ /**
317
+ * Increase the current date by the given delta.
318
+ * @param delta The number of days to increase (default: 1).
319
+ * @param time The time of the new day (default: {@link dayStartTime}).
320
+ * @returns The new current date.
321
+ */
322
+ increaseDate(delta?: number, time?: number): number;
323
+ /**
324
+ * Check if the current time is between the given times.
325
+ * @param fromTime The starting time. If the {@link currentTime} is equal to this time, the function will return true. If undefined, the day start is used.
326
+ * @param toTime The ending time. If undefined, the day end is used.
327
+ * @returns true if the current time is between the given times, otherwise false.
328
+ */
329
+ nowIsBetween(fromTime: number | undefined, toTime: number | undefined): boolean;
330
+ }
331
+
332
+ declare class QuestHandler implements QuestHandlerInterface {
333
+ get quests(): QuestInterface[];
334
+ get startedQuests(): QuestInterface[];
335
+ get inProgressQuests(): QuestInterface[];
336
+ get completedQuests(): QuestInterface[];
337
+ get failedQuests(): QuestInterface[];
338
+ get notStartedQuests(): QuestInterface[];
339
+ find(id: string): QuestInterface | undefined;
340
+ startsStageMustBeStarted(props: OnRunProps): Promise<void>;
341
+ }
342
+
343
+ declare class RoutineHandler implements RoutineHandlerInterface {
344
+ /**
345
+ * Get the temporary commitments by its id.
346
+ * @returns The temporary commitments.
347
+ */
348
+ private get temporaryRoutine();
349
+ get commitmentsIds(): string[];
350
+ add(commitment: (CommitmentInterface | CommitmentIdType)[] | CommitmentInterface | CommitmentIdType, roomId: string, options?: ActiveScheduling): void;
351
+ find(id: string): CommitmentInterface | undefined;
352
+ remove(commitment: CommitmentInterface | CommitmentIdType, roomId?: string): void;
353
+ clearExpiredRoutine(): void;
354
+ get characterCommitments(): {
355
+ [character: string]: [CommitmentInterface, string];
356
+ };
357
+ get currentRoutine(): CommitmentInterface[];
358
+ get roomCommitments(): {
359
+ [roomId: string]: CommitmentInterface[];
360
+ };
361
+ getCommitmentByCharacter(character: CharacterInterface | CharacterIdType): CommitmentInterface | undefined;
362
+ }
363
+
364
+ declare class TimeHandler implements TimeHandlerInterface {
365
+ initialize(settings: TimeSettings): void;
366
+ get dayStartTime(): number;
367
+ get dayEndTime(): number;
368
+ get defaultTimeSpent(): number;
369
+ get timeSlots(): TimeSlotInterface[];
370
+ get weekLength(): number;
371
+ get weekendStartDay(): number;
372
+ get getDayName(): ((weekDayNumber: number) => string) | undefined;
373
+ get currentTime(): number;
374
+ set currentTime(value: number | undefined);
375
+ get currentDate(): number;
376
+ set currentDate(value: number | undefined);
377
+ get isWeekend(): boolean;
378
+ get currentWeekDayNumber(): number;
379
+ get currentDayName(): string;
380
+ get currentTimeSlot(): number;
381
+ increaseTime(delta?: number): number;
382
+ increaseDate(delta?: number, time?: number): number;
383
+ nowIsBetween(fromTime: number | undefined, toTime: number | undefined): boolean;
384
+ }
385
+
386
+ /**
387
+ * The global time manager instance. It handles the current time and date, the week structure
388
+ * (week length, weekend, day names) and the time slots of the day.
389
+ */
390
+ declare const timeTracker: TimeHandler;
391
+ /**
392
+ * The global navigator instance. It gives access to the registered maps, locations and rooms,
393
+ * and it keeps track of the room where the player currently is (saved and restored with the game state).
394
+ */
395
+ declare const navigator: NavigatorHandlerInterface;
396
+ /**
397
+ * The global routine manager instance. It handles the commitments of the characters (fixed or added
398
+ * during the game session), the rooms where they take place and the current routine of each character.
399
+ */
400
+ declare const routine: RoutineHandler;
401
+ /**
402
+ * The global quests manager instance. It gives access to the registered quests, filtered by their
403
+ * state (not started, in progress, completed, failed), and it starts the stages that must start automatically.
404
+ */
405
+ declare const questsNotebook: QuestHandler;
406
+
407
+ declare const handlers_navigator: typeof navigator;
408
+ declare const handlers_questsNotebook: typeof questsNotebook;
409
+ declare const handlers_routine: typeof routine;
410
+ declare const handlers_timeTracker: typeof timeTracker;
411
+ declare namespace handlers {
412
+ export { handlers_navigator as navigator, handlers_questsNotebook as questsNotebook, handlers_routine as routine, handlers_timeTracker as timeTracker };
413
+ }
414
+
415
+ export { type NavigatorHandlerInterface as N, type QuestHandlerInterface as Q, type RoutineHandlerInterface as R, type TimeSlotInterface as T, type TimeHandlerInterface as a, type TimeSettings as b, handlers as h, navigator as n, questsNotebook as q, routine as r, timeTracker as t };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var handlers=require('@drincs/nqtr/handlers'),Qe=require('@drincs/nqtr/registries'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage'),characters=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core');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 Qe__namespace=/*#__PURE__*/_interopNamespace(Qe);var ce=Object.defineProperty;var K=(s,e)=>{for(var t in e)ce(s,t,{get:e[t],enumerable:true});};var $={};K($,{ActivityBaseModel:()=>_,ActivityStoredClass:()=>m,CommitmentBaseModel:()=>A,CommitmentStoredClass:()=>p,LocationBaseModel:()=>b,LocationStoredClass:()=>h,MapBaseModel:()=>C,MapStoredClass:()=>y,QuestBaseModel:()=>P,QuestStoredClass:()=>v,RoomBaseModel:()=>E,RoomStoredClass:()=>S,StageBaseModel:()=>D,StageStoredClass:()=>I});var fe="__nqtr-activity__",m=class extends storage.StoredClassModel{constructor(t,r,i,n=fe){super(n,t);this._onRun=r;this._timeSlot=i.timeSlot,this._dateScheduling=i.dateScheduling;}_onRun;_timeSlot;get timeSlot(){return this._timeSlot}_dateScheduling;get dateScheduling(){return this._dateScheduling}addTempHistoryItem(){return narration.narration.addCurrentStepToHistory()}get run(){return async t=>(this.addTempHistoryItem(),await this._onRun(this,t))}get expired(){return !!(this.dateScheduling?.to&&this.dateScheduling.to<=handlers.timeTracker.currentDate)}isActive(t={}){let{timeSlot:r=this.timeSlot,dateScheduling:i=this.dateScheduling}=t;if(i?.from!=null&&i.from>handlers.timeTracker.currentDate||i?.to!=null&&i.to<handlers.timeTracker.currentDate)return false;r&&!Array.isArray(r)&&(r=[r]);for(let n of r||[])if(!handlers.timeTracker.nowIsBetween(n?.from,n?.to))return false;return true}};var _=class extends m{constructor(e,t,r){super(e,t,{dateScheduling:r.dateScheduling,timeSlot:r.timeSlot}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var u="___nqtr-time_manager_data___",g="___nqtr-current_room_memory___",L="___nqtr-last_event_memory___";function R(s){storage.storage.set(L,s);}function j(){return storage.storage.get(L)}var he="__nqtr-commitment__",p=class extends m{constructor(e,t,r,i){r=r||(()=>{}),super(e,r,i,he),this.defaultExecutionType=i.executionType||"interaction",this.defaultPriority=i.priority,this.characters=t.reduce((n,a)=>{if(typeof a=="string"){let c=characters.RegisteredCharacters.get(a);c?n.push(c):console.warn(`Character with id ${a} not found for commitment ${e}`);}else n.push(a);return n},[]);}defaultExecutionType;defaultPriority;characters;get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(e){this.setStorageProperty("executionType",e);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(e){this.setStorageProperty("priority",e);}addTempHistoryItem(){let e=handlers.navigator.currentRoom;if(!e||this.executionType!=="automatic")return super.addTempHistoryItem();let t=j();switch(t?.type){case "editroom":storage.storage.set(g,t.prev),super.addTempHistoryItem(),storage.storage.set(g,e.id);break;case "edittime":{let r=storage.storage.get(u)||{};storage.storage.set(u,t.prev),super.addTempHistoryItem(),storage.storage.set(u,r);break}}}runOptions;get run(){return async(e,t)=>{let r=t?.removeFromRoutine??this.executionType==="automatic";return this.addTempHistoryItem(),r&&handlers.routine.remove(this.id),await this._onRun(this,e)}}};var A=class extends p{constructor(e,t,r){super(e,t?Array.isArray(t)?t:[t]:[],r.onRun,{executionType:r.executionType,priority:r.priority,timeSlot:r.timeSlot,dateScheduling:r.dateScheduling}),this._name=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var o;(i=>(i.log=(n,...a)=>console.log(`[NQTR] ${n}`,...a),i.warn=(n,...a)=>console.warn(`[NQTR] ${n}`,...a),i.error=(n,...a)=>console.error(`[NQTR] ${n}`,...a),i.info=(n,...a)=>console.info(`[NQTR] ${n}`,...a)))(o||={});var f=class extends storage.StoredClassModel{constructor(e,t,r=[]){super(e,t),this.defaultActivitiesIds=r.map(i=>typeof i=="string"?i:i.id);}defaultActivitiesIds;get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(e){let t=this.activeActivityScheduling;delete t[e],this.setStorageProperty("activeActivityScheduling",t);let r=this.excludedActivitiesScheduling;delete r[e],this.setStorageProperty("excludedActivitiesScheduling",r);}editActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.activeActivityScheduling;r[e]=t,this.setStorageProperty("activeActivityScheduling",r);}editExcludedActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.excludedActivitiesScheduling;r[e]=t,this.setStorageProperty("excludedActivitiesScheduling",r);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}get activitiesIds(){return this.additionalActivitiesIds.concat(this.defaultActivitiesIds)}addActivity(e,t={}){let r=typeof e=="string"?Qe.RegisteredActivities.get(e):e;if(!r)throw o.error(`Activity with id ${e} not found.`),new core.PixiError("unknown_element",`Activity with id ${e} not found.`);let{timeSlot:i,dateScheduling:n}=t;if(i&&!Array.isArray(i)&&(i=[i]),i?.forEach(c=>{let{to:l=handlers.timeTracker.dayEndTime+1}=c||{};if(c&&c.from>=l)throw o.error("The from time must be less than the to time."),new core.PixiError("invalid_usage","The from time must be less than the to time.")}),n?.from!==void 0&&n?.to!==void 0&&n?.from>=n?.to)throw o.error("The from day/date must be less than the to day/date."),new core.PixiError("invalid_usage","The from day/date must be less than the to day/date.");let a=this.additionalActivitiesIds;this.defaultActivitiesIds.includes(r.id)||a.includes(r.id)?o.info(`Activity with id ${r.id} already exists in the ${this.id}, so it will be updated with the new scheduling options if they are provided.`):(a.push(r.id),this.setStorageProperty("additionalActivitiesIds",a)),this.excludedActivitiesIds.includes(r.id)&&(this.removeActivityScheduling(r.id),o.log(`Activity with id ${r.id} was excluded from the ${this.id}, but now it will be added again with the new scheduling options. So it will be removed from the excluded activities list.`)),(i||n)&&this.editActivityScheduling(r.id,{timeSlot:i,dateScheduling:n});}removeActivity(e){let t=typeof e=="string"?e:e.id,r=this.additionalActivitiesIds;if(r.includes(t))r=r.filter(i=>i!==t),this.setStorageProperty("additionalActivitiesIds",r);else if(this.defaultActivitiesIds.includes(t)){let i=this.excludedActivitiesIds;i.push(t),this.setStorageProperty("excludedActivitiesIds",i);}else o.warn(`Activity with id ${t} not found, so it will be ignored.`);}clearExpiredActivities(){let e=this.activeActivityScheduling,t=this.excludedActivitiesScheduling,r=this.additionalActivitiesIds,i=this.excludedActivitiesIds;r.forEach(n=>{if(n in e){let{to:a}=e[n].dateScheduling||{};a&&a<handlers.timeTracker.currentDate&&(this.removeActivityScheduling(n),r=r.filter(c=>c!==n));}}),i.forEach(n=>{n in t&&t[n]&&(this.removeActivityScheduling(n),i=i.filter(a=>a!==n));});}get activities(){return [...new Set([...this.additionalActivitiesIds,...this.defaultActivitiesIds])].reduce((e,t)=>{let r=Qe.RegisteredActivities.get(t);return r?.isActive(this.activeActivityScheduling[t])&&!this.excludedActivitiesScheduling[t]&&e.push(r),e},[])}};var ve="__nqtr-location__",h=class extends f{constructor(t,r,i=[]){super(ve,t,i);this._map=r;}_map;get map(){return this._map}get rooms(){return handlers.navigator.rooms.filter(t=>t.location.id===this.id)}};var b=class extends h{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Te="__nqtr-map__",y=class extends f{constructor(e,t=[]){super(Te,e,t);}get locations(){return handlers.navigator.locations.filter(e=>e.map.id===this.id)}};var C=class extends y{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var te="__nqtr-room__",S=class extends f{_location;constructor(e,t,r=[]){Array.isArray(r)?super(te,e,r):(super(te,e,r.activities),r.routine.forEach(i=>{let n=typeof i=="string"?i:i.id;Qe.fixedCommitments.set(n,e);})),this._location=t;}get routine(){return handlers.routine.roomCommitments[this.id]||[]}addCommitment(e,t={}){let{timeSlot:r,dateScheduling:i}=t;if(r&&!Array.isArray(r)&&(r=[r]),r?.forEach(n=>{let{to:a=handlers.timeTracker.dayEndTime+1}=n||{};if(n&&n.from>=a)throw o.error("The from time must be less than the to time."),new core.PixiError("invalid_usage","The from time must be less than the to time.")}),i?.from!==void 0&&i?.to!==void 0&&i?.from>=i?.to)throw o.error("The from day/date must be less than the to day/date."),new core.PixiError("invalid_usage","The from day/date must be less than the to day/date.");handlers.routine.add(e,this.id,{timeSlot:r,dateScheduling:i});}removeCommitment(e){handlers.routine.remove(e,this.id);}get location(){return this._location}get characters(){return this.routine.reduce((e,t)=>(e.push(...t.characters),e),[])}get automaticFunctions(){return this.routine.reduce((e,t)=>{if(t.executionType==="automatic"&&t.run){let r=async i=>{await t.run(i);};e.push(r);}return e},[])}};var E=class extends S{constructor(e,t,r={}){super(e,t,{activities:r.activities||[],routine:r.routine||[]}),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Ae="__nqtr-quest__",v=class extends storage.StoredClassModel{constructor(t,r,i={}){super(Ae,t);this._stages=r;this._onStart=i.onStart,this._onContinue=i.onContinue||i.onNextStage;}_stages;get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===void 0||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==void 0}get completed(){return this.currentStageIndex===void 0?false:this.currentStageIndex>this.stages.length-1}get inProgress(){return this.completed||this.failed?false:this.started}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onContinue;get onContinue(){return this._onContinue}get onNextStage(){return this._onContinue}async start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){o.error(`Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r?.start)return this.onStart&&await this.onStart(this,t),await r.start(t);o.error(`Quest ${this.id} has no start stage`);}async goNextIfCompleted(t){return await this.advanceIfCompleted(t)}async advanceIfCompleted(t){if(!this.inProgress)return false;let r=this.currentStage;return r?r.completed?await this.advanceUnconditionally(t):false:(o.error(`Quest ${this.id} has no current stage`),false)}async goNext(t){return await this.continue(t)}async continue(t){let r=this.currentStage;return r?(r.completed=true,await this.advanceUnconditionally(t)):(o.error(`Quest ${this.id} has no current stage`),false)}async forceGoNext(t){return await this.advanceUnconditionally(t)}async advanceUnconditionally(t){if(!this.inProgress)return console.warn(`[NQTR] Quest ${this.id} is not in progress`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===void 0)return o.error(`Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onContinue&&await this.onContinue(this,t),r?.onEnd&&await r.onEnd(r,t);let n=this.currentStage;return n&&(n.inizialize(),this.currentStageMustStart&&await this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}async startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?await r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var P=class extends v{constructor(e,t,r){super(e,t,{onStart:r.onStart,onContinue:r.onContinue||r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var Ce="__nqtr-stage__",I=class extends storage.StoredClassModel{constructor(e,t={}){super(Ce,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._deltaDateRequired=t.deltaDateRequired,this._questsRequired=t.questsRequired||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get inizializeDate(){return this.getStorageProperty("inizializeDate")}set inizializeDate(e){this.setStorageProperty("inizializeDate",e);}get startDate(){let e=this.inizializeDate;if(e!==void 0)return e+this.deltaDateRequired}get canStart(){let e=this.deltaDateRequired;if(e>0){let t=this.inizializeDate;if(t===void 0||t+e>handlers.timeTracker.currentDate)return false}return !(this.questsRequired.length>0&&!this.questsRequired.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.deltaDateRequired>0&&(this.inizializeDate=handlers.timeTracker.currentDate,console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`));}async start(e){this.canStart?(this.started=true,this.onStart&&await this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_deltaDateRequired;get deltaDateRequired(){return this._deltaDateRequired||0}_questsRequired;get questsRequired(){return this._questsRequired||[]}};var D=class extends I{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,deltaDateRequired:t.deltaDateRequired,questsRequired:t.questsRequired}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequired=t.flagsRequired||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequired;get flagsRequired(){return this._flagsRequired}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>storage.storage.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequired.length>0&&!this.flagsRequired.every(e=>storage.storage.getFlag(e.flag))?false:super.canStart}};var ae={};var oe={};var G={};K(G,{navigator:()=>qe,questsNotebook:()=>Ne,routine:()=>Me,timeTracker:()=>Oe});var w=class{get rooms(){return Qe.RegisteredRooms.values()}get locations(){return Qe.RegisteredLocations.values()}get maps(){return Qe.RegisteredMaps.values()}get currentRoomId(){return storage.storage.get(g)}get currentRoom(){let e=this.currentRoomId;if(!e){o.error("The current room has not yet been set");return}let t=Qe.RegisteredRooms.get(e);if(!t){o.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!Qe.RegisteredRooms.get(e)){o.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.storage.get(g);r!==e&&(R({type:"editroom",prev:r,value:e}),storage.storage.set(g,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Qe.RegisteredRooms.values().forEach(e=>{e.clearExpiredActivities();});}};var O=class{get quests(){return Qe.RegisteredQuests.values()}get startedQuests(){return this.quests.filter(e=>e.started)}get inProgressQuests(){return this.quests.filter(e=>e.inProgress)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return Qe.RegisteredQuests.get(e)}async startsStageMustBeStarted(e){let t=this.quests.map(r=>r.currentStageMustStart?r.startCurrentStage(e):Promise.resolve());await Promise.all(t);}};var H="___nqtr-temporary_commitment___",q=class{get temporaryRoutine(){let e=storage.storage.get(H);if(e){if(Array.isArray(e)){if(e.length>0)throw new core.PixiError("obsolete_save","The save you loaded is not compatible with the current version of NQTR. Please delete the save and start a new game.");return {}}}else return {};return e}get commitmentsIds(){return [...Qe.fixedCommitments.keys(),...Object.keys(this.temporaryRoutine)]}add(e,t,r={}){Array.isArray(e)||(e=[e]);let i=this.temporaryRoutine;e.forEach(n=>{let a=typeof n=="string"?n:n.id;i[a]={id:a,roomId:t,...r};}),storage.storage.set(H,i);}find(e){return Qe.RegisteredCommitments.get(e)}remove(e,t){typeof e!="string"&&(e=e.id);let r=this.temporaryRoutine;r[e]?(!t||r[e].roomId===t)&&delete r[e]:o.warn(`The commitment ${e} was not found in the temporary routine, so it will be ignored. If you want to remove a fixed commitment, you can add it to the temporary routine with a same character.`),storage.storage.set(H,r);}clearExpiredRoutine(){Qe.RegisteredCommitments.values().forEach(e=>{e.expired&&this.remove(e);});}get characterCommitments(){let e=this.temporaryRoutine;return this.commitmentsIds.reduce((t,r)=>{let i=Qe.RegisteredCommitments.get(r),n=e[r],a=n?.roomId||Qe.fixedCommitments.get(r);return a&&i?.isActive(n)&&(i.characters.length>0?i.characters.every(l=>!t[l.id]||i.priority>t[l.id][0].priority)&&i.characters.forEach(l=>{t[l.id]=[i,a];}):o.error(`The commitment ${i.id} has no characters assigned`)),t},{})}get currentRoutine(){return Object.values(this.characterCommitments).map(([e])=>e)}get roomCommitments(){return Object.values(this.characterCommitments).reduce((e,t)=>{let r=t[1];return e[r]||(e[r]=[]),e[r].push(t[0]),e},{})}getCommitmentByCharacter(e){let t=typeof e=="string"?e:e.id;return this.currentRoutine.find(r=>{if(r.characters.map(i=>i.id).includes(t))return r})}};var we={dayStartTime:0,dayEndTime:24,defaultTimeSpent:1,timeSlots:[],weekLength:7,weekendStartDay:6,getDayName:void 0},d=we;var M=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:i=1,timeSlots:n=[],weekLength:a=7,weekendStartDay:c=a-1,getDayName:l}=e;d.dayStartTime=t,d.dayEndTime=r,d.defaultTimeSpent=i,d.timeSlots=n,d.weekLength=a,c>=d.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${a}, so will be ignored`):d.weekendStartDay=c,d.getDayName=l;}get dayStartTime(){return d.dayStartTime}get dayEndTime(){return d.dayEndTime}get defaultTimeSpent(){return d.defaultTimeSpent}get timeSlots(){return d.timeSlots}get weekLength(){return d.weekLength}get weekendStartDay(){return d.weekendStartDay}get getDayName(){return d.getDayName}get currentTime(){let e=storage.storage.get(u)||{};return Object.hasOwn(e,"currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.storage.get(u)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,R({type:"edittime",prev:t,value:r}),storage.storage.set(u,r);}get currentDate(){let e=storage.storage.get(u)||{};return Object.hasOwn(e,"currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.storage.get(u)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,R({type:"edittime",prev:t,value:r}),storage.storage.set(u,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var Oe=new M,qe=new w,Me=new q,Ne=new O;var Le={...$,...ae,...oe,handlers:G,registries:Qe__namespace},wr=Le;Object.defineProperty(exports,"RegisteredActivities",{enumerable:true,get:function(){return Qe.RegisteredActivities}});Object.defineProperty(exports,"RegisteredCommitments",{enumerable:true,get:function(){return Qe.RegisteredCommitments}});Object.defineProperty(exports,"RegisteredLocations",{enumerable:true,get:function(){return Qe.RegisteredLocations}});Object.defineProperty(exports,"RegisteredMaps",{enumerable:true,get:function(){return Qe.RegisteredMaps}});Object.defineProperty(exports,"RegisteredQuests",{enumerable:true,get:function(){return Qe.RegisteredQuests}});Object.defineProperty(exports,"RegisteredRooms",{enumerable:true,get:function(){return Qe.RegisteredRooms}});exports.ActivityBaseModel=_;exports.ActivityStoredClass=m;exports.CommitmentBaseModel=A;exports.CommitmentStoredClass=p;exports.LocationBaseModel=b;exports.LocationStoredClass=h;exports.MapBaseModel=C;exports.MapStoredClass=y;exports.QuestBaseModel=P;exports.QuestStoredClass=v;exports.RoomBaseModel=E;exports.RoomStoredClass=S;exports.StageBaseModel=D;exports.StageStoredClass=I;exports.default=wr;Object.keys(handlers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return handlers[k]}})});
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var handlers=require('@drincs/nqtr/handlers'),Qe=require('@drincs/nqtr/registries'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage'),characters=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core');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 Qe__namespace=/*#__PURE__*/_interopNamespace(Qe);var ce=Object.defineProperty;var K=(s,e)=>{for(var t in e)ce(s,t,{get:e[t],enumerable:true});};var B={};K(B,{ActivityBaseModel:()=>_,ActivityStoredClass:()=>m,CommitmentBaseModel:()=>A,CommitmentStoredClass:()=>p,LocationBaseModel:()=>b,LocationStoredClass:()=>h,MapBaseModel:()=>C,MapStoredClass:()=>y,QuestBaseModel:()=>P,QuestStoredClass:()=>S,RoomBaseModel:()=>E,RoomStoredClass:()=>v,StageBaseModel:()=>D,StageStoredClass:()=>I});var fe="__nqtr-activity__",m=class extends storage.StoredClassModel{constructor(t,r,i,n=fe){super(n,t);this._onRun=r;this._timeSlot=i.timeSlot,this._dateScheduling=i.dateScheduling;}_onRun;_timeSlot;get timeSlot(){return this._timeSlot}_dateScheduling;get dateScheduling(){return this._dateScheduling}async addTempHistoryItem(){return await narration.narration.addCurrentStepToHistory()}get run(){return async t=>(await this.addTempHistoryItem(),await this._onRun(this,t))}get expired(){return !!(this.dateScheduling?.to&&this.dateScheduling.to<=handlers.timeTracker.currentDate)}isActive(t={}){let{timeSlot:r=this.timeSlot,dateScheduling:i=this.dateScheduling}=t;if(i?.from!=null&&i.from>handlers.timeTracker.currentDate||i?.to!=null&&i.to<handlers.timeTracker.currentDate)return false;r&&!Array.isArray(r)&&(r=[r]);for(let n of r||[])if(!handlers.timeTracker.nowIsBetween(n?.from,n?.to))return false;return true}};var _=class extends m{constructor(e,t,r){super(e,t,{dateScheduling:r.dateScheduling,timeSlot:r.timeSlot}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var u="___nqtr-time_manager_data___",g="___nqtr-current_room_memory___",L="___nqtr-last_event_memory___";function R(s){storage.storage.set(L,s);}function j(){return storage.storage.get(L)}var he="__nqtr-commitment__",p=class extends m{constructor(e,t,r,i){r=r||(()=>{}),super(e,r,i,he),this.defaultExecutionType=i.executionType||"interaction",this.defaultPriority=i.priority,this.characters=t.reduce((n,a)=>{if(typeof a=="string"){let c=characters.RegisteredCharacters.get(a);c?n.push(c):console.warn(`Character with id ${a} not found for commitment ${e}`);}else n.push(a);return n},[]);}defaultExecutionType;defaultPriority;characters;get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(e){this.setStorageProperty("executionType",e);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(e){this.setStorageProperty("priority",e);}async addTempHistoryItem(){let e=handlers.navigator.currentRoom;if(!e||this.executionType!=="automatic")return await super.addTempHistoryItem();let t=j();switch(t?.type){case "editroom":storage.storage.set(g,t.prev),await super.addTempHistoryItem(),storage.storage.set(g,e.id);break;case "edittime":{let r=storage.storage.get(u)||{};storage.storage.set(u,t.prev),await super.addTempHistoryItem(),storage.storage.set(u,r);break}}}runOptions;get run(){return async(e,t)=>{let r=t?.removeFromRoutine??this.executionType==="automatic";return await this.addTempHistoryItem(),r&&handlers.routine.remove(this.id),await this._onRun(this,e)}}};var A=class extends p{constructor(e,t,r){super(e,t?Array.isArray(t)?t:[t]:[],r.onRun,{executionType:r.executionType,priority:r.priority,timeSlot:r.timeSlot,dateScheduling:r.dateScheduling}),this._name=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var o;(i=>(i.log=(n,...a)=>console.log(`[NQTR] ${n}`,...a),i.warn=(n,...a)=>console.warn(`[NQTR] ${n}`,...a),i.error=(n,...a)=>console.error(`[NQTR] ${n}`,...a),i.info=(n,...a)=>console.info(`[NQTR] ${n}`,...a)))(o||={});var f=class extends storage.StoredClassModel{constructor(e,t,r=[]){super(e,t),this.defaultActivitiesIds=r.map(i=>typeof i=="string"?i:i.id);}defaultActivitiesIds;get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(e){let t=this.activeActivityScheduling;delete t[e],this.setStorageProperty("activeActivityScheduling",t);let r=this.excludedActivitiesScheduling;delete r[e],this.setStorageProperty("excludedActivitiesScheduling",r);}editActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.activeActivityScheduling;r[e]=t,this.setStorageProperty("activeActivityScheduling",r);}editExcludedActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.excludedActivitiesScheduling;r[e]=t,this.setStorageProperty("excludedActivitiesScheduling",r);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}get activitiesIds(){return this.additionalActivitiesIds.concat(this.defaultActivitiesIds)}addActivity(e,t={}){let r=typeof e=="string"?Qe.RegisteredActivities.get(e):e;if(!r)throw o.error(`Activity with id ${e} not found.`),new core.PixiError("unknown_element",`Activity with id ${e} not found.`);let{timeSlot:i,dateScheduling:n}=t;if(i&&!Array.isArray(i)&&(i=[i]),i?.forEach(c=>{let{to:l=handlers.timeTracker.dayEndTime+1}=c||{};if(c&&c.from>=l)throw o.error("The from time must be less than the to time."),new core.PixiError("invalid_usage","The from time must be less than the to time.")}),n?.from!==void 0&&n?.to!==void 0&&n?.from>=n?.to)throw o.error("The from day/date must be less than the to day/date."),new core.PixiError("invalid_usage","The from day/date must be less than the to day/date.");let a=this.additionalActivitiesIds;this.defaultActivitiesIds.includes(r.id)||a.includes(r.id)?o.info(`Activity with id ${r.id} already exists in the ${this.id}, so it will be updated with the new scheduling options if they are provided.`):(a.push(r.id),this.setStorageProperty("additionalActivitiesIds",a)),this.excludedActivitiesIds.includes(r.id)&&(this.removeActivityScheduling(r.id),o.log(`Activity with id ${r.id} was excluded from the ${this.id}, but now it will be added again with the new scheduling options. So it will be removed from the excluded activities list.`)),(i||n)&&this.editActivityScheduling(r.id,{timeSlot:i,dateScheduling:n});}removeActivity(e){let t=typeof e=="string"?e:e.id,r=this.additionalActivitiesIds;if(r.includes(t))r=r.filter(i=>i!==t),this.setStorageProperty("additionalActivitiesIds",r);else if(this.defaultActivitiesIds.includes(t)){let i=this.excludedActivitiesIds;i.push(t),this.setStorageProperty("excludedActivitiesIds",i);}else o.warn(`Activity with id ${t} not found, so it will be ignored.`);}clearExpiredActivities(){let e=this.activeActivityScheduling,t=this.excludedActivitiesScheduling,r=this.additionalActivitiesIds,i=this.excludedActivitiesIds;r.forEach(n=>{if(n in e){let{to:a}=e[n].dateScheduling||{};a&&a<handlers.timeTracker.currentDate&&(this.removeActivityScheduling(n),r=r.filter(c=>c!==n));}}),i.forEach(n=>{n in t&&t[n]&&(this.removeActivityScheduling(n),i=i.filter(a=>a!==n));});}get activities(){return [...new Set([...this.additionalActivitiesIds,...this.defaultActivitiesIds])].reduce((e,t)=>{let r=Qe.RegisteredActivities.get(t);return r?.isActive(this.activeActivityScheduling[t])&&!this.excludedActivitiesScheduling[t]&&e.push(r),e},[])}};var Se="__nqtr-location__",h=class extends f{constructor(t,r,i=[]){super(Se,t,i);this._map=r;}_map;get map(){return this._map}get rooms(){return handlers.navigator.rooms.filter(t=>t.location.id===this.id)}};var b=class extends h{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Te="__nqtr-map__",y=class extends f{constructor(e,t=[]){super(Te,e,t);}get locations(){return handlers.navigator.locations.filter(e=>e.map.id===this.id)}};var C=class extends y{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var te="__nqtr-room__",v=class extends f{_location;constructor(e,t,r=[]){Array.isArray(r)?super(te,e,r):(super(te,e,r.activities),r.routine.forEach(i=>{let n=typeof i=="string"?i:i.id;Qe.fixedCommitments.set(n,e);})),this._location=t;}get routine(){return handlers.routine.roomCommitments[this.id]||[]}addCommitment(e,t={}){let{timeSlot:r,dateScheduling:i}=t;if(r&&!Array.isArray(r)&&(r=[r]),r?.forEach(n=>{let{to:a=handlers.timeTracker.dayEndTime+1}=n||{};if(n&&n.from>=a)throw o.error("The from time must be less than the to time."),new core.PixiError("invalid_usage","The from time must be less than the to time.")}),i?.from!==void 0&&i?.to!==void 0&&i?.from>=i?.to)throw o.error("The from day/date must be less than the to day/date."),new core.PixiError("invalid_usage","The from day/date must be less than the to day/date.");handlers.routine.add(e,this.id,{timeSlot:r,dateScheduling:i});}removeCommitment(e){handlers.routine.remove(e,this.id);}get location(){return this._location}get characters(){return this.routine.reduce((e,t)=>(e.push(...t.characters),e),[])}get automaticFunctions(){return this.routine.reduce((e,t)=>{if(t.executionType==="automatic"&&t.run){let r=async i=>{await t.run(i);};e.push(r);}return e},[])}};var E=class extends v{constructor(e,t,r={}){super(e,t,{activities:r.activities||[],routine:r.routine||[]}),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Ae="__nqtr-quest__",S=class extends storage.StoredClassModel{constructor(t,r,i={}){super(Ae,t);this._stages=r;this._onStart=i.onStart,this._onContinue=i.onContinue||i.onNextStage;}_stages;get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===void 0||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==void 0}get completed(){return this.currentStageIndex===void 0?false:this.currentStageIndex>this.stages.length-1}get inProgress(){return this.completed||this.failed?false:this.started}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onContinue;get onContinue(){return this._onContinue}get onNextStage(){return this._onContinue}async start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){o.error(`Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r?.start)return this.onStart&&await this.onStart(this,t),await r.start(t);o.error(`Quest ${this.id} has no start stage`);}async goNextIfCompleted(t){return await this.advanceIfCompleted(t)}async advanceIfCompleted(t){if(!this.inProgress)return false;let r=this.currentStage;return r?r.completed?await this.advanceUnconditionally(t):false:(o.error(`Quest ${this.id} has no current stage`),false)}async goNext(t){return await this.continue(t)}async continue(t){let r=this.currentStage;return r?(r.completed=true,await this.advanceUnconditionally(t)):(o.error(`Quest ${this.id} has no current stage`),false)}async forceGoNext(t){return await this.advanceUnconditionally(t)}async advanceUnconditionally(t){if(!this.inProgress)return console.warn(`[NQTR] Quest ${this.id} is not in progress`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===void 0)return o.error(`Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onContinue&&await this.onContinue(this,t),r?.onEnd&&await r.onEnd(r,t);let n=this.currentStage;return n&&(n.inizialize(),this.currentStageMustStart&&await this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}async startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?await r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var P=class extends S{constructor(e,t,r){super(e,t,{onStart:r.onStart,onContinue:r.onContinue||r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var Ce="__nqtr-stage__",I=class extends storage.StoredClassModel{constructor(e,t={}){super(Ce,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._deltaDateRequired=t.deltaDateRequired,this._questsRequired=t.questsRequired||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get inizializeDate(){return this.getStorageProperty("inizializeDate")}set inizializeDate(e){this.setStorageProperty("inizializeDate",e);}get startDate(){let e=this.inizializeDate;if(e!==void 0)return e+this.deltaDateRequired}get canStart(){let e=this.deltaDateRequired;if(e>0){let t=this.inizializeDate;if(t===void 0||t+e>handlers.timeTracker.currentDate)return false}return !(this.questsRequired.length>0&&!this.questsRequired.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.deltaDateRequired>0&&(this.inizializeDate=handlers.timeTracker.currentDate,console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`));}async start(e){this.canStart?(this.started=true,this.onStart&&await this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_deltaDateRequired;get deltaDateRequired(){return this._deltaDateRequired||0}_questsRequired;get questsRequired(){return this._questsRequired||[]}};var D=class extends I{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,deltaDateRequired:t.deltaDateRequired,questsRequired:t.questsRequired}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequired=t.flagsRequired||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequired;get flagsRequired(){return this._flagsRequired}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>storage.storage.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequired.length>0&&!this.flagsRequired.every(e=>storage.storage.getFlag(e.flag))?false:super.canStart}};var ae={};var oe={};var G={};K(G,{navigator:()=>qe,questsNotebook:()=>Ne,routine:()=>Me,timeTracker:()=>Oe});var w=class{get rooms(){return Qe.RegisteredRooms.values()}get locations(){return Qe.RegisteredLocations.values()}get maps(){return Qe.RegisteredMaps.values()}get currentRoomId(){return storage.storage.get(g)}get currentRoom(){let e=this.currentRoomId;if(!e){o.error("The current room has not yet been set");return}let t=Qe.RegisteredRooms.get(e);if(!t){o.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!Qe.RegisteredRooms.get(e)){o.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.storage.get(g);r!==e&&(R({type:"editroom",prev:r,value:e}),storage.storage.set(g,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Qe.RegisteredRooms.values().forEach(e=>{e.clearExpiredActivities();});}};var O=class{get quests(){return Qe.RegisteredQuests.values()}get startedQuests(){return this.quests.filter(e=>e.started)}get inProgressQuests(){return this.quests.filter(e=>e.inProgress)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return Qe.RegisteredQuests.get(e)}async startsStageMustBeStarted(e){let t=this.quests.map(r=>r.currentStageMustStart?r.startCurrentStage(e):Promise.resolve());await Promise.all(t);}};var z="___nqtr-temporary_commitment___",q=class{get temporaryRoutine(){let e=storage.storage.get(z);if(e){if(Array.isArray(e)){if(e.length>0)throw new core.PixiError("obsolete_save","The save you loaded is not compatible with the current version of NQTR. Please delete the save and start a new game.");return {}}}else return {};return e}get commitmentsIds(){return [...Qe.fixedCommitments.keys(),...Object.keys(this.temporaryRoutine)]}add(e,t,r={}){Array.isArray(e)||(e=[e]);let i=this.temporaryRoutine;e.forEach(n=>{let a=typeof n=="string"?n:n.id;i[a]={id:a,roomId:t,...r};}),storage.storage.set(z,i);}find(e){return Qe.RegisteredCommitments.get(e)}remove(e,t){typeof e!="string"&&(e=e.id);let r=this.temporaryRoutine;r[e]?(!t||r[e].roomId===t)&&delete r[e]:o.warn(`The commitment ${e} was not found in the temporary routine, so it will be ignored. If you want to remove a fixed commitment, you can add it to the temporary routine with a same character.`),storage.storage.set(z,r);}clearExpiredRoutine(){Qe.RegisteredCommitments.values().forEach(e=>{e.expired&&this.remove(e);});}get characterCommitments(){let e=this.temporaryRoutine;return this.commitmentsIds.reduce((t,r)=>{let i=Qe.RegisteredCommitments.get(r),n=e[r],a=n?.roomId||Qe.fixedCommitments.get(r);return a&&i?.isActive(n)&&(i.characters.length>0?i.characters.every(l=>!t[l.id]||i.priority>t[l.id][0].priority)&&i.characters.forEach(l=>{t[l.id]=[i,a];}):o.error(`The commitment ${i.id} has no characters assigned`)),t},{})}get currentRoutine(){return Object.values(this.characterCommitments).map(([e])=>e)}get roomCommitments(){return Object.values(this.characterCommitments).reduce((e,t)=>{let r=t[1];return e[r]||(e[r]=[]),e[r].push(t[0]),e},{})}getCommitmentByCharacter(e){let t=typeof e=="string"?e:e.id;return this.currentRoutine.find(r=>{if(r.characters.map(i=>i.id).includes(t))return r})}};var we={dayStartTime:0,dayEndTime:24,defaultTimeSpent:1,timeSlots:[],weekLength:7,weekendStartDay:6,getDayName:void 0},d=we;var M=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:i=1,timeSlots:n=[],weekLength:a=7,weekendStartDay:c=a-1,getDayName:l}=e;d.dayStartTime=t,d.dayEndTime=r,d.defaultTimeSpent=i,d.timeSlots=n,d.weekLength=a,c>=d.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${a}, so will be ignored`):d.weekendStartDay=c,d.getDayName=l;}get dayStartTime(){return d.dayStartTime}get dayEndTime(){return d.dayEndTime}get defaultTimeSpent(){return d.defaultTimeSpent}get timeSlots(){return d.timeSlots}get weekLength(){return d.weekLength}get weekendStartDay(){return d.weekendStartDay}get getDayName(){return d.getDayName}get currentTime(){let e=storage.storage.get(u)||{};return Object.hasOwn(e,"currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.storage.get(u)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,R({type:"edittime",prev:t,value:r}),storage.storage.set(u,r);}get currentDate(){let e=storage.storage.get(u)||{};return Object.hasOwn(e,"currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.storage.get(u)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,R({type:"edittime",prev:t,value:r}),storage.storage.set(u,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var Oe=new M,qe=new w,Me=new q,Ne=new O;var Le={...B,...ae,...oe,handlers:G,registries:Qe__namespace},wr=Le;Object.defineProperty(exports,"RegisteredActivities",{enumerable:true,get:function(){return Qe.RegisteredActivities}});Object.defineProperty(exports,"RegisteredCommitments",{enumerable:true,get:function(){return Qe.RegisteredCommitments}});Object.defineProperty(exports,"RegisteredLocations",{enumerable:true,get:function(){return Qe.RegisteredLocations}});Object.defineProperty(exports,"RegisteredMaps",{enumerable:true,get:function(){return Qe.RegisteredMaps}});Object.defineProperty(exports,"RegisteredQuests",{enumerable:true,get:function(){return Qe.RegisteredQuests}});Object.defineProperty(exports,"RegisteredRooms",{enumerable:true,get:function(){return Qe.RegisteredRooms}});exports.ActivityBaseModel=_;exports.ActivityStoredClass=m;exports.CommitmentBaseModel=A;exports.CommitmentStoredClass=p;exports.LocationBaseModel=b;exports.LocationStoredClass=h;exports.MapBaseModel=C;exports.MapStoredClass=y;exports.QuestBaseModel=P;exports.QuestStoredClass=S;exports.RoomBaseModel=E;exports.RoomStoredClass=v;exports.StageBaseModel=D;exports.StageStoredClass=I;exports.default=wr;Object.keys(handlers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return handlers[k]}})});
package/dist/index.d.mts CHANGED
@@ -2,13 +2,13 @@ export * from '@drincs/nqtr/handlers';
2
2
  import * as registries from '@drincs/nqtr/registries';
3
3
  import { ActivityIdType, CommitmentIdType } from '@drincs/nqtr/registries';
4
4
  export { ActivityIdType, CommitmentIdType, LocationIdType, MapIdType, NqtrActivityIds, NqtrCommitmentIds, NqtrLocationIds, NqtrMapIds, NqtrQuestIds, NqtrRoomIds, QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuests, RegisteredRooms, RoomIdType } from '@drincs/nqtr/registries';
5
- import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, b as ActivityBaseInternalInterface, c as ActiveScheduling, d as OnRunAsyncFunction, e as CommitmentBaseInternalInterface, f as OnRunProps, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, R as RoomInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-BN_O8nDA.mjs';
6
- export { l as OnRunFunction } from './StageInterface-BN_O8nDA.mjs';
5
+ import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, b as ActivityBaseInternalInterface, c as ActiveScheduling, d as OnRunAsyncFunction, e as CommitmentBaseInternalInterface, f as OnRunProps, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, R as RoomInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-B8NCX3T6.mjs';
6
+ export { l as OnRunFunction } from './StageInterface-B8NCX3T6.mjs';
7
7
  import { StoredClassModel } from '@drincs/pixi-vn/storage';
8
8
  import { CharacterInterface, CharacterIdType } from '@drincs/pixi-vn/characters';
9
9
  import { CharacterInterface as CharacterInterface$1, CharacterIdType as CharacterIdType$1 } from '@drincs/pixi-vn';
10
- import { h as handlers$1 } from './index-D0T0L2IE.mjs';
11
- export { T as ITimeStlot, a as TimeSettings } from './index-D0T0L2IE.mjs';
10
+ import { h as handlers$1 } from './index-CnkqN42W.mjs';
11
+ export { T as ITimeStlot, N as NavigatorHandlerInterface, Q as QuestHandlerInterface, R as RoutineHandlerInterface, a as TimeHandlerInterface, b as TimeSettings } from './index-CnkqN42W.mjs';
12
12
  import '@drincs/nqtr';
13
13
 
14
14
  interface ActivityProps {
@@ -299,7 +299,7 @@ declare class ActivityStoredClass<OnRunEventType = ActivityInterface> extends St
299
299
  get timeSlot(): TimeSchedulingInterface[] | TimeSchedulingInterface | undefined;
300
300
  private _dateScheduling?;
301
301
  get dateScheduling(): DateSchedulingInterface | undefined;
302
- protected addTempHistoryItem(): void;
302
+ protected addTempHistoryItem(): Promise<void>;
303
303
  get run(): OnRunAsyncFunction;
304
304
  get expired(): boolean;
305
305
  isActive(options?: ActiveScheduling): boolean;
@@ -391,7 +391,7 @@ declare class CommitmentStoredClass extends ActivityStoredClass<CommitmentInterf
391
391
  set executionType(value: ExecutionType);
392
392
  get priority(): number;
393
393
  set priority(value: number);
394
- protected addTempHistoryItem(): void;
394
+ protected addTempHistoryItem(): Promise<void>;
395
395
  /**
396
396
  * Options for {@link run}.
397
397
  */
package/dist/index.d.ts CHANGED
@@ -2,13 +2,13 @@ export * from '@drincs/nqtr/handlers';
2
2
  import * as registries from '@drincs/nqtr/registries';
3
3
  import { ActivityIdType, CommitmentIdType } from '@drincs/nqtr/registries';
4
4
  export { ActivityIdType, CommitmentIdType, LocationIdType, MapIdType, NqtrActivityIds, NqtrCommitmentIds, NqtrLocationIds, NqtrMapIds, NqtrQuestIds, NqtrRoomIds, QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuests, RegisteredRooms, RoomIdType } from '@drincs/nqtr/registries';
5
- import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, b as ActivityBaseInternalInterface, c as ActiveScheduling, d as OnRunAsyncFunction, e as CommitmentBaseInternalInterface, f as OnRunProps, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, R as RoomInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-BN_O8nDA.js';
6
- export { l as OnRunFunction } from './StageInterface-BN_O8nDA.js';
5
+ import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, b as ActivityBaseInternalInterface, c as ActiveScheduling, d as OnRunAsyncFunction, e as CommitmentBaseInternalInterface, f as OnRunProps, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, R as RoomInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-B8NCX3T6.js';
6
+ export { l as OnRunFunction } from './StageInterface-B8NCX3T6.js';
7
7
  import { StoredClassModel } from '@drincs/pixi-vn/storage';
8
8
  import { CharacterInterface, CharacterIdType } from '@drincs/pixi-vn/characters';
9
9
  import { CharacterInterface as CharacterInterface$1, CharacterIdType as CharacterIdType$1 } from '@drincs/pixi-vn';
10
- import { h as handlers$1 } from './index-CtxMgD9N.js';
11
- export { T as ITimeStlot, a as TimeSettings } from './index-CtxMgD9N.js';
10
+ import { h as handlers$1 } from './index-C2ZYWKtA.js';
11
+ export { T as ITimeStlot, N as NavigatorHandlerInterface, Q as QuestHandlerInterface, R as RoutineHandlerInterface, a as TimeHandlerInterface, b as TimeSettings } from './index-C2ZYWKtA.js';
12
12
  import '@drincs/nqtr';
13
13
 
14
14
  interface ActivityProps {
@@ -299,7 +299,7 @@ declare class ActivityStoredClass<OnRunEventType = ActivityInterface> extends St
299
299
  get timeSlot(): TimeSchedulingInterface[] | TimeSchedulingInterface | undefined;
300
300
  private _dateScheduling?;
301
301
  get dateScheduling(): DateSchedulingInterface | undefined;
302
- protected addTempHistoryItem(): void;
302
+ protected addTempHistoryItem(): Promise<void>;
303
303
  get run(): OnRunAsyncFunction;
304
304
  get expired(): boolean;
305
305
  isActive(options?: ActiveScheduling): boolean;
@@ -391,7 +391,7 @@ declare class CommitmentStoredClass extends ActivityStoredClass<CommitmentInterf
391
391
  set executionType(value: ExecutionType);
392
392
  get priority(): number;
393
393
  set priority(value: number);
394
- protected addTempHistoryItem(): void;
394
+ protected addTempHistoryItem(): Promise<void>;
395
395
  /**
396
396
  * Options for {@link run}.
397
397
  */