UNPKG

kradan

Version:

> The tool for helping you to broadcast your code in your speaking session.

2 lines 13.6 kB
(function(e){function t(t){for(var r,i,o=t[0],u=t[1],c=t[2],l=0,p=[];l<o.length;l++)i=o[l],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&p.push(a[i][0]),a[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);f&&f(t);while(p.length)p.shift()();return s.push.apply(s,c||[]),n()}function n(){for(var e,t=0;t<s.length;t++){for(var n=s[t],r=!0,i=1;i<n.length;i++){var o=n[i];0!==a[o]&&(r=!1)}r&&(s.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},i={app:0},a={app:0},s=[];function o(e){return u.p+"js/"+({}[e]||e)+"."+{"chunk-3a62f98c":"fef5262d","chunk-76de296e":"1e7aa968"}[e]+".js"}function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.e=function(e){var t=[],n={"chunk-76de296e":1};i[e]?t.push(i[e]):0!==i[e]&&n[e]&&t.push(i[e]=new Promise((function(t,n){for(var r="css/"+({}[e]||e)+"."+{"chunk-3a62f98c":"31d6cfe0","chunk-76de296e":"7e6b003d"}[e]+".css",a=u.p+r,s=document.getElementsByTagName("link"),o=0;o<s.length;o++){var c=s[o],l=c.getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(l===r||l===a))return t()}var p=document.getElementsByTagName("style");for(o=0;o<p.length;o++){c=p[o],l=c.getAttribute("data-href");if(l===r||l===a)return t()}var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.onload=t,f.onerror=function(t){var r=t&&t.target&&t.target.src||a,s=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");s.code="CSS_CHUNK_LOAD_FAILED",s.request=r,delete i[e],f.parentNode.removeChild(f),n(s)},f.href=a;var h=document.getElementsByTagName("head")[0];h.appendChild(f)})).then((function(){i[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var s=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=s);var c,l=document.createElement("script");l.charset="utf-8",l.timeout=120,u.nc&&l.setAttribute("nonce",u.nc),l.src=o(e);var p=new Error;c=function(t){l.onerror=l.onload=null,clearTimeout(f);var n=a[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;p.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",p.name="ChunkLoadError",p.type=r,p.request=i,n[1](p)}a[e]=void 0}};var f=setTimeout((function(){c({type:"timeout",target:l})}),12e4);l.onerror=l.onload=c,document.head.appendChild(l)}return Promise.all(t)},u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/",u.oe=function(e){throw console.error(e),e};var c=window["webpackJsonp"]=window["webpackJsonp"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var p=0;p<c.length;p++)t(c[p]);var f=l;s.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("56d7")},1:function(e,t){},"56d7":function(e,t,n){"use strict";n.r(t);n("a481"),n("cadf"),n("551c"),n("f751"),n("097d");var r=n("2b0e"),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app",on:{mousemove:e.mousemove,mouseup:e.mouseUp}},[n("div",{staticClass:"left",style:{width:e.divLeft+"px"}},[n("div",{staticClass:"tree"},[n("ul",[n("item",{staticClass:"item",attrs:{model:e.list,"unseen-file-paths":e.unseenFilePaths,"unseen-folder-paths":e.unseenFolderPaths},on:{openFile:e.openFile}})],1)]),n("div",{staticClass:"download-button",attrs:{download:""},on:{click:e.downloadZip}},[n("i",{staticClass:"fas fa-download"}),e._v(" "+e._s(e.list.name)+".zip ")])]),n("div",{staticClass:"resize",on:{mousedown:e.mouseDown}}),n("div",{staticClass:"right",style:{width:e.divRight+"px"}},[n("ul",{staticClass:"tabs"},e._l(e.openFiles,(function(t){return n("li",{key:t.path,staticClass:"tabs-tab",class:{"is-active":e.currentOpenFilePath===t.path},on:{click:function(n){return n.target!==n.currentTarget?null:e.openFile(t.path)}}},[n("span",{staticClass:"tabs-tab-name",on:{click:function(n){return n.target!==n.currentTarget?null:e.openFile(t.path)}}},[e._v(e._s(t.name))]),n("span",{staticClass:"icon",staticStyle:{float:"right"},on:{click:function(n){return e.closeFile(t.path)}}},[n("i",{directives:[{name:"show",rawName:"v-show",value:!e.isUnseenTab(t.path),expression:"!isUnseenTab(file.path)"}],staticClass:"fas fa-times"}),n("i",{directives:[{name:"show",rawName:"v-show",value:e.isUnseenTab(t.path),expression:"isUnseenTab(file.path)"}],staticClass:"fas fa-edit"})])])})),0),n("div",{staticClass:"item-views"},e._l(e.openFiles,(function(t){return n("div",{key:t.path},[e.currentOpenFilePath===t.path?n("viewer",{attrs:{info:t,"unseen-line":e.unseenLine}}):e._e()],1)})),0)])])},a=[],s=(n("ac4d"),n("8a81"),n("5df3"),n("1c4c"),n("6b54"),n("8e6e"),n("456d"),n("386d"),n("ac6a"),n("20d6"),n("7618")),o=(n("28a5"),n("96cf"),n("3b8d")),u=(n("7514"),n("7f7f"),n("bd86")),c=n("c4e3"),l=n.n(c),p=n("2440"),f=n("8055"),h=n("94be"),d=n.n(h),m=n("2f62");function v(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function b(e,t){if(e){if("string"===typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){Object(u["a"])(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w=function(){return n.e("chunk-76de296e").then(n.bind(null,"06fb"))},O=function(){return n.e("chunk-3a62f98c").then(n.bind(null,"5e7d"))},P=n("bf68"),x=P.diffLines,j=new l.a,k={name:"App",data:function(){return{list:{name:"Root",path:"/",children:[]},unseenLine:[],unseenFolderPaths:[],mousePress:!1,divLeft:200}},computed:F(F({},Object(m["b"])(["currentOpenFilePath","openFiles","unseenFilePaths"])),{},{divRight:function(){return window.innerWidth-this.divLeft-10}}),mounted:function(){var e=this,t=Object(f["connect"])(this.$host);t.on("list",(function(t){-1!==t.name.lastIndexOf("\\")&&(t.name=t.name.substring(t.name.lastIndexOf("\\")+1,t.name.length)),e.list=t})),t.on("change",(function(t){e.addUnseenFile(t);var n=e.openFiles.find((function(e){return e.path===t}));n&&e.getFile(t)}))},methods:F(F({},Object(m["c"])(["mutateCurrentOpenFilePath","sliceOpenFiles","sliceUnseenFilePaths"])),{},{getFile:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,u,c,l=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.$http.get("/files"+t);case 2:n=e.sent,r=t.split("/").pop(),i={name:r,path:t,code:"",unseenLines:[],marker:function(){var e=document.createElement("div");return e.style.color="#fba949",e.innerHTML="|",e},editorOption:{tabSize:4,theme:"material",lineNumbers:!0,lineWrapping:!1,line:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","breakpoints","CodeMirror-foldgutter"]}},a=this.openFiles.find((function(e){return e.path===t})),a?(o="","string"===typeof n.data?o=n.data:"object"===Object(s["a"])(n.data)&&(o=d()(n.data,null,2,100)),u=x(a.code,o),a.unseenLines=this.addUnseenLine(u),a.code=o):(i.code="","string"===typeof n.data?i.code=n.data:"object"===Object(s["a"])(n.data)&&(i.code=d()(n.data,null,2,100)),c=this.openFiles.findIndex((function(e){return e.path===l.currentOpenFilePath})),this.sliceOpenFiles({index:c,newFile:i}),this.mutateCurrentOpenFilePath(t));case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),openFile:function(e){this.removeUnseenFile(e),this.openFiles.find((function(t){return t.path===e}))?this.mutateCurrentOpenFilePath(e):this.getFile(e)},closeFile:function(e){var t=this.openFiles.findIndex((function(t){return t.path===e}));if(this.openFiles.splice(t,1),this.currentOpenFilePath===e){var n=t<=0?t:t-1;0===this.openFiles.length?this.mutateCurrentOpenFilePath(""):this.mutateCurrentOpenFilePath(this.openFiles[n].path)}},addUnseenFile:function(e){var t=this;if(!this.unseenFilePaths.find((function(t){return t===e}))){this.unseenFilePaths.push(e);var n=e.split("/");n.shift(),n.shift(),n.forEach((function(n){var r=e.substring(0,e.search("/"+n));t.unseenFolderPaths.push({path:r+"/",file:e})}))}},removeUnseenFile:function(e){var t=this,n=this.unseenFilePaths.indexOf(e);if(-1!==n){this.unseenFilePaths.splice(n,1);var r=this.unseenFolderPaths.filter((function(t){return t.file===e}));r.forEach((function(){var n=t.unseenFolderPaths.findIndex((function(t){return t.file===e}));-1!==n&&t.unseenFolderPaths.splice(n,1)}))}},addUnseenLine:function(e){var t=0,n=[];return e.forEach((function(e){if(void 0===e.added&&void 0===e.removed&&(t+=e.count),e.added)if(e.count>1)for(var r=0;r<e.count;r++)n.push(parseInt(t)),t++;else n.push(parseInt(t)),t+=e.count})),n},isUnseenTab:function(e){return this.unseenFilePaths.find((function(t){return t===e}))},downloadZip:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getZip(this.list);case 2:return e.next=4,j.generateAsync({type:"blob"});case 4:t=e.sent,Object(p["saveAs"])(t,this.list.name+".zip");case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),getZip:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var n,r,i,a,s,o;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:n=v(t.children),e.prev=1,n.s();case 3:if((r=n.n()).done){e.next=25;break}if(i=r.value,a=i.path.split(".").pop().toUpperCase(),"directory"!==i.type){e.next=11;break}return e.next=9,this.getZip(i);case 9:e.next=23;break;case 11:if("file"!==i.type||"PNG"!==a&&"JPG"!==a&&"JPEG"!==a&&"ICO"!==a&&"SVG"!==a&&"GIF"!==a){e.next=18;break}return e.next=14,this.promiseImage(i);case 14:s=e.sent,j.file(this.list.name+i.path,s,{base64:!0}),e.next=23;break;case 18:if("file"!==i.type||"MAP"===a){e.next=23;break}return e.next=21,this.$http.get("/files"+i.path);case 21:o=e.sent,j.file(this.list.name+i.path,o.data,{binary:!0});case 23:e.next=3;break;case 25:e.next=30;break;case 27:e.prev=27,e.t0=e["catch"](1),n.e(e.t0);case 30:return e.prev=30,n.f(),e.finish(30);case 33:case"end":return e.stop()}}),e,this,[[1,27,30,33]])})));function t(t){return e.apply(this,arguments)}return t}(),promiseImage:function(e){var t=this;return new Promise((function(n,r){var i=document.createElement("img");i.setAttribute("crossorigin","anonymous"),i.src=t.$baseApiUrl+"files"+e.path,i.onload=function(){var e=document.createElement("canvas");e.width=this.naturalWidth,e.height=this.naturalHeight,e.getContext("2d").drawImage(this,0,0),n(e.toDataURL("image/png").replace(/^data:image\/(png|jpg);base64,/,""))}}))},mouseDown:function(e){this.mousePress=!0},mousemove:function(e){this.mousePress&&(this.divLeft=e.screenX)},mouseUp:function(e){this.mousePress=!1}}),components:{Item:O,Viewer:w}},C=k,U=(n("5c0b"),n("2877")),S=Object(U["a"])(C,i,a,!1,null,null,null),E=S.exports;r["a"].use(m["a"]);var A=new m["a"].Store({state:{currentOpenFilePath:"",openFiles:[],unseenFilePaths:[]},mutations:{mutateCurrentOpenFilePath:function(e,t){e.currentOpenFilePath=t},sliceOpenFiles:function(e,t){var n=t.index,r=t.newFile;e.openFiles.splice(n+1,0,r)},sliceUnseenFilePaths:function(e,t){var n=t.index,r=t.newFile;e.openFiles.splice(n+1,0,r)}},getters:{currentOpenFilePath:function(e){return e.currentOpenFilePath},openFiles:function(e){return e.openFiles},unseenFilePaths:function(e){return e.unseenFilePaths}}}),L=n("bc3a"),_=n.n(L),I=(n("a7be"),null);r["a"].prototype.$isProduction=!0,r["a"].config.performance=!0,I=window.location.href.replace("http://","").replace("https://","").replace("/","");var T="//".concat(I,"/");r["a"].prototype.$baseApiUrl=T,r["a"].prototype.$host=I,r["a"].prototype.$http=_.a.create({baseURL:T}),new r["a"]({el:"#app",store:A,render:function(e){return e(E)}})},"5c0b":function(e,t,n){"use strict";n("9c0c")},"9c0c":function(e,t,n){}}); //# sourceMappingURL=app.c4bcc627.js.map