text: "use strict";var e=require("atom"),t=require("path");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(require("node-notifier")),i=function(){return(i=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation.
  
  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.
  
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */function r(e,t,o,n){return new(o||(o=Promise))((function(i,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function s(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function a(e,t){var o,n,i,r,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,n&&(i=2&r[0]?n.return:r[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;switch(n=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,n=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){a.label=r[1];break}if(6===r[0]&&a.label<i[1]){a.label=i[1],i=r;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(r);break}i[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],n=0}finally{o=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}var s="notify",c=s,u={schema:{injectNotifications:{title:"Inject Notifications",description:"Shows native notifications whenever an Atom notification is triggered",type:"boolean",default:!0,order:0},showWhenFocused:{title:"Show when focused",description:"Shows desktop notifications only when the editor has focus",type:"boolean",default:!1,order:1},iconTheme:{title:"Icon Theme",description:"Choose an icon theme for your notifications",type:"string",enum:[{value:"appIconWithBadge",description:"App Icon with Badge"},{value:"badge",description:"Badge"}],default:"badge",order:2},overrides:{title:"Overrides",description:"The following settings only take effect when Atom runs in developer mode",type:"object",order:3,properties:{sound:{title:"Sound",type:"string",enum:[{value:"default",description:"(default)"},{value:"always",description:"Always play sound"},{value:"never",description:"Never play sound"}],default:"default",order:1},icon:{title:"Icon",type:"string",enum:[{value:"default",description:"(default)"},{value:"always",description:"Always show icon"},{value:"never",description:"Never show icon"}],default:"default",order:2}}},developer:{title:"Developer",description:"The following settings only take effect when Atom runs in developer mode.",type:"object",order:4,properties:{enableCommands:{title:"Enable Commands",description:"Exposes a number of demo commands to Atom",type:"boolean",default:!0,order:1},exposeToWindow:{title:"Expose to Window object ",description:"Allows running `notify` methods directly from the console. Requires a restart to take effect.",type:"boolean",default:!0,order:2}}}},get:function(e){return void 0===e&&(e=""),(null==e?void 0:e.length)?atom.config.get(s+"."+e):atom.config.get(""+s)},migrate:function(e,t){if(atom.config.get(s+"."+e)&&!atom.config.get(s+"."+t)){try{atom.config.set(s+"."+t,atom.config.get(s+"."+e))}catch(e){return void atom.notifications.addWarning("Failed to migrate configuration, see console for details")}atom.config.unset(s+"."+e)}},unset:function(e){void 0===e&&(e="");var t=(null==e?void 0:e.length)?s+"."+e:s;atom.config.unset(String(t))},open:function(e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return e=i({pending:!0,searchAllPanes:!0},e),[4,atom.workspace.open("atom://config/packages/"+s,e)];case 1:return t.sent(),[2]}}))}))}};function l(e){var o=String(u.get("iconTheme"));switch(o){case"appIconWithBadge":return t.join(__dirname,"..","/images/atom-"+atom.getReleaseChannel()+"-"+e+".png");case"badge":return t.join(__dirname,"..","/images/badge-"+e+".png");default:throw Error("Unsupported icon theme: "+o)}}function f(e){var o=u.get("overrides.icon"),n=t.join(__dirname,"..","/images/atom-"+atom.getReleaseChannel()+".png");switch(o){case"never":return;case"always":return e||n;default:return e}}function d(e){switch(u.get("overrides.sound")){case"never":return!1;case"always":return!0;default:return e}}
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation.
  
  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.
  
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
  function p(e,t){for(var o=0,n=t.length,i=e.length;o<n;o++,i++)e[i]=t[o];return e}var h=new(function(){function e(e){void 0===e&&(e={}),this.name=e.name,this.styleSheet="\n      background-color: "+(e.backgroundColor||"darkgrey")+";\n      border-radius: 2px;\n      color: "+(e.color||"white")+";\n      line-height: 1.5;\n      padding: 1px 4px;\n      text-shadow: 0 1px 0px rgba(0, 0, 0, 0.2);\n    "}return e.prototype.__console__=function(e){for(var t,o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];(null===atom||void 0===atom?void 0:atom.inDevMode())&&(o.unshift("%c"+this.name+"%c",this.styleSheet,""),(t=window.console)[e].apply(t,o))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["debug"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["error"],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["info"],e))},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["log"],e))},e.prototype.trace=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["trace"],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.__console__.apply(this,p(["warn"],e))},e}())({name:s,backgroundColor:"cornflowerblue"});function g(e,t){var o=i(i({},t="string"==typeof t?{message:t}:t),{sender:"com.github.atom",appID:"com.squirrel.atom.atom",icon:f(t.icon),contentImage:l(e),sound:d(t.sound)});n.default.notify(o)}var m={error:function(e){g("error",e)},fatalError:function(e){g("fatal",e)},info:function(e){g("info",e)},success:function(e){g("success",e)},warn:function(e){g("warning",e)}},y={config:u.schema,contentImage:null,icon:null,showWhenFocused:!1,subscriptions:new e.CompositeDisposable,activate:function(){return r(this,void 0,void 0,(function(){var e=this;return a(this,(function(t){return h.log("Activating package"),this.showWhenFocused=u.get("showWhenFocused"),atom.config.observe(c+".showWhenFocused",(function(t){e.showWhenFocused=t})),u.get("injectNotifications")&&this.subscriptions.add(atom.notifications.onDidAddNotification((function(t){if((e.showWhenFocused||document.body.classList.contains("is-blurred"))&&t)return e.intercept(t)}))),atom.inDevMode()&&(u.get("developer.enableCommands")&&this.subscriptions.add(atom.commands.add("atom-workspace",{"notify:show-error":function(){return e.notify({title:"Error",message:"This is a demo message",type:"error"})}}),atom.commands.add("atom-workspace",{"notify:show-fatal-error":function(){return e.notify({title:"Fatal Error",message:"This is a demo message",type:"fatalError"})}}),atom.commands.add("atom-workspace",{"notify:show-info":function(){return e.notify({title:"Info",message:"This is a demo message",type:"info"})}}),atom.commands.add("atom-workspace",{"notify:show-success":function(){return e.notify({title:"Success",message:"This is a demo message",type:"success"})}}),atom.commands.add("atom-workspace",{"notify:show-warning":function(){return e.notify({title:"Warning",message:"This is a demo message",type:"warn"})}})),u.get("developer.exposeToWindow")&&(window.notify=m)),[2]}))}))},intercept:function(e){var t=function(e){switch(e=e.toLowerCase()){case"fatal":case"fatalerror":return"fatalError";case"warning":return"warn";default:return e}}(e.getType().toLowerCase()),o=e.getMessage(),n=e.getDetail(),i=e.getOptions().dismissable,r={type:t,title:o,message:n,wait:i,timeout:i?void 0:atom.config.get("notifications.defaultTimeout")};this.notify(r)},notify:function(e){var t=i({},e);m[e.type](t)},deactivate:function(){var e;h.log("Deactivating package"),null===(e=this.subscriptions)||void 0===e||e.dispose()},provideNotify:function(){return h.log("Providing service"),this.notify}};module.exports=y;
  