@drincs/nqtr 0.3.5 → 0.3.6

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 (49) hide show
  1. package/dist/classes/index.d.mts +2 -2
  2. package/dist/classes/index.d.ts +2 -2
  3. package/dist/classes/index.js +1 -1
  4. package/dist/classes/index.js.map +1 -1
  5. package/dist/classes/index.mjs +1 -1
  6. package/dist/classes/index.mjs.map +1 -1
  7. package/dist/classes/navigation/LocationBaseModel.js +1 -1
  8. package/dist/classes/navigation/LocationBaseModel.js.map +1 -1
  9. package/dist/classes/navigation/LocationBaseModel.mjs +1 -1
  10. package/dist/classes/navigation/LocationBaseModel.mjs.map +1 -1
  11. package/dist/classes/navigation/LocationStoredClass.js +1 -1
  12. package/dist/classes/navigation/LocationStoredClass.js.map +1 -1
  13. package/dist/classes/navigation/LocationStoredClass.mjs +1 -1
  14. package/dist/classes/navigation/LocationStoredClass.mjs.map +1 -1
  15. package/dist/classes/navigation/MapBaseModel.js +1 -1
  16. package/dist/classes/navigation/MapBaseModel.js.map +1 -1
  17. package/dist/classes/navigation/MapBaseModel.mjs +1 -1
  18. package/dist/classes/navigation/MapBaseModel.mjs.map +1 -1
  19. package/dist/classes/navigation/MapStoredClass.js +1 -1
  20. package/dist/classes/navigation/MapStoredClass.js.map +1 -1
  21. package/dist/classes/navigation/MapStoredClass.mjs +1 -1
  22. package/dist/classes/navigation/MapStoredClass.mjs.map +1 -1
  23. package/dist/classes/navigation/NavigationAbstractClass.d.mts +1 -1
  24. package/dist/classes/navigation/NavigationAbstractClass.d.ts +1 -1
  25. package/dist/classes/navigation/NavigationAbstractClass.js +1 -1
  26. package/dist/classes/navigation/NavigationAbstractClass.js.map +1 -1
  27. package/dist/classes/navigation/NavigationAbstractClass.mjs +1 -1
  28. package/dist/classes/navigation/NavigationAbstractClass.mjs.map +1 -1
  29. package/dist/classes/navigation/RoomBaseModel.js +1 -1
  30. package/dist/classes/navigation/RoomBaseModel.js.map +1 -1
  31. package/dist/classes/navigation/RoomBaseModel.mjs +1 -1
  32. package/dist/classes/navigation/RoomBaseModel.mjs.map +1 -1
  33. package/dist/classes/navigation/RoomStoredClass.js +1 -1
  34. package/dist/classes/navigation/RoomStoredClass.js.map +1 -1
  35. package/dist/classes/navigation/RoomStoredClass.mjs +1 -1
  36. package/dist/classes/navigation/RoomStoredClass.mjs.map +1 -1
  37. package/dist/decorators/index.d.mts +1 -1
  38. package/dist/decorators/index.d.ts +1 -1
  39. package/dist/decorators/index.js +1 -1
  40. package/dist/decorators/index.mjs +1 -1
  41. package/dist/index.d.mts +4 -4
  42. package/dist/index.d.ts +4 -4
  43. package/dist/index.js +1 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +1 -1
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/interface/navigation/NavigationAbstractClass.d.mts +1 -1
  48. package/dist/interface/navigation/NavigationAbstractClass.d.ts +1 -1
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/decorators/ActivityDecorator.ts","../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/navigation/NavigationAbstractClass.ts"],"names":["registeredActivities","getActivityById","id","activity","TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","NavigationAbstractClass","StoredClassModel","categoryId","defaultActivities","activityId","activeActivityScheduling","excludedActivitiesScheduling","scheduling","options","hours","fromDay","toDay","additionalActivitiesIds","excludedActivitiesIds","res"],"mappings":"mDAEO,IAAMA,CAAAA,CAA4D,EAiBlE,CAAA,SAASC,CAAgBC,CAAAA,CAAAA,CAA2C,CACvE,GAAI,CACA,IAAIC,CAAAA,CAAWH,CAAqBE,CAAAA,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EAEzB,CAAC,CAAA,CACD,OAAO,OAAQ,CAAA,IAAA,CAAK,4BAA4B,CAAA,CAAE,OAAQ,CAAA,CAAC,CAAC+B,CAAYG,CAAAA,CAAU,CAAM,GAAA,CACpF,IAAIlC,CAAAA,CAAWF,EAAgBiC,CAAU,CAAA,CACrC/B,CAAYA,EAAAA,CAAAA,CAAS,QACrB,EAAA,EAAEkC,EAAW,KAASA,EAAAA,CAAAA,CAAW,KAASR,EAAAA,CAAAA,CAAY,UAEtDe,CAAAA,EAAAA,CAAAA,CAAI,IAAKzC,CAAAA,CAAQ,EAEzB,CAAC,CACMyC,CAAAA,CACX,CACJ","file":"NavigationAbstractClass.js","sourcesContent":["import { ActivityInterface } from \"../interface\"\n\nexport const registeredActivities: { [id: string]: ActivityInterface } = {}\n\nexport function saveActivity(activities: ActivityInterface | ActivityInterface[]) {\n if (Array.isArray(activities)) {\n activities.forEach(activity => {\n registeredActivities[activity.id] = activity\n })\n return\n }\n registeredActivities[activities.id] = activities\n}\n\n/**\n * Get an activity by its id.\n * @param id The id of the activity.\n * @returns The activity or undefined if not found.\n */\nexport function getActivityById(id: string): ActivityInterface | undefined {\n try {\n let activity = registeredActivities[id]\n if (!activity) {\n console.error(`[NQTR] Activity ${id} not found`)\n return\n }\n return activity\n }\n catch (e) {\n console.error(`[NQTR] Error while getting Activity ${id}`, e)\n return\n }\n}\n","export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * 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'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { getActivityById } from \"../../decorators\";\nimport { ActivityInterface } from \"../../interface\";\nimport NavigationAbstractInterface from \"../../interface/navigation/NavigationAbstractClass\";\nimport { timeTracker } from \"../../managers\";\n\ntype ActiveScheduling = {\n fromHour?: number\n toHour?: number\n fromDay?: number\n toDay?: number\n}\ntype ExcludedScheduling = {\n toDay?: number\n}\n\nexport default abstract class NavigationAbstractClass extends StoredClassModel implements NavigationAbstractInterface {\n constructor(\n categoryId: string, id: string,\n private defaultActivities: ActivityInterface[] = []\n ) {\n super(categoryId, id)\n }\n private get defaultActivitiesIds(): string[] {\n return this.defaultActivities.map(activity => activity.id)\n }\n private get activeActivityScheduling(): { [activityId: string]: ActiveScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ActiveScheduling }>(`activeActivityScheduling`) || {}\n }\n private get excludedActivitiesScheduling(): { [activityId: string]: ExcludedScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ExcludedScheduling }>(`excludedActivitiesScheduling`) || {}\n }\n private removeActivityScheduling(activityId: string) {\n let activeActivityScheduling = this.activeActivityScheduling\n delete activeActivityScheduling[activityId]\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling)\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n delete excludedActivitiesScheduling[activityId]\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling)\n }\n private editActivityScheduling(activityId: string, scheduling: ActiveScheduling) {\n this.removeActivityScheduling(activityId)\n let activeActivityScheduling = this.activeActivityScheduling\n activeActivityScheduling[activityId] = scheduling\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling)\n }\n private editExcludedActivityScheduling(activityId: string, scheduling: ExcludedScheduling) {\n this.removeActivityScheduling(activityId)\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n excludedActivitiesScheduling[activityId] = scheduling\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling)\n }\n private get additionalActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`additionalActivitiesIds`) || []\n }\n private get excludedActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`excludedActivitiesIds`) || []\n }\n addActivity(activity: ActivityInterface, options: {\n /**\n * the activity will be associated with this class only for the specified hours.\n * If you set from 3 and to 5, the activity will be associated with this class only for hours 3, 4 and 5. soSo at 2 or 6 it will not be associated with this class.\n */\n hours?: {\n from: number\n to: number\n }\n /**\n * the activity will be associated with this class from the specified day.\n * If you set 3, the activity will be associated with this class from day 3. So at day 2 it will not be associated with this class.\n */\n fromDay?: number\n /**\n * the activity will be associated with this class to the specified day.\n * If you set 3, the activity will be associated with this class until day 3. So at day 4 it will not be associated with this class.\n */\n toDay?: number\n } = {}) {\n const { hours, fromDay, toDay } = options\n let scheduling: ActiveScheduling = {}\n if (hours) {\n if (hours.from >= hours.to) {\n throw new Error(`[NQTR] The from hour must be less than the to hour.`)\n }\n scheduling.fromHour = hours.from\n }\n if (fromDay === 0) {\n console.warn(`[NQTR] The from day must be greater than 0, so it will be ignored.`)\n }\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`)\n }\n if (fromDay && toDay && fromDay >= toDay) {\n throw new Error(`[NQTR] The from day must be less than the to day.`)\n }\n if (fromDay) {\n scheduling.fromDay = fromDay\n }\n if (toDay) {\n scheduling.toDay = toDay\n }\n\n if (this.defaultActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`)\n return\n }\n let additionalActivitiesIds = this.additionalActivitiesIds\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling)\n return\n }\n else if (this.excludedActivitiesIds.includes(activity.id)) {\n this.removeActivityScheduling(activity.id)\n console.log(`[NQTR] Activity with id ${activity.id} was excluded, so it will be associated with this class again.`)\n return\n }\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`)\n return\n }\n additionalActivitiesIds.push(activity.id)\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds)\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling)\n }\n }\n revoveActivity(activity: ActivityInterface, options: {\n /**\n * The activity will be excluded from this class only for the specified days.\n * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.\n */\n toDay?: number\n } = {}) {\n const { toDay } = options\n let scheduling: ExcludedScheduling = {}\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`)\n }\n if (toDay) {\n scheduling.toDay = toDay\n }\n\n let additionalActivitiesIds = this.additionalActivitiesIds\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling)\n return\n }\n additionalActivitiesIds = additionalActivitiesIds.filter(id => id !== activity.id)\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds)\n }\n else if (this.defaultActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling)\n return\n }\n let excludedActivitiesIds = this.excludedActivitiesIds\n excludedActivitiesIds.push(activity.id)\n this.setStorageProperty(`excludedActivitiesIds`, excludedActivitiesIds)\n }\n else {\n console.warn(`[NQTR] Activity with id ${activity.id} not found, so it will be ignored.`)\n }\n }\n clearExpiredActivities() {\n let activeActivityScheduling = this.activeActivityScheduling\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n let additionalActivitiesIds = this.additionalActivitiesIds\n let excludedActivitiesIds = this.excludedActivitiesIds\n\n additionalActivitiesIds.forEach(activityId => {\n if (activityId in activeActivityScheduling) {\n let { toDay } = activeActivityScheduling[activityId]\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId)\n additionalActivitiesIds = additionalActivitiesIds.filter(id => id !== activityId)\n }\n }\n })\n excludedActivitiesIds.forEach(activityId => {\n if (activityId in excludedActivitiesScheduling) {\n let { toDay } = excludedActivitiesScheduling[activityId]\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId)\n excludedActivitiesIds = excludedActivitiesIds.filter(id => id !== activityId)\n }\n }\n })\n }\n\n get activities(): ActivityInterface[] {\n let res: ActivityInterface[] = []\n Object.entries(this.activeActivityScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId)\n const { fromDay = activity?.fromDay, fromHour = activity?.fromHour, toDay = activity?.toDay, toHour = activity?.toHour } = scheduling\n if (activity &&\n !(fromHour && toHour && !timeTracker.nowIsBetween(fromHour, toHour)) &&\n !(fromDay && fromDay > timeTracker.currentDay) &&\n !(toDay && toDay < timeTracker.currentDay)\n ) {\n res.push(activity)\n }\n })\n Object.entries(this.excludedActivitiesScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId)\n if (activity && activity.isActive &&\n !(scheduling.toDay && scheduling.toDay >= timeTracker.currentDay)\n ) {\n res.push(activity)\n }\n })\n return res\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/decorators/ActivityDecorator.ts","../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/navigation/NavigationAbstractClass.ts"],"names":["registeredActivities","getActivityById","id","activity","TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","NavigationAbstractClass","StoredClassModel","categoryId","defaultActivities","activityId","activeActivityScheduling","excludedActivitiesScheduling","scheduling","options","hours","fromDay","toDay","additionalActivitiesIds","excludedActivitiesIds","res"],"mappings":"mDAEO,IAAMA,CAAAA,CAA4D,EAiBlE,CAAA,SAASC,CAAgBC,CAAAA,CAAAA,CAA2C,CACvE,GAAI,CACA,IAAIC,CAAAA,CAAWH,CAAqBE,CAAAA,CAAE,CACtC,CAAA,GAAI,CAACC,CAAU,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAmBD,gBAAAA,EAAAA,CAAE,YAAY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,CAAU,CAAM,GAAA,CACpF,IAAIlC,CAAAA,CAAWF,EAAgBiC,CAAU,CAAA,CACrC/B,CAAYA,EAAAA,CAAAA,CAAS,QAAY,EAAA,EAAEkC,EAAW,KAASA,EAAAA,CAAAA,CAAW,KAASR,EAAAA,CAAAA,CAAY,UACvFe,CAAAA,EAAAA,CAAAA,CAAI,IAAKzC,CAAAA,CAAQ,EAEzB,CAAC,CACMyC,CAAAA,CACX,CACJ","file":"NavigationAbstractClass.js","sourcesContent":["import { ActivityInterface } from \"../interface\"\n\nexport const registeredActivities: { [id: string]: ActivityInterface } = {}\n\nexport function saveActivity(activities: ActivityInterface | ActivityInterface[]) {\n if (Array.isArray(activities)) {\n activities.forEach(activity => {\n registeredActivities[activity.id] = activity\n })\n return\n }\n registeredActivities[activities.id] = activities\n}\n\n/**\n * Get an activity by its id.\n * @param id The id of the activity.\n * @returns The activity or undefined if not found.\n */\nexport function getActivityById(id: string): ActivityInterface | undefined {\n try {\n let activity = registeredActivities[id]\n if (!activity) {\n console.error(`[NQTR] Activity ${id} not found`)\n return\n }\n return activity\n }\n catch (e) {\n console.error(`[NQTR] Error while getting Activity ${id}`, e)\n return\n }\n}\n","export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * 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'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { getActivityById } from \"../../decorators\";\nimport { ActivityInterface } from \"../../interface\";\nimport NavigationAbstractInterface from \"../../interface/navigation/NavigationAbstractClass\";\nimport { timeTracker } from \"../../managers\";\n\ntype ActiveScheduling = {\n fromHour?: number;\n toHour?: number;\n fromDay?: number;\n toDay?: number;\n};\ntype ExcludedScheduling = {\n toDay?: number;\n};\n\nexport default abstract class NavigationAbstractClass extends StoredClassModel implements NavigationAbstractInterface {\n constructor(categoryId: string, id: string, private defaultActivities: ActivityInterface[] = []) {\n super(categoryId, id);\n }\n private get defaultActivitiesIds(): string[] {\n return this.defaultActivities.map((activity) => activity.id);\n }\n private get activeActivityScheduling(): { [activityId: string]: ActiveScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ActiveScheduling }>(`activeActivityScheduling`) || {};\n }\n private get excludedActivitiesScheduling(): { [activityId: string]: ExcludedScheduling } {\n return (\n this.getStorageProperty<{ [activityId: string]: ExcludedScheduling }>(`excludedActivitiesScheduling`) || {}\n );\n }\n private removeActivityScheduling(activityId: string) {\n let activeActivityScheduling = this.activeActivityScheduling;\n delete activeActivityScheduling[activityId];\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n delete excludedActivitiesScheduling[activityId];\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private editActivityScheduling(activityId: string, scheduling: ActiveScheduling) {\n this.removeActivityScheduling(activityId);\n let activeActivityScheduling = this.activeActivityScheduling;\n activeActivityScheduling[activityId] = scheduling;\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n }\n private editExcludedActivityScheduling(activityId: string, scheduling: ExcludedScheduling) {\n this.removeActivityScheduling(activityId);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n excludedActivitiesScheduling[activityId] = scheduling;\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private get additionalActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`additionalActivitiesIds`) || [];\n }\n private get excludedActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`excludedActivitiesIds`) || [];\n }\n addActivity(\n activity: ActivityInterface,\n options: {\n /**\n * the activity will be associated with this class only for the specified hours.\n * If you set from 3 and to 5, the activity will be associated with this class only for hours 3, 4 and 5. soSo at 2 or 6 it will not be associated with this class.\n */\n hours?: {\n from: number;\n to: number;\n };\n /**\n * the activity will be associated with this class from the specified day.\n * If you set 3, the activity will be associated with this class from day 3. So at day 2 it will not be associated with this class.\n */\n fromDay?: number;\n /**\n * the activity will be associated with this class to the specified day.\n * If you set 3, the activity will be associated with this class until day 3. So at day 4 it will not be associated with this class.\n */\n toDay?: number;\n } = {}\n ) {\n const { hours, fromDay, toDay } = options;\n let scheduling: ActiveScheduling = {};\n if (hours) {\n if (hours.from >= hours.to) {\n throw new Error(`[NQTR] The from hour must be less than the to hour.`);\n }\n scheduling.fromHour = hours.from;\n }\n if (fromDay === 0) {\n console.warn(`[NQTR] The from day must be greater than 0, so it will be ignored.`);\n }\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`);\n }\n if (fromDay && toDay && fromDay >= toDay) {\n throw new Error(`[NQTR] The from day must be less than the to day.`);\n }\n if (fromDay) {\n scheduling.fromDay = fromDay;\n }\n if (toDay) {\n scheduling.toDay = toDay;\n }\n\n if (this.defaultActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n return;\n }\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling);\n return;\n } else if (this.excludedActivitiesIds.includes(activity.id)) {\n this.removeActivityScheduling(activity.id);\n console.log(\n `[NQTR] Activity with id ${activity.id} was excluded, so it will be associated with this class again.`\n );\n return;\n }\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n return;\n }\n additionalActivitiesIds.push(activity.id);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling);\n }\n }\n removeActivity(\n activity: ActivityInterface,\n options: {\n /**\n * The activity will be excluded from this class only for the specified days.\n * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.\n */\n toDay?: number;\n } = {}\n ) {\n const { toDay } = options;\n let scheduling: ExcludedScheduling = {};\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`);\n }\n if (toDay) {\n scheduling.toDay = toDay;\n }\n\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling);\n return;\n }\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activity.id);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n } else if (this.defaultActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling);\n return;\n }\n let excludedActivitiesIds = this.excludedActivitiesIds;\n excludedActivitiesIds.push(activity.id);\n this.setStorageProperty(`excludedActivitiesIds`, excludedActivitiesIds);\n } else {\n console.warn(`[NQTR] Activity with id ${activity.id} not found, so it will be ignored.`);\n }\n }\n clearExpiredActivities() {\n let activeActivityScheduling = this.activeActivityScheduling;\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n let additionalActivitiesIds = this.additionalActivitiesIds;\n let excludedActivitiesIds = this.excludedActivitiesIds;\n\n additionalActivitiesIds.forEach((activityId) => {\n if (activityId in activeActivityScheduling) {\n let { toDay } = activeActivityScheduling[activityId];\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId);\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n excludedActivitiesIds.forEach((activityId) => {\n if (activityId in excludedActivitiesScheduling) {\n let { toDay } = excludedActivitiesScheduling[activityId];\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId);\n excludedActivitiesIds = excludedActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n }\n\n get activities(): ActivityInterface[] {\n let res: ActivityInterface[] = [];\n Object.entries(this.activeActivityScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId);\n const {\n fromDay = activity?.fromDay,\n fromHour = activity?.fromHour,\n toDay = activity?.toDay,\n toHour = activity?.toHour,\n } = scheduling;\n if (\n activity &&\n !(fromHour && toHour && !timeTracker.nowIsBetween(fromHour, toHour)) &&\n !(fromDay && fromDay > timeTracker.currentDay) &&\n !(toDay && toDay < timeTracker.currentDay)\n ) {\n res.push(activity);\n }\n });\n Object.entries(this.excludedActivitiesScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId);\n if (activity && activity.isActive && !(scheduling.toDay && scheduling.toDay >= timeTracker.currentDay)) {\n res.push(activity);\n }\n });\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {StoredClassModel,storage}from'@drincs/pixi-vn';var C={};function v(a){try{let e=C[a];if(!e){console.error(`[NQTR] Activity ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${a}`,e);return}}var d="___nqtr-time_manager_data___";var c=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var p=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:o=[],weekLength:n=7,weekendStartDay:s=n-1,weekDaysNames:u=[]}=e;c.minDayHours=t,c.maxDayHours=r,c.defaultTimeSpent=i,c.timeSlots=o,c.weekLength=n,s>=c.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${n}, so will be ignored`):c.weekendStartDay=s,u.length!==n?console.warn(`[NQTR] Week days names should be equal to week length ${n}, so will be ignored`):c.weekDaysNames=u;}get minDayHours(){return c.minDayHours}get maxDayHours(){return c.maxDayHours}get defaultTimeSpent(){return c.defaultTimeSpent}get timeSlots(){return c.timeSlots}get weekLength(){return c.weekLength}get weekendStartDay(){return c.weekendStartDay}get weekDaysNames(){return c.weekDaysNames}get currentHour(){let e=storage.getVariable(d)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=storage.getVariable(d)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,storage.setVariable(d,t);}get currentDay(){let e=storage.getVariable(d)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=storage.getVariable(d)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,storage.setVariable(d,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var l=new p;var T=class extends StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:o,toDay:n}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(o===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),n===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),o&&n&&o>=n)throw new Error("[NQTR] The from day must be less than the to day.");if(o&&(s.fromDay=o),n&&(s.toDay=n),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let u=this.additionalActivitiesIds;if(u.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}u.push(t.id),this.setStorageProperty("additionalActivitiesIds",u),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}revoveActivity(t,r={}){let{toDay:i}=r,o={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(o.toDay=i);let n=this.additionalActivitiesIds;if(n.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}n=n.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",n);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,o=this.excludedActivitiesIds;i.forEach(n=>{if(n in t){let{toDay:s}=t[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),i=i.filter(u=>u!==n));}}),o.forEach(n=>{if(n in r){let{toDay:s}=r[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),o=o.filter(u=>u!==n));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let o=v(r),{fromDay:n=o?.fromDay,fromHour:s=o?.fromHour,toDay:u=o?.toDay,toHour:R=o?.toHour}=i;o&&!(s&&R&&!l.nowIsBetween(s,R))&&!(n&&n>l.currentDay)&&!(u&&u<l.currentDay)&&t.push(o);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let o=v(r);o&&o.isActive&&!(i.toDay&&i.toDay>=l.currentDay)&&t.push(o);}),t}};export{T as default};//# sourceMappingURL=NavigationAbstractClass.mjs.map
1
+ import {StoredClassModel,storage}from'@drincs/pixi-vn';var C={};function v(a){try{let e=C[a];if(!e){console.error(`[NQTR] Activity ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${a}`,e);return}}var d="___nqtr-time_manager_data___";var c=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var p=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:o=[],weekLength:n=7,weekendStartDay:s=n-1,weekDaysNames:u=[]}=e;c.minDayHours=t,c.maxDayHours=r,c.defaultTimeSpent=i,c.timeSlots=o,c.weekLength=n,s>=c.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${n}, so will be ignored`):c.weekendStartDay=s,u.length!==n?console.warn(`[NQTR] Week days names should be equal to week length ${n}, so will be ignored`):c.weekDaysNames=u;}get minDayHours(){return c.minDayHours}get maxDayHours(){return c.maxDayHours}get defaultTimeSpent(){return c.defaultTimeSpent}get timeSlots(){return c.timeSlots}get weekLength(){return c.weekLength}get weekendStartDay(){return c.weekendStartDay}get weekDaysNames(){return c.weekDaysNames}get currentHour(){let e=storage.getVariable(d)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=storage.getVariable(d)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,storage.setVariable(d,t);}get currentDay(){let e=storage.getVariable(d)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=storage.getVariable(d)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,storage.setVariable(d,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var l=new p;var T=class extends StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:o,toDay:n}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(o===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),n===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),o&&n&&o>=n)throw new Error("[NQTR] The from day must be less than the to day.");if(o&&(s.fromDay=o),n&&(s.toDay=n),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let u=this.additionalActivitiesIds;if(u.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}u.push(t.id),this.setStorageProperty("additionalActivitiesIds",u),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}removeActivity(t,r={}){let{toDay:i}=r,o={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(o.toDay=i);let n=this.additionalActivitiesIds;if(n.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}n=n.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",n);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,o=this.excludedActivitiesIds;i.forEach(n=>{if(n in t){let{toDay:s}=t[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),i=i.filter(u=>u!==n));}}),o.forEach(n=>{if(n in r){let{toDay:s}=r[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),o=o.filter(u=>u!==n));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let o=v(r),{fromDay:n=o?.fromDay,fromHour:s=o?.fromHour,toDay:u=o?.toDay,toHour:R=o?.toHour}=i;o&&!(s&&R&&!l.nowIsBetween(s,R))&&!(n&&n>l.currentDay)&&!(u&&u<l.currentDay)&&t.push(o);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let o=v(r);o&&o.isActive&&!(i.toDay&&i.toDay>=l.currentDay)&&t.push(o);}),t}};export{T as default};//# sourceMappingURL=NavigationAbstractClass.mjs.map
2
2
  //# sourceMappingURL=NavigationAbstractClass.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/decorators/ActivityDecorator.ts","../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/navigation/NavigationAbstractClass.ts"],"names":["registeredActivities","getActivityById","id","activity","TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","NavigationAbstractClass","StoredClassModel","categoryId","defaultActivities","activityId","activeActivityScheduling","excludedActivitiesScheduling","scheduling","options","hours","fromDay","toDay","additionalActivitiesIds","excludedActivitiesIds","res"],"mappings":"uDAEO,IAAMA,CAAAA,CAA4D,EAiBlE,CAAA,SAASC,CAAgBC,CAAAA,CAAAA,CAA2C,CACvE,GAAI,CACA,IAAIC,CAAAA,CAAWH,CAAqBE,CAAAA,CAAE,CACtC,CAAA,GAAI,CAACC,CAAU,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAmBD,gBAAAA,EAAAA,CAAE,YAAY,CAC/C,CAAA,MACJ,CACA,OAAOC,CACX,CAAA,MACO,EAAG,CACN,OAAA,CAAQ,KAAM,CAAA,CAAA,oCAAA,EAAuCD,CAAE,CAAA,CAAA,CAAI,CAAC,CAC5D,CAAA,MACJ,CACJ,CC/BO,IAAME,CAAgB,CAAA,8BAAA,CCC7B,IAAqBC,CAArB,CAAA,KAAiE,CAC7D,OAAO,WAAsB,CAAA,CAAA,CAC7B,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,CAClC,CAAA,OAAO,UAA0B,EAAC,CAClC,OAAO,UAAA,CAAqB,CAC5B,CAAA,OAAO,gBAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CAAA,CCJA,IAAqBC,CAAAA,CAArB,KAAiC,CAC7B,UAAWC,CAAAA,CAAAA,CAAwB,CAC/B,GAAM,CACF,WAAAC,CAAAA,CAAAA,CAAc,CACd,CAAA,WAAA,CAAAC,EAAc,EACd,CAAA,gBAAA,CAAAC,CAAmB,CAAA,CAA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AAA,OAAA,CAAS,QAAAuB,CAAAA,CAAAA,CAAWvB,CAAU,EAAA,QAAA,CAAU,MAAAsC,CAAQtC,CAAAA,CAAAA,EAAU,KAAO,CAAA,MAAA,CAAAwB,CAASxB,CAAAA,CAAAA,EAAU,MAAO,CAAA,CAAIkC,CACvHlC,CAAAA,CAAAA,EACA,EAAEuB,CAAAA,EAAYC,CAAU,EAAA,CAACE,EAAY,YAAaH,CAAAA,CAAAA,CAAUC,CAAM,CAAA,CAAA,EAClE,EAAEa,CAAAA,EAAWA,EAAUX,CAAY,CAAA,UAAA,CAAA,EACnC,EAAEY,CAAAA,EAASA,CAAQZ,CAAAA,CAAAA,CAAY,aAE/Be,CAAI,CAAA,IAAA,CAAKzC,CAAQ,EAEzB,CAAC,CAAA,CACD,OAAO,OAAQ,CAAA,IAAA,CAAK,4BAA4B,CAAA,CAAE,OAAQ,CAAA,CAAC,CAAC+B,CAAYG,CAAAA,CAAU,CAAM,GAAA,CACpF,IAAIlC,CAAAA,CAAWF,EAAgBiC,CAAU,CAAA,CACrC/B,CAAYA,EAAAA,CAAAA,CAAS,QACrB,EAAA,EAAEkC,EAAW,KAASA,EAAAA,CAAAA,CAAW,KAASR,EAAAA,CAAAA,CAAY,UAEtDe,CAAAA,EAAAA,CAAAA,CAAI,IAAKzC,CAAAA,CAAQ,EAEzB,CAAC,CACMyC,CAAAA,CACX,CACJ","file":"NavigationAbstractClass.mjs","sourcesContent":["import { ActivityInterface } from \"../interface\"\n\nexport const registeredActivities: { [id: string]: ActivityInterface } = {}\n\nexport function saveActivity(activities: ActivityInterface | ActivityInterface[]) {\n if (Array.isArray(activities)) {\n activities.forEach(activity => {\n registeredActivities[activity.id] = activity\n })\n return\n }\n registeredActivities[activities.id] = activities\n}\n\n/**\n * Get an activity by its id.\n * @param id The id of the activity.\n * @returns The activity or undefined if not found.\n */\nexport function getActivityById(id: string): ActivityInterface | undefined {\n try {\n let activity = registeredActivities[id]\n if (!activity) {\n console.error(`[NQTR] Activity ${id} not found`)\n return\n }\n return activity\n }\n catch (e) {\n console.error(`[NQTR] Error while getting Activity ${id}`, e)\n return\n }\n}\n","export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * 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'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { getActivityById } from \"../../decorators\";\nimport { ActivityInterface } from \"../../interface\";\nimport NavigationAbstractInterface from \"../../interface/navigation/NavigationAbstractClass\";\nimport { timeTracker } from \"../../managers\";\n\ntype ActiveScheduling = {\n fromHour?: number\n toHour?: number\n fromDay?: number\n toDay?: number\n}\ntype ExcludedScheduling = {\n toDay?: number\n}\n\nexport default abstract class NavigationAbstractClass extends StoredClassModel implements NavigationAbstractInterface {\n constructor(\n categoryId: string, id: string,\n private defaultActivities: ActivityInterface[] = []\n ) {\n super(categoryId, id)\n }\n private get defaultActivitiesIds(): string[] {\n return this.defaultActivities.map(activity => activity.id)\n }\n private get activeActivityScheduling(): { [activityId: string]: ActiveScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ActiveScheduling }>(`activeActivityScheduling`) || {}\n }\n private get excludedActivitiesScheduling(): { [activityId: string]: ExcludedScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ExcludedScheduling }>(`excludedActivitiesScheduling`) || {}\n }\n private removeActivityScheduling(activityId: string) {\n let activeActivityScheduling = this.activeActivityScheduling\n delete activeActivityScheduling[activityId]\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling)\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n delete excludedActivitiesScheduling[activityId]\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling)\n }\n private editActivityScheduling(activityId: string, scheduling: ActiveScheduling) {\n this.removeActivityScheduling(activityId)\n let activeActivityScheduling = this.activeActivityScheduling\n activeActivityScheduling[activityId] = scheduling\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling)\n }\n private editExcludedActivityScheduling(activityId: string, scheduling: ExcludedScheduling) {\n this.removeActivityScheduling(activityId)\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n excludedActivitiesScheduling[activityId] = scheduling\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling)\n }\n private get additionalActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`additionalActivitiesIds`) || []\n }\n private get excludedActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`excludedActivitiesIds`) || []\n }\n addActivity(activity: ActivityInterface, options: {\n /**\n * the activity will be associated with this class only for the specified hours.\n * If you set from 3 and to 5, the activity will be associated with this class only for hours 3, 4 and 5. soSo at 2 or 6 it will not be associated with this class.\n */\n hours?: {\n from: number\n to: number\n }\n /**\n * the activity will be associated with this class from the specified day.\n * If you set 3, the activity will be associated with this class from day 3. So at day 2 it will not be associated with this class.\n */\n fromDay?: number\n /**\n * the activity will be associated with this class to the specified day.\n * If you set 3, the activity will be associated with this class until day 3. So at day 4 it will not be associated with this class.\n */\n toDay?: number\n } = {}) {\n const { hours, fromDay, toDay } = options\n let scheduling: ActiveScheduling = {}\n if (hours) {\n if (hours.from >= hours.to) {\n throw new Error(`[NQTR] The from hour must be less than the to hour.`)\n }\n scheduling.fromHour = hours.from\n }\n if (fromDay === 0) {\n console.warn(`[NQTR] The from day must be greater than 0, so it will be ignored.`)\n }\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`)\n }\n if (fromDay && toDay && fromDay >= toDay) {\n throw new Error(`[NQTR] The from day must be less than the to day.`)\n }\n if (fromDay) {\n scheduling.fromDay = fromDay\n }\n if (toDay) {\n scheduling.toDay = toDay\n }\n\n if (this.defaultActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`)\n return\n }\n let additionalActivitiesIds = this.additionalActivitiesIds\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling)\n return\n }\n else if (this.excludedActivitiesIds.includes(activity.id)) {\n this.removeActivityScheduling(activity.id)\n console.log(`[NQTR] Activity with id ${activity.id} was excluded, so it will be associated with this class again.`)\n return\n }\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`)\n return\n }\n additionalActivitiesIds.push(activity.id)\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds)\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling)\n }\n }\n revoveActivity(activity: ActivityInterface, options: {\n /**\n * The activity will be excluded from this class only for the specified days.\n * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.\n */\n toDay?: number\n } = {}) {\n const { toDay } = options\n let scheduling: ExcludedScheduling = {}\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`)\n }\n if (toDay) {\n scheduling.toDay = toDay\n }\n\n let additionalActivitiesIds = this.additionalActivitiesIds\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling)\n return\n }\n additionalActivitiesIds = additionalActivitiesIds.filter(id => id !== activity.id)\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds)\n }\n else if (this.defaultActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling)\n return\n }\n let excludedActivitiesIds = this.excludedActivitiesIds\n excludedActivitiesIds.push(activity.id)\n this.setStorageProperty(`excludedActivitiesIds`, excludedActivitiesIds)\n }\n else {\n console.warn(`[NQTR] Activity with id ${activity.id} not found, so it will be ignored.`)\n }\n }\n clearExpiredActivities() {\n let activeActivityScheduling = this.activeActivityScheduling\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling\n let additionalActivitiesIds = this.additionalActivitiesIds\n let excludedActivitiesIds = this.excludedActivitiesIds\n\n additionalActivitiesIds.forEach(activityId => {\n if (activityId in activeActivityScheduling) {\n let { toDay } = activeActivityScheduling[activityId]\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId)\n additionalActivitiesIds = additionalActivitiesIds.filter(id => id !== activityId)\n }\n }\n })\n excludedActivitiesIds.forEach(activityId => {\n if (activityId in excludedActivitiesScheduling) {\n let { toDay } = excludedActivitiesScheduling[activityId]\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId)\n excludedActivitiesIds = excludedActivitiesIds.filter(id => id !== activityId)\n }\n }\n })\n }\n\n get activities(): ActivityInterface[] {\n let res: ActivityInterface[] = []\n Object.entries(this.activeActivityScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId)\n const { fromDay = activity?.fromDay, fromHour = activity?.fromHour, toDay = activity?.toDay, toHour = activity?.toHour } = scheduling\n if (activity &&\n !(fromHour && toHour && !timeTracker.nowIsBetween(fromHour, toHour)) &&\n !(fromDay && fromDay > timeTracker.currentDay) &&\n !(toDay && toDay < timeTracker.currentDay)\n ) {\n res.push(activity)\n }\n })\n Object.entries(this.excludedActivitiesScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId)\n if (activity && activity.isActive &&\n !(scheduling.toDay && scheduling.toDay >= timeTracker.currentDay)\n ) {\n res.push(activity)\n }\n })\n return res\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/decorators/ActivityDecorator.ts","../../../src/constants.ts","../../../src/managers/TimeManagerSettings.ts","../../../src/managers/TimeManager.ts","../../../src/managers/index.ts","../../../src/classes/navigation/NavigationAbstractClass.ts"],"names":["registeredActivities","getActivityById","id","activity","TIME_DATA_KEY","TimeManagerSettings","TimeManager","settings","minDayHours","maxDayHours","defaultTimeSpent","timeSlots","weekLength","weekendStartDay","weekDaysNames","data","storage","value","weekDayNumber","index","slot","timeSpent","newHour","newDayHour","days","newDay","fromHour","toHour","currentHour","timeTracker","NavigationAbstractClass","StoredClassModel","categoryId","defaultActivities","activityId","activeActivityScheduling","excludedActivitiesScheduling","scheduling","options","hours","fromDay","toDay","additionalActivitiesIds","excludedActivitiesIds","res"],"mappings":"uDAEO,IAAMA,CAAAA,CAA4D,EAiBlE,CAAA,SAASC,CAAgBC,CAAAA,CAAAA,CAA2C,CACvE,GAAI,CACA,IAAIC,CAAAA,CAAWH,CAAqBE,CAAAA,CAAE,CACtC,CAAA,GAAI,CAACC,CAAU,CAAA,CACX,OAAQ,CAAA,KAAA,CAAM,CAAmBD,gBAAAA,EAAAA,CAAE,YAAY,CAC/C,CAAA,MACJ,CACA,OAAOC,CACX,CAAA,MACO,EAAG,CACN,OAAA,CAAQ,KAAM,CAAA,CAAA,oCAAA,EAAuCD,CAAE,CAAA,CAAA,CAAI,CAAC,CAC5D,CAAA,MACJ,CACJ,CC/BO,IAAME,CAAgB,CAAA,8BAAA,CCC7B,IAAqBC,CAArB,CAAA,KAAiE,CAC7D,OAAO,WAAsB,CAAA,CAAA,CAC7B,OAAO,WAAsB,CAAA,EAAA,CAC7B,OAAO,gBAAA,CAA2B,CAClC,CAAA,OAAO,UAA0B,EAAC,CAClC,OAAO,UAAA,CAAqB,CAC5B,CAAA,OAAO,gBAA0B,IAAK,CAAA,UAAA,CAAa,CACnD,CAAA,OAAO,aAA0B,CAAA,EACrC,CAAA,CCJA,IAAqBC,CAAAA,CAArB,KAAiC,CAC7B,UAAWC,CAAAA,CAAAA,CAAwB,CAC/B,GAAM,CACF,WAAAC,CAAAA,CAAAA,CAAc,CACd,CAAA,WAAA,CAAAC,EAAc,EACd,CAAA,gBAAA,CAAAC,CAAmB,CAAA,CAAA,CACnB,SAAAC,CAAAA,CAAAA,CAAY,EACZ,CAAA,UAAA,CAAAC,CAAa,CAAA,CAAA,CACb,eAAAC,CAAAA,CAAAA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,CAAA,MAAA,CAAAwB,CAASxB,CAAAA,CAAAA,EAAU,MACvB,CAAA,CAAIkC,CAEAlC,CAAAA,CAAAA,EACA,EAAEuB,CAAAA,EAAYC,CAAU,EAAA,CAACE,EAAY,YAAaH,CAAAA,CAAAA,CAAUC,CAAM,CAAA,CAAA,EAClE,EAAEa,CAAAA,EAAWA,EAAUX,CAAY,CAAA,UAAA,CAAA,EACnC,EAAEY,CAAAA,EAASA,CAAQZ,CAAAA,CAAAA,CAAY,aAE/Be,CAAI,CAAA,IAAA,CAAKzC,CAAQ,EAEzB,CAAC,CAAA,CACD,OAAO,OAAQ,CAAA,IAAA,CAAK,4BAA4B,CAAA,CAAE,OAAQ,CAAA,CAAC,CAAC+B,CAAYG,CAAAA,CAAU,CAAM,GAAA,CACpF,IAAIlC,CAAAA,CAAWF,EAAgBiC,CAAU,CAAA,CACrC/B,CAAYA,EAAAA,CAAAA,CAAS,QAAY,EAAA,EAAEkC,EAAW,KAASA,EAAAA,CAAAA,CAAW,KAASR,EAAAA,CAAAA,CAAY,UACvFe,CAAAA,EAAAA,CAAAA,CAAI,IAAKzC,CAAAA,CAAQ,EAEzB,CAAC,CACMyC,CAAAA,CACX,CACJ","file":"NavigationAbstractClass.mjs","sourcesContent":["import { ActivityInterface } from \"../interface\"\n\nexport const registeredActivities: { [id: string]: ActivityInterface } = {}\n\nexport function saveActivity(activities: ActivityInterface | ActivityInterface[]) {\n if (Array.isArray(activities)) {\n activities.forEach(activity => {\n registeredActivities[activity.id] = activity\n })\n return\n }\n registeredActivities[activities.id] = activities\n}\n\n/**\n * Get an activity by its id.\n * @param id The id of the activity.\n * @returns The activity or undefined if not found.\n */\nexport function getActivityById(id: string): ActivityInterface | undefined {\n try {\n let activity = registeredActivities[id]\n if (!activity) {\n console.error(`[NQTR] Activity ${id} not found`)\n return\n }\n return activity\n }\n catch (e) {\n console.error(`[NQTR] Error while getting Activity ${id}`, e)\n return\n }\n}\n","export const TIME_SETTINGS_KEY = '___nqtr-time_manager_settings___';\nexport const TIME_DATA_KEY = '___nqtr-time_manager_data___';\n\n","import { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\n\nexport default class TimeManagerSettings implements TimeSettings {\n static minDayHours: number = 0\n static maxDayHours: number = 24\n static defaultTimeSpent: number = 1\n static timeSlots: ITimeStlot[] = []\n static weekLength: number = 7\n static weekendStartDay: number = this.weekLength - 1\n static weekDaysNames: string[] = []\n}\n","import { storage } from \"@drincs/pixi-vn\";\nimport { TIME_DATA_KEY } from \"../constants\";\nimport TimeDataType from \"../types/TimeDataType\";\nimport { ITimeStlot, TimeSettings } from \"../types/TimeSettings\";\nimport TimeManagerSettings from \"./TimeManagerSettings\";\n\nexport default class TimeManager {\n initialize(settings: TimeSettings) {\n const {\n minDayHours = 0,\n maxDayHours = 24,\n defaultTimeSpent = 1,\n timeSlots = [],\n weekLength = 7,\n weekendStartDay = weekLength - 1,\n weekDaysNames = [],\n } = settings\n TimeManagerSettings.minDayHours = minDayHours\n TimeManagerSettings.maxDayHours = maxDayHours\n TimeManagerSettings.defaultTimeSpent = defaultTimeSpent\n TimeManagerSettings.timeSlots = timeSlots\n TimeManagerSettings.weekLength = weekLength\n if (weekendStartDay >= TimeManagerSettings.weekLength) {\n console.warn(`[NQTR] Weekend start day should be less than week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekendStartDay = weekendStartDay\n }\n if (weekDaysNames.length !== weekLength) {\n console.warn(`[NQTR] Week days names should be equal to week length ${weekLength}, so will be ignored`)\n }\n else {\n TimeManagerSettings.weekDaysNames = weekDaysNames\n }\n }\n get minDayHours(): number {\n return TimeManagerSettings.minDayHours\n }\n get maxDayHours(): number {\n return TimeManagerSettings.maxDayHours\n }\n get defaultTimeSpent(): number {\n return TimeManagerSettings.defaultTimeSpent\n }\n get timeSlots(): ITimeStlot[] {\n return TimeManagerSettings.timeSlots\n }\n get weekLength(): number {\n return TimeManagerSettings.weekLength\n }\n get weekendStartDay(): number {\n return TimeManagerSettings.weekendStartDay\n }\n get weekDaysNames(): string[] {\n return TimeManagerSettings.weekDaysNames\n }\n\n /**\n * Get the current hour\n */\n get currentHour(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentHour') && typeof data.currentHour === 'number') {\n return data.currentHour\n }\n return this.minDayHours\n }\n set currentHour(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentHour = value\n } else {\n delete data.currentHour\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * Get the current day\n */\n get currentDay(): number {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (data.hasOwnProperty('currentDay') && typeof data.currentDay === 'number') {\n return data.currentDay\n }\n return 0\n }\n set currentDay(value: number | undefined) {\n let data = storage.getVariable<TimeDataType>(TIME_DATA_KEY) || {}\n if (typeof value === 'number') {\n data.currentDay = value\n }\n else {\n delete data.currentDay\n }\n storage.setVariable(TIME_DATA_KEY, data)\n }\n /**\n * If the current day is greater than or equal to the weekend start day, then it will return true.\n */\n get isWeekend(): boolean {\n return this.currentWeekDayNumber >= this.weekendStartDay\n }\n /**\n * Get the current week day number (1 - {@link weekLength}).\n * For example, if the week length is 7 and the current day is 10, then the result will be 4.\n */\n get currentWeekDayNumber(): number {\n let result = this.currentDay % this.weekLength\n return result + 1\n }\n /**\n * Get the current week day name. If the week days names are not defined, then it will return undefined.\n * 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'.\n * @default \"\"\n */\n get currentDayName(): string {\n let weekDayNumber = this.currentWeekDayNumber - 1\n if (weekDayNumber >= this.weekDaysNames.length) {\n console.warn(`[NQTR] Week day name is not defined for day ${weekDayNumber}`, this.weekDaysNames)\n return \"\"\n }\n return this.weekDaysNames[weekDayNumber]\n }\n /**\n * Get the current {@link timeSlots} index.\n * You can use this property to create \"Image that changes based on the time period\":\n * @example\n * ```tsx\n * import { weekLength } from '@drincs/nqtr';\n * \n * function changeBackground() {\n * return (\n * <img src={`background-currentTimeSlot.currentTimeSlot.png`} />\n * )\n * }\n */\n get currentTimeSlot(): number {\n if (this.timeSlots.length === 0) {\n console.warn('[NQTR] Time slots are not defined')\n return 0\n }\n for (let index = 0; index < this.timeSlots.length; index++) {\n let slot = this.timeSlots[index]\n if (this.timeSlots.length > index + 1) {\n if (this.nowIsBetween(slot.startHour, this.timeSlots[index + 1].startHour)) {\n return index\n }\n }\n }\n return this.timeSlots.length - 1\n }\n\n /**\n * This function will increase the current hour by the given time spent.\n * If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.\n * @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})\n * @returns currentTimeSlot.currentHour\n */\n increaseHour(timeSpent: number = this.defaultTimeSpent): number {\n let newHour = this.currentHour + timeSpent\n if (newHour >= this.maxDayHours) {\n this.increaseDay()\n newHour = this.minDayHours + (newHour - this.maxDayHours)\n }\n this.currentHour = newHour\n return this.currentHour\n }\n\n /**\n * This function will increase the current day by the given days.\n * @param newDayHour is the hour of the new day (default: {@link minDayHours})\n * @param days is the number of days to increase (default: 1)\n * @returns timeTracker.currentDay\n */\n increaseDay(newDayHour: number = this.minDayHours, days: number = 1): number {\n let newDay = this.currentDay + days\n this.currentDay = newDay\n this.currentHour = newDayHour\n return this.currentDay\n }\n\n /**\n * This function will check if the current hour is between the given hours.\n * @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.\n * @param toHour the ending hour.\n * @returns true if the current hour is between the given hours, otherwise false.\n */\n nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean {\n if (fromHour === undefined) {\n fromHour = this.minDayHours\n }\n if (toHour === undefined) {\n toHour = this.maxDayHours\n }\n let currentHour = this.currentHour\n if (fromHour < toHour) {\n return currentHour >= fromHour && currentHour < toHour\n }\n return currentHour >= fromHour || currentHour < toHour\n }\n}\n","import NavigatorManager from \"./NavigatorManager\";\nimport QuestManager from \"./QuestManager\";\nimport RoutineManager from \"./RoutineManager\";\nimport { default as TimeManager } from \"./TimeManager\";\n\nconst timeTracker = new TimeManager();\nconst navigator = new NavigatorManager();\nconst routine = new RoutineManager();\nconst questsNotebook = new QuestManager();\n\nexport { navigator, questsNotebook, routine, timeTracker };\n","import { StoredClassModel } from \"@drincs/pixi-vn\";\nimport { getActivityById } from \"../../decorators\";\nimport { ActivityInterface } from \"../../interface\";\nimport NavigationAbstractInterface from \"../../interface/navigation/NavigationAbstractClass\";\nimport { timeTracker } from \"../../managers\";\n\ntype ActiveScheduling = {\n fromHour?: number;\n toHour?: number;\n fromDay?: number;\n toDay?: number;\n};\ntype ExcludedScheduling = {\n toDay?: number;\n};\n\nexport default abstract class NavigationAbstractClass extends StoredClassModel implements NavigationAbstractInterface {\n constructor(categoryId: string, id: string, private defaultActivities: ActivityInterface[] = []) {\n super(categoryId, id);\n }\n private get defaultActivitiesIds(): string[] {\n return this.defaultActivities.map((activity) => activity.id);\n }\n private get activeActivityScheduling(): { [activityId: string]: ActiveScheduling } {\n return this.getStorageProperty<{ [activityId: string]: ActiveScheduling }>(`activeActivityScheduling`) || {};\n }\n private get excludedActivitiesScheduling(): { [activityId: string]: ExcludedScheduling } {\n return (\n this.getStorageProperty<{ [activityId: string]: ExcludedScheduling }>(`excludedActivitiesScheduling`) || {}\n );\n }\n private removeActivityScheduling(activityId: string) {\n let activeActivityScheduling = this.activeActivityScheduling;\n delete activeActivityScheduling[activityId];\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n delete excludedActivitiesScheduling[activityId];\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private editActivityScheduling(activityId: string, scheduling: ActiveScheduling) {\n this.removeActivityScheduling(activityId);\n let activeActivityScheduling = this.activeActivityScheduling;\n activeActivityScheduling[activityId] = scheduling;\n this.setStorageProperty(`activeActivityScheduling`, activeActivityScheduling);\n }\n private editExcludedActivityScheduling(activityId: string, scheduling: ExcludedScheduling) {\n this.removeActivityScheduling(activityId);\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n excludedActivitiesScheduling[activityId] = scheduling;\n this.setStorageProperty(`excludedActivitiesScheduling`, excludedActivitiesScheduling);\n }\n private get additionalActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`additionalActivitiesIds`) || [];\n }\n private get excludedActivitiesIds(): string[] {\n return this.getStorageProperty<string[]>(`excludedActivitiesIds`) || [];\n }\n addActivity(\n activity: ActivityInterface,\n options: {\n /**\n * the activity will be associated with this class only for the specified hours.\n * If you set from 3 and to 5, the activity will be associated with this class only for hours 3, 4 and 5. soSo at 2 or 6 it will not be associated with this class.\n */\n hours?: {\n from: number;\n to: number;\n };\n /**\n * the activity will be associated with this class from the specified day.\n * If you set 3, the activity will be associated with this class from day 3. So at day 2 it will not be associated with this class.\n */\n fromDay?: number;\n /**\n * the activity will be associated with this class to the specified day.\n * If you set 3, the activity will be associated with this class until day 3. So at day 4 it will not be associated with this class.\n */\n toDay?: number;\n } = {}\n ) {\n const { hours, fromDay, toDay } = options;\n let scheduling: ActiveScheduling = {};\n if (hours) {\n if (hours.from >= hours.to) {\n throw new Error(`[NQTR] The from hour must be less than the to hour.`);\n }\n scheduling.fromHour = hours.from;\n }\n if (fromDay === 0) {\n console.warn(`[NQTR] The from day must be greater than 0, so it will be ignored.`);\n }\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`);\n }\n if (fromDay && toDay && fromDay >= toDay) {\n throw new Error(`[NQTR] The from day must be less than the to day.`);\n }\n if (fromDay) {\n scheduling.fromDay = fromDay;\n }\n if (toDay) {\n scheduling.toDay = toDay;\n }\n\n if (this.defaultActivitiesIds.includes(activity.id)) {\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n return;\n }\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling);\n return;\n } else if (this.excludedActivitiesIds.includes(activity.id)) {\n this.removeActivityScheduling(activity.id);\n console.log(\n `[NQTR] Activity with id ${activity.id} was excluded, so it will be associated with this class again.`\n );\n return;\n }\n console.warn(`[NQTR] Activity with id ${activity.id} already exists, so it will be ignored.`);\n return;\n }\n additionalActivitiesIds.push(activity.id);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n if (Object.keys(scheduling).length) {\n this.editActivityScheduling(activity.id, scheduling);\n }\n }\n removeActivity(\n activity: ActivityInterface,\n options: {\n /**\n * The activity will be excluded from this class only for the specified days.\n * If to 3, the activity will be excluded from this class only for days 1, 2 and 3. So at day 4 it will be associated with this class.\n */\n toDay?: number;\n } = {}\n ) {\n const { toDay } = options;\n let scheduling: ExcludedScheduling = {};\n if (toDay === 0) {\n console.warn(`[NQTR] The to day must be greater than 0, so it will be ignored.`);\n }\n if (toDay) {\n scheduling.toDay = toDay;\n }\n\n let additionalActivitiesIds = this.additionalActivitiesIds;\n if (additionalActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling);\n return;\n }\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activity.id);\n this.setStorageProperty(`additionalActivitiesIds`, additionalActivitiesIds);\n } else if (this.defaultActivitiesIds.includes(activity.id)) {\n if (Object.keys(scheduling).length) {\n this.editExcludedActivityScheduling(activity.id, scheduling);\n return;\n }\n let excludedActivitiesIds = this.excludedActivitiesIds;\n excludedActivitiesIds.push(activity.id);\n this.setStorageProperty(`excludedActivitiesIds`, excludedActivitiesIds);\n } else {\n console.warn(`[NQTR] Activity with id ${activity.id} not found, so it will be ignored.`);\n }\n }\n clearExpiredActivities() {\n let activeActivityScheduling = this.activeActivityScheduling;\n let excludedActivitiesScheduling = this.excludedActivitiesScheduling;\n let additionalActivitiesIds = this.additionalActivitiesIds;\n let excludedActivitiesIds = this.excludedActivitiesIds;\n\n additionalActivitiesIds.forEach((activityId) => {\n if (activityId in activeActivityScheduling) {\n let { toDay } = activeActivityScheduling[activityId];\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId);\n additionalActivitiesIds = additionalActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n excludedActivitiesIds.forEach((activityId) => {\n if (activityId in excludedActivitiesScheduling) {\n let { toDay } = excludedActivitiesScheduling[activityId];\n if (toDay && toDay < timeTracker.currentDay) {\n this.removeActivityScheduling(activityId);\n excludedActivitiesIds = excludedActivitiesIds.filter((id) => id !== activityId);\n }\n }\n });\n }\n\n get activities(): ActivityInterface[] {\n let res: ActivityInterface[] = [];\n Object.entries(this.activeActivityScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId);\n const {\n fromDay = activity?.fromDay,\n fromHour = activity?.fromHour,\n toDay = activity?.toDay,\n toHour = activity?.toHour,\n } = scheduling;\n if (\n activity &&\n !(fromHour && toHour && !timeTracker.nowIsBetween(fromHour, toHour)) &&\n !(fromDay && fromDay > timeTracker.currentDay) &&\n !(toDay && toDay < timeTracker.currentDay)\n ) {\n res.push(activity);\n }\n });\n Object.entries(this.excludedActivitiesScheduling).forEach(([activityId, scheduling]) => {\n let activity = getActivityById(activityId);\n if (activity && activity.isActive && !(scheduling.toDay && scheduling.toDay >= timeTracker.currentDay)) {\n res.push(activity);\n }\n });\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var m={};function _(a){try{let e=m[a];if(!e){console.error(`[NQTR] Room ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${a}`,e);return}}var C="___nqtr-current_room_memory___",g=class{get rooms(){return Object.values(m)}get locations(){let e={};return Object.values(m).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(m).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(C);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=_(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!_(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(C,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(m).forEach(([e,t])=>{t.clearExpiredActivities();});}};var I={},S={};function w(a){try{let e=I[a];if(!e){console.error(`[NQTR] Commitment ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${a}`,e);return}}var D="___nqtr-temporary_commitment___",y=class{get fixedRoutine(){return Object.values(S)}set fixedRoutine(e){e.forEach(t=>{S[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),S[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(D);return e?e.map(r=>w(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!w(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);pixiVn.storage.setVariable(D,t);}find(e){return w(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=pixiVn.storage.getVariable(D);r&&(r=r.filter(i=>!t.includes(i)),pixiVn.storage.setVariable(D,r));}clearExpiredRoutine(){Object.values(I).forEach(e=>{e.expired&&delete I[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return H.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var d="___nqtr-time_manager_data___";var c=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var p=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:o=[],weekLength:n=7,weekendStartDay:s=n-1,weekDaysNames:u=[]}=e;c.minDayHours=t,c.maxDayHours=r,c.defaultTimeSpent=i,c.timeSlots=o,c.weekLength=n,s>=c.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${n}, so will be ignored`):c.weekendStartDay=s,u.length!==n?console.warn(`[NQTR] Week days names should be equal to week length ${n}, so will be ignored`):c.weekDaysNames=u;}get minDayHours(){return c.minDayHours}get maxDayHours(){return c.maxDayHours}get defaultTimeSpent(){return c.defaultTimeSpent}get timeSlots(){return c.timeSlots}get weekLength(){return c.weekLength}get weekendStartDay(){return c.weekendStartDay}get weekDaysNames(){return c.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(d)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(d)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(d,t);}get currentDay(){let e=pixiVn.storage.getVariable(d)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(d)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(d,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var l=new p,H=new g,R=new y;var P={};function T(a){try{let e=P[a];if(!e){console.error(`[NQTR] Activity ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${a}`,e);return}}var v=class extends pixiVn.StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:o,toDay:n}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(o===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),n===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),o&&n&&o>=n)throw new Error("[NQTR] The from day must be less than the to day.");if(o&&(s.fromDay=o),n&&(s.toDay=n),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let u=this.additionalActivitiesIds;if(u.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}u.push(t.id),this.setStorageProperty("additionalActivitiesIds",u),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}revoveActivity(t,r={}){let{toDay:i}=r,o={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(o.toDay=i);let n=this.additionalActivitiesIds;if(n.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}n=n.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",n);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,o=this.excludedActivitiesIds;i.forEach(n=>{if(n in t){let{toDay:s}=t[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),i=i.filter(u=>u!==n));}}),o.forEach(n=>{if(n in r){let{toDay:s}=r[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),o=o.filter(u=>u!==n));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let o=T(r),{fromDay:n=o?.fromDay,fromHour:s=o?.fromHour,toDay:u=o?.toDay,toHour:N=o?.toHour}=i;o&&!(s&&N&&!l.nowIsBetween(s,N))&&!(n&&n>l.currentDay)&&!(u&&u<l.currentDay)&&t.push(o);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let o=T(r);o&&o.isActive&&!(i.toDay&&i.toDay>=l.currentDay)&&t.push(o);}),t}};var M="__nqtr-room__",b=class extends v{constructor(t,r,i=[]){super(M,t,i);this._location=r;}get routine(){return R.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}};var Q=class extends b{constructor(e,t,r={}){super(e,t,r.activities||[]),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"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}get routine(){return R.currentRoutine.filter(e=>e.room.id===this.id)}};module.exports=Q;//# sourceMappingURL=RoomBaseModel.js.map
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var m={};function _(a){try{let e=m[a];if(!e){console.error(`[NQTR] Room ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Room ${a}`,e);return}}var C="___nqtr-current_room_memory___",g=class{get rooms(){return Object.values(m)}get locations(){let e={};return Object.values(m).forEach(t=>{e[t.location.id]=t.location;}),Object.values(e)}get maps(){let e={};return Object.values(m).forEach(t=>{e[t.location.map.id]=t.location.map;}),Object.values(e)}get currentRoom(){let e=pixiVn.storage.getVariable(C);if(!e){console.error("[NQTR] The current room has not yet been set");return}let t=_(e);if(!t){console.error(`[NQTR] Current room ${e} not found`);return}return t}set currentRoom(e){if(!_(e.id)){console.error(`[NQTR] The room ${e.id} is not registered, so it can't be set as current room`);return}pixiVn.storage.setVariable(C,e.id);}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){Object.entries(m).forEach(([e,t])=>{t.clearExpiredActivities();});}};var I={},S={};function w(a){try{let e=I[a];if(!e){console.error(`[NQTR] Commitment ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Commitment ${a}`,e);return}}var D="___nqtr-temporary_commitment___",y=class{get fixedRoutine(){return Object.values(S)}set fixedRoutine(e){e.forEach(t=>{S[t.id]&&console.warn(`[NQTR] Commitment id ${t.id} already exists, it will be overwritten`),S[t.id]=t;});}get temporaryRoutine(){let e=pixiVn.storage.getVariable(D);return e?e.map(r=>w(r)).filter(r=>r!==undefined):[]}get allRoutine(){return [...this.fixedRoutine,...this.temporaryRoutine]}add(e){Array.isArray(e)||(e=[e]);let t=e.map(r=>{if(!w(r.id)){console.warn(`[NQTR] Commitment ${r.id} not found, it will be ignored`);return}return r.id}).filter(r=>r!==undefined);pixiVn.storage.setVariable(D,t);}find(e){return w(e)}remove(e){Array.isArray(e)||(e=[e]);let t=e.map(i=>i.id),r=pixiVn.storage.getVariable(D);r&&(r=r.filter(i=>!t.includes(i)),pixiVn.storage.setVariable(D,r));}clearExpiredRoutine(){Object.values(I).forEach(e=>{e.expired&&delete I[e.id];});}get currentRoutine(){let e={};return [...this.temporaryRoutine,...this.fixedRoutine].reverse().forEach(t=>{t.isActive&&(t.characters.length>0?t.characters.every(i=>!e[i.id]||t.priority>e[i.id].priority)&&t.characters.forEach(i=>{e[i.id]=t;}):console.error(`[NQTR] The commitment ${t.id} has no characters assigned`));}),Object.values(e)}get currentRoomRoutine(){return H.currentRoom?.routine||[]}getCommitmentByCharacter(e){this.currentRoutine.forEach(t=>{if(t.characters.map(r=>r.id).includes(e.id))return t});}};var d="___nqtr-time_manager_data___";var c=class{static minDayHours=0;static maxDayHours=24;static defaultTimeSpent=1;static timeSlots=[];static weekLength=7;static weekendStartDay=this.weekLength-1;static weekDaysNames=[]};var p=class{initialize(e){let{minDayHours:t=0,maxDayHours:r=24,defaultTimeSpent:i=1,timeSlots:o=[],weekLength:n=7,weekendStartDay:s=n-1,weekDaysNames:u=[]}=e;c.minDayHours=t,c.maxDayHours=r,c.defaultTimeSpent=i,c.timeSlots=o,c.weekLength=n,s>=c.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${n}, so will be ignored`):c.weekendStartDay=s,u.length!==n?console.warn(`[NQTR] Week days names should be equal to week length ${n}, so will be ignored`):c.weekDaysNames=u;}get minDayHours(){return c.minDayHours}get maxDayHours(){return c.maxDayHours}get defaultTimeSpent(){return c.defaultTimeSpent}get timeSlots(){return c.timeSlots}get weekLength(){return c.weekLength}get weekendStartDay(){return c.weekendStartDay}get weekDaysNames(){return c.weekDaysNames}get currentHour(){let e=pixiVn.storage.getVariable(d)||{};return e.hasOwnProperty("currentHour")&&typeof e.currentHour=="number"?e.currentHour:this.minDayHours}set currentHour(e){let t=pixiVn.storage.getVariable(d)||{};typeof e=="number"?t.currentHour=e:delete t.currentHour,pixiVn.storage.setVariable(d,t);}get currentDay(){let e=pixiVn.storage.getVariable(d)||{};return e.hasOwnProperty("currentDay")&&typeof e.currentDay=="number"?e.currentDay:0}set currentDay(e){let t=pixiVn.storage.getVariable(d)||{};typeof e=="number"?t.currentDay=e:delete t.currentDay,pixiVn.storage.setVariable(d,t);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDay%this.weekLength+1}get currentDayName(){let e=this.currentWeekDayNumber-1;return e>=this.weekDaysNames.length?(console.warn(`[NQTR] Week day name is not defined for day ${e}`,this.weekDaysNames),""):this.weekDaysNames[e]}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.startHour,this.timeSlots[e+1].startHour))return e}return this.timeSlots.length-1}increaseHour(e=this.defaultTimeSpent){let t=this.currentHour+e;return t>=this.maxDayHours&&(this.increaseDay(),t=this.minDayHours+(t-this.maxDayHours)),this.currentHour=t,this.currentHour}increaseDay(e=this.minDayHours,t=1){let r=this.currentDay+t;return this.currentDay=r,this.currentHour=e,this.currentDay}nowIsBetween(e,t){e===undefined&&(e=this.minDayHours),t===undefined&&(t=this.maxDayHours);let r=this.currentHour;return e<t?r>=e&&r<t:r>=e||r<t}};var l=new p,H=new g,R=new y;var P={};function T(a){try{let e=P[a];if(!e){console.error(`[NQTR] Activity ${a} not found`);return}return e}catch(e){console.error(`[NQTR] Error while getting Activity ${a}`,e);return}}var v=class extends pixiVn.StoredClassModel{constructor(t,r,i=[]){super(t,r);this.defaultActivities=i;}get defaultActivitiesIds(){return this.defaultActivities.map(t=>t.id)}get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(t){let r=this.activeActivityScheduling;delete r[t],this.setStorageProperty("activeActivityScheduling",r);let i=this.excludedActivitiesScheduling;delete i[t],this.setStorageProperty("excludedActivitiesScheduling",i);}editActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.activeActivityScheduling;i[t]=r,this.setStorageProperty("activeActivityScheduling",i);}editExcludedActivityScheduling(t,r){this.removeActivityScheduling(t);let i=this.excludedActivitiesScheduling;i[t]=r,this.setStorageProperty("excludedActivitiesScheduling",i);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}addActivity(t,r={}){let{hours:i,fromDay:o,toDay:n}=r,s={};if(i){if(i.from>=i.to)throw new Error("[NQTR] The from hour must be less than the to hour.");s.fromHour=i.from;}if(o===0&&console.warn("[NQTR] The from day must be greater than 0, so it will be ignored."),n===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),o&&n&&o>=n)throw new Error("[NQTR] The from day must be less than the to day.");if(o&&(s.fromDay=o),n&&(s.toDay=n),this.defaultActivitiesIds.includes(t.id)){console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}let u=this.additionalActivitiesIds;if(u.includes(t.id)){if(Object.keys(s).length){this.editActivityScheduling(t.id,s);return}else if(this.excludedActivitiesIds.includes(t.id)){this.removeActivityScheduling(t.id),console.log(`[NQTR] Activity with id ${t.id} was excluded, so it will be associated with this class again.`);return}console.warn(`[NQTR] Activity with id ${t.id} already exists, so it will be ignored.`);return}u.push(t.id),this.setStorageProperty("additionalActivitiesIds",u),Object.keys(s).length&&this.editActivityScheduling(t.id,s);}removeActivity(t,r={}){let{toDay:i}=r,o={};i===0&&console.warn("[NQTR] The to day must be greater than 0, so it will be ignored."),i&&(o.toDay=i);let n=this.additionalActivitiesIds;if(n.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}n=n.filter(s=>s!==t.id),this.setStorageProperty("additionalActivitiesIds",n);}else if(this.defaultActivitiesIds.includes(t.id)){if(Object.keys(o).length){this.editExcludedActivityScheduling(t.id,o);return}let s=this.excludedActivitiesIds;s.push(t.id),this.setStorageProperty("excludedActivitiesIds",s);}else console.warn(`[NQTR] Activity with id ${t.id} not found, so it will be ignored.`);}clearExpiredActivities(){let t=this.activeActivityScheduling,r=this.excludedActivitiesScheduling,i=this.additionalActivitiesIds,o=this.excludedActivitiesIds;i.forEach(n=>{if(n in t){let{toDay:s}=t[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),i=i.filter(u=>u!==n));}}),o.forEach(n=>{if(n in r){let{toDay:s}=r[n];s&&s<l.currentDay&&(this.removeActivityScheduling(n),o=o.filter(u=>u!==n));}});}get activities(){let t=[];return Object.entries(this.activeActivityScheduling).forEach(([r,i])=>{let o=T(r),{fromDay:n=o?.fromDay,fromHour:s=o?.fromHour,toDay:u=o?.toDay,toHour:N=o?.toHour}=i;o&&!(s&&N&&!l.nowIsBetween(s,N))&&!(n&&n>l.currentDay)&&!(u&&u<l.currentDay)&&t.push(o);}),Object.entries(this.excludedActivitiesScheduling).forEach(([r,i])=>{let o=T(r);o&&o.isActive&&!(i.toDay&&i.toDay>=l.currentDay)&&t.push(o);}),t}};var M="__nqtr-room__",b=class extends v{constructor(t,r,i=[]){super(M,t,i);this._location=r;}get routine(){return R.currentRoutine.filter(t=>t.room.id===this.id)}get location(){return this._location}};var Q=class extends b{constructor(e,t,r={}){super(e,t,r.activities||[]),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"?pixiVn.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?pixiVn.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}get routine(){return R.currentRoutine.filter(e=>e.room.id===this.id)}};module.exports=Q;//# sourceMappingURL=RoomBaseModel.js.map
2
2
  //# sourceMappingURL=RoomBaseModel.js.map