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M,GAC3C,IACI,EADA,EAAO,KAIN,KAAK,YAUU,mBAFpB,EAAO,GAAQ,CAAC,KAGZ,EAAW,EACX,EAAO,CAAC,IAGZ,EAAO,IAAI,KAAK,SAAU,CAAE,KAAM,KAAK,KAAM,KAAM,KAAK,QACnD,IAAI,mBAAoB,KAAK,SAClC,EAAK,IAAI,oBAAqB,EAAK,OAAS,KAAK,OAAO,IACxD,EAAK,IAAI,oBAAqB,KAAK,OACnC,EAAK,IAAI,qBAAsB,EAAK,OACpC,EAAK,IAAI,oBAAqB,GAC9B,EAAK,IAAI,sBAAuB,EAAK,OAAS,OAAS,SACvD,EAAK,IAAI,wBAAyB,EAAK,UACvC,EAAK,IAAI,oBAAqB,EAAK,MACnC,EAAK,IAAI,6BAA8B,EAAK,mBAAgB,GAC5D,EAAK,IAAI,gCAAiC,EAAW,eAAY,GACjE,EAAK,IAAI,qCAAsC,EAAW,cAAW,GACrE,EAAK,IAAI,oCAAgC,GACzC,EAAK,UAEL,EAAK,MAAK,SAAS,EAAK,GAChB,GAAY,EACZ,EAAS,GACF,GAA2B,aAAf,EAAK,OACxB,OAAS,EAAW,EAAK,gCAAgC,cAEjE,KAnCI,KAAK,SAAS,KAAK,SAAS,SAAS,GAC7B,GAAK,QAAQ,IAAI,GACrB,EAAK,OAAO,KAAK,EAAM,EAAM,EAAM,EACvC,GAiCR,EAMA,OAAO,QAAU,IAAI","file":"/npm/growly@1.3.0/lib/growly.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/growly@1.3.0/lib/growly.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var GNTP = require('./gntp.js');\n\n/**\n * Interface for registering Growl applications and sending Growl notifications.\n *\n * @api private\n */\n\nfunction Growly() {\n    this.appname = 'Growly';\n    this.notifications = undefined;\n    this.labels = undefined;\n    this.count = 0;\n    this.registered = false;\n    this.host = undefined;\n    this.port = undefined;\n}\n\n/**\n * Returns an array of label strings extracted from each notification object in\n * `Growly.notifications`.\n *\n * @param {Array} notifications\n * @return {Array} notification labels\n * @api private\n */\n\nGrowly.prototype.getLabels = function() {\n    return this.notifications.map(function(notif) {\n        return notif.label;\n    });\n};\n\n/**\n * Set the host to be used by GNTP requests.\n *\n * @param {String} host\n * @param {Number} port\n * @api public\n */\n\nGrowly.prototype.setHost = function(host, port) {\n    this.host = host;\n    this.port = port;\n};\n\n/**\n * Register an application with the name `appname` (required), icon `appicon`, and\n * a list of notification types `notifications`. If provided, `callback` will be\n * called when the request completes with the first argument being an `err` error\n * object if the request failed.\n *\n * Each object in the `notifications` array defines a type of notification the\n * application will have with the following properties:\n *\n *  - `.label` name used to identify the type of notification being used (required)\n *  - `.dispname` name users will see in Growl's preference panel (defaults to `.label`)\n *  - `.enabled` whether or not notifications of this type are enabled (defaults to true)\n *  - `.icon` default icon notifications of this type should use (url, file path, or Buffer object)\n *\n *  Example registration:\n *\n *      growl.register('My Application', 'path/to/icon.png', [\n *          { label: 'success', dispname: 'Success', icon: 'path/to/success.png' },\n *          { label: 'warning', dispname: 'Warning', icon: 'path/to/warning.png', enabled: false }\n *      ], function(err) { console.log(err || 'Registration successful!'); });\n *\n * @param {String} appname\n * @param {String|Buffer} appicon\n * @param {Array} notifications\n * @param {Function} callback\n * @api public\n */\n\nGrowly.prototype.register = function(appname, appicon, notifications, callback) {\n    var gntp;\n\n    if (typeof appicon === 'object') {\n        notifications = appicon;\n        appicon = undefined;\n    }\n\n    if (notifications === undefined || !notifications.length) {\n        notifications = [{ label: 'default', dispname: 'Default Notification', enabled: true }];\n    }\n\n    if (typeof arguments[arguments.length - 1] === 'function') {\n        callback = arguments[arguments.length - 1];\n    } else {\n        callback = function() {};\n    }\n\n    this.appname = appname;\n    this.notifications = notifications;\n    this.labels = this.getLabels();\n    this.registered = true;\n\n    gntp = new GNTP('REGISTER', { host: this.host, port: this.port });\n    gntp.add('Application-Name', appname);\n    gntp.add('Application-Icon', appicon);\n    gntp.add('Notifications-Count', notifications.length);\n    gntp.newline();\n\n    notifications.forEach(function(notif) {\n        if (notif.enabled === undefined) notif.enabled = true;\n        gntp.add('Notification-Name', notif.label);\n        gntp.add('Notification-Display-Name', notif.dispname);\n        gntp.add('Notification-Enabled', notif.enabled ? 'True' : 'False');\n        gntp.add('Notification-Icon', notif.icon);\n        gntp.newline();\n    });\n\n    gntp.send(callback);\n};\n\n/**\n * Send a notification with `text` content. Growly will lazily register itself\n * if the user hasn't already before sending the notification.\n *\n * A notification can have the following `opts` options:\n *\n *  - `.label` type of notification to use (defaults to the first registered type)\n *  - `.title` title of the notification\n *  - `.icon` url, file path, or Buffer instance for the notification's icon.\n *  - `.sticky` whether or not to sticky the notification (defaults to false)\n *  - `.priority` the priority of the notification from lowest (-2) to highest (2)\n *  - `.coalescingId` replace/update the matching previous notification. May be ignored.\n *\n * If provided, `callback` will be called when the user interacts with the notification.\n * The first argument will be an `err` error object, and the second argument an `action`\n * string equal to either 'clicked' or 'closed' (whichever action the user took.)\n *\n * Example notification:\n *\n *     growl.notify('Stuffs broken!', { label: 'warning' }, function(err, action) {\n *         console.log('Action:', action);\n *     });\n *\n * @param {String} text\n * @param {Object} opts\n * @param {Function} callback\n * @api public\n */\n\nGrowly.prototype.notify = function(text, opts, callback) {\n    var self = this,\n        gntp;\n\n    /* Lazy registration. */\n    if (!this.registered) {\n        this.register(this.appname, function(err) {\n            if (err) console.log(err);\n            self.notify.call(self, text, opts, callback);\n        });\n        return;\n    }\n\n    opts = opts || {};\n\n    if (typeof opts === 'function') {\n        callback = opts;\n        opts = {};\n    }\n\n    gntp = new GNTP('NOTIFY', { host: this.host, port: this.port });\n    gntp.add('Application-Name', this.appname);\n    gntp.add('Notification-Name', opts.label || this.labels[0]);\n    gntp.add('Notification-ID', ++this.count);\n    gntp.add('Notification-Title', opts.title);\n    gntp.add('Notification-Text', text);\n    gntp.add('Notification-Sticky', opts.sticky ? 'True' : 'False');\n    gntp.add('Notification-Priority', opts.priority);\n    gntp.add('Notification-Icon', opts.icon);\n    gntp.add('Notification-Coalescing-ID', opts.coalescingId || undefined);\n    gntp.add('Notification-Callback-Context', callback ? 'context' : undefined);\n    gntp.add('Notification-Callback-Context-Type', callback ? 'string' : undefined);\n    gntp.add('Notification-Callback-Target', undefined);\n    gntp.newline();\n\n    gntp.send(function(err, resp) {\n        if (callback && err) {\n            callback(err);\n        } else if (callback && resp.state === 'CALLBACK') {\n            callback(undefined, resp['Notification-Callback-Result'].toLowerCase());\n        }\n    });\n};\n\n/**\n * Expose an instance of the Growly object.\n */\n\nmodule.exports = new Growly();\n"]}