UNPKG

md-live

Version:
82 lines (76 loc) 27.1 kB
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([/*!***********************!*\ !*** ./server/app.js ***! \***********************/ function(t,e,n){(function(e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=n(/*! fs */1),s=n(/*! path */3),l=n(/*! express */4),u=l(),c=n(/*! http */5).Server(u),f=n(/*! socket.io */6)(c),d=n(/*! chokidar */7),p=n(/*! open */8),h=n(/*! ./document-types/markdown-document */9),m=n(/*! ./document-types/structured-document */13),v=[h,m],g=n(/*! ./document-types/lib.js */16),y=g.ClientError,x=n(/*! ./document-types/error-template.handlebars */17),b=n(/*! ./views/index.handlebars */18),w={start:"server: %s",empty:"no *.md files in %s",emit:"saved: %s",watch:"watch: %s",added:"added: %s",removed:"removed: %s",not_exist:"doesn't exist: %s",bad_doc:"document is malformed"},k={port:2304,dir:s.resolve("."),verbose:!1,help:!1,browser:!1,file:!1,socket:"http://localhost:2304"},_=[h,m],P={log:function(t){var e=P.argsToArr(arguments);e[0]=P.joinArgs("[mdlive] ",t),console.log.apply(null,e)},isWatched:function(t){var e=!0,n=!1,r=void 0;try{for(var o,i=_[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;if(a.isDoc(t))return!0}}catch(s){n=!0,r=s}finally{try{!e&&i["return"]&&i["return"]()}finally{if(n)throw r}}return!1},isEmpty:function(t){return!t.length},isBool:function(t){return"[object Boolean]"===toString.call(t)},isObject:function(t){var e="undefined"==typeof t?"undefined":i(t);return"function"===e||"object"===e&&!!t},argsToArr:function(t){return Array.prototype.slice.call(t)},joinArgs:function(){return P.argsToArr(arguments).join("")},has:function(t,e){return null!==t&&hasOwnProperty.call(t,e)},extend:function(t){for(var e=1,n=arguments.length;e<n;e++){var r=arguments[e];for(var o in r)P.has(r,o)&&(t[o]=r[o])}return t},isTracked:function(t){var e=!0,n=!1,r=void 0;try{for(var o,i=v[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;if(a.isDoc(t))return!0}}catch(s){n=!0,r=s}finally{try{!e&&i["return"]&&i["return"]()}finally{if(n)throw r}}return!1},buildData:function(t,e,n){n=n||!1;var r=s.basename(t),o=t.replace(r,""),i="",a="unknown",l=!0,u=!1,c=void 0;try{for(var f,d=v[Symbol.iterator]();!(l=(f=d.next()).done);l=!0){var p=f.value;if(p.isDoc(t)){if(a=p.type,n)try{i=p.render(t,e)}catch(h){i=x({msg:h.stack})}else i=p.render(t,e);break}}}catch(m){u=!0,c=m}finally{try{!l&&d["return"]&&d["return"]()}finally{if(u)throw c}}return{name:r,dir:o,path:t,source:e,content:i,type:a}}},M=function(){function t(e){r(this,t),this.options=P.extend(k,e),this.log=this.options.verbose?P.log:function(){},this.url=P.joinArgs("http://localhost:",this.options.port),this.help(),this.start(),this.socket(),this.open(),this.filewatcher=d.watch(s.join(this.options.dir,"*.*")).on("change",this.emitFileChange.bind(this,"data")).on("add",this.emitFileChange.bind(this,"push")).on("unlink",this.emitRemove.bind(this))}return o(t,[{key:"emitFileChange",value:function(t,e){P.isTracked(e)&&(e=s.resolve(e),a.readFile(e,"utf8",function(n,r){if(!n){try{r=P.buildData(e,r),f.emit(t,r)}catch(o){o instanceof y?f.emit("toast",o.toast):f.emit("toast",{title:"error",text:o.message||o,kind:"error",timeout:0})}P.log(w.emit,e)}}))}},{key:"emitRemove",value:function(t){t=s.resolve(t),f.emit("rm",t),P.log(w.removed,t)}},{key:"help",value:function(){if(this.options.help){var t=a.createReadStream(s.join(e,"help.txt"));t.pipe(process.stdout),t.on("end",process.exit)}}},{key:"start",value:function(){var t=this;u.use(l["static"](s.join(DIRNAME,"public"))),u.use(l["static"](this.options.dir)),t.prepare(),u.get("/",function(e,n){n.end(b({url:t.url}))}),c.listen(this.options.port),P.log(w.start,this.url)}},{key:"prepare",value:function(){var t=this,e=a.readdirSync(this.options.dir).filter(function(t){return P.isWatched(t)}).map(function(e){return s.join(t.options.dir,e)})||[];this.options.file&&this.options.file.split(",").forEach(function(t){a.existsSync(t)&&P.isWatched(t)?e.push(t):P.log(w.not_exist,t)}),this.files=e.map(function(t){var e=a.readFileSync(t,"utf8");return P.buildData(t,e,!0)})}},{key:"open",value:function(){this.options.browser&&p(this.url)}},{key:"socket",value:function(){var t=this;f.on("connection",function(e){f.emit("initialize",t.files)})}}]),t}();t.exports=M}).call(e,"/")},/*!*********************!*\ !*** external "fs" ***! \*********************/ function(t,e){t.exports=require("fs")},,/*!***********************!*\ !*** external "path" ***! \***********************/ function(t,e){t.exports=require("path")},/*!**************************!*\ !*** external "express" ***! \**************************/ function(t,e){t.exports=require("express")},/*!***********************!*\ !*** external "http" ***! \***********************/ function(t,e){t.exports=require("http")},/*!****************************!*\ !*** external "socket.io" ***! \****************************/ function(t,e){t.exports=require("socket.io")},/*!***************************!*\ !*** external "chokidar" ***! \***************************/ function(t,e){t.exports=require("chokidar")},/*!***********************!*\ !*** external "open" ***! \***********************/ function(t,e){t.exports=require("open")},/*!****************************************************!*\ !*** ./server/document-types/markdown-document.js ***! \****************************************************/ function(t,e,n){"use strict";var r=n(/*! marked */10),o=new r.Renderer,i=n(/*! ./markdown-document.handlebars */11),a={isDoc:function(t){return/\.(markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext)$/.test(t)},render:function(t,e){var n=r(e,{renderer:o});return i({content:n})},type:"markdown"};t.exports=a},/*!*************************!*\ !*** external "marked" ***! \*************************/ function(t,e){t.exports=require("marked")},/*!************************************************************!*\ !*** ./server/document-types/markdown-document.handlebars ***! \************************************************************/ function(t,e,n){var r=n(/*! ./~/handlebars/dist/handlebars.runtime.js */12);t.exports=(r["default"]||r).template({compiler:[7,">= 4.0.0"],main:function(t,e,n,r,o){var i,a;return'<!DOCTYPE html>\n<html>\n<head>\n <title></title>\n <link href="/css/markdown-document.css" rel="stylesheet" type="text/css"/>\n</head>\n<body>\n '+(null!=(a=null!=(a=n.content||(null!=e?e.content:e))?a:n.helperMissing,i="function"==typeof a?a.call(null!=e?e:{},{name:"content",hash:{},data:o}):a)?i:"")+"\n <script type=\"text/javascript\">\n document.addEventListener('post-render', function() {\n 'use strict';\n\n var Prism = use('Prism');\n var _ = use('_');\n\n // highlight all code blocks\n let codeBlocks = Array.prototype.slice.call(\n document.getElementsByTagName('code'));\n _.each(codeBlocks, function(block) {\n if (block.className.indexOf('lang-') !== -1) {\n let language = /lang-([^ ]*)/g.exec(block.className)[1];\n let prismLanguage = Prism.languages[language];\n if (prismLanguage !== undefined) {\n block.innerHTML = Prism.highlight(\n block.innerText,\n Prism.languages[language]\n );\n }\n }\n });\n });\n </script>\n</body>\n</html>\n"},useData:!0})},/*!*************************************************!*\ !*** ./~/handlebars/dist/handlebars.runtime.js ***! \*************************************************/ function(t,e,n){/*! handlebars v4.0.5 Copyright (C) 2011-2015 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @license */ !function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(){var t=new s.HandlebarsEnvironment;return p.extend(t,s),t.SafeString=u["default"],t.Exception=f["default"],t.Utils=p,t.escapeExpression=p.escapeExpression,t.VM=m,t.template=function(e){return m.template(e,t)},t}var o=n(1)["default"],i=n(2)["default"];e.__esModule=!0;var a=n(3),s=o(a),l=n(17),u=i(l),c=n(5),f=i(c),d=n(4),p=o(d),h=n(18),m=o(h),v=n(19),g=i(v),y=r();y.create=r,g["default"](y),y["default"]=y,e["default"]=y,t.exports=e["default"]},function(t,e){"use strict";e["default"]=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e},e.__esModule=!0},function(t,e){"use strict";e["default"]=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0},function(t,e,n){"use strict";function r(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},l.registerDefaultHelpers(this),u.registerDefaultDecorators(this)}var o=n(2)["default"];e.__esModule=!0,e.HandlebarsEnvironment=r;var i=n(4),a=n(5),s=o(a),l=n(6),u=n(14),c=n(16),f=o(c),d="4.0.5";e.VERSION=d;var p=7;e.COMPILER_REVISION=p;var h={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};e.REVISION_CHANGES=h;var m="[object Object]";r.prototype={constructor:r,logger:f["default"],log:f["default"].log,registerHelper:function(t,e){if(i.toString.call(t)===m){if(e)throw new s["default"]("Arg not supported with multiple helpers");i.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(i.toString.call(t)===m)i.extend(this.partials,t);else{if("undefined"==typeof e)throw new s["default"]('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(i.toString.call(t)===m){if(e)throw new s["default"]("Arg not supported with multiple decorators");i.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]}};var v=f["default"].log;e.log=v,e.createFrame=i.createFrame,e.logger=f["default"]},function(t,e){"use strict";function n(t){return c[t]}function r(t){for(var e=1;e<arguments.length;e++)for(var n in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],n)&&(t[n]=arguments[e][n]);return t}function o(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}function i(t){if("string"!=typeof t){if(t&&t.toHTML)return t.toHTML();if(null==t)return"";if(!t)return t+"";t=""+t}return d.test(t)?t.replace(f,n):t}function a(t){return!t&&0!==t||!(!m(t)||0!==t.length)}function s(t){var e=r({},t);return e._parent=t,e}function l(t,e){return t.path=e,t}function u(t,e){return(t?t+".":"")+e}e.__esModule=!0,e.extend=r,e.indexOf=o,e.escapeExpression=i,e.isEmpty=a,e.createFrame=s,e.blockParams=l,e.appendContextPath=u;var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},f=/[&<>"'`=]/g,d=/[&<>"'`=]/,p=Object.prototype.toString;e.toString=p;var h=function(t){return"function"==typeof t};h(/x/)&&(e.isFunction=h=function(t){return"function"==typeof t&&"[object Function]"===p.call(t)}),e.isFunction=h;var m=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===p.call(t)};e.isArray=m},function(t,e){"use strict";function n(t,e){var o=e&&e.loc,i=void 0,a=void 0;o&&(i=o.start.line,a=o.start.column,t+=" - "+i+":"+a);for(var s=Error.prototype.constructor.call(this,t),l=0;l<r.length;l++)this[r[l]]=s[r[l]];Error.captureStackTrace&&Error.captureStackTrace(this,n),o&&(this.lineNumber=i,this.column=a)}e.__esModule=!0;var r=["description","fileName","lineNumber","message","name","number","stack"];n.prototype=new Error,e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){a["default"](t),l["default"](t),c["default"](t),d["default"](t),h["default"](t),v["default"](t),y["default"](t)}var o=n(2)["default"];e.__esModule=!0,e.registerDefaultHelpers=r;var i=n(7),a=o(i),s=n(8),l=o(s),u=n(9),c=o(u),f=n(10),d=o(f),p=n(11),h=o(p),m=n(12),v=o(m),g=n(13),y=o(g)},function(t,e,n){"use strict";e.__esModule=!0;var r=n(4);e["default"]=function(t){t.registerHelper("blockHelperMissing",function(e,n){var o=n.inverse,i=n.fn;if(e===!0)return i(this);if(e===!1||null==e)return o(this);if(r.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):o(this);if(n.data&&n.ids){var a=r.createFrame(n.data);a.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:a}}return i(e,n)})},t.exports=e["default"]},function(t,e,n){"use strict";var r=n(2)["default"];e.__esModule=!0;var o=n(4),i=n(5),a=r(i);e["default"]=function(t){t.registerHelper("each",function(t,e){function n(e,n,i){u&&(u.key=e,u.index=n,u.first=0===n,u.last=!!i,c&&(u.contextPath=c+e)),l+=r(t[e],{data:u,blockParams:o.blockParams([t[e],e],[c+e,null])})}if(!e)throw new a["default"]("Must pass iterator to #each");var r=e.fn,i=e.inverse,s=0,l="",u=void 0,c=void 0;if(e.data&&e.ids&&(c=o.appendContextPath(e.data.contextPath,e.ids[0])+"."),o.isFunction(t)&&(t=t.call(this)),e.data&&(u=o.createFrame(e.data)),t&&"object"==typeof t)if(o.isArray(t))for(var f=t.length;s<f;s++)s in t&&n(s,s,s===t.length-1);else{var d=void 0;for(var p in t)t.hasOwnProperty(p)&&(void 0!==d&&n(d,s-1),d=p,s++);void 0!==d&&n(d,s-1,!0)}return 0===s&&(l=i(this)),l})},t.exports=e["default"]},function(t,e,n){"use strict";var r=n(2)["default"];e.__esModule=!0;var o=n(5),i=r(o);e["default"]=function(t){t.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new i["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},t.exports=e["default"]},function(t,e,n){"use strict";e.__esModule=!0;var r=n(4);e["default"]=function(t){t.registerHelper("if",function(t,e){return r.isFunction(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||r.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){return t.helpers["if"].call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e["default"]},function(t,e){"use strict";e.__esModule=!0,e["default"]=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)e.push(arguments[r]);var o=1;null!=n.hash.level?o=n.hash.level:n.data&&null!=n.data.level&&(o=n.data.level),e[0]=o,t.log.apply(t,e)})},t.exports=e["default"]},function(t,e){"use strict";e.__esModule=!0,e["default"]=function(t){t.registerHelper("lookup",function(t,e){return t&&t[e]})},t.exports=e["default"]},function(t,e,n){"use strict";e.__esModule=!0;var r=n(4);e["default"]=function(t){t.registerHelper("with",function(t,e){r.isFunction(t)&&(t=t.call(this));var n=e.fn;if(r.isEmpty(t))return e.inverse(this);var o=e.data;return e.data&&e.ids&&(o=r.createFrame(e.data),o.contextPath=r.appendContextPath(e.data.contextPath,e.ids[0])),n(t,{data:o,blockParams:r.blockParams([t],[o&&o.contextPath])})})},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){a["default"](t)}var o=n(2)["default"];e.__esModule=!0,e.registerDefaultDecorators=r;var i=n(15),a=o(i)},function(t,e,n){"use strict";e.__esModule=!0;var r=n(4);e["default"]=function(t){t.registerDecorator("inline",function(t,e,n,o){var i=t;return e.partials||(e.partials={},i=function(o,i){var a=n.partials;n.partials=r.extend({},a,e.partials);var s=t(o,i);return n.partials=a,s}),e.partials[o.args[0]]=o.fn,i})},t.exports=e["default"]},function(t,e,n){"use strict";e.__esModule=!0;var r=n(4),o={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(t){if("string"==typeof t){var e=r.indexOf(o.methodMap,t.toLowerCase());t=e>=0?e:parseInt(t,10)}return t},log:function(t){if(t=o.lookupLevel(t),"undefined"!=typeof console&&o.lookupLevel(o.level)<=t){var e=o.methodMap[t];console[e]||(e="log");for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];console[e].apply(console,r)}}};e["default"]=o,t.exports=e["default"]},function(t,e){"use strict";function n(t){this.string=t}e.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){var e=t&&t[0]||1,n=g.COMPILER_REVISION;if(e!==n){if(e<n){var r=g.REVISION_CHANGES[n],o=g.REVISION_CHANGES[e];throw new v["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+o+").")}throw new v["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function o(t,e){function n(n,r,o){o.hash&&(r=h.extend({},r,o.hash),o.ids&&(o.ids[0]=!0)),n=e.VM.resolvePartial.call(this,n,r,o);var i=e.VM.invokePartial.call(this,n,r,o);if(null==i&&e.compile&&(o.partials[o.name]=e.compile(n,t.compilerOptions,e),i=o.partials[o.name](r,o)),null!=i){if(o.indent){for(var a=i.split("\n"),s=0,l=a.length;s<l&&(a[s]||s+1!==l);s++)a[s]=o.indent+a[s];i=a.join("\n")}return i}throw new v["default"]("The partial "+o.name+" could not be compiled when running in runtime-only mode")}function r(e){function n(e){return""+t.main(o,e,o.helpers,o.partials,a,l,s)}var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=i.data;r._setup(i),!i.partial&&t.useData&&(a=u(e,a));var s=void 0,l=t.useBlockParams?[]:void 0;return t.useDepths&&(s=i.depths?e!==i.depths[0]?[e].concat(i.depths):i.depths:[e]),(n=c(t.main,n,o,i.depths||[],a,l))(e,i)}if(!e)throw new v["default"]("No environment passed to template");if(!t||!t.main)throw new v["default"]("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var o={strict:function(t,e){if(!(e in t))throw new v["default"]('"'+e+'" not defined in '+t);return t[e]},lookup:function(t,e){for(var n=t.length,r=0;r<n;r++)if(t[r]&&null!=t[r][e])return t[r][e]},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:h.escapeExpression,invokePartial:n,fn:function(e){var n=t[e];return n.decorator=t[e+"_d"],n},programs:[],program:function(t,e,n,r,o){var a=this.programs[t],s=this.fn(t);return e||o||r||n?a=i(this,t,s,e,n,r,o):a||(a=this.programs[t]=i(this,t,s)),a},data:function(t,e){for(;t&&e--;)t=t._parent;return t},merge:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=h.extend({},e,t)),n},noop:e.VM.noop,compilerInfo:t.compiler};return r.isTop=!0,r._setup=function(n){n.partial?(o.helpers=n.helpers,o.partials=n.partials,o.decorators=n.decorators):(o.helpers=o.merge(n.helpers,e.helpers),t.usePartial&&(o.partials=o.merge(n.partials,e.partials)),(t.usePartial||t.useDecorators)&&(o.decorators=o.merge(n.decorators,e.decorators)))},r._child=function(e,n,r,a){if(t.useBlockParams&&!r)throw new v["default"]("must pass block params");if(t.useDepths&&!a)throw new v["default"]("must pass parent depths");return i(o,e,t[e],n,0,r,a)},r}function i(t,e,n,r,o,i,a){function s(e){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=a;return a&&e!==a[0]&&(s=[e].concat(a)),n(t,e,t.helpers,t.partials,o.data||r,i&&[o.blockParams].concat(i),s)}return s=c(n,s,t,a,r,i),s.program=e,s.depth=a?a.length:0,s.blockParams=o||0,s}function a(t,e,n){return t?t.call||n.name||(n.name=t,t=n.partials[t]):t="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],t}function s(t,e,n){n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var r=void 0;if(n.fn&&n.fn!==l&&(n.data=g.createFrame(n.data),r=n.data["partial-block"]=n.fn,r.partials&&(n.partials=h.extend({},n.partials,r.partials))),void 0===t&&r&&(t=r),void 0===t)throw new v["default"]("The partial "+n.name+" could not be found");if(t instanceof Function)return t(e,n)}function l(){return""}function u(t,e){return e&&"root"in e||(e=e?g.createFrame(e):{},e.root=t),e}function c(t,e,n,r,o,i){if(t.decorator){var a={};e=t.decorator(e,a,n,r&&r[0],o,i,r),h.extend(e,a)}return e}var f=n(1)["default"],d=n(2)["default"];e.__esModule=!0,e.checkRevision=r,e.template=o,e.wrapProgram=i,e.resolvePartial=a,e.invokePartial=s,e.noop=l;var p=n(4),h=f(p),m=n(5),v=d(m),g=n(3)},function(t,e){(function(n){"use strict";e.__esModule=!0,e["default"]=function(t){var e="undefined"!=typeof n?n:window,r=e.Handlebars;t.noConflict=function(){return e.Handlebars===t&&(e.Handlebars=r),t}},t.exports=e["default"]}).call(e,function(){return this}())}])})},/*!******************************************************!*\ !*** ./server/document-types/structured-document.js ***! \******************************************************/ function(t,e,n){"use strict";function r(t){return new m({title:"parse error",text:t,actions:[{text:"docs",action:"window.open('http://www.purple.com', '_blank');"}],timeout:0})}function o(t){var e=[];return u.safeLoadAll(t,function(t){e.push(t)}),e}function i(t,e){if(!e)throw r("no meta block");if(!e.template)throw r("template not specified in meta block of document");var n=c.join(c.dirname(t),e.template);try{f.statSync(n)}catch(o){throw r("could not load template '"+e.template+"'")}try{for(var i in e.helpers)try{l.registerHelper(i,nodeRequire(c.join(c.dirname(t),e.helpers[i])))}catch(o){throw r("could not register helper '"+e.helpers[i]+"'")}if(!Object.hasOwnProperty(h,n))try{h[n]=l.compile(f.readFileSync(n).toString())}catch(o){throw r("error compiling template '"+e.template+"'")}return{template:h[n]}}catch(o){return console.log(o),null}}function a(t,e){if(!e)return null;switch(e.length){case 1:return g;case 2:return i(t,e[0]);default:return null}}function s(t){if(!t)return null;switch(t.length){case 1:return t[0];case 2:return t[1];default:return null}}var l=n(/*! handlebars */14),u=n(/*! js-yaml */15),c=n(/*! path */3),f=n(/*! fs */1),d=n(/*! marked */10),p=new d.Renderer,h=[];l.registerHelper("md",function(t){return new l.SafeString(d(t,{renderer:p}))});var m=n(/*! ./lib.js */16).ClientError,v=n(/*! ./error-template.handlebars */17),g={helpers:[],template:c.join(DIRNAME,"/document-types/default-meta.handlebars")},y={isDoc:function(t){return/\.doc\.(yaml|yml)$/.test(t)},render:function(t,e){var n=o(e);if(1!==n.length&&2!==n.length)throw r("expected 2 yaml documents. See the documentation");var i=a(t,n),l=s(n);return n&&i&&l||(i={template:v,helpers:[]},l={msg:"could not load document "+t+"\n\n"+e}),i.template(l)},type:"structured"};t.exports=y},/*!*****************************!*\ !*** external "handlebars" ***! \*****************************/ function(t,e){t.exports=require("handlebars")},/*!**************************!*\ !*** external "js-yaml" ***! \**************************/ function(t,e){t.exports=require("js-yaml")},/*!**************************************!*\ !*** ./server/document-types/lib.js ***! \**************************************/ function(t,e){"use strict";function n(t){this.toast=t,this.toast.kind=this.toast.kind||"error"}function r(t,e){var n=void 0;for(n in e)if(e.hasOwnProperty(n)&&e[n]===t)return!0;return!1}function o(t,e,n){e=e||"",n=n||[];for(var a in t){var s=e+"."+a;if("object"===i(t[a]))if(r(t[a],n))console.log(s+"...");else{var l=n.concat([t[a]]);o(t[a],s,l)}else console.log(s)}}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};n.prototype=Error,t.exports={ClientError:n,recurseKeys:o}},/*!*********************************************************!*\ !*** ./server/document-types/error-template.handlebars ***! \*********************************************************/ function(t,e,n){var r=n(/*! ./~/handlebars/dist/handlebars.runtime.js */12);t.exports=(r["default"]||r).template({compiler:[7,">= 4.0.0"],main:function(t,e,n,r,o){var i;return"<pre>\n"+t.escapeExpression((i=null!=(i=n.msg||(null!=e?e.msg:e))?i:n.helperMissing,"function"==typeof i?i.call(null!=e?e:{},{name:"msg",hash:{},data:o}):i))+"\n</pre>"},useData:!0})},/*!***************************************!*\ !*** ./server/views/index.handlebars ***! \***************************************/ function(t,e,n){var r=n(/*! ./~/handlebars/dist/handlebars.runtime.js */12);t.exports=(r["default"]||r).template({compiler:[7,">= 4.0.0"],main:function(t,e,n,r,o){var i,a;return'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />\n <meta name="viewport" content="width=device-width minimum-scale=0, maximum-scale=1.0" />\n\n <title>MarkdownLive</title>\n <link href="/css/default.css" media="all" rel="stylesheet"/>\n </head>\n<body>\n\n</body>\n <div id="content" class="content">\n <nav id="nav" class="nav"></nav>\n <section id="docview" class="section__document"></section>\n <section id="notification-dock" class="section__notifications"></section>\n </div>\n <script type="text/javascript">\n var Db = { socket: "'+(null!=(a=null!=(a=n.url||(null!=e?e.url:e))?a:n.helperMissing,i="function"==typeof a?a.call(null!=e?e:{},{name:"url",hash:{},data:o}):a)?i:"")+'" };\n </script>\n <script type="text/javascript" src="/js/client.lib.js">\n</script>\n <script type="text/javascript" src="/js/client.js">\n </script>\n</html>\n'},useData:!0})}]); //# sourceMappingURL=server.js.map