@e1011/es-kit 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js +1 -1
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/array.js +1 -1
- package/dist/lib/cjs/src/core/utils/array.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/date.js +1 -1
- package/dist/lib/cjs/src/core/utils/date.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/other.js +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/other.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/textValueOperations.js +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/textValueOperations.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js +9 -10
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
- package/dist/lib/esm/src/core/utils/array.js +2 -18
- package/dist/lib/esm/src/core/utils/array.js.map +1 -1
- package/dist/lib/esm/src/core/utils/date.js +38 -42
- package/dist/lib/esm/src/core/utils/date.js.map +1 -1
- package/dist/lib/esm/src/core/utils/helpers/other.js +24 -19
- package/dist/lib/esm/src/core/utils/helpers/other.js.map +1 -1
- package/dist/lib/esm/src/core/utils/helpers/textValueOperations.js +13 -14
- package/dist/lib/esm/src/core/utils/helpers/textValueOperations.js.map +1 -1
- package/dist/lib/esm/src/index.js +57 -59
- package/dist/lib/esm/src/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/index.d.ts +0 -2
- package/dist/types/src/core/utils/appState/peregrineMQ/index.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.d.ts.map +1 -1
- package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.stories.d.ts.map +1 -1
- package/dist/types/src/core/utils/array.d.ts +2 -10
- package/dist/types/src/core/utils/array.d.ts.map +1 -1
- package/dist/types/src/core/utils/array.spec.d.ts +1 -1
- package/dist/types/src/core/utils/array.spec.d.ts.map +1 -1
- package/dist/types/src/core/utils/date.d.ts.map +1 -1
- package/dist/types/src/core/utils/helpers/other.d.ts +8 -3
- package/dist/types/src/core/utils/helpers/other.d.ts.map +1 -1
- package/dist/types/src/core/utils/helpers/textValueOperations.d.ts.map +1 -1
- package/dist/types/src/core/utils/keyExtractor.d.ts +1 -1
- package/dist/types/src/core/utils/keyExtractor.d.ts.map +1 -1
- package/dist/utils/appState/peregrineMQ/peregrineMQ.js +2 -0
- package/dist/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/utils/appState/peregrineMQ/peregrineMQ.types.js.map +1 -0
- package/dist/utils/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/utils/appState/store/store.vanillajs.js.map +1 -0
- package/dist/utils/appState/store/store.vanillajs.templates.js.map +1 -0
- package/dist/utils/array.js +2 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/utils/date.js +2 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/esm/{src/core/utils/appState → appState}/peregrineMQ/peregrineMQ.js +9 -10
- package/dist/utils/esm/appState/peregrineMQ/peregrineMQ.js.map +1 -0
- package/dist/utils/esm/appState/peregrineMQ/peregrineMQ.types.js.map +1 -0
- package/dist/utils/esm/appState/stateMachine/tiny-state-machine.base.js.map +1 -0
- package/dist/utils/esm/appState/store/store.vanillajs.js.map +1 -0
- package/dist/utils/esm/appState/store/store.vanillajs.templates.js.map +1 -0
- package/dist/utils/esm/array.js +6 -0
- package/dist/utils/esm/array.js.map +1 -0
- package/dist/utils/esm/date.js +100 -0
- package/dist/utils/esm/date.js.map +1 -0
- package/dist/utils/esm/helpers/birthnumber.validator.js.map +1 -0
- package/dist/utils/esm/helpers/birthnumberCZSKvalidator.js.map +1 -0
- package/dist/utils/esm/helpers/cancelableDelayedFunction.js.map +1 -0
- package/dist/utils/esm/helpers/date.js.map +1 -0
- package/dist/utils/esm/helpers/deviceInfo.js.map +1 -0
- package/dist/utils/esm/helpers/emailMatcher.js.map +1 -0
- package/dist/utils/esm/helpers/file.js.map +1 -0
- package/dist/utils/esm/helpers/fileValidator.js.map +1 -0
- package/dist/utils/esm/helpers/objectOperations.js.map +1 -0
- package/dist/utils/esm/helpers/other.js +29 -0
- package/dist/utils/esm/helpers/other.js.map +1 -0
- package/dist/utils/esm/helpers/text.js.map +1 -0
- package/dist/utils/esm/helpers/textValueOperations.js +17 -0
- package/dist/utils/esm/helpers/textValueOperations.js.map +1 -0
- package/dist/utils/esm/helpers/ui.js.map +1 -0
- package/dist/utils/esm/helpers/valueOperations.js.map +1 -0
- package/dist/utils/esm/index.js +125 -0
- package/dist/utils/esm/{src/core/utils/index.js.map → index.js.map} +1 -1
- package/dist/utils/esm/keyExtractor.js.map +1 -0
- package/dist/utils/esm/webComponents/webComponent.utils.js.map +1 -0
- package/dist/utils/helpers/birthnumber.validator.js.map +1 -0
- package/dist/utils/helpers/birthnumberCZSKvalidator.js.map +1 -0
- package/dist/utils/helpers/cancelableDelayedFunction.js.map +1 -0
- package/dist/utils/helpers/date.js.map +1 -0
- package/dist/utils/helpers/deviceInfo.js.map +1 -0
- package/dist/utils/helpers/emailMatcher.js.map +1 -0
- package/dist/utils/helpers/file.js.map +1 -0
- package/dist/utils/helpers/fileValidator.js.map +1 -0
- package/dist/utils/helpers/objectOperations.js.map +1 -0
- package/dist/utils/helpers/other.js +2 -0
- package/dist/utils/helpers/other.js.map +1 -0
- package/dist/utils/helpers/text.js.map +1 -0
- package/dist/utils/helpers/textValueOperations.js +2 -0
- package/dist/utils/helpers/textValueOperations.js.map +1 -0
- package/dist/utils/helpers/ui.js.map +1 -0
- package/dist/utils/helpers/valueOperations.js.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/keyExtractor.js.map +1 -0
- package/dist/utils/webComponents/webComponent.utils.js.map +1 -0
- package/package.json +21 -5
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/native.js +0 -2
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/rng.js +0 -2
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/stringify.js +0 -2
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/v4.js +0 -2
- package/dist/lib/cjs/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/index.js +0 -2
- package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/index.js.map +0 -1
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/rng.js +0 -11
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/stringify.js +0 -10
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/v4.js +0 -14
- package/dist/lib/esm/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/index.js +0 -9
- package/dist/lib/esm/src/core/utils/appState/peregrineMQ/index.js.map +0 -1
- package/dist/ui/styles/generic.anims.css +0 -169
- package/dist/ui/styles/generic.anims.css.map +0 -1
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/rng.js +0 -11
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/stringify.js +0 -10
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/v4.js +0 -14
- package/dist/utils/esm/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/index.js +0 -9
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/index.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.types.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +0 -1
- package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.templates.js.map +0 -1
- package/dist/utils/esm/src/core/utils/array.js +0 -22
- package/dist/utils/esm/src/core/utils/array.js.map +0 -1
- package/dist/utils/esm/src/core/utils/date.js +0 -104
- package/dist/utils/esm/src/core/utils/date.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/birthnumber.validator.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/birthnumberCZSKvalidator.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/cancelableDelayedFunction.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/date.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/deviceInfo.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/emailMatcher.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/file.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/fileValidator.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/objectOperations.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/other.js +0 -24
- package/dist/utils/esm/src/core/utils/helpers/other.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/text.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/textValueOperations.js +0 -18
- package/dist/utils/esm/src/core/utils/helpers/textValueOperations.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/ui.js.map +0 -1
- package/dist/utils/esm/src/core/utils/helpers/valueOperations.js.map +0 -1
- package/dist/utils/esm/src/core/utils/index.js +0 -127
- package/dist/utils/esm/src/core/utils/keyExtractor.js.map +0 -1
- package/dist/utils/esm/src/core/utils/webComponents/webComponent.utils.js.map +0 -1
- package/dist/utils/node_modules/uuid/dist/esm-browser/native.js +0 -2
- package/dist/utils/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- package/dist/utils/node_modules/uuid/dist/esm-browser/rng.js +0 -2
- package/dist/utils/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/utils/node_modules/uuid/dist/esm-browser/stringify.js +0 -2
- package/dist/utils/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/utils/node_modules/uuid/dist/esm-browser/v4.js +0 -2
- package/dist/utils/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- package/dist/utils/src/core/utils/appState/peregrineMQ/index.js +0 -2
- package/dist/utils/src/core/utils/appState/peregrineMQ/index.js.map +0 -1
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js +0 -2
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +0 -1
- package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.types.js.map +0 -1
- package/dist/utils/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +0 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +0 -1
- package/dist/utils/src/core/utils/appState/store/store.vanillajs.templates.js.map +0 -1
- package/dist/utils/src/core/utils/array.js +0 -2
- package/dist/utils/src/core/utils/array.js.map +0 -1
- package/dist/utils/src/core/utils/date.js +0 -2
- package/dist/utils/src/core/utils/date.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/birthnumber.validator.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/birthnumberCZSKvalidator.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/cancelableDelayedFunction.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/date.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/deviceInfo.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/emailMatcher.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/file.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/fileValidator.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/objectOperations.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/other.js +0 -2
- package/dist/utils/src/core/utils/helpers/other.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/text.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/textValueOperations.js +0 -2
- package/dist/utils/src/core/utils/helpers/textValueOperations.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/ui.js.map +0 -1
- package/dist/utils/src/core/utils/helpers/valueOperations.js.map +0 -1
- package/dist/utils/src/core/utils/index.js +0 -2
- package/dist/utils/src/core/utils/keyExtractor.js.map +0 -1
- package/dist/utils/src/core/utils/webComponents/webComponent.utils.js.map +0 -1
- /package/dist/utils/{src/core/utils/appState → appState}/peregrineMQ/peregrineMQ.types.js +0 -0
- /package/dist/utils/{src/core/utils/appState → appState}/stateMachine/tiny-state-machine.base.js +0 -0
- /package/dist/utils/{src/core/utils/appState → appState}/store/store.vanillajs.js +0 -0
- /package/dist/utils/{src/core/utils/appState → appState}/store/store.vanillajs.templates.js +0 -0
- /package/dist/utils/esm/{src/core/utils/appState → appState}/peregrineMQ/peregrineMQ.types.js +0 -0
- /package/dist/utils/esm/{src/core/utils/appState → appState}/stateMachine/tiny-state-machine.base.js +0 -0
- /package/dist/utils/esm/{src/core/utils/appState → appState}/store/store.vanillajs.js +0 -0
- /package/dist/utils/esm/{src/core/utils/appState → appState}/store/store.vanillajs.templates.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/birthnumber.validator.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/birthnumberCZSKvalidator.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/cancelableDelayedFunction.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/date.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/deviceInfo.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/emailMatcher.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/file.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/fileValidator.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/objectOperations.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/text.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/ui.js +0 -0
- /package/dist/utils/esm/{src/core/utils/helpers → helpers}/valueOperations.js +0 -0
- /package/dist/utils/esm/{src/core/utils/keyExtractor.js → keyExtractor.js} +0 -0
- /package/dist/utils/esm/{src/core/utils/webComponents → webComponents}/webComponent.utils.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/birthnumber.validator.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/birthnumberCZSKvalidator.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/cancelableDelayedFunction.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/date.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/deviceInfo.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/emailMatcher.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/file.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/fileValidator.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/objectOperations.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/text.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/ui.js +0 -0
- /package/dist/utils/{src/core/utils/helpers → helpers}/valueOperations.js +0 -0
- /package/dist/utils/{src/core/utils/index.js.map → index.js.map} +0 -0
- /package/dist/utils/{src/core/utils/keyExtractor.js → keyExtractor.js} +0 -0
- /package/dist/utils/{src/core/utils/webComponents → webComponents}/webComponent.utils.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peregrineMQ.js","sources":["../../../../../../../src/core/utils/appState/peregrineMQ/peregrineMQ.ts"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport {\n Callback, Config, PeregrineMQApi, PublishToChannelReturnType,\n PublishReturnType, SubscribersSet,\n UnsubscribeOptions, NON_EXISTENT_CHANNEL_TYPE,\n NON_EXISTENT_CHANNEL,\n CallbackPayload,\n} from './peregrineMQ.types'\n\n\nexport class PeregrineMQClearError extends Error {\n constructor() {\n super('Clearing PeregrineMQ is not allowed. Please read the documentation for more information.')\n this.name = 'PeregrineMQClearError'\n }\n}\n\n/**\n * Represents a message queue with publish/subscribe functionality.\n */\nexport class PeregrineMQ implements PeregrineMQApi {\n private id: string\n\n private config: Config = {\n allowAutoPrune: false,\n pruneInterval: 10000,\n allowClear: false,\n }\n\n /**\n * The map of channels and their subscribers sets.\n */\n private channels: Map<string, SubscribersSet> = new Map()\n\n /**\n * The map of listeners and their subscribed channels.\n */\n private listeners: Map<Callback, SubscribersSet[]> = new Map()\n\n /**\n * Adds a callback as a listener to a channel.\n * @param callback The callback function to add as a listener.\n * @param channel The channel to add the listener to.\n */\n private addListener = (callback: Callback, channel: string): void => {\n const listener = this.listeners.get(callback)\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet) {\n if (listener) {\n listener.push(subscribersSet)\n } else {\n this.listeners.set(callback, [subscribersSet])\n }\n }\n }\n\n /**\n * Removes the callback from the listeners collection if it is not subscribed to any channels.\n * @description Removes the callback only when it is not present in any other subscriberSet\n * (Ref to Map<string, SubscribersSet>).\n * @param callback The callback to remove from listeners.\n */\n private removeListener = (callback: Callback): void => {\n const channelSubscriberSets = this.listeners.get(callback)\n let isEmpty = true\n\n // eslint-disable-next-line no-restricted-syntax\n for (const channelSubscriberSet of channelSubscriberSets || []) {\n isEmpty = !channelSubscriberSet.has(callback)\n if (!isEmpty) {\n break\n }\n }\n\n if (isEmpty) {\n this.listeners.delete(callback)\n }\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param isParent Indicates if the channel is a parent channel.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n private publishToChannel = (\n channel: string, isParent: boolean, data?: unknown,\n ): PublishToChannelReturnType => {\n const subscribersSet = this.channels.get(channel)\n\n if (!subscribersSet) {\n return NON_EXISTENT_CHANNEL as NON_EXISTENT_CHANNEL_TYPE\n }\n\n const iterator = subscribersSet[Symbol.iterator]()\n let subscriberFunc = iterator.next().value\n\n const results = []\n\n // eslint-disable-next-line no-plusplus\n while (subscriberFunc) {\n // eslint-disable-next-line no-await-in-loop\n results.push(subscriberFunc(channel, data as CallbackPayload))\n subscriberFunc = iterator.next().value\n }\n return results?.length === 1 ? results[0] : results\n }\n\n /**\n * Creates a new instance of PeregrineMQ.\n * @param id Specific instance of PeregrineMQ identifier\n * @param config The configuration options for PeregrineMQ.\n */\n constructor(id?: string, config?: Config) {\n this.id = id || uuidv4()\n this.configure(config || {})\n }\n\n /**\n * Gets the total number of subscribers across all channels.\n */\n get length(): number {\n return [...this.channels.values()].reduce((acc, subscribersList) => acc + subscribersList.size, 0)\n }\n\n /**\n * Configures PeregrineMQ with the specified options.\n * @param config The configuration options for PeregrineMQ.\n * @returns An object containing the prune interval handler (if auto prune is enabled).\n */\n configure = (config: Config): {\n clearPruneInterval?: () => void\n restartPruneInterval?: () => void\n } => {\n this.config = config\n const { allowAutoPrune, pruneInterval } = config\n\n let pruneIntervalHandler: ReturnType<typeof setInterval>\n\n if (allowAutoPrune) {\n pruneIntervalHandler = setInterval(() => {\n this.prune()\n }, pruneInterval)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instance: PeregrineMQ = this\n\n return {\n ...(allowAutoPrune\n ? {\n clearPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n },\n restartPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n pruneIntervalHandler = setInterval(() => {\n instance.prune()\n }, pruneInterval)\n },\n }\n : {}),\n }\n }\n\n /**\n * Gets an array of all channels.\n * @returns An array of channel names.\n */\n getChannels = (): string[] => [...this.channels.keys()]\n\n /**\n * Prunes the channels with no subscribers.\n * @returns An array of pruned channel names.\n */\n prune = (): string[] => {\n const iterator = this.channels[Symbol.iterator]()\n let subscribersSet = iterator.next().value\n const prunedChannels: string[] = []\n\n // eslint-disable-next-line no-plusplus\n while (subscribersSet) {\n if (subscribersSet[1]?.size === 0) {\n prunedChannels.push(subscribersSet[0])\n this.channels.delete(subscribersSet[0])\n }\n subscribersSet = iterator.next().value\n }\n\n return prunedChannels\n }\n\n /**\n * Removes a channel and its subscribers.\n * @param channel The channel to remove.\n * @returns A boolean indicating if the channel was successfully removed.\n */\n removeChannel = (channel: string): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet && subscribersSet.size > 0) {\n const channelListeners = [...subscribersSet || []]\n\n subscribersSet.clear()\n\n let index = channelListeners.length\n\n // eslint-disable-next-line no-plusplus\n while (index--) {\n this.removeListener(channelListeners[index])\n }\n }\n\n return this.channels.delete(channel)\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n publish = <T>(channel: string, data?: T): PublishReturnType => {\n if (channel.includes('.')) {\n const nestedChannels = channel.split('.')\n\n let { length } = nestedChannels\n let it = 0\n const results = []\n\n // eslint-disable-next-line no-plusplus\n while (length--) {\n // eslint-disable-next-line no-await-in-loop\n const result = this.publishToChannel(\n nestedChannels.slice(0, it + 1).join('.'),\n length !== nestedChannels.length - 1,\n data,\n )\n\n it += 1\n results.push(result)\n }\n return results\n }\n\n return this.publishToChannel(channel, false, data)\n }\n\n /**\n * Subscribes a callback to a channel.\n * @param channel The channel to subscribe to.\n * @param callback The callback function to subscribe.\n * @returns A function to unsubscribe the callback.\n */\n subscribe = (channel: string, callback: Callback): () => boolean => {\n const subscribersList = this.channels.get(channel)\n\n if (subscribersList) {\n subscribersList.add(callback)\n } else {\n this.channels.set(channel, new Set([callback]))\n }\n\n this.addListener(callback, channel)\n\n return () => this.unsubscribe(callback, { channel, prune: true })\n }\n\n /**\n * Unsubscribes a callback from a channel or all channels.\n * @param callback The callback function to unsubscribe.\n * @param options Optional unsubscribe options.\n * @returns A boolean indicating if the callback was successfully unsubscribed.\n */\n unsubscribe = (callback: Callback, options?: UnsubscribeOptions): boolean => {\n const { channel, prune } = options || {}\n\n let unsubscribed = false\n\n if (channel) {\n const subscriberSet = this.channels.get(channel)\n\n unsubscribed = subscriberSet ? subscriberSet.delete(callback) : false\n if (prune && subscriberSet?.size === 0) {\n this.channels.delete(channel)\n }\n\n this.removeListener(callback)\n\n return unsubscribed\n }\n\n const subscriberSetArray = this.listeners.get(callback) || []\n\n // remove callback form listeners and all channels\n // TODO remove only if has\n // eslint-disable-next-line no-restricted-syntax\n for (const subscriberSet of subscriberSetArray) {\n unsubscribed = subscriberSet.delete(callback) as boolean\n\n if (prune && subscriberSet.size === 0) {\n this.prune()\n }\n }\n\n this.listeners.delete(callback)\n\n return unsubscribed\n }\n\n /**\n * Checks if a callback is subscribed to a specific channel or any channel.\n * @param callback The callback function to check.\n * @param channel Optional channel name to check subscription for.\n * @returns A boolean indicating if the callback is subscribed.\n */\n isSubscribed = (callback: Callback, channel?: string): boolean => {\n if (channel) {\n const subscribersList = this.channels.get(channel)\n\n return subscribersList ? subscribersList.has(callback) : false\n }\n\n return this.listeners.has(callback)\n }\n\n /**\n * Clears all channels and listeners.\n * @throws {Error} If clearing PeregrineMQ is not allowed.\n */\n clear = (): void => {\n if (this.config.allowClear) {\n this.channels.clear()\n this.listeners.clear()\n } else {\n throw new PeregrineMQClearError()\n }\n }\n\n /**\n * Returns the specific instance of PeregrineMQ.\n * @returns A string identifier of the specific instance of PeregrineMQ.\n */\n getId = (): string => this.id\n}\n"],"names":["PeregrineMQClearError","PeregrineMQ","id","config","__publicField","callback","channel","listener","subscribersSet","channelSubscriberSets","isEmpty","channelSubscriberSet","isParent","data","NON_EXISTENT_CHANNEL","iterator","subscriberFunc","results","allowAutoPrune","pruneInterval","pruneIntervalHandler","instance","prunedChannels","_a","channelListeners","index","nestedChannels","length","it","result","subscribersList","options","prune","unsubscribed","subscriberSet","subscriberSetArray","uuidv4","acc"],"mappings":"mWAWO,MAAMA,UAA8B,KAAM,CAC/C,aAAc,CACZ,MAAM,0FAA0F,EAChG,KAAK,KAAO,uBACd,CACF,CAKO,MAAMC,CAAsC,CA+FjD,YAAYC,EAAaC,EAAiB,CA9FlCC,EAAA,WAEAA,EAAA,cAAiB,CACvB,eAAgB,GAChB,cAAe,IACf,WAAY,EAAA,GAMNA,EAAA,oBAA4C,KAK5CA,EAAA,qBAAiD,KAOjDA,EAAA,mBAAc,CAACC,EAAoBC,IAA0B,CACnE,MAAMC,EAAW,KAAK,UAAU,IAAIF,CAAQ,EACtCG,EAAiB,KAAK,SAAS,IAAIF,CAAO,EAE5CE,IACED,EACFA,EAAS,KAAKC,CAAc,EAE5B,KAAK,UAAU,IAAIH,EAAU,CAACG,CAAc,CAAC,EAGnD,GAQQJ,EAAA,sBAAkBC,GAA6B,CACrD,MAAMI,EAAwB,KAAK,UAAU,IAAIJ,CAAQ,EACzD,IAAIK,EAAU,GAGd,UAAWC,KAAwBF,GAAyB,GAE1D,GADAC,EAAU,CAACC,EAAqB,IAAIN,CAAQ,EACxC,CAACK,EACH,MAI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AAA,EAEtC,IAAIE,EAAe,GAEnB,GAAI3B,EAAS,CACX,MAAM4B,EAAgB,KAAK,SAAS,IAAI5B,CAAO,EAE/C,OAAA2B,EAAeC,EAAgBA,EAAc,OAAO7B,CAAQ,EAAI,GAC5D2B,IAASE,GAAA,YAAAA,EAAe,QAAS,GACnC,KAAK,SAAS,OAAO5B,CAAO,EAG9B,KAAK,eAAeD,CAAQ,EAErB4B,CACT,CAEA,MAAME,EAAqB,KAAK,UAAU,IAAI9B,CAAQ,GAAK,CAAA,EAK3D,UAAW6B,KAAiBC,EAC1BF,EAAeC,EAAc,OAAO7B,CAAQ,EAExC2B,GAASE,EAAc,OAAS,GAClC,KAAK,MAAA,EAIT,YAAK,UAAU,OAAO7B,CAAQ,EAEvB4B,CACT,GAQA7B,EAAA,oBAAe,CAACC,EAAoBC,IAA8B,CAChE,GAAIA,EAAS,CACX,MAAMwB,EAAkB,KAAK,SAAS,IAAIxB,CAAO,EAEjD,OAAOwB,EAAkBA,EAAgB,IAAIzB,CAAQ,EAAI,EAC3D,CAEA,OAAO,KAAK,UAAU,IAAIA,CAAQ,CACpC,GAMAD,EAAA,aAAQ,IAAY,CAClB,GAAI,KAAK,OAAO,WACd,KAAK,SAAS,MAAA,EACd,KAAK,UAAU,MAAA,MAEf,OAAM,IAAIJ,CAEd,GAMAI,EAAA,aAAQ,IAAc,KAAK,IArOzB,KAAK,GAAKF,GAAMkC,UAAA,EAChB,KAAK,UAAUjC,GAAU,EAAE,CAC7B,CAKA,IAAI,QAAiB,CACnB,MAAO,CAAC,GAAG,KAAK,SAAS,QAAQ,EAAE,OAAO,CAACkC,EAAKP,IAAoBO,EAAMP,EAAgB,KAAM,CAAC,CACnG,CA6NF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peregrineMQ.types.js","sources":["../../../../../../../src/core/utils/appState/peregrineMQ/peregrineMQ.types.ts"],"sourcesContent":["export type CallbackPayload = string | number | Record<any, any>;\nexport type Callback = (message: string, data?: CallbackPayload) => void;\n\nexport type SubscribersSet = Set<Callback>;\n\nexport interface Config {\n /**\n * If true, enables automatic removal of channels without subscribers.\n */\n allowAutoPrune?: boolean\n\n /**\n * The interval, in milliseconds, for checking channels with no subscribers.\n */\n pruneInterval?: number\n\n /**\n * If true, allows the use of the clear method to remove all channels and listeners.\n */\n allowClear?: boolean\n}\n\nexport interface UnsubscribeOptions {\n /**\n * The channel to unsubscribe from.\n */\n channel?: string\n\n /**\n * If true, removes the channel from the collection when the last subscriber is removed.\n */\n prune?: boolean\n}\n\nexport interface PeregrineMQApi {\n /**\n * Sets the configuration options for a PeregrineMQ instance.\n *\n * @param {Config} config - An object containing configuration options for the instance.\n * @return {void}\n */\n configure: (config: Config) => void\n\n /**\n * Retrieves a list of all channels and their subscribers.\n *\n * @return { string[] }\n */\n getChannels: () => string[]\n\n /**\n * Removes all channels that have no subscribers.\n *\n * @return {void}\n */\n prune: () => void\n\n /**\n * Removes a specified channel from the collection.\n *\n * @param {string} channel - The name of the channel to remove.\n * @return {boolean} - Returns true if the channel was successfully removed, otherwise false.\n */\n removeChannel: (channel: string) => boolean\n\n /**\n * Publishes a message to a specified channel, passing the data to its subscribers.\n *\n * @param {string} channel - The channel to publish the message to.\n * @param {unknown} [data] - The data to pass to subscribers.\n * @return {boolean} - Returns true if the message was successfully published, otherwise false.\n */\n publish: (channel: string, data?: unknown) => PublishReturnType\n\n /**\n * Subscribes a function to a specified channel.\n * The returned unsubscribe function is unique and should be stored for later use.\n *\n * @param {string} channel - The channel name to subscribe to.\n * @param {Callback} callback - The function to call when a new message is published.\n * @return {() => boolean} - The unsubscribe function.\n */\n subscribe: (channel: string, callback: Callback) => () => boolean\n\n /**\n * Unsubscribes a callback from a channel.\n * Returns true if the callback was successfully unsubscribed, otherwise false.\n *\n * @param {Callback} callback - The callback to unsubscribe.\n * @param {UnsubscribeOptions} [options] - Options for unsubscribing, including the channel.\n * @return {boolean} - Returns true if the callback was successfully unsubscribed, otherwise false.\n */\n unsubscribe: (callback: Callback, options?: UnsubscribeOptions) => boolean\n\n /**\n * Checks if a specified callback is subscribed to a specified channel (or any channel if not specified).\n *\n * @param {Callback} callback - The callback to check for subscription.\n * @param {string} [channel] - The channel to check for subscription. If not specified, all channels will be checked.\n * @return {boolean} - Returns true if the callback is subscribed, otherwise false.\n */\n isSubscribed: (callback: Callback, channel?: string) => boolean\n\n /**\n * Removes all channels and subscribers from the collection.\n *\n * @function\n * @alias clear\n */\n clear: () => void\n\n /**\n * Retrieves the identifier for the specific instance of PeregrineMQ.\n *\n * @return {string} - A string identifier for the specific instance.\n */\n getId: () => string\n}\nexport const NON_EXISTENT_CHANNEL = 'NON_EXISTENT_CHANNEL'\n\nexport type NON_EXISTENT_CHANNEL_TYPE = typeof NON_EXISTENT_CHANNEL\n\nexport type PublishToChannelReturnType = NON_EXISTENT_CHANNEL_TYPE\n | undefined | boolean | unknown | Array<undefined | boolean | unknown>\n\nexport type PublishReturnType = PublishToChannelReturnType | PublishToChannelReturnType[]\n"],"names":["NON_EXISTENT_CHANNEL"],"mappings":"gFAsHO,MAAMA,EAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiny-state-machine.base.js","sources":["../../../../../../../src/core/utils/appState/stateMachine/tiny-state-machine.base.ts"],"sourcesContent":["export enum TinyStateMachineEventType {\n CHANGE = 'change',\n TRANSITIONED_TO = 'transitionedTo',\n TRANSITIONED_FROM = 'transitionedFrom',\n ADDED_TO_QUEUE = 'addedToQueue',\n REMOVED_FROM_QUEUE = 'removedFromQueue'\n}\n\nexport type TinyStateMachineListenerCallBack = (\n stateEvent: TinyStateMachineEvent,\n state?: ITinyStateMachineState\n) => void;\n\nexport class TinyStateMachineEvent extends Event {\n constructor(type: TinyStateMachineEventType, eventInitDict?: any) {\n super(type, eventInitDict)\n }\n}\n\ninterface IPubSub {\n subscribe: (listener: TinyStateMachineListenerCallBack) => () => void\n unsubscribe: (listener: TinyStateMachineListenerCallBack) => void\n publish: (...args: any[]) => void\n}\n\nexport interface ITinyStateMachineState extends IPubSub {\n name: string\n}\n\nexport class TinyStateMachineState implements ITinyStateMachineState {\n #name: string\n\n #listeners: Set<TinyStateMachineListenerCallBack>\n\n constructor(name: string) {\n this.#name = name\n this.#listeners = new Set<TinyStateMachineListenerCallBack>()\n }\n\n get name(): string {\n return this.#name\n }\n\n subscribe = (listener: TinyStateMachineListenerCallBack): () => void => {\n this.#listeners.add(listener)\n return () => this.#listeners.delete(listener)\n }\n\n unsubscribe = (listener: TinyStateMachineListenerCallBack): boolean => this.#listeners.delete(listener)\n\n publish = (event: TinyStateMachineEvent): void => {\n if (!this.#listeners?.size) {\n return\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of this.#listeners) {\n listener(event)\n }\n }\n\n toString = (): string => `TinyStateMachineSate: ${this.#name}`\n\n get [Symbol.toStringTag](): string {\n return `TinyStateMachineSate: ${this.#name}`\n }\n}\n\nexport interface ITinyStateMachine extends IPubSub {\n states: Set<TinyStateMachineState>\n addState: (state: TinyStateMachineState) => void\n removeState: (state: TinyStateMachineState) => void\n currentState: undefined | TinyStateMachineState\n gotoState: (state: TinyStateMachineState) => void | boolean\n\n}\n\nexport const createStates = (stateNames: string[]): Set<TinyStateMachineState> => new Set(\n stateNames.map((name: string) => new TinyStateMachineState(name)),\n)\n\nexport class TinyStateMachine implements ITinyStateMachine {\n #states: Set<TinyStateMachineState>\n\n #listeners: Set<TinyStateMachineListenerCallBack>\n\n #currentState: undefined | TinyStateMachineState\n\n constructor(states: Set<TinyStateMachineState>) {\n this.#states = states\n this.#listeners = new Set<TinyStateMachineListenerCallBack>()\n }\n\n addState = (state: TinyStateMachineState): void => {\n this.#states.add(state)\n }\n\n removeState = (state: TinyStateMachineState): void => {\n this.#states.delete(state)\n }\n\n get states (): Set<TinyStateMachineState> {\n return this.#states\n }\n\n get currentState (): undefined | TinyStateMachineState {\n return this.#currentState\n }\n\n subscribe = (listener: TinyStateMachineListenerCallBack): () => void => {\n this.#listeners.add(listener)\n return () => this.#listeners.delete(listener)\n }\n\n unsubscribe = (listener: TinyStateMachineListenerCallBack): void => {\n this.#listeners.delete(listener)\n }\n\n publish = (event: TinyStateMachineEvent, state?: TinyStateMachineState): void => {\n if (!this.#listeners?.size) {\n return\n }\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of this.#listeners) {\n listener(event, state)\n }\n }\n\n #getStateByName = (stateName: string): undefined | TinyStateMachineState => Array\n .from(this.#states).find((state: TinyStateMachineState) => state.name === stateName)\n\n #getStateByState\n = (state: TinyStateMachineState): undefined | TinyStateMachineState => (this.#states.has(state) ? state : undefined)\n\n gotoState = (state: TinyStateMachineState | string): void | boolean => {\n const foundState = typeof state === 'string'\n ? this.#getStateByName(state as string)\n : this.#getStateByState(state as TinyStateMachineState)\n\n if (!foundState) {\n throw Error(`TinyStateMachin::gotoState state not found: ${state}`)\n }\n\n const prevState: undefined | TinyStateMachineState = this.#currentState\n\n this.#currentState = foundState\n this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM), prevState)\n this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO), foundState)\n\n prevState?.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM))\n this.#currentState.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO))\n return true\n }\n\n next = (): TinyStateMachineState | null => {\n let nextState: TinyStateMachineState\n const arrayOfStates: TinyStateMachineState[] = Array.from(this.#states)\n\n if (!this.#currentState) {\n [nextState] = arrayOfStates\n\n return this.gotoState(nextState) ? nextState : null\n }\n\n const currentStateIndex = arrayOfStates\n .findIndex((state: TinyStateMachineState) => state === this.#currentState)\n\n if (currentStateIndex < this.#states.size - 2) {\n nextState = arrayOfStates[currentStateIndex + 1]\n return this.gotoState(nextState) ? nextState : null\n }\n\n return null\n }\n}\n\n\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const stateIterator = function* () {\n let operation: string\n let state: string = stateIterator.IS_RUNNING\n\n while (true) {\n // console.log('inside while loop')\n\n // // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // // @ts-ignore\n\n\n // // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // // @ts-ignore\n operation = yield state\n\n // // console.log('operation', operation)\n // // console.log('state', state)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (operation === stateIterator.DO_END) {\n state = stateIterator.IS_FINITE\n yield state\n break\n }\n }\n yield* [1, 2, 3]\n yield 123\n\n return 10\n}\n\nstateIterator.DO_END = '__DO__END__'\nstateIterator.IS_FINITE = '__IS__FINITE__'\nstateIterator.IS_RUNNING = '__IS__RUNNING__'\n"],"names":["TinyStateMachineEventType","TinyStateMachineEvent","type","eventInitDict","TinyStateMachineState","name","__privateAdd","_name","_listeners","__publicField","listener","__privateGet","event","_a","__privateSet","createStates","stateNames","TinyStateMachine","states","_states","_currentState","state","_getStateByName","stateName","_getStateByState","foundState","prevState","nextState","arrayOfStates","currentStateIndex","stateIterator","operation"],"mappings":"2jBAAO,IAAKA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,kBAAoB,mBACpBA,EAAA,eAAiB,eACjBA,EAAA,mBAAqB,mBALXA,IAAAA,GAAA,CAAA,CAAA,EAaL,MAAMC,UAA8B,KAAM,CAC/C,YAAYC,EAAiCC,EAAqB,CAChE,MAAMD,EAAMC,CAAa,CAC3B,CACF,SAYO,MAAMC,CAAwD,CAKnE,YAAYC,EAAc,CAJ1BC,EAAA,KAAAC,GAEAD,EAAA,KAAAE,GAWAC,EAAA,iBAAaC,IACXC,EAAA,KAAKH,GAAW,IAAIE,CAAQ,EACrB,IAAMC,EAAA,KAAKH,GAAW,OAAOE,CAAQ,IAG9CD,EAAA,mBAAeC,GAAwDC,EAAA,KAAKH,GAAW,OAAOE,CAAQ,GAEtGD,EAAA,eAAWG,GAAuC,OAChD,IAAKC,EAAAF,EAAA,K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IC,EACAV,EAAgBS,EAAc,WAElC,OAeE,GANAC,EAAY,MAAMV,EAMdU,IAAcD,EAAc,OAAQ,CACtCT,EAAQS,EAAc,UACtB,MAAMT,EACN,KACF,CAEF,aAAO,CAAC,EAAG,EAAG,CAAC,EACf,KAAM,KAEC,EACT,EAEAS,EAAc,OAAS,cACvBA,EAAc,UAAY,iBAC1BA,EAAc,WAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\nimport { isFunctionAsync } from '../../helpers'\n\n\nlet SET_STATE_MERGE: boolean = true\n\n\nexport const canSetStateMerge = (value: boolean): void => {\n SET_STATE_MERGE = !!value\n}\n\nexport const getSetStateMerge = (): boolean => SET_STATE_MERGE\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents an equality function for comparing selected values.\n */\nexport type EqualityFn<T> = (a: SelectedValueType<T>, b: SelectedValueType<T>) => boolean\n\n\n/**\n * Shallow equality check for selector results.\n * Handles primitives (===), null/undefined, arrays (element-wise ===), and plain objects (own-key ===).\n */\nexport const shallowEqual = <T>(a: SelectedValueType<T>, b: SelectedValueType<T>): boolean => {\n if (Object.is(a, b)) { return true }\n if (typeof a !== 'object' || typeof b !== 'object' || a == null || b == null) { return false }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) { return false }\n return a.every((val, i) => Object.is(val, (b as unknown[])[i]))\n }\n\n const keysA = Object.keys(a as object)\n const keysB = Object.keys(b as object)\n\n if (keysA.length !== keysB.length) { return false }\n return keysA.every(\n (key) => Object.is(\n (a as Record<string, unknown>)[key],\n (b as Record<string, unknown>)[key],\n ),\n )\n}\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n equalityFn?: EqualityFn<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>, equalityFn?: EqualityFn<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n// TODO infer actionNames from createStore arguments\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n\n\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\ntype Actions<T> = { [key: string]: ActionHandler<T>}\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Actions<T>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = (): Partial<T> => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>): Promise<Partial<T>> => {\n currentState = SET_STATE_MERGE ? { ...getState(), ...newState } : newState\n\n const errors: unknown[] = []\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n try {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n const effectiveEqualityFn = listener.equalityFn ?? (selector ? shallowEqual : undefined)\n const isEqual = effectiveEqualityFn\n ? effectiveEqualityFn(listener.previousValue as SelectedValueType<T>, newValue)\n : listener.previousValue !== undefined && listener.previousValue === newValue\n\n if (!isEqual) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n } catch (error) {\n errors.push(error)\n }\n }\n\n if (errors.length > 0) {\n throw errors[0]\n }\n\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>, equalityFn?: EqualityFn<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatch selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n if (equalityFn && !listener.equalityFn) {\n // eslint-disable-next-line no-param-reassign\n listener.equalityFn = equalityFn\n }\n\n if (listener.selector) {\n // setting the previousValue for the next cache/equality check\n // eslint-disable-next-line no-param-reassign\n listener.previousValue = listener.selector(getState())\n }\n\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Actions<T> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => {\n // eslint-disable-next-line no-param-reassign\n aggregator[actionName] = async(...rest: unknown[]): Promise<void | Partial<T>> => {\n // TODO try to not call subscriber too many times becuase of Error and Pending values\n const isAsync = isFunctionAsync(actionHandler as () => unknown)\n\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Error`]: null,\n [`${actionName}Pending`]: true,\n })\n }\n\n try {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n // TODO try to mutate state only once with the results, that means pass custom setState to action,\n // so that it would matk pending and error already inside action\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n\n if (isAsync) {\n setState({ ...getState(), [`${actionName}Pending`]: false })\n }\n\n return resultOfAction\n } catch (error) {\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Pending`]: false,\n [`${actionName}Error`]: error,\n })\n }\n throw error\n }\n }\n\n return aggregator\n },\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n // ? storeCombinedWithActions as StoreWithActions<T> & ActionsStateReturnType<A>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["SET_STATE_MERGE","canSetStateMerge","value","getSetStateMerge","shallowEqual","a","b","val","i","keysA","keysB","key","createStore","initialState","actions","reducer","currentState","listeners","getState","setState","newState","errors","listener","selector","newValue","effectiveEqualityFn","error","storeBaseicApi","equalityFn","resolvedActions","_a","aggregator","actionName","actionHandler","rest","isAsync","isFunctionAsync","resultOfAction","storeCombinedWithActions"],"mappings":"0HAMA,IAAIA,EAA2B,GAGxB,MAAMC,EAAoBC,GAAyB,CACxDF,EAAkB,CAAC,CAACE,CACtB,EAEaC,EAAmB,IAAeH,EA0BlCI,EAAe,CAAIC,EAAyBC,IAAqC,CAC5F,GAAI,OAAO,GAAGD,EAAGC,CAAC,EAAK,MAAO,GAC9B,GAAI,OAAOD,GAAM,UAAY,OAAOC,GAAM,UAAYD,GAAK,MAAQC,GAAK,KAAQ,MAAO,GAEvF,GAAI,MAAM,QAAQD,CAAC,GAAK,MAAM,QAAQC,CAAC,EACrC,OAAID,EAAE,SAAWC,EAAE,OAAiB,GAC7BD,EAAE,MAAM,CAACE,EAAKC,IAAM,OAAO,GAAGD,EAAMD,EAAgBE,CAAC,CAAC,CAAC,EAGhE,MAAMC,EAAQ,OAAO,KAAKJ,CAAW,EAC/BK,EAAQ,OAAO,KAAKJ,CAAW,EAErC,OAAIG,EAAM,SAAWC,EAAM,OAAiB,GACrCD,EAAM,MACVE,GAAQ,OAAO,GACbN,EAA8BM,CAAG,EACjCL,EAA8BK,CAAG,CAAA,CACpC,CAEJ,EAkFaC,EAAc,CACzBC,EACAC,EACAC,IACmC,OACnC,IAAIC,EAA2BH,EAC/B,MAAMI,MAAgB,IAMhBC,EAAW,IAAkBF,EAQ7BG,EAAW,MAAOC,GAA8C,CACpEJ,EAAehB,EAAkB,CAAE,GAAGkB,IAAY,GAAGE,GAAaA,EAElE,MAAMC,EAAoB,CAAA,EAG1B,UAAWC,KAAYL,EACrB,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e,CAAI,EAItE,OAAInB,GACFI,EAASJ,EAAQG,EAAA,EAAYc,EAAY,GAAGE,CAAI,CAAC,EAG/CC,GACFhB,EAAS,CAAE,GAAGD,IAAY,CAAC,GAAGc,CAAU,SAAS,EAAG,GAAO,EAGtDK,CACT,OAASX,EAAO,CACd,MAAIS,GACFhB,EAAS,CACP,GAAGD,EAAA,EACH,CAAC,GAAGc,CAAU,SAAS,EAAG,GAC1B,CAAC,GAAGA,CAAU,OAAO,EAAGN,CAAA,CACzB,EAEGA,CACR,CACF,EAEOK,GAET,CAAA,GACE,KAKAO,EAA2B,CAC/B,GAAGX,EACH,GAAIE,EAAkB,CAAE,QAAS,CAAE,GAAGA,CAAA,CAAgB,EAAM,CAAA,CAAC,EAG/D,OACIS,CAGN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.vanillajs.templates.js","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.templates.ts"],"sourcesContent":["import { ActionHandler, Reducer, Store, StoreWithActions, createStore } from './store.vanillajs'\n\n\ntype DefaultES = { [key: string]: any }\n\n\nexport type DataState<T, ES = DefaultES> = {\n dataId: string\n isLoading: boolean\n error?: unknown\n data?: T\n} & ES\n\n\ntype Load<T, ES = DefaultES> = (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n\ntype LoadHandler<T, ES = DefaultES> = (\n dataPromise: unknown | Promise<unknown>,\n) => Promise<Partial<DataState<T, ES>>>\n\n/**\n * Creates a data store with actions.\n * @param dataId - The ID of the data.\n * @param actions - Optional actions for the data store.\n * @returns The created data store with actions.\n */\nexport const createDataStore\n= <T, ES = DefaultES>(\n dataId: string,\n initialState?: Partial<ES>,\n actions?: Record<string, ActionHandler<DataState<T, ES>>>,\n reducer?: Reducer<DataState<T, ES>>,\n): StoreWithActions<DataState<T, ES>>\n& { actions: { load: LoadHandler<T, ES> } } => {\n const loadActions: { load: Load<T, ES> } = {\n ...actions,\n /**\n * Loads data into the data store.\n * @param getState - Function to get the current state of the data store.\n * @param setState - Function to set the state of the data store.\n * @param dataPromise - The data promise to be loaded.\n * @returns A promise that resolves to the updated state of the data store.\n */\n load: async (\n getState: Store<DataState<T, ES>>['getState'],\n setState: Store<DataState<T, ES>>['setState'],\n dataPromise: unknown | Promise<unknown>,\n ) => {\n const dataState: Partial<DataState<T, ES>> = getState()\n\n setState({ ...dataState, isLoading: true })\n\n try {\n const response: unknown = await dataPromise\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.data = response?.data || response\n } catch (error: unknown) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n dataState.error = error\n }\n return setState({ ...dataState, isLoading: false })\n },\n }\n\n return (createStore<DataState<T, ES>>({\n ...initialState,\n dataId,\n isLoading: false,\n } as Partial<DataState<T, ES>>, loadActions, reducer)) as StoreWithActions<DataState<T, ES>>\n & { actions: { load: LoadHandler<T, ES> } }\n}\n"],"names":["createDataStore","dataId","initialState","actions","reducer","loadActions","getState","setState","dataPromise","dataState","response","error","createStore"],"mappings":"wHA+BaA,EACX,CACAC,EACAC,EACAC,EACAC,IAE6C,CAC7C,MAAMC,EAAqC,CACzC,GAAGF,EAQH,KAAM,MACJG,EACAC,EACAC,IACG,CACH,MAAMC,EAAuCH,EAAA,EAE7CC,EAAS,CAAE,GAAGE,EAAW,UAAW,GAAM,EAE1C,GAAI,CACF,MAAMC,EAAoB,MAAMF,EAIhCC,EAAU,MAAOC,GAAA,YAAAA,EAAU,OAAQA,CACrC,OAASC,EAAgB,CAGvBF,EAAU,MAAQE,CACpB,CACA,OAAOJ,EAAS,CAAE,GAAGE,EAAW,UAAW,GAAO,CACpD,CAAA,EAGF,OAAQG,cAA8B,CACpC,GAAGV,EACH,OAAAD,EACA,UAAW,EAAA,EACmBI,EAAaD,CAAO,CAEtD"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});Object.defineProperty(Array.prototype,"last",{get(){return this[this.length-1]},set(t){return this[this.length-1]=t,this}});Object.defineProperty(Array.prototype,"first",{get(){return this[0]},set(t){return this[0]=t,this}});const r=Array.prototype.first,e=Array.prototype.last;exports.ArrayFirst=r;exports.ArrayLast=e;
|
|
2
|
-
//# sourceMappingURL=array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sources":["../../../../../src/core/utils/array.ts"],"sourcesContent":["/* eslint-disable no-extend-native */\nObject.defineProperty(Array.prototype, 'last', {\n get() { return this[this.length - 1] },\n set(v) { this[this.length - 1] = v; return this },\n})\n\n\nObject.defineProperty(Array.prototype, 'first', {\n get() { return this[0] },\n set(v) { this[0] = v; return this },\n})\n\n// redeclare array, to have last, first accessors\ndeclare global {\n interface Array<T> {\n last: T | undefined\n first: T | undefined\n }\n}\n\nexport default Array.prototype\n\n\nexport const ArrayFirst = Array.prototype.first\nexport const ArrayLast = Array.prototype.last\n"],"names":["v","ArrayFirst","ArrayLast"],"mappings":"gFACA,OAAO,eAAe,MAAM,UAAW,OAAQ,CAC7C,KAAM,CAAE,OAAO,KAAK,KAAK,OAAS,CAAC,CAAE,EACrC,IAAIA,EAAG,CAAE,YAAK,KAAK,OAAS,CAAC,EAAIA,EAAU,IAAK,CAClD,CAAC,EAGD,OAAO,eAAe,MAAM,UAAW,QAAS,CAC9C,KAAM,CAAE,OAAO,KAAK,CAAC,CAAE,EACvB,IAAIA,EAAG,CAAE,YAAK,CAAC,EAAIA,EAAU,IAAK,CACpC,CAAC,EAaM,MAAMC,EAAa,MAAM,UAAU,MAC7BC,EAAY,MAAM,UAAU"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("dayjs"),p=require("dayjs/plugin/relativeTime"),v=require("dayjs/plugin/updateLocale"),_=require("dayjs/plugin/customParseFormat"),n=e=>e&&e.__esModule?e:{default:e},t=n(M),h=n(p),w=n(v),g=n(_),N={thresholds:[{l:"s",r:1},{l:"m",r:1},{l:"mm",r:59,d:"minute"},{l:"h",r:1},{l:"hh",r:23,d:"hour"},{l:"d",r:1},{l:"dd",r:29,d:"day"},{l:"M",r:1},{l:"MM",r:11,d:"month"},{l:"y",r:1},{l:"yy",d:"year"}]},c={future:"in %s",past:"%s ago",s:"now",m:"now",mm:"now",h:"1 hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},f={future:"za %s",past:"%s před",s:"nyní",m:"nyní",mm:"nyní",h:"1 hodinu",hh:"%d hodiny",d:"den",dd:"%d dny",M:"měsíc",MM:"%d měsíci",y:"rok",yy:"%d roky"};t.default.extend(g.default);t.default.extend(h.default,N);t.default.extend(w.default);t.default.updateLocale("cz",{relativeTime:{...f}});t.default.updateLocale("en",{relativeTime:{...c}});const L=(e,d)=>(t.default.updateLocale("en",{relativeTime:{...d==="cz"?f:c,...h.default}}),t.default(e,void 0).fromNow(!0)),F=(e,d)=>y({...d,from:!0,value:e}),q=(e,d)=>y({...d,to:!0,value:e}),y=({value:e,valueFormat:d,formatString:i,language:o="en",relativeTime:s,from:r,to:a,shouldAddDay:l=!1,shouldSubtractDay:u=!1,showPreffix:T=!1})=>{if(t.default.updateLocale("en",{relativeTime:{...o==="cz"?f:c,...s}}),t.default.locale(o),!r&&a){const m=t.default(e,d||void 0).add(l?1:0,"day");return t.default(new Date).locale(o).to(m,!T)}if(r&&!a){const m=t.default(e,d||void 0).subtract(u?1:0,"day");return t.default(m,d||void 0).locale(o).fromNow(!T)}return t.default(e,d||void 0).locale(o).format(i)},z=(e,d,i,o,s=" - ",r="month")=>{const a=t.default(e),l=t.default(d),u=a.diff(l,r);return`${a.format(u===0?i:o)}${s}${l.format(o)}`};exports.dateRangeFormat=z;exports.getDateTime=y;exports.getTimeFromNow=F;exports.getTimeFromNowOriginal=L;exports.getTimeTo=q;
|
|
2
|
-
//# sourceMappingURL=date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sources":["../../../../../src/core/utils/date.ts"],"sourcesContent":["import dayjs, { UnitType } from 'dayjs'\nimport relativeTime from 'dayjs/plugin/relativeTime'\nimport updateLocale from 'dayjs/plugin/updateLocale'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\n\nexport type DateTimeFormat = {\n value: Date | string | number\n valueFormat?: string\n formatString?: string\n language?: string\n relativeTime?: Record<string, string>\n from?: boolean\n to?: boolean\n shouldSubtractDay?: boolean\n shouldAddDay?: boolean\n showPreffix?: boolean\n}\n\nconst relativeTimeConfig = {\n thresholds: [\n { l: 's', r: 1 },\n { l: 'm', r: 1 },\n { l: 'mm', r: 59, d: 'minute' },\n { l: 'h', r: 1 },\n { l: 'hh', r: 23, d: 'hour' },\n { l: 'd', r: 1 },\n { l: 'dd', r: 29, d: 'day' },\n { l: 'M', r: 1 },\n { l: 'MM', r: 11, d: 'month' },\n { l: 'y', r: 1 },\n { l: 'yy', d: 'year' },\n ],\n}\n\nconst relativeTimeEN = {\n future: 'in %s',\n past: '%s ago',\n s: 'now',\n m: 'now',\n mm: 'now',\n h: '1 hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days', // probably 'a week' instead?\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n}\n\nconst relativeTimeCZ = {\n future: 'za %s',\n past: '%s před',\n s: 'nyní',\n m: 'nyní',\n mm: 'nyní',\n h: '1 hodinu',\n hh: '%d hodiny',\n d: 'den',\n dd: '%d dny',\n M: 'měsíc',\n MM: '%d měsíci',\n y: 'rok',\n yy: '%d roky',\n}\n\ndayjs.extend(customParseFormat)\ndayjs.extend(relativeTime, relativeTimeConfig)\ndayjs.extend(updateLocale)\n\ndayjs.updateLocale('cz', {\n relativeTime: {\n ...relativeTimeCZ,\n },\n})\ndayjs.updateLocale('en', {\n relativeTime: {\n ...relativeTimeEN,\n },\n})\n\nexport const getTimeFromNowOriginal = (value: string, language: string): string => {\n dayjs.updateLocale('en', {\n relativeTime: {\n ...(language === 'cz' ? relativeTimeCZ : relativeTimeEN),\n ...relativeTime,\n },\n })\n return dayjs(value, undefined).fromNow(true)\n}\n\nexport const getTimeFromNow = (\n value: Date | string | number,\n valueFormat?: Partial<DateTimeFormat>,\n): string => getDateTime({ ...valueFormat, from: true, value })\n\nexport const getTimeTo = (\n value: Date | string | number,\n valueFormat?: Partial<DateTimeFormat>,\n): string => getDateTime({ ...valueFormat, to: true, value })\n\nexport const getDateTime = ({\n value,\n valueFormat,\n formatString,\n language = 'en',\n relativeTime,\n from,\n to,\n shouldAddDay = false,\n shouldSubtractDay = false,\n showPreffix = false,\n}: DateTimeFormat): string => {\n dayjs.updateLocale('en', {\n relativeTime: {\n ...(language === 'cz' ? relativeTimeCZ : relativeTimeEN),\n ...relativeTime,\n },\n })\n\n dayjs.locale(language)\n\n if (!from && to) {\n const dateTo = dayjs(value, valueFormat || undefined).add(shouldAddDay ? 1 : 0, 'day')\n\n return dayjs(new Date()).locale(language).to(dateTo, !showPreffix)\n }\n\n if (from && !to) {\n const dateTo = dayjs(value, valueFormat || undefined).subtract(shouldSubtractDay ? 1 : 0, 'day')\n\n return dayjs(dateTo, valueFormat || undefined).locale(language).fromNow(!showPreffix)\n }\n\n return dayjs(value, valueFormat || undefined).locale(language).format(formatString)\n}\n\nexport const dateRangeFormat = (\n dateFrom: Date, dateTo: Date, shortFormat: string, longFormat: string,\n delimiter = ' - ', datePeriod: UnitType = 'month',\n) : string => {\n const dayJSFrom = dayjs(dateFrom)\n const dayJSTo = dayjs(dateTo)\n\n const diffMonths = dayJSFrom.diff(dayJSTo, datePeriod)\n\n return `${dayJSFrom.format(diffMonths === 0 ? shortFormat : longFormat)}${delimiter}${dayJSTo.format(longFormat)}`\n}\n"],"names":["relativeTimeConfig","relativeTimeEN","relativeTimeCZ","dayjs","customParseFormat","relativeTime","updateLocale","getTimeFromNowOriginal","value","language","getTimeFromNow","valueFormat","getDateTime","getTimeTo","formatString","from","to","shouldAddDay","shouldSubtractDay","showPreffix","dateTo","dateRangeFormat","dateFrom","shortFormat","longFormat","delimiter","datePeriod","dayJSFrom","dayJSTo","diffMonths"],"mappings":"kSAkBMA,EAAqB,CACzB,WAAY,CACV,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,KAAM,EAAG,GAAI,EAAG,QAAA,EACrB,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,KAAM,EAAG,GAAI,EAAG,MAAA,EACrB,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,KAAM,EAAG,GAAI,EAAG,KAAA,EACrB,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,KAAM,EAAG,GAAI,EAAG,OAAA,EACrB,CAAE,EAAG,IAAK,EAAG,CAAA,EACb,CAAE,EAAG,KAAM,EAAG,MAAA,CAAO,CAEzB,EAEMC,EAAiB,CACrB,OAAQ,QACR,KAAM,SACN,EAAG,MACH,EAAG,MACH,GAAI,MACJ,EAAG,SACH,GAAI,WACJ,EAAG,QACH,GAAI,UACJ,EAAG,UACH,GAAI,YACJ,EAAG,SACH,GAAI,UACN,EAEMC,EAAiB,CACrB,OAAQ,QACR,KAAM,UACN,EAAG,OACH,EAAG,OACH,GAAI,OACJ,EAAG,WACH,GAAI,YACJ,EAAG,MACH,GAAI,SACJ,EAAG,QACH,GAAI,YACJ,EAAG,MACH,GAAI,SACN,EAEAC,EAAAA,QAAM,OAAOC,EAAAA,OAAiB,EAC9BD,EAAAA,QAAM,OAAOE,EAAAA,QAAcL,CAAkB,EAC7CG,EAAAA,QAAM,OAAOG,EAAAA,OAAY,EAEzBH,EAAAA,QAAM,aAAa,KAAM,CACvB,aAAc,CACZ,GAAGD,CAAA,CAEP,CAAC,EACDC,EAAAA,QAAM,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AAA,QAAMK,EAAOG,GAAe,MAAS,EAAE,OAAOF,CAAQ,EAAE,OAAOK,CAAY,CACpF,EAEaO,EAAkB,CAC7BC,EAAgBF,EAAcG,EAAqBC,EACnDC,EAAY,MAAOC,EAAuB,UAC9B,CACZ,MAAMC,EAAYxB,EAAAA,QAAMmB,CAAQ,EAC1BM,EAAUzB,EAAAA,QAAMiB,CAAM,EAEtBS,EAAaF,EAAU,KAAKC,EAASF,CAAU,EAErD,MAAO,GAAGC,EAAU,OAAOE,IAAe,EAAIN,EAAcC,CAAU,CAAC,GAAGC,CAAS,GAAGG,EAAQ,OAAOJ,CAAU,CAAC,EAClH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"birthnumber.validator.js","sources":["../../../../../../src/core/utils/helpers/birthnumber.validator.ts"],"sourcesContent":["import {\n parse as parseBirthNumber,\n isValidFormat,\n isValidModulo11,\n} from './birthnumberCZSKvalidator'\n\n// TODO Lukas Z, add spec/test for isBirthNumberValid\nexport const isBirthNumberValid = (birthnumber: string, birthdate: string, gender: string): boolean => {\n if (!isValidFormat(birthnumber) || !isValidModulo11(birthnumber)) {\n return false\n }\n\n const parsedBirthNumber = parseBirthNumber(birthnumber)\n\n if (parsedBirthNumber) {\n if (gender !== parsedBirthNumber.gender) {\n return false\n }\n const { year, month, day } = parsedBirthNumber\n\n if (birthdate !== `${String(day).padStart(2, '0')}.${String(month).padStart(2, '0')}.${year}`) {\n return false\n }\n }\n return true\n}\n"],"names":["isBirthNumberValid","birthnumber","birthdate","gender","isValidFormat","isValidModulo11","parsedBirthNumber","parseBirthNumber","year","month","day"],"mappings":"iIAOaA,EAAqB,CAACC,EAAqBC,EAAmBC,IAA4B,CACrG,GAAI,CAACC,EAAAA,cAAcH,CAAW,GAAK,CAACI,EAAAA,gBAAgBJ,CAAW,EAC7D,MAAO,GAGT,MAAMK,EAAoBC,EAAAA,MAAiBN,CAAW,EAEtD,GAAIK,EAAmB,CACrB,GAAIH,IAAWG,EAAkB,OAC/B,MAAO,GAET,KAAM,CAAE,KAAAE,EAAM,MAAAC,EAAO,IAAAC,CAAA,EAAQJ,EAE7B,GAAIJ,IAAc,GAAG,OAAOQ,CAAG,EAAE,SAAS,EAAG,GAAG,CAAC,IAAI,OAAOD,CAAK,EAAE,SAAS,EAAG,GAAG,CAAC,IAAID,CAAI,GACzF,MAAO,EAEX,CACA,MAAO,EACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"birthnumberCZSKvalidator.js","sources":["../../../../../../src/core/utils/helpers/birthnumberCZSKvalidator.ts"],"sourcesContent":["export const regex = /^\\s*(\\d\\d)(\\d\\d)(\\d\\d)[/]*(\\d\\d\\d)(\\d?)\\s*$/\n\nexport const getMatch: (value: string | number) => null | RegExpMatchArray\n = (value: string | number) => String(value).match(regex)\n\nexport const isValidFormat = (value: string | number): boolean => {\n const match = getMatch(value)\n\n return match !== null && !!match[0] && parse(value) !== null\n}\n\nexport const isValidModulo11 = (value: string | number): boolean => {\n const validFormat = isValidFormat(value)\n\n if (!validFormat) {\n return false\n }\n\n let stringValue: string\n\n if (typeof value === 'string') {\n stringValue = value.replace('/', '')\n } else {\n stringValue = (value as number).toString()\n }\n\n if (stringValue.length < 10) {\n return true\n }\n\n const controlDigit = stringValue.substr(9, 1)\n let mod = parseInt(stringValue.substr(0, 9), 10) % 11\n\n if (mod === 10) {\n mod = 0\n }\n\n return parseInt(controlDigit, 10) === mod\n}\n\ntype RangeTupleType = [number, number, string, number]\n\nconst monthRange = {\n ranges: [\n // M\n [1, 12, 'M', 0],\n // M\n [21, 32, 'M', 20],\n // F\n [51, 62, 'F', 50],\n // F\n [71, 82, 'F', 70],\n ] as RangeTupleType[],\n getRange(monthHint: number): RangeTupleType | undefined {\n return this.ranges.find(([min, max]) => monthHint >= min && monthHint <= max)\n },\n getGender(monthHint: number): string | null {\n const range = this.getRange(monthHint)\n\n return range ? range[2] as string : null\n },\n getMonth(monthHint: number): string {\n const range = this.getRange(monthHint)\n\n return String(range ? monthHint - (range[3] as number) : null).padStart(2, '0')\n },\n}\n\ntype ParsedBirthNumber = {\n day: string | number | null\n month: string | number | null\n year: string | number | null\n gender: string | null\n}\n\nexport const parse = (value: string | number | undefined): ParsedBirthNumber | null => {\n if (!value) {\n return null\n }\n const match = getMatch(value)\n\n if (!match) {\n return null\n }\n\n const controlDigit = match[5]\n\n let year = parseInt(match[1], 10)\n\n // eslint-disable-next-line no-nested-ternary\n year += controlDigit === '' ? (year < 54 ? 1900 : 1800) : (year < 54 ? 2000 : 1900)\n const monthHint = parseInt(match[2], 10)\n const month = monthRange.getMonth(monthHint)\n const gender = monthRange.getGender(monthHint)\n const day = String(parseInt(match[3], 10)).padStart(2, '0')\n\n // console.log('year-month-day')\n // console.log(`${year}-${month}-${day}`)\n\n const date = new Date(`${year}-${month}-${day}`)\n\n if (date instanceof Date && !Number.isNaN(date) && date.getMonth() + 1 === parseInt(month, 10)) {\n return {\n day,\n month,\n year,\n gender,\n }\n }\n return null\n}\n\n// TODO, control digit and year control\n/*\n if ($c === '') {\n $year += $year < 54 ? 1900 : 1800;\n } else {\n // kontrolní číslice\n $mod = ($year . $month . $day . $ext) % 11;\n if ($mod === 10) $mod = 0;\n if ($mod !== (int) $c) {\n return false;\n }\n\n $year += $year < 54 ? 2000 : 1900;\n }\n*/\n"],"names":["regex","getMatch","value","isValidFormat","match","parse","isValidModulo11","stringValue","controlDigit","mod","monthRange","monthHint","min","max","range","year","month","gender","day","date"],"mappings":"gFAAO,MAAMA,EAAQ,8CAERC,EACRC,GAA2B,OAAOA,CAAK,EAAE,MAAMF,CAAK,EAE5CG,EAAiBD,GAAoC,CAChE,MAAME,EAAQH,EAASC,CAAK,EAE5B,OAAOE,IAAU,MAAQ,CAAC,CAACA,EAAM,CAAC,GAAKC,EAAMH,CAAK,IAAM,IAC1D,EAEaI,EAAmBJ,GAAoC,CAGlE,GAAI,CAFgBC,EAAcD,CAAK,EAGrC,MAAO,GAGT,IAAIK,EAQ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AAS,EACvCO,EAAM,OAAO,SAASd,EAAM,CAAC,EAAG,EAAE,CAAC,EAAE,SAAS,EAAG,GAAG,EAKpDe,MAAW,KAAK,GAAGJ,CAAI,IAAIC,CAAK,IAAIE,CAAG,EAAE,EAE/C,OAAIC,aAAgB,MAAQ,CAAC,OAAO,MAAMA,CAAI,GAAKA,EAAK,SAAA,EAAa,IAAM,SAASH,EAAO,EAAE,EACpF,CACL,IAAAE,EACA,MAAAF,EACA,KAAAD,EACA,OAAAE,CAAA,EAGG,IACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cancelableDelayedFunction.js","sources":["../../../../../../src/core/utils/helpers/cancelableDelayedFunction.ts"],"sourcesContent":["export const cancelableSetInterval = (func: () => void, delay = 100): () => void => {\n const timeoutInterval = setInterval(func, delay)\n\n return (): void => clearInterval(timeoutInterval)\n}\n\nexport const cancelableSetTimeout = (func: () => void, delay = 100): () => void => {\n const timeoutInterval = setTimeout(func, delay)\n\n return (): void => clearTimeout(timeoutInterval)\n}\n"],"names":["cancelableSetInterval","func","delay","timeoutInterval","cancelableSetTimeout"],"mappings":"gFAAO,MAAMA,EAAwB,CAACC,EAAkBC,EAAQ,MAAoB,CAClF,MAAMC,EAAkB,YAAYF,EAAMC,CAAK,EAE/C,MAAO,IAAY,cAAcC,CAAe,CAClD,EAEaC,EAAuB,CAACH,EAAkBC,EAAQ,MAAoB,CACjF,MAAMC,EAAkB,WAAWF,EAAMC,CAAK,EAE9C,MAAO,IAAY,aAAaC,CAAe,CACjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sources":["../../../../../../src/core/utils/helpers/date.ts"],"sourcesContent":["import dayjs from 'dayjs'\n\nexport const getDate = (): string => new Date().toString()\n\n\nexport const formatDateToTimestamp = (date = new Date()): string => dayjs(date).format('YYYY-MM-DD HH:mm:ss')\n\nexport const DATE_FORMAT = 'MM-DD-YYYY'\nexport const DATE_TIME_FORMAT = 'MM-DD-YYYY HH-mm-ss'\n\nexport const formatDate = (date: string | Date): string => dayjs(date).format(DATE_FORMAT)\nexport const formatDateTime = (date: string | Date): string => dayjs(date).format(DATE_TIME_FORMAT)\n\n"],"names":["getDate","formatDateToTimestamp","date","dayjs","DATE_FORMAT","DATE_TIME_FORMAT","formatDate","formatDateTime"],"mappings":"mJAEaA,EAAU,IAAc,IAAI,KAAA,EAAO,SAAA,EAGnCC,EAAwB,CAACC,EAAO,IAAI,OAAmBC,EAAAA,QAAMD,CAAI,EAAE,OAAO,qBAAqB,EAE/FE,EAAc,aACdC,EAAmB,sBAEnBC,EAAcJ,GAAgCC,EAAAA,QAAMD,CAAI,EAAE,OAAOE,CAAW,EAC5EG,EAAkBL,GAAgCC,EAAAA,QAAMD,CAAI,EAAE,OAAOG,CAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sources":["../../../../../../src/core/utils/helpers/deviceInfo.ts"],"sourcesContent":["export const getDeviceId = async (): Promise<string | null | undefined> => {\n try {\n const devices = await navigator?.mediaDevices?.enumerateDevices?.()\n const device = devices.find((device) => device.kind === 'videoinput')\n\n return device?.deviceId || device?.groupId\n } catch (error: any) {\n return null\n }\n}\n"],"names":["getDeviceId","device","_b","_a"],"mappings":"gFAAO,MAAMA,EAAc,SAAgD,SACzE,GAAI,CAEF,MAAMC,GADU,OAAMC,GAAAC,EAAA,iCAAW,eAAX,YAAAA,EAAyB,mBAAzB,YAAAD,EAAA,KAAAC,KACC,KAAMF,GAAWA,EAAO,OAAS,YAAY,EAEpE,OAAOA,GAAA,YAAAA,EAAQ,YAAYA,GAAA,YAAAA,EAAQ,QACrC,MAAqB,CACnB,OAAO,IACT,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emailMatcher.js","sources":["../../../../../../src/core/utils/helpers/emailMatcher.ts"],"sourcesContent":["export const regexBuilder\n= (domain: string, prefix = '', suffix = ''): RegExp => {\n const normPrefix = prefix.replace('.', '\\\\.')\n const normSuffix = suffix.replace('.', '\\\\.')\n\n if (normPrefix && normSuffix) {\n return new RegExp(\n `^(${normPrefix})+(.+)+(${normSuffix})+@(${domain})$`,\n )\n } if (normPrefix) {\n return new RegExp(\n `^(${normPrefix})+(.+)+@(${domain})$`,\n )\n } if (normSuffix) {\n return new RegExp(\n `^(.+)+(${normSuffix})+@(${domain})$`,\n )\n }\n return new RegExp(\n `^(${domain})$`,\n )\n}\n\nexport const emailMatch = (rgx:RegExp, email:string): boolean => rgx.test(email)\n\n// eslint-disable-next-line default-param-last\nexport const emailMatcher = (domain: string, prefix = '', suffix = '', email:string): boolean => {\n const rgx: RegExp = regexBuilder(domain, prefix, suffix)\n\n return emailMatch(rgx, email)\n}\n\n// const rgx = regexBuilder('gmail.com', 'ext.')\n// const rgx2 = regexBuilder('gmail.com', '', 'ddssds')\n\n// console.log(rgx.test('ddssds@gmail.com'))\n// console.log(rgx.test('extddssds@gmail.com'))\n// console.log(rgx.test('ext.ddssds@gmail.com'))\n\n// console.log(rgx2.test('xddssds@gmail.com'))\n// console.log(rgx2.test('extddssds@gmail.com'))\n// console.log(rgx2.test('ext.ddssds@gmail.com'))\n"],"names":["regexBuilder","domain","prefix","suffix","normPrefix","normSuffix","emailMatch","rgx","email","emailMatcher"],"mappings":"gFAAO,MAAMA,EACX,CAACC,EAAgBC,EAAS,GAAIC,EAAS,KAAe,CACtD,MAAMC,EAAaF,EAAO,QAAQ,IAAK,KAAK,EACtCG,EAAaF,EAAO,QAAQ,IAAK,KAAK,EAE5C,OAAIC,GAAcC,EACT,IAAI,OACT,KAAKD,CAAU,WAAWC,CAAU,OAAOJ,CAAM,IAAA,EAE/CG,EACG,IAAI,OACT,KAAKA,CAAU,YAAYH,CAAM,IAAA,EAE/BI,EACG,IAAI,OACT,UAAUA,CAAU,OAAOJ,CAAM,IAAA,EAG9B,IAAI,OACT,KAAKA,CAAM,IAAA,CAEf,EAEaK,EAAa,CAACC,EAAYC,IAA0BD,EAAI,KAAKC,CAAK,EAGlEC,EAAe,CAACR,EAAgBC,EAAS,GAAIC,EAAS,GAAIK,IAA0B,CAC/F,MAAMD,EAAcP,EAAaC,EAAQC,EAAQC,CAAM,EAEvD,OAAOG,EAAWC,EAAKC,CAAK,CAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sources":["../../../../../../src/core/utils/helpers/file.ts"],"sourcesContent":["export const cleanCsvLines = (data:string): string => {\n if (!data || !data.length) {\n return data\n }\n\n let lineDelimiter = '\\r\\n'\n let lines: string[] = data.split(lineDelimiter)\n\n if (lines.length <= 1) {\n lineDelimiter = '\\n'\n lines = data.split(lineDelimiter)\n }\n\n let linesNum = lines.length\n\n // eslint-disable-next-line no-cond-assign\n // eslint-disable-next-line no-plusplus\n while (linesNum--) {\n if (lines[linesNum].trim() === '' || lines[linesNum].split(';').join('').trim() === '') {\n lines.splice(linesNum, 1)\n }\n }\n return lines.join(lineDelimiter)\n}\n\nexport const formatFilePath = (filePath?: string): string | undefined => filePath?.split('/')?.pop()\n"],"names":["cleanCsvLines","data","lineDelimiter","lines","linesNum","formatFilePath","filePath","_a"],"mappings":"gFAAO,MAAMA,EAAiBC,GAAwB,CACpD,GAAI,CAACA,GAAQ,CAACA,EAAK,OACjB,OAAOA,EAGT,IAAIC,EAAgB;AAAA,EAChBC,EAAkBF,EAAK,MAAMC,CAAa,EAE1CC,EAAM,QAAU,IAClBD,EAAgB;AAAA,EAChBC,EAAQF,EAAK,MAAMC,CAAa,GAGlC,IAAIE,EAAWD,EAAM,OAIrB,KAAOC,MACDD,EAAMC,CAAQ,EAAE,KAAA,IAAW,IAAMD,EAAMC,CAAQ,EAAE,MAAM,GAAG,EAAE,KAAK,EAAE,EAAE,KAAA,IAAW,KAClFD,EAAM,OAAOC,EAAU,CAAC,EAG5B,OAAOD,EAAM,KAAKD,CAAa,CACjC,EAEaG,EAAkBC,GAAA,OAA0C,OAAAC,EAAAD,GAAA,YAAAA,EAAU,MAAM,OAAhB,YAAAC,EAAsB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileValidator.js","sources":["../../../../../../src/core/utils/helpers/fileValidator.ts"],"sourcesContent":["import { fileNameExt } from './textValueOperations'\n\nexport const parseCSVdata = (data: string, columnDelimiter = ';'): {\n firstLine: string\n lines: string[]\n columns: null | string[]\n numColumns: number\n} => {\n let lines: string[] = data.split('\\r\\n')\n\n if (lines.length <= 1) {\n lines = data.split('\\n')\n }\n\n const firstLine: string = lines.shift() as string\n const columns: null | string[] = firstLine ? firstLine.split(columnDelimiter) : null\n const numColumns: number = columns ? columns.length : 0\n\n return {\n firstLine,\n lines,\n columns,\n numColumns,\n }\n}\n\nexport const validateLineNumColumns\n = (lineColumns: Array<string>, numColumns: number, line: string, index: number): ErrorMessage | null => {\n if (lineColumns.length !== numColumns) {\n // errors.push(`Line number of cells is not equal to the number of columns: \"${line}, index: ${index}\"`)\n return {\n message: 'errors.uploadInput.file.line.invalid',\n params: { line, index: index + 1 } } as ErrorMessage\n }\n return null\n }\n\nexport const validateLineCellTrimmed\n = (cell: string, line: string, lineIndex: number, cellIndex: number): ErrorMessage | null => {\n if (cell !== cell.trim()) {\n return {\n message: 'errors.uploadInput.file.cell.invalid',\n params: {\n line, cell, lineIndex, cellIndex,\n },\n } as ErrorMessage\n }\n return null\n }\n\nexport const validateCSVlines = (lines: string[], numColumns: number, columnDelimiter = ';'): ErrorMessage[] => {\n const errors: ErrorMessage[] = []\n // lines without first line of columns (hence the index + 1 in error message)\n let linesNum = lines.length\n\n // eslint-disable-next-line no-cond-assign\n // eslint-disable-next-line no-plusplus\n while (linesNum--) {\n if (lines[linesNum].trim() === '' || lines[linesNum].split(';').join('').trim() === '') {\n lines.splice(linesNum, 1)\n }\n }\n\n let lineColumns = null\n let errorLineNumColumns = null\n let errorLineCellNotTrimmed = null\n\n lines.forEach((line, index) => {\n lineColumns = line.split(columnDelimiter)\n\n errorLineNumColumns = validateLineNumColumns(lineColumns, numColumns, line, index)\n errorLineNumColumns && errors.push(errorLineNumColumns)\n\n lineColumns.forEach((cell, cellIndex) => {\n errorLineCellNotTrimmed = validateLineCellTrimmed(cell, line, index, cellIndex)\n errorLineCellNotTrimmed && errors.push(errorLineCellNotTrimmed)\n })\n })\n\n return errors\n}\n\n/*\n// maybe add aditional mime types\nhttp://fileformats.archiveteam.org/wiki/CSV\n['text/csv','application/csv', 'text/x-csv',\n'application/x-csv', 'text/x-comma-separated-values', 'text/comma-separated-values']\n*/\n\nexport type ErrorMessage = {\n message: string\n params: Record<string, string | number>\n}\n\nexport const validateCSVFile\n= (file: File, callBack: (errors?: (ErrorMessage | string)[] | null) => void, columnDelimiter = ';'): void => {\n if (!file) {\n callBack(['errors.uploadInput.file.empty'])\n return\n }\n if (fileNameExt(file.name) !== 'csv' || !['text/csv', 'text/plain', 'application/vnd.ms-excel'].includes(file.type)) {\n callBack(['errors.uploadInput.file.invalid'])\n return\n }\n const reader = new FileReader()\n\n reader.readAsText(file)\n reader.onloadend = (): void => {\n const data = reader.result ? reader.result.toString() : ''\n\n const { numColumns, lines } = parseCSVdata(data, columnDelimiter)\n\n if (numColumns < 2) {\n callBack(['errors.uploadInput.file.numColumns'])\n return\n }\n\n if (lines?.length < 1) {\n callBack(['errors.uploadInput.file.numLines'])\n return\n }\n\n const errors: (ErrorMessage | string)[] = validateCSVlines(lines, numColumns, columnDelimiter)\n\n const flatErrors: string[] = errors.map((errorMsg: ErrorMessage | string) => (\n (errorMsg as ErrorMessage)?.message ? JSON.stringify(errorMsg) : String(errorMsg)))\n\n const errorsArray: string[] = [...new Set(flatErrors)].map((serialized: string) => JSON.parse(serialized))\n\n // callBack && callBack(errorsArray.length ? errorsArray?.splice?.(0, 6) : null)\n callBack && callBack(errorsArray.length ? errorsArray : null)\n }\n\n reader.onerror = (error): void => {\n console.error(error)\n }\n}\n\nexport const validateSDFFile\n= (file: File, callBack: (errors?: (ErrorMessage | string)[] | null) => void, columnDelimiter = ';'): void => {\n if (!file) {\n callBack(['errors.uploadInput.file.empty'])\n return\n }\n if (fileNameExt(file.name) !== 'sdf') {\n callBack(['errors.uploadInput.file.invalid'])\n return\n }\n const reader = new FileReader()\n\n reader.readAsText(file)\n reader.onloadend = (): void => {\n const data = reader.result ? reader.result.toString() : ''\n\n const { lines } = parseCSVdata(data, columnDelimiter)\n\n if (lines?.length < 1) {\n callBack(['errors.uploadInput.file.numLines'])\n return\n }\n\n callBack && callBack(null)\n }\n\n reader.onerror = (error): void => {\n console.error(error)\n }\n}\n\nexport const validateJSONFile\n= (file: File, callBack: (errors?: (ErrorMessage | string)[] | null) => void, columnDelimiter = ';'): void => {\n if (!file) {\n callBack(['errors.uploadInput.file.empty'])\n return\n }\n if (fileNameExt(file.name) !== 'json') {\n callBack(['errors.uploadInput.file.invalid'])\n return\n }\n const reader = new FileReader()\n\n reader.readAsText(file)\n reader.onloadend = (): void => {\n const data = reader.result ? reader.result.toString() : ''\n\n try {\n const parsed = JSON.parse(data)\n\n JSON.stringify(parsed)\n } catch (error) {\n console.error(error)\n callBack(['errors.uploadInput.file.invalid'])\n return\n }\n\n const { lines } = parseCSVdata(data, columnDelimiter)\n\n if (lines?.length < 1) {\n callBack(['errors.uploadInput.file.numLines'])\n return\n }\n\n callBack && callBack(null)\n }\n\n reader.onerror = (error): void => {\n console.error(error)\n }\n}\n"],"names":["parseCSVdata","data","columnDelimiter","lines","firstLine","columns","numColumns","validateLineNumColumns","lineColumns","line","index","validateLineCellTrimmed","cell","lineIndex","cellIndex","validateCSVlines","errors","linesNum","errorLineNumColumns","errorLineCellNotTrimmed","validateCSVFile","file","callBack","fileNameExt","reader","flatErrors","errorMsg","errorsArray","serialized","error","validateSDFFile","validateJSONFile","parsed"],"mappings":"4HAEaA,EAAe,CAACC,EAAcC,EAAkB,MAKxD,CACH,IAAIC,EAAkBF,EAAK,MAAM;AAAA,CAAM,EAEnCE,EAAM,QAAU,IAClBA,EAAQF,EAAK,MAAM;AAAA,CAAI,G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AO,WAAa,GAElD,CAAE,MAAArB,CAAA,EAAUH,EAAaC,EAAMC,CAAe,EAEpD,IAAIC,GAAA,YAAAA,EAAO,QAAS,EAAG,CACrBmB,EAAS,CAAC,kCAAkC,CAAC,EAC7C,MACF,CAEAA,GAAYA,EAAS,IAAI,CAC3B,EAEAE,EAAO,QAAWK,GAAgB,CAElC,CACF,EAEaE,EACX,CAACV,EAAYC,EAA+DpB,EAAkB,MAAc,CAC5G,GAAI,CAACmB,EAAM,CACTC,EAAS,CAAC,+BAA+B,CAAC,EAC1C,MACF,CACA,GAAIC,cAAYF,EAAK,IAAI,IAAM,OAAQ,CACrCC,EAAS,CAAC,iCAAiC,CAAC,EAC5C,MACF,CACA,MAAME,EAAS,IAAI,WAEnBA,EAAO,WAAWH,CAAI,EACtBG,EAAO,UAAY,IAAY,CAC7B,MAAMvB,EAAOuB,EAAO,OAASA,EAAO,OAAO,WAAa,GAExD,GAAI,CACF,MAAMQ,EAAS,KAAK,MAAM/B,CAAI,EAE9B,KAAK,UAAU+B,CAAM,CACvB,MAAgB,CAEdV,EAAS,CAAC,iCAAiC,CAAC,EAC5C,MACF,CAEA,KAAM,CAAE,MAAAnB,CAAA,EAAUH,EAAaC,EAAMC,CAAe,EAEpD,IAAIC,GAAA,YAAAA,EAAO,QAAS,EAAG,CACrBmB,EAAS,CAAC,kCAAkC,CAAC,EAC7C,MACF,CAEAA,GAAYA,EAAS,IAAI,CAC3B,EAEAE,EAAO,QAAWK,GAAgB,CAElC,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"objectOperations.js","sources":["../../../../../../src/core/utils/helpers/objectOperations.ts"],"sourcesContent":["export const duplicatesInArray = (arr: unknown[]): null | Record<string, number> => {\n const setFromArr = new Set(arr)\n\n if (Array.from(setFromArr).length !== arr.length) {\n const foundDuplicates: Record<string, number> = {}\n const itemsMap: Record<string, number> = {}\n\n arr.forEach((item: unknown) => {\n if (itemsMap[String(item)] !== undefined) {\n foundDuplicates[String(item)] = itemsMap[String(item)] + 1\n itemsMap[String(item)] += 1\n } else {\n itemsMap[String(item)] = 1\n }\n })\n return foundDuplicates\n }\n return null\n}\n\ntype Replacer = ((this: any, key: string, value: any) => any) | undefined\ntype Options = {\n graphQL?: boolean\n [key: string]: any\n}\n\nexport const formatJsonString = (\n value: any,\n replacer?: Replacer | undefined,\n space?: string | number | undefined,\n { graphQL, ...options }: Options = {},\n): string => {\n if (!graphQL) {\n return JSON.stringify(value, replacer, space)\n }\n const strValues: string[] = []\n\n Object.entries(value).forEach(([key, value]) => {\n let str = `${key}: `\n\n if (typeof value === 'object' && !Array.isArray(value)) {\n str += `${formatJsonString(value, replacer, space, { graphQL, ...options })}`\n } else {\n str += JSON.stringify(value)\n }\n strValues.push(str)\n })\n return `{${strValues.join(', ')}}`\n}\n\nconst simpleIdentiy = (value: string | number): string => `${value}`\n\nexport const formatObj = (\n obj: Record<string, string | number>,\n delimiter = ', ',\n mapValue: ((value: string | number) => string) = simpleIdentiy,\n mapKey: ((value: string | number) => string) = simpleIdentiy,\n): string => (typeof obj === 'object'\n ? Object.entries(obj).map(([key, value]) => `${mapKey(key)}: ${mapValue(value)}`).join(delimiter)\n : '')\n\n\nexport const formatObj2 = (\n obj: Record<string, string | number>,\n delimiter = ', ',\n mapValue: ((value: string | number) => string) = simpleIdentiy,\n mapKey: ((value: string | number) => string) = simpleIdentiy,\n): string => {\n if (typeof obj === 'object' && Array.isArray(obj)) {\n return obj\n .map((objValue) => formatObj2(objValue, delimiter, mapValue, mapKey))\n .join(delimiter)\n }\n\n if (typeof obj === 'object') {\n return Object.entries(obj)\n .map(([key, value]) => {\n const mappedKey = mapKey(key)\n const mappedValue = mapValue(typeof value === 'object' ? formatObj2(value) : value)\n\n return `${mappedKey ? `${mappedKey}: ` : ''}${mappedValue}`\n })\n .join(delimiter)\n }\n return ''\n}\n\n\n\n\n\nexport const chunkArray = (dataArray: any[], chunkSize = 100): (any[])[] => {\n const result = []\n\n const len = dataArray.length\n\n for (let i = 0; i < len; i += chunkSize) {\n const chunk = dataArray.slice(i, i + chunkSize)\n\n result.push(chunk)\n }\n return result\n}\n\nexport type TreeNodeStr = (string | TreeNodeStr)[]\n\ntype TreeNode = {\n name: string\n children?: Record<string, TreeNode>\n}\n\n// ['app', ['user', 'dashboard', ['ui', ['header', 'footer', 'menu'], 'realTime']]]\n\nexport const arrayToObjectTree = (itemsInTree: TreeNodeStr[]): Record<string, TreeNode> => {\n let previousParent: TreeNode\n\n const innerMake = (items: TreeNodeStr[]): Record<string, TreeNode> => {\n const treeObject: Record<string, TreeNode> = items.reduce((tree: Record<string, TreeNode>, item, index, array) => {\n let resolvedTree: Record<string, TreeNode> = { ...tree }\n\n if (typeof item === 'string') {\n resolvedTree[item] = { name: item }\n if (!previousParent) {\n previousParent = resolvedTree[item]\n }\n\n if (index === 0 && Array.isArray(array[1])) {\n previousParent = resolvedTree[item]\n }\n }\n if (Array.isArray(item)) {\n let parent = previousParent\n\n if (index > 1) {\n resolvedTree[item[0] as string] = resolvedTree[item[0] as string] || { name: item[0] }\n parent = resolvedTree[item[0] as string]\n\n resolvedTree = { ...resolvedTree, ...innerMake(item as TreeNodeStr[]) }\n } else {\n parent.children = innerMake(item as TreeNodeStr[])\n }\n }\n return resolvedTree\n }, {})\n\n return treeObject\n }\n\n return innerMake(itemsInTree)\n}\n"],"names":["duplicatesInArray","arr","setFromArr","foundDuplicates","itemsMap","item","formatJsonString","value","replacer","space","graphQL","options","strValues","key","str","simpleIdentiy","formatObj","obj","delimiter","mapValue","mapKey","formatObj2","objValue","mappedKey","mappedValue","chunkArray","dataArray","chunkSize","result","len","i","chunk","arrayToObjectTree","itemsInTree","previousParent","innerMake","items","tree","index","array","resolvedTree","parent"],"mappings":"gFAAO,MAAMA,EAAqBC,GAAkD,CAClF,MAAMC,EAAa,IAAI,IAAID,CAAG,EAE9B,GAAI,MAAM,KAAKC,CAAU,EAAE,SAAWD,EAAI,OAAQ,CAChD,MAAME,EAA0C,CAAA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oC,EAAO,SAAWN,EAAU9B,CAAqB,CAErD,CACA,OAAOmC,CACT,EAAG,CAAA,CAAE,EAKP,OAAOL,EAAUF,CAAW,CAC9B"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("ramda"),l=(e,t,n)=>e?t:n,y=c.memoizeWith(c.identity),a=c.memoizeWith((...e)=>JSON.stringify(e)),d=(e=(...t)=>JSON.stringify(t))=>c.memoizeWith(e),p=(e,t=100,n=!1)=>{let o;return function(...i){const s=this,r=()=>{clearTimeout(o),o=null,n||e.apply(s,i)},u=n&&!o;clearTimeout(o),o=setTimeout(r,t),u&&e.apply(s,i)}},z=e=>new Promise(t=>{setTimeout(()=>t(`delayed: ${e}`),e)}),m=(async()=>{}).constructor,T=e=>e.constructor===m.prototype.constructor;exports.AsyncFunctionTemplate=m;exports.debounce=p;exports.delay=z;exports.isFunctionAsync=T;exports.memoize=y;exports.memoizeComplex=a;exports.memoizer=d;exports.nestedTernary=l;
|
|
2
|
-
//# sourceMappingURL=other.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"other.js","sources":["../../../../../../src/core/utils/helpers/other.ts"],"sourcesContent":["import { memoizeWith, identity } from 'ramda'\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const nestedTernary = (condition: boolean, branchA: any, branchB: any): any => (condition ? branchA : branchB)\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const memoize = memoizeWith(identity)\n\n// Beware fellow developer, this is to be used with caution and precison\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nexport const memoizeComplex = memoizeWith((...args) => JSON.stringify(args))\n\nexport const memoizer\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n= (memoizeFunc = (...args): string => JSON.stringify(args)): ReturnType<typeof memoizeWith> => memoizeWith(memoizeFunc)\n\nexport const debounce = (func: () => void, wait = 100, immediate = false): () => void => {\n let timeout: any\n\n return function debounced(...args) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const context: unknown = this\n const later = (): void => {\n clearTimeout(timeout)\n timeout = null\n if (!immediate) {\n func.apply(context, args)\n }\n }\n const callNow = immediate && !timeout\n\n clearTimeout(timeout)\n timeout = setTimeout(later, wait)\n if (callNow) {\n func.apply(context, args)\n }\n }\n}\n\nexport const delay = (delay: number): Promise<string> => new Promise((resolve) => {\n setTimeout(() => resolve(`delayed: ${delay}`), delay)\n})\n\nexport const AsyncFunctionTemplate = (async (): Promise<void> => {}).constructor\n\nexport const isFunctionAsync = (\n func: (...args: any[]) => unknown,\n): boolean => func.constructor === AsyncFunctionTemplate.prototype.constructor\n"],"names":["nestedTernary","condition","branchA","branchB","memoize","memoizeWith","identity","memoizeComplex","args","memoizer","memoizeFunc","debounce","func","wait","immediate","timeout","context","later","callNow","delay","resolve","AsyncFunctionTemplate","isFunctionAsync"],"mappings":"yGAGaA,EAAgB,CAACC,EAAoBC,EAAcC,IAAuBF,EAAYC,EAAUC,EAIhGC,EAAUC,EAAAA,YAAYC,EAAAA,QAAQ,EAK9BC,EAAiBF,EAAAA,YAAY,IAAIG,IAAS,KAAK,UAAUA,CAAI,CAAC,EAE9DC,EAGX,CAACC,EAAc,IAAIF,IAAiB,KAAK,UAAUA,CAAI,IAAsCH,EAAAA,YAAYK,CAAW,EAEzGC,EAAW,CAACC,EAAkBC,EAAO,IAAKC,EAAY,KAAsB,CACvF,IAAIC,EAEJ,OAAO,YAAsBP,EAAM,CAIjC,MAAMQ,EAAmB,KACnBC,EAAQ,IAAY,CACxB,aAAaF,CAAO,EACpBA,EAAU,KACLD,GACHF,EAAK,MAAMI,EAASR,CAAI,CAE5B,EACMU,EAAUJ,GAAa,CAACC,EAE9B,aAAaA,CAAO,EACpBA,EAAU,WAAWE,EAAOJ,CAAI,EAC5BK,GACFN,EAAK,MAAMI,EAASR,CAAI,CAE5B,CACF,EAEaW,EAASA,GAAmC,IAAI,QAASC,GAAY,CAChF,WAAW,IAAMA,EAAQ,YAAYD,CAAK,EAAE,EAAGA,CAAK,CACtD,CAAC,EAEYE,GAAyB,SAA2B,CAAC,GAAG,YAExDC,EACXV,GACYA,EAAK,cAAgBS,EAAsB,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../../../../../../src/core/utils/helpers/text.ts"],"sourcesContent":["import _sanitize from 'sanitize-html'\n\nexport const defaultSanitizeConfig = {\n allowedTags: ['b', 'i', 'em', 'strong', 'a', 'p', 'span', 'li', 'ul', 'div', 'h1', 'h2', 'h3', 'h4', 'img'],\n allowedAttributes: {\n a: ['href', 'target', 'style', 'class', 'onclick'],\n '*': ['href', 'target', 'style', 'align', 'alt', 'center', 'bgcolor', 'style', 'src'],\n },\n}\n\nexport const sanitizeHtml\n = (\n text: string,\n sanitizeConfig?: typeof defaultSanitizeConfig,\n ): ReturnType<typeof _sanitize> => _sanitize(text, sanitizeConfig || defaultSanitizeConfig)\n\nexport const composeId = (text: string): string => text?.toLowerCase?.()?.replace(/\\s+/g, '-')\n"],"names":["defaultSanitizeConfig","sanitizeHtml","text","sanitizeConfig","_sanitize","composeId","_b","_a"],"mappings":"2JAEaA,EAAwB,CACnC,YAAa,CAAC,IAAK,IAAK,KAAM,SAAU,IAAK,IAAK,OAAQ,KAAM,KAAM,MAAO,KAAM,KAAM,KAAM,KAAM,KAAK,EAC1G,kBAAmB,CACjB,EAAG,CAAC,OAAQ,SAAU,QAAS,QAAS,SAAS,EACjD,IAAK,CAAC,OAAQ,SAAU,QAAS,QAAS,MAAO,SAAU,UAAW,QAAS,KAAK,CAAA,CAExF,EAEaC,EACT,CACAC,EACAC,IACiCC,EAAAA,QAAUF,EAAMC,GAAkBH,CAAqB,EAE/EK,EAAaH,YAAyB,OAAAI,GAAAC,EAAAL,GAAA,YAAAA,EAAM,cAAN,YAAAK,EAAA,KAAAL,KAAA,YAAAI,EAAuB,QAAQ,OAAQ"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("ramda"),i=e=>e?a.toLower(e):"",s=e=>e?a.toUpper(e):"",l=e=>e?e.toString().replace(/ /g,""):"",u=e=>e.slice((e.lastIndexOf(".")-1>>>0)+2),t=e=>{var n,o;return(o=(n=e==null?void 0:e.normalize("NFD"))==null?void 0:n.replace)==null?void 0:o.call(n,/[\u0300-\u036f]/g,"")},p=(e,n,o=!0,r=!0)=>!n||!e||!n.trim()||!e.trim()?!1:o&&r?t(n.toLowerCase()).includes(t(e.toLowerCase())):o?n.toLowerCase().includes(e.toLowerCase()):r?t(n).includes(t(e)):n.includes(e),g=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),f=(e,n=0,o="...")=>!n||e.length<=n?e:`${e.substr(0,n)}${o}`,c=e=>e&&t(e==null?void 0:e.toLocaleLowerCase().replaceAll(/\s/g,"-").replaceAll(/["]/g,"")),d=e=>e&&encodeURIComponent(c(e));exports.escapeRegExp=g;exports.fileNameExt=u;exports.findStringInText=p;exports.normalizeString=t;exports.removeWhitespaces=l;exports.sanitizeId=c;exports.sanitizePathId=d;exports.toLowerCase=i;exports.toUpperCase=s;exports.truncateText=f;
|
|
2
|
-
//# sourceMappingURL=textValueOperations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textValueOperations.js","sources":["../../../../../../src/core/utils/helpers/textValueOperations.ts"],"sourcesContent":["import {\n toLower, toUpper,\n} from 'ramda'\n\n// todo memoize\nexport const toLowerCase = (str: string | number): string | number => (str ? toLower(str as string) as string : '')\n\n// todo memoize\nexport const toUpperCase = (str: string): string => (str ? toUpper(str) as string : '')\n\n// todo memoize\nexport const removeWhitespaces = (str: string | number): string | number => (str ? str.toString()\n .replace(/ /g, '') as string : '')\n\n// eslint-disable-next-line no-bitwise\nexport const fileNameExt = (fileName: string): string => fileName.slice((fileName.lastIndexOf('.') - 1 >>> 0) + 2)\n\nexport const normalizeString = (str: string): string => str?.normalize('NFD')?.replace?.(/[\\u0300-\\u036f]/g, '')\n\nexport const findStringInText = (str: string, text: string, ci = true, norm = true): boolean => {\n if (!text || !str || !text.trim() || !str.trim()) {\n return false\n }\n\n if (ci && norm) {\n return normalizeString(text.toLowerCase()).includes(normalizeString(str.toLowerCase()))\n }\n\n if (ci) {\n return text.toLowerCase().includes(str.toLowerCase())\n }\n\n if (norm) {\n return normalizeString(text).includes(normalizeString(str))\n }\n\n return text.includes(str)\n}\n\n// eslint-disable-next-line no-useless-escape\nexport const escapeRegExp = (str: string): string => str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&')\n\nexport const truncateText = (text: string, maxNumChars = 0, indicator = '...'): string => {\n if (!maxNumChars || text.length <= maxNumChars) {\n return text\n }\n return `${text.substr(0, maxNumChars)}${indicator}`\n}\n\nexport const sanitizeId\n = (id: string): string => id && normalizeString(id?.toLocaleLowerCase().replaceAll(/\\s/g, '-').replaceAll(/[\"]/g, ''))\n\nexport const sanitizePathId\n = (id: string): string => id && encodeURIComponent(sanitizeId(id))\n"],"names":["toLowerCase","str","toLower","toUpperCase","toUpper","removeWhitespaces","fileNameExt","fileName","normalizeString","_b","_a","findStringInText","text","ci","norm","escapeRegExp","truncateText","maxNumChars","indicator","sanitizeId","id","sanitizePathId"],"mappings":"yGAKaA,EAAeC,GAA2CA,EAAMC,EAAAA,QAAQD,CAAa,EAAc,GAGnGE,EAAeF,GAAyBA,EAAMG,EAAAA,QAAQH,CAAG,EAAc,GAGvEI,EAAqBJ,GAA2CA,EAAMA,EAAI,WACpF,QAAQ,KAAM,EAAE,EAAc,GAGpBK,EAAeC,GAA6BA,EAAS,OAAOA,EAAS,YAAY,GAAG,EAAI,IAAM,GAAK,CAAC,EAEpGC,EAAmBP,GAAA,SAAwB,OAAAQ,GAAAC,EAAAT,GAAA,YAAAA,EAAK,UAAU,SAAf,YAAAS,EAAuB,UAAvB,YAAAD,EAAA,KAAAC,EAAiC,mBAAoB,KAEhGC,EAAmB,CAACV,EAAaW,EAAcC,EAAK,GAAMC,EAAO,KACxE,CAACF,GAAQ,CAACX,GAAO,CAACW,EAAK,QAAU,CAACX,EAAI,OACjC,GAGLY,GAAMC,EACDN,EAAgBI,EAAK,aAAa,EAAE,SAASJ,EAAgBP,EAAI,YAAA,CAAa,CAAC,EAGpFY,EACKD,EAAK,YAAA,EAAc,SAASX,EAAI,aAAa,EAGlDa,EACKN,EAAgBI,CAAI,EAAE,SAASJ,EAAgBP,CAAG,CAAC,EAGrDW,EAAK,SAASX,CAAG,EAIbc,EAAgBd,GAAwBA,EAAI,QAAQ,sCAAuC,MAAM,EAEjGe,EAAe,CAACJ,EAAcK,EAAc,EAAGC,EAAY,QAClE,CAACD,GAAeL,EAAK,QAAUK,EAC1BL,EAEF,GAAGA,EAAK,OAAO,EAAGK,CAAW,CAAC,GAAGC,CAAS,GAGtCC,EACRC,GAAuBA,GAAMZ,EAAgBY,GAAA,YAAAA,EAAI,oBAAoB,WAAW,MAAO,KAAK,WAAW,OAAQ,GAAG,EAE1GC,EACRD,GAAuBA,GAAM,mBAAmBD,EAAWC,CAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sources":["../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nconst THEME_PROP = '__eskit_themes__'\n\nconst defaultThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Reads the theme config stored on the given element.\n * Falls back to defaultThemes when no config has been set.\n * Scoping to the element means different microfrontends (different roots) are isolated,\n * while all bundles targeting the same element share one config.\n * @param {HTMLElement} [element] - The element to read from. Defaults to document.body.\n * @returns {ThemeMap} The current base themes for the element.\n */\nexport const getBaseThemes = (element?: HTMLElement): ThemeMap => {\n const el = element ?? document.body\n\n return (el as unknown as Record<string, unknown>)[THEME_PROP] as ThemeMap ?? defaultThemes\n}\n\n/**\n * Sets the base theme class names on the given element.\n * @param {ThemeMap} themes - CSS classes for dark and light themes.\n * @param {HTMLElement} [element] - The element to store config on. Defaults to document.body.\n */\nexport const setThemeClassNames = (themes: ThemeMap, element?: HTMLElement): void => {\n const el = element ?? document.body\n const store = el as unknown as Record<string, unknown>\n\n store[THEME_PROP] = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (\n isDark: boolean, htmlElement?: HTMLElement, findShadows = true,\n): void => {\n const themes = getBaseThemes(htmlElement)\n const oldClass = isDark ? themes.light : themes.dark\n const newClass = isDark ? themes.dark : themes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n const el = htmlElement || document.body\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(getBaseThemes(el).dark)\n }\n switchColorTheme(resolvedIsDark, el)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["mapSerReplacer","key","value","classNames","classes","className","parseProps","props","dataProps","restProps","generateId","token","increment","forcedValue","_a","noValue","_b","_c","anchorClick","href","target","remove","aElement","noop","event","THEME_PROP","defaultThemes","getBaseThemes","element","setThemeClassNames","themes","store","switchColorTheme","isDark","htmlElement","findShadows","oldClass","newClass","_d","firstChild","_e","updateColorTheme","el","resolvedIsDark","windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","changeLightColorThemeHandler"],"mappings":"gFAAO,MAAMA,EACX,CAACC,EAAaC,IACVA,aAAiB,IACZ,CACL,SAAU,MACV,MAAO,MAAM,KAAKA,EAAM,SAAS,CAAA,EAG9BA,EAIIC,EAAa,IAAIC,IAAkCA,EAC7D,OAAQC,GAA2B,OAAOA,GAAc,UAAYA,IAAc,QAAaA,IAAc,IAAK,EACl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AAA,EAAQ,OAAO,EACvC,OAAO,WAAW,8BAA8B,EAAE,iBAChDW,EAAiCK,CAAA,EAEnC,OAAO,WAAW,+BAA+B,EAAE,iBACjDL,EAAiCM,CAAA,EAG5B,IAAM,CACX,OAAO,WAAW,8BAA8B,EAAE,oBAChDN,EAAiCK,CAAA,EAEnC,OAAO,WAAW,+BAA+B,EAAE,oBACjDL,EAAiCM,CAAA,CAErC,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valueOperations.js","sources":["../../../../../../src/core/utils/helpers/valueOperations.ts"],"sourcesContent":["export type Limit = {\n min?: number\n max?: number\n};\n\nexport const numberDefined = (value?: number | undefined | null): boolean => value !== undefined && value !== null\n\nexport const restrictNumberInLimits = (value: number, limit?: Limit): number => Math.max(\n Math.min(value, numberDefined(limit?.max) ? (limit?.max as number) : Infinity),\n numberDefined(limit?.min) ? (limit?.min as number) : -Infinity,\n)\n\nexport enum Operation {\n ADD = 'add',\n SUBTRACT = 'subtract',\n MULTIPLY = 'multiply',\n DIVIDE = 'divide',\n}\n\nexport const numberOperation = (\n value: number,\n operand: number,\n operation: Operation,\n limit?: Limit,\n): number => {\n let result = 0\n\n switch (operation) {\n case Operation.ADD: {\n result = value + operand\n break\n }\n case Operation.SUBTRACT: {\n result = value - operand\n break\n }\n case Operation.MULTIPLY: {\n result = value * operand\n break\n }\n case Operation.DIVIDE: {\n result = operand === 0 ? 0 : value / operand\n break\n }\n default:\n value\n }\n\n return restrictNumberInLimits(result, limit)\n}\n\nexport const incerementValue\n // eslint-disable-next-line default-param-last\n = (value: number, inc = 1, limit?: Limit): number => numberOperation(value, inc, Operation.ADD, limit)\n\nexport const decrementValue\n // eslint-disable-next-line default-param-last\n = (value: number, inc = 1, limit?: Limit): number => numberOperation(value, inc, Operation.SUBTRACT, limit)\n\nexport const setValue = (\n value: number | string | Record<string, unknown> | any,\n limit?: Limit,\n): any => (typeof value === 'number' && limit ? restrictNumberInLimits(value, limit) : value)\n"],"names":["numberDefined","value","restrictNumberInLimits","limit","Operation","numberOperation","operand","operation","result","incerementValue","inc","decrementValue","setValue"],"mappings":"gFAKO,MAAMA,EAAiBC,GAAsEA,GAAU,KAEjGC,EAAyB,CAACD,EAAeE,IAA0B,KAAK,IACnF,KAAK,IAAIF,EAAOD,EAAcG,GAAA,YAAAA,EAAO,GAAG,EAAKA,GAAA,YAAAA,EAAO,IAAiB,GAAQ,EAC7EH,EAAcG,GAAA,YAAAA,EAAO,GAAG,EAAKA,GAAA,YAAAA,EAAO,IAAiB,IACvD,EAEO,IAAKC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,OAAS,SAJCA,IAAAA,GAAA,CAAA,CAAA,EAOL,MAAMC,EAAkB,CAC7BJ,EACAK,EACAC,EACAJ,IACW,CACX,IAAIK,EAAS,EAEb,OAAQD,EAAA,CACN,IAAK,MAAe,CAClBC,EAASP,EAAQK,EACjB,KACF,CACA,IAAK,WAAoB,CACvBE,EAASP,EAAQK,EACjB,KACF,CACA,IAAK,WAAoB,CACvBE,EAASP,EAAQK,EACjB,KACF,CACA,IAAK,SAAkB,CACrBE,EAASF,IAAY,EAAI,EAAIL,EAAQK,EACrC,KACF,CAEE,CAGJ,OAAOJ,EAAuBM,EAAQL,CAAK,CAC7C,EAEaM,EAET,CAACR,EAAeS,EAAM,EAAGP,IAA0BE,EAAgBJ,EAAOS,EAAK,MAAeP,CAAK,EAE1FQ,EAET,CAACV,EAAeS,EAAM,EAAGP,IAA0BE,EAAgBJ,EAAOS,EAAK,WAAoBP,CAAK,EAE/FS,EAAW,CACtBX,EACAE,IACS,OAAOF,GAAU,UAAYE,EAAQD,EAAuBD,EAAOE,CAAK,EAAIF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./keyExtractor.js"),c=require("./date.js"),v=require("./appState/peregrineMQ/index.js"),p=require("./array.js"),a=require("./helpers/other.js"),n=require("./helpers/date.js"),M=require("./appState/peregrineMQ/peregrineMQ.types.js"),r=require("./helpers/valueOperations.js"),g=require("./appState/peregrineMQ/peregrineMQ.js"),o=require("./appState/stateMachine/tiny-state-machine.base.js"),e=require("./helpers/ui.js"),s=require("./helpers/objectOperations.js"),m=require("./appState/store/store.vanillajs.js"),h=require("./helpers/cancelableDelayedFunction.js"),u=require("./webComponents/webComponent.utils.js"),y=require("./helpers/file.js"),d=require("./helpers/text.js"),b=require("./appState/store/store.vanillajs.templates.js"),T=require("./helpers/emailMatcher.js"),t=require("./helpers/textValueOperations.js"),C=require("./helpers/deviceInfo.js"),l=require("./helpers/birthnumberCZSKvalidator.js"),f=require("./helpers/birthnumber.validator.js"),i=require("./helpers/fileValidator.js");exports.keyExtractor=S.keyExtractor;exports.keyExtractorFunction=S.keyExtractorFunction;exports.dateRangeFormat=c.dateRangeFormat;exports.getDateTime=c.getDateTime;exports.getTimeFromNow=c.getTimeFromNow;exports.getTimeFromNowOriginal=c.getTimeFromNowOriginal;exports.getTimeTo=c.getTimeTo;exports.peregrineMQInstance=v.peregrineMQInstance;exports.ArrayFirst=p.ArrayFirst;exports.ArrayLast=p.ArrayLast;exports.AsyncFunctionTemplate=a.AsyncFunctionTemplate;exports.debounce=a.debounce;exports.delay=a.delay;exports.isFunctionAsync=a.isFunctionAsync;exports.memoize=a.memoize;exports.memoizeComplex=a.memoizeComplex;exports.memoizer=a.memoizer;exports.nestedTernary=a.nestedTernary;exports.DATE_FORMAT=n.DATE_FORMAT;exports.DATE_TIME_FORMAT=n.DATE_TIME_FORMAT;exports.formatDate=n.formatDate;exports.formatDateTime=n.formatDateTime;exports.formatDateToTimestamp=n.formatDateToTimestamp;exports.getDate=n.getDate;exports.NON_EXISTENT_CHANNEL=M.NON_EXISTENT_CHANNEL;exports.Operation=r.Operation;exports.decrementValue=r.decrementValue;exports.incerementValue=r.incerementValue;exports.numberDefined=r.numberDefined;exports.numberOperation=r.numberOperation;exports.restrictNumberInLimits=r.restrictNumberInLimits;exports.setValue=r.setValue;exports.PeregrineMQ=g.PeregrineMQ;exports.PeregrineMQClearError=g.PeregrineMQClearError;exports.TinyStateMachine=o.TinyStateMachine;exports.TinyStateMachineEvent=o.TinyStateMachineEvent;exports.TinyStateMachineEventType=o.TinyStateMachineEventType;exports.TinyStateMachineState=o.TinyStateMachineState;exports.createStates=o.createStates;exports.stateIterator=o.stateIterator;exports.anchorClick=e.anchorClick;exports.classNames=e.classNames;exports.generateId=e.generateId;exports.getBaseThemes=e.getBaseThemes;exports.mapSerReplacer=e.mapSerReplacer;exports.noop=e.noop;exports.observeThemePreference=e.observeThemePreference;exports.parseProps=e.parseProps;exports.setThemeClassNames=e.setThemeClassNames;exports.switchColorTheme=e.switchColorTheme;exports.updateColorTheme=e.updateColorTheme;exports.arrayToObjectTree=s.arrayToObjectTree;exports.chunkArray=s.chunkArray;exports.duplicatesInArray=s.duplicatesInArray;exports.formatJsonString=s.formatJsonString;exports.formatObj=s.formatObj;exports.formatObj2=s.formatObj2;exports.canSetStateMerge=m.canSetStateMerge;exports.createStore=m.createStore;exports.getSetStateMerge=m.getSetStateMerge;exports.shallowEqual=m.shallowEqual;exports.cancelableSetInterval=h.cancelableSetInterval;exports.cancelableSetTimeout=h.cancelableSetTimeout;exports.ced=u.ced;exports.createResolveAttribute=u.createResolveAttribute;exports.customElementDefine=u.customElementDefine;exports.resolveAttributes=u.resolveAttributes;exports.cleanCsvLines=y.cleanCsvLines;exports.formatFilePath=y.formatFilePath;exports.composeId=d.composeId;exports.defaultSanitizeConfig=d.defaultSanitizeConfig;exports.sanitizeHtml=d.sanitizeHtml;exports.createDataStore=b.createDataStore;exports.emailMatch=T.emailMatch;exports.emailMatcher=T.emailMatcher;exports.regexBuilder=T.regexBuilder;exports.escapeRegExp=t.escapeRegExp;exports.fileNameExt=t.fileNameExt;exports.findStringInText=t.findStringInText;exports.normalizeString=t.normalizeString;exports.removeWhitespaces=t.removeWhitespaces;exports.sanitizeId=t.sanitizeId;exports.sanitizePathId=t.sanitizePathId;exports.toLowerCase=t.toLowerCase;exports.toUpperCase=t.toUpperCase;exports.truncateText=t.truncateText;exports.getDeviceId=C.getDeviceId;exports.getMatch=l.getMatch;exports.isValidFormat=l.isValidFormat;exports.isValidModulo11=l.isValidModulo11;exports.parse=l.parse;exports.regex=l.regex;exports.isBirthNumberValid=f.isBirthNumberValid;exports.parseCSVdata=i.parseCSVdata;exports.validateCSVFile=i.validateCSVFile;exports.validateCSVlines=i.validateCSVlines;exports.validateJSONFile=i.validateJSONFile;exports.validateLineCellTrimmed=i.validateLineCellTrimmed;exports.validateLineNumColumns=i.validateLineNumColumns;exports.validateSDFFile=i.validateSDFFile;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyExtractor.js","sources":["../../../../../src/core/utils/keyExtractor.ts"],"sourcesContent":["import { memoizeComplex } from './helpers/other'\n\ntype ItemLikeObject = {\n key?: string\n id?: string | number\n}\n\nexport function keyExtractorFunction<Item extends ItemLikeObject>(item: Item, index: number): string {\n return String(item?.key ?? item?.id ?? index)\n}\n\nexport const keyExtractor = memoizeComplex(keyExtractorFunction)\n"],"names":["keyExtractorFunction","item","index","keyExtractor","memoizeComplex"],"mappings":"sHAOO,SAASA,EAAkDC,EAAYC,EAAuB,CACnG,OAAO,QAAOD,GAAA,YAAAA,EAAM,OAAOA,GAAA,YAAAA,EAAM,KAAMC,CAAK,CAC9C,CAEO,MAAMC,EAAeC,EAAAA,eAAeJ,CAAoB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webComponent.utils.js","sources":["../../../../../../src/core/utils/webComponents/webComponent.utils.ts"],"sourcesContent":["/* custom elements define */\nexport const ced = (name: string): (componentClass: typeof HTMLElement) => void => (\n componentClass: typeof HTMLElement,\n) => {\n customElements.get(name) || customElements.define(name, componentClass)\n}\n\nexport const customElementDefine = ced\n\n\n\nexport const createResolveAttribute = (\n component: Element & Record<string, any>,\n) => (\n attributeName: string,\n // eslint-disable-next-line default-param-last\n overrideProperty = true,\n valueMap?: (value: unknown) => unknown,\n): boolean => {\n const attrValue = component.getAttribute(attributeName)\n const attrValueDefined = attrValue !== undefined\n\n if (overrideProperty && attrValueDefined && component[attributeName] === undefined) {\n // eslint-disable-next-line no-param-reassign\n component[attributeName] = valueMap ? valueMap(attrValue) : attrValue\n }\n\n return attrValueDefined\n}\n\nexport const resolveAttributes = (\n component: Element & Record<string, any>,\n attributes: ({ name: string; override: boolean; valueMap?: (value: unknown) => unknown } | string)[],\n): void => {\n const resolver = createResolveAttribute(component)\n\n attributes.forEach((attribute) => {\n if (typeof attribute === 'string') {\n resolver(attribute)\n } else {\n const { name, override, valueMap } = attribute\n\n resolver(name, override, valueMap)\n }\n })\n}\n"],"names":["ced","name","componentClass","customElementDefine","createResolveAttribute","component","attributeName","overrideProperty","valueMap","attrValue","attrValueDefined","resolveAttributes","attributes","resolver","attribute","override"],"mappings":"gFACO,MAAMA,EAAOC,GAClBC,GACG,CACH,eAAe,IAAID,CAAI,GAAK,eAAe,OAAOA,EAAMC,CAAc,CACxE,EAEaC,EAAsBH,EAItBI,EACXC,GACG,CACHC,EAEAC,EAAmB,GACnBC,IACY,CACZ,MAAMC,EAAYJ,EAAU,aAAaC,CAAa,EAChDI,EAAmBD,IAAc,OAEvC,OAAIF,GAAoBG,GAAoBL,EAAUC,CAAa,IAAM,SAEvED,EAAUC,CAAa,EAAIE,EAAWA,EAASC,CAAS,EAAIA,GAGvDC,CACT,EAEaC,EAAoB,CAC/BN,EACAO,IACS,CACT,MAAMC,EAAWT,EAAuBC,CAAS,EAEjDO,EAAW,QAASE,GAAc,CAChC,GAAI,OAAOA,GAAc,SACvBD,EAASC,CAAS,MACb,CACL,KAAM,CAAE,KAAAb,EAAM,SAAAc,EAAU,SAAAP,CAAA,EAAaM,EAErCD,EAASZ,EAAMc,EAAUP,CAAQ,CACnC,CACF,CAAC,CACH"}
|
|
File without changes
|
/package/dist/utils/{src/core/utils/appState → appState}/stateMachine/tiny-state-machine.base.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/utils/esm/{src/core/utils/appState → appState}/peregrineMQ/peregrineMQ.types.js
RENAMED
|
File without changes
|
/package/dist/utils/esm/{src/core/utils/appState → appState}/stateMachine/tiny-state-machine.base.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/utils/esm/{src/core/utils/appState → appState}/store/store.vanillajs.templates.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/utils/esm/{src/core/utils/webComponents → webComponents}/webComponent.utils.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|