{"version":3,"sources":["jsdelivr-header.js","/npm/cordova-plugin-notificare-inbox@4.2.4/src/js/events.ts","/npm/cordova-plugin-notificare-inbox@4.2.4/src/js/notificare-inbox.ts","/npm/cordova-plugin-notificare-inbox@4.2.4/src/js/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;66CCNA,IAAM,oBAA2C,G,SAEjC,YACd,SAAS,iBACP,eACA,WACE,QAAQ,MAEN,SAAmB,GACjB,oBAAoB,QAAO,SAAC,GAAQ,OAAA,EAAI,QAAU,EAAM,IAAI,IAAE,SAAQ,SAAC,GAAQ,OAAA,EAAI,SAAS,EAAM,KAAnB,GACjF,IACA,SAAmB,GACjB,QAAQ,MAAM,qCAAsC,EACtD,GACA,kBACA,mBACA,G,IAGJ,EAEJ,CAEA,IAAA,kBAAA,WAEE,SAAqB,EAAA,EAAwB,GAAxB,KAAK,MAAL,EAAwB,KAAQ,SAAR,EAC3C,oBAAoB,KAAK,K,CAS7B,OANE,EAAA,UAAA,OAAA,WACE,IAAM,EAAQ,oBAAoB,QAAQ,MACtC,GAAS,GACX,oBAAoB,OAAO,EAAO,E,EAGvC,CAAD,CAZA,GCnBA,gBAAA,oBAAA,I,CAgIA,OA3HsB,EAAA,SAApB,W,qFACE,SAAO,IAAI,SAA+B,SAAC,EAAS,GAClD,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,WAAY,GAC/D,I,MACD,EAMmB,EAAA,SAApB,W,qFACE,SAAO,IAAI,SAAgB,SAAC,EAAS,GACnC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,WAAY,GAC/D,I,MACD,EASmB,EAAA,QAApB,W,qFACE,SAAO,IAAI,SAAc,SAAC,EAAS,GACjC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,UAAW,GAC9D,I,MACD,EAUmB,EAAI,KAAxB,SAAyB,G,qFACvB,SAAO,IAAI,SAAgC,SAAC,EAAS,GACnD,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,OAAQ,CAAC,GAC5D,I,MACD,EAUmB,EAAU,WAA9B,SAA+B,G,qFAC7B,SAAO,IAAI,SAAc,SAAC,EAAS,GACjC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,aAAc,CAAC,GAClE,I,MACD,EAQmB,EAAA,cAApB,W,qFACE,SAAO,IAAI,SAAc,SAAC,EAAS,GACjC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,gBAAiB,GACpE,I,MACD,EASmB,EAAM,OAA1B,SAA2B,G,qFACzB,SAAO,IAAI,SAAc,SAAC,EAAS,GACjC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,SAAU,CAAC,GAC9D,I,MACD,EAQmB,EAAA,MAApB,W,qFACE,SAAO,IAAI,SAAc,SAAC,EAAS,GACjC,QAAQ,KAAK,EAAS,EAAQ,kBAAmB,QAAS,GAC5D,I,MACD,EAaa,EAAc,eAA5B,SAA6B,GAC3B,OAAO,IAAI,kBAAkB,gBAAiB,E,EAYlC,EAAc,eAA5B,SAA6B,GAC3B,OAAO,IAAI,kBAAkB,gBAAiB,E,EAIjD,CAAD,CAhIA,GCGA,Y","file":"/npm/cordova-plugin-notificare-inbox@4.2.4/build/notificare-inbox.bundle.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/cordova-plugin-notificare-inbox@4.2.4/build/notificare-inbox.bundle.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const EVENT_SUBSCRIPTIONS: EventSubscription[] = [];\n\nexport function bootstrap(): void {\n  document.addEventListener(\n    'deviceready',\n    function onDeviceReady() {\n      cordova.exec(\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        function onSuccess(event: any) {\n          EVENT_SUBSCRIPTIONS.filter((sub) => sub.event === event.name).forEach((sub) => sub.callback(event.data));\n        },\n        function onFailure(error) {\n          console.error('Failed to register event listener.', error);\n        },\n        'NotificareInbox',\n        'registerListener',\n        []\n      );\n    },\n    false\n  );\n}\n\nexport class EventSubscription {\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  constructor(readonly event: string, readonly callback: (data: any) => void) {\n    EVENT_SUBSCRIPTIONS.push(this);\n  }\n\n  remove(): void {\n    const index = EVENT_SUBSCRIPTIONS.indexOf(this);\n    if (index >= 0) {\n      EVENT_SUBSCRIPTIONS.splice(index, 1);\n    }\n  }\n}\n","import { NotificareNotification } from 'cordova-plugin-notificare';\nimport { EventSubscription } from './events';\nimport { NotificareInboxItem } from './models/notificare-inbox-item';\n\nexport class NotificareInbox {\n  /**\n   * @returns {Promise<NotificareInboxItem[]>} - A promise that resolves to a\n   * list of all {@link NotificareInboxItem}, sorted by the timestamp.\n   */\n  public static async getItems(): Promise<NotificareInboxItem[]> {\n    return new Promise<NotificareInboxItem[]>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'getItems', []);\n    });\n  }\n\n  /**\n   * @returns {Promise<number>} - A promise that resolves to the current badge\n   * count, representing the number of unread inbox items.\n   */\n  public static async getBadge(): Promise<number> {\n    return new Promise<number>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'getBadge', []);\n    });\n  }\n\n  /**\n   * Refreshes the inbox data, ensuring the items and badge count reflect the\n   * latest server state.\n   *\n   * @returns {Promise<void>} - A promise that resolves when the inbox data has\n   * been successfully refreshed.\n   */\n  public static async refresh(): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'refresh', []);\n    });\n  }\n\n  /**\n   * Opens a specified inbox item, marking it as read and returning the\n   * associated notification.\n   *\n   * @param {NotificareInboxItem} item - The {@link NotificareInboxItem} to open.\n   * @return {Promise<NotificareNotification>} - The {@link NotificareNotification}\n   * associated with the inbox item.\n   */\n  public static async open(item: NotificareInboxItem): Promise<NotificareNotification> {\n    return new Promise<NotificareNotification>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'open', [item]);\n    });\n  }\n\n  /**\n   * Marks the specified inbox item as read.\n   *\n   * @param {NotificareInboxItem} item - The {@link NotificareInboxItem} to mark\n   * as read.\n   * @returns {Promise<void>} - A promise that resolves when the inbox item has\n   * been successfully marked as read.\n   */\n  public static async markAsRead(item: NotificareInboxItem): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'markAsRead', [item]);\n    });\n  }\n\n  /**\n   * Marks all inbox items as read.\n   *\n   * @returns {Promise<void>} - A promise that resolves when all inbox items\n   * have been successfully marked as read.\n   */\n  public static async markAllAsRead(): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'markAllAsRead', []);\n    });\n  }\n\n  /**\n   * Permanently removes the specified inbox item from the inbox.\n   *\n   * @param {NotificareInboxItem} item - The {@link NotificareInboxItem} to remove.\n   * @returns {Promise<void>} - A promise that resolves when the inbox item has\n   * been successfully removed.\n   */\n  public static async remove(item: NotificareInboxItem): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'remove', [item]);\n    });\n  }\n\n  /**\n   * Clears all inbox items, permanently deleting them from the inbox.\n   *\n   * @returns {Promise<void>} - A promise that resolves when all inbox items\n   * have been successfully cleared.\n   */\n  public static async clear(): Promise<void> {\n    return new Promise<void>((resolve, reject) => {\n      cordova.exec(resolve, reject, 'NotificareInbox', 'clear', []);\n    });\n  }\n\n  // region Events\n\n  /**\n   * Called when the inbox is successfully updated.\n   *\n   * @param callback - A callback that will be invoked with the result of the\n   * onInboxUpdated event. It will provide an updated list of\n   * {@link NotificareInboxItem}.\n   * @returns {EventSubscription} - The {@link EventSubscription} for the onInboxUpdated\n   * event.\n   */\n  public static onInboxUpdated(callback: (items: NotificareInboxItem[]) => void): EventSubscription {\n    return new EventSubscription('inbox_updated', callback);\n  }\n\n  /**\n   * Called when the unread message count badge is updated.\n   *\n   * @param callback - A callback that will be invoked with the\n   * result of the onBadgeUpdated event. It will provide an updated badge count,\n   * representing current the number of unread inbox items.\n   * @returns {EventSubscription} - The {@link EventSubscription} for the onBadgeUpdated\n   * event.\n   */\n  public static onBadgeUpdated(callback: (badge: number) => void): EventSubscription {\n    return new EventSubscription('badge_updated', callback);\n  }\n\n  // endregion\n}\n","import { NotificareInbox } from './notificare-inbox';\nimport { bootstrap } from './events';\n\nexport * from './models/notificare-inbox-item';\n\nexport default NotificareInbox;\n\nbootstrap();\n"]}