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BAAiB,QAAS,GAC5B,EAAE,iBAAiB,QAAS,GAC5B,EAAE,iBAAiB,QAAS,GAC5B,EAAE,iBAAiB,OAAQ,GACpB,CACT,EAEJ,CAEA,OAAO,QAAU","file":"/npm/react-desktop-notify@1.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-desktop-notify@1.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","function Notify() {\r\n  let body = \"\"; // Required\r\n  let title = \"\"; //  Required\r\n  let badge = \"\";\r\n  let icon = \"\";\r\n  let image = \"\";\r\n  let vibrate = \"\";\r\n\r\n  let renotify = false;\r\n  let dir = \"auto\";\r\n  let requireInteraction = false;\r\n  let silent = false;\r\n\r\n  /**\r\n   * ===========Read Only Properties=================\r\n   */\r\n\r\n  this.setVibratePattern = pattern => {\r\n    if (!pattern)\r\n      throw new Error(\"Vibrate pattern of notification cannot be empty\");\r\n\r\n    if (!pattern.length)\r\n      throw new Error(\"Vibration pattern must be array type\");\r\n    vibrate = pattern;\r\n\r\n    pattern.forEach(item => {\r\n      if (typeof item !== \"number\")\r\n        throw new Error(\"Vibration pattern must be array Of Numbers\");\r\n    });\r\n\r\n    vibrate = pattern;\r\n\r\n    return this;\r\n  };\r\n\r\n  this.setSilent = (status = false) => {\r\n    if (typeof status !== \"boolean\")\r\n      throw new Error(\"Silent status must be boolean type\");\r\n    silent = status;\r\n    return this;\r\n  };\r\n\r\n  this.setFixed = (status = true) => {\r\n    if (typeof status !== \"boolean\")\r\n      throw new Error(\"AutoClose status must be boolean type\");\r\n    requireInteraction = status;\r\n    return this;\r\n  };\r\n\r\n  this.setImage = (imageUrl = \"\") => {\r\n    if (!imageUrl) throw new Error(\"Image of notification cannot be empty\");\r\n    if (typeof imageUrl !== \"string\")\r\n      throw new Error(\"Image Url must be string type\");\r\n\r\n    image = imageUrl;\r\n    return this;\r\n  };\r\n\r\n  this.setRenotify = (status = true) => {\r\n    if (typeof status !== \"boolean\")\r\n      throw new Error(\"Renotify status must be boolean type\");\r\n    renotify = status;\r\n    return this;\r\n  };\r\n\r\n  this.setIcon = (imageUrl = \"\") => {\r\n    if (!imageUrl) throw new Error(\"Icon of notification cannot be empty\");\r\n    if (typeof imageUrl !== \"string\")\r\n      throw new Error(\"Icon image Url must be string type\");\r\n    icon = imageUrl;\r\n    return this;\r\n  };\r\n\r\n  this.setTextDirection = (direction = \"\") => {\r\n    if (!direction) throw new Error(\"Text direction cannot be empty\");\r\n\r\n    if (typeof direction !== \"string\")\r\n      throw new Error(\"Text direction must be string type\");\r\n\r\n    if (direction === \"ltr\" || direction === \"rtl\") dir = direction;\r\n    else throw new Error('Text direction must be one of type [ \"ltr\", \"rtl\" ]');\r\n\r\n    return this;\r\n  };\r\n\r\n  this.setBadge = (imageUrl = \"\") => {\r\n    if (!imageUrl) throw new Error(\"Badge of notification cannot be empty\");\r\n    if (typeof imageUrl !== \"string\")\r\n      throw new Error(\"Badge image Url must be string type\");\r\n    badge = imageUrl;\r\n    return this;\r\n  };\r\n\r\n  this.setTitle = (text = \"\") => {\r\n    if (!text) throw new Error(\"Title of notification cannot be empty\");\r\n    if (typeof text !== \"string\") throw new Error(\"Title must be string type\");\r\n\r\n    title = text;\r\n    return this;\r\n  };\r\n\r\n  this.setText = (text = \"\") => {\r\n    if (!text) throw new Error(\"Body of notification cannot be empty\");\r\n    if (typeof text !== \"string\") throw new Error(\"Body must be string type\");\r\n\r\n    body = text;\r\n    return this;\r\n  };\r\n\r\n  /**\r\n   * ========= Event Handlers================\r\n   */\r\n\r\n  let onClickFunc = () => {};\r\n  let onCloseFunc = () => {};\r\n  let onErrorFunc = () => {};\r\n  let onShowFunc = () => {};\r\n\r\n  this.setOnClick = (callback = \"\") => {\r\n    if (typeof callback !== \"function\")\r\n      throw new Error(\"OnCLick must be  type Function\");\r\n\r\n    onClickFunc = callback;\r\n    return this;\r\n  };\r\n\r\n  this.setOnError = (callback = \"\") => {\r\n    if (typeof callback !== \"function\")\r\n      throw new Error(\"OnError must be  type Function\");\r\n\r\n    onErrorFunc = callback;\r\n    return this;\r\n  };\r\n\r\n  this.setOnClose = (callback = \"\") => {\r\n    if (typeof callback !== \"function\")\r\n      throw new Error(\"OnClose must be  type Function\");\r\n\r\n    onCloseFunc = callback;\r\n    return this;\r\n  };\r\n\r\n  this.setOnShow = (callback = \"\") => {\r\n    if (typeof callback !== \"function\")\r\n      throw new Error(\"OnShow must be  type Function\");\r\n\r\n    onShowFunc = callback;\r\n    return this;\r\n  };\r\n\r\n  /**\r\n   * ============  Methods ===========\r\n   *\r\n   */\r\n  //Returns a promise of permission granted or not\r\n  this.requestPermission = () => {\r\n    return new Promise(async (resolve, reject) => {\r\n      const result = await Notification.requestPermission();\r\n      if (result === \"granted\") resolve(true);\r\n      else resolve(false);\r\n    });\r\n  };\r\n\r\n  // Returns a notification object\r\n  this.show = async () => {\r\n    if (!body) throw new Error(\"Empty Notification text\");\r\n    if (!title) throw new Error(\"Empty Notification title\");\r\n\r\n    const permission = Notification.permission;\r\n    if (permission === \"granted\") {\r\n      const options = {\r\n        body,\r\n        badge,\r\n        icon,\r\n        image,\r\n        vibrate,\r\n        renotify,\r\n        dir,\r\n        requireInteraction,\r\n        silent\r\n      };\r\n\r\n      const n = new Notification(title, options);\r\n      n.addEventListener(\"click\", onClickFunc);\r\n      n.addEventListener(\"close\", onCloseFunc);\r\n      n.addEventListener(\"error\", onErrorFunc);\r\n      n.addEventListener(\"show\", onShowFunc);\r\n      return n;\r\n    }\r\n  };\r\n}\r\n\r\nmodule.exports = Notify;\r\n"]}