md/js/app.1789491a.js
2022-01-26 12:35:25 +00:00

4 lines
86 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(e){function t(t){for(var n,a,s=t[0],c=t[1],l=t[2],d=0,_=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&_.push(r[a][0]),r[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);u&&u(t);while(_.length)_.shift()();return i.push.apply(i,l||[]),o()}function o(){for(var e,t=0;t<i.length;t++){for(var o=i[t],n=!0,s=1;s<o.length;s++){var c=o[s];0!==r[c]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=o[0]))}return e}var n={},r={app:0},i=[];function a(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=n,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/md/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],c=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var u=c;i.push([0,"chunk-vendors"]),o()})({0:function(e,t,o){e.exports=o("56d7")},1:function(e,t){},"115d":function(e,t,o){},"11ef":function(e,t,o){"use strict";o("8c0a")},1280:function(e,t,o){"use strict";o("115d")},2395:function(e,t,o){},"2b77":function(e,t,o){},"37e4":function(e,t,o){},"3a5e":function(e,t,o){"use strict";var n=o("aae9"),r=o("cb57"),i=(o("11ef"),o("2877")),a=Object(i["a"])(r["default"],n["a"],n["b"],!1,null,"a205efe8",null);t["default"]=a.exports},"3ea0":function(e,t,o){},"3f5e":function(module,__webpack_exports__,__webpack_require__){"use strict";var _home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("1da1"),regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("96cf"),regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__),core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("ac1f"),core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2__),core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("5319"),core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3__),core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("1276"),core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__),core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("0d03"),core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5__),core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("4d90"),core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6__),core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("d401"),core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7__),core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("d3b7"),core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8___default=__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8__),core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("25f0"),core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_9__),core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("99af"),core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_10___default=__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_10__),core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("e9c4"),core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_11__),core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("b0c0"),core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12___default=__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_12__),core_js_modules_es_math_trunc_js__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("b65f"),core_js_modules_es_math_trunc_js__WEBPACK_IMPORTED_MODULE_13___default=__webpack_require__.n(core_js_modules_es_math_trunc_js__WEBPACK_IMPORTED_MODULE_13__),_fetch__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("e1d2"),_config__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__("da71"),crypto_js__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__("3452"),crypto_js__WEBPACK_IMPORTED_MODULE_16___default=__webpack_require__.n(crypto_js__WEBPACK_IMPORTED_MODULE_16__),ali_oss__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__("9b15"),ali_oss__WEBPACK_IMPORTED_MODULE_17___default=__webpack_require__.n(ali_oss__WEBPACK_IMPORTED_MODULE_17__),cos_js_sdk_v5__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__("3438"),cos_js_sdk_v5__WEBPACK_IMPORTED_MODULE_18___default=__webpack_require__.n(cos_js_sdk_v5__WEBPACK_IMPORTED_MODULE_18__),buffer_from__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__("653c"),buffer_from__WEBPACK_IMPORTED_MODULE_19___default=__webpack_require__.n(buffer_from__WEBPACK_IMPORTED_MODULE_19__),uuid__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__("ec26"),qiniu_js__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__("f744"),_assets_scripts_tokenTools__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__("4e00");function getConfig(e,t){if(e){var o="github"===t?_config__WEBPACK_IMPORTED_MODULE_15__["b"]:_config__WEBPACK_IMPORTED_MODULE_15__["a"],n=o.username,r=o.repoList,i=o.branch,a=o.accessTokenList,s=Math.floor(Math.random()*a.length),c=a[s].replace("doocsmd",""),l=Math.floor(Math.random()*r.length),u=r[l];return{username:n,repo:u,branch:i,accessToken:c}}var d=JSON.parse(localStorage.getItem("".concat(t,"Config"))),_=d.repo.replace("https://".concat(t,".com/"),"").replace("http://".concat(t,".com/"),"").replace("".concat(t,".com/"),"").split("/");return{username:_[0],repo:_[1],branch:d.branch||"master",accessToken:d.accessToken}}function getDir(){var e=new Date,t=e.getFullYear(),o=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0");return"".concat(t,"/").concat(o,"/").concat(n)}function getDateFilename(e){var t=(new Date).getTime(),o=e.split(".")[1];return"".concat(t,"-").concat(Object(uuid__WEBPACK_IMPORTED_MODULE_20__["a"])(),".").concat(o)}function ghFileUpload(e,t){return _ghFileUpload.apply(this,arguments)}function _ghFileUpload(){return _ghFileUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t,o){var n,r,i,a,s,c,l,u,d,_,m,f,p;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r="default"===localStorage.getItem("imgHost"),i=getConfig(r,"github"),a=i.username,s=i.repo,c=i.branch,l=i.accessToken,u=getDir(),d="https://api.github.com/repos/".concat(a,"/").concat(s,"/contents/").concat(u,"/"),_=getDateFilename(o),e.next=7,Object(_fetch__WEBPACK_IMPORTED_MODULE_14__["a"])({url:d+_,method:"put",headers:{Authorization:"token ".concat(l)},data:{content:t,branch:c,message:"Upload by ".concat(window.location.href)}});case 7:return m=e.sent,f="raw.githubusercontent.com/".concat(a,"/").concat(s,"/").concat(c,"/"),p="cdn.jsdelivr.net/gh/".concat(a,"/").concat(s,"@").concat(c,"/"),m.content=(null===(n=m.data)||void 0===n?void 0:n.content)||m.content,e.abrupt("return",r?m.content.download_url.replace(f,p):m.content.download_url);case 12:case"end":return e.stop()}}),e)}))),_ghFileUpload.apply(this,arguments)}function giteeUpload(e,t){return _giteeUpload.apply(this,arguments)}function _giteeUpload(){return _giteeUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t,o){var n,r,i,a,s,c,l,u,d,_,m;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r="default"===localStorage.getItem("imgHost"),i=getConfig(r,"gitee"),a=i.username,s=i.repo,c=i.branch,l=i.accessToken,u=getDir(),d=getDateFilename(o),_="https://gitee.com/api/v5/repos/".concat(a,"/").concat(s,"/contents/").concat(u,"/").concat(d),e.next=7,Object(_fetch__WEBPACK_IMPORTED_MODULE_14__["a"])({url:_,method:"POST",data:{content:t,branch:c,access_token:l,message:"Upload by ".concat(window.location.href)}});case 7:return m=e.sent,m.content=(null===(n=m.data)||void 0===n?void 0:n.content)||m.content,e.abrupt("return",encodeURI(m.content.download_url));case 10:case"end":return e.stop()}}),e)}))),_giteeUpload.apply(this,arguments)}function getQiniuToken(e,t,o){var n=JSON.stringify(o),r=Object(_assets_scripts_tokenTools__WEBPACK_IMPORTED_MODULE_22__["base64encode"])(Object(_assets_scripts_tokenTools__WEBPACK_IMPORTED_MODULE_22__["utf16to8"])(n)),i=crypto_js__WEBPACK_IMPORTED_MODULE_16___default.a.HmacSHA1(r,t),a=i.toString(crypto_js__WEBPACK_IMPORTED_MODULE_16___default.a.enc.Base64);return"".concat(e,":").concat(Object(_assets_scripts_tokenTools__WEBPACK_IMPORTED_MODULE_22__["safe64"])(a),":").concat(r)}function qiniuUpload(e){return _qiniuUpload.apply(this,arguments)}function _qiniuUpload(){return _qiniuUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t){var o,n,r,i,a,s,c,l,u,d,_;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return o=JSON.parse(localStorage.getItem("qiniuConfig")),n=o.accessKey,r=o.secretKey,i=o.bucket,a=o.region,s=o.path,c=o.domain,l=getQiniuToken(n,r,{scope:i,deadline:Math.trunc((new Date).getTime()/1e3)+3600}),u=s?"".concat(s,"/"):"",d=u+getDateFilename(t.name),_=qiniu_js__WEBPACK_IMPORTED_MODULE_21__["upload"](t,d,l,{},{region:a}),e.abrupt("return",new Promise((function(e,t){_.subscribe({next:function(e){console.log(e)},error:function(e){t(e.message)},complete:function(t){e("".concat(c,"/").concat(t.key))}})})));case 6:case"end":return e.stop()}}),e)}))),_qiniuUpload.apply(this,arguments)}function aliOSSFileUpload(e,t){return _aliOSSFileUpload.apply(this,arguments)}function _aliOSSFileUpload(){return _aliOSSFileUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t,o){var n,r,i,a,s,c,l,u,d,_,m,f;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=getDateFilename(o),r=JSON.parse(localStorage.getItem("aliOSSConfig")),i=r.region,a=r.bucket,s=r.accessKeyId,c=r.accessKeySecret,l=r.cdnHost,u=r.path,d=buffer_from__WEBPACK_IMPORTED_MODULE_19___default()(t,"base64"),_="".concat(u,"/").concat(n),m=new ali_oss__WEBPACK_IMPORTED_MODULE_17___default.a({region:i,bucket:a,accessKeyId:s,accessKeySecret:c}),e.prev=5,e.next=8,m.put(_,d);case 8:if(f=e.sent,""!=l){e.next=11;break}return e.abrupt("return",f.url);case 11:return e.abrupt("return","".concat(l,"/").concat(""==u?n:_));case 14:return e.prev=14,e.t0=e["catch"](5),e.abrupt("return",Promise.reject(e.t0));case 17:case"end":return e.stop()}}),e,null,[[5,14]])}))),_aliOSSFileUpload.apply(this,arguments)}function txCOSFileUpload(e){return _txCOSFileUpload.apply(this,arguments)}function _txCOSFileUpload(){return _txCOSFileUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t){var o,n,r,i,a,s,c,l,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return o=getDateFilename(t.name),n=JSON.parse(localStorage.getItem("txCOSConfig")),r=n.secretId,i=n.secretKey,a=n.bucket,s=n.region,c=n.path,l=n.cdnHost,u=new cos_js_sdk_v5__WEBPACK_IMPORTED_MODULE_18___default.a({SecretId:r,SecretKey:i}),e.abrupt("return",new Promise((function(e,n){u.putObject({Bucket:a,Region:s,Key:"".concat(c,"/").concat(o),Body:t},(function(t,r){t?n(t):e(l?""==c?"".concat(l,"/").concat(o):"".concat(l,"/").concat(c,"/").concat(o):"https://".concat(r.Location))}))})));case 4:case"end":return e.stop()}}),e)}))),_txCOSFileUpload.apply(this,arguments)}function formCustomUpload(e,t){return _formCustomUpload.apply(this,arguments)}function _formCustomUpload(){return _formCustomUpload=Object(_home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function _callee6(content,file){var str;return regeneratorRuntime.wrap((function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:return str="\n async (CUSTOM_ARG) => {\n ".concat(localStorage.getItem("formCustomConfig"),"\n }\n "),_context6.abrupt("return",new Promise((function(resolve,reject){var exportObj={content:content,file:file,util:{axios:_fetch__WEBPACK_IMPORTED_MODULE_14__["a"],CryptoJS:crypto_js__WEBPACK_IMPORTED_MODULE_16___default.a,OSS:ali_oss__WEBPACK_IMPORTED_MODULE_17___default.a,COS:cos_js_sdk_v5__WEBPACK_IMPORTED_MODULE_18___default.a,Buffer:buffer_from__WEBPACK_IMPORTED_MODULE_19___default.a,uuidv4:uuid__WEBPACK_IMPORTED_MODULE_20__["a"],qiniu:qiniu_js__WEBPACK_IMPORTED_MODULE_21__,tokenTools:_assets_scripts_tokenTools__WEBPACK_IMPORTED_MODULE_22__,getDir:getDir,getDateFilename:getDateFilename},okCb:resolve,errCb:reject};eval(str)(exportObj)["catch"]((function(e){console.error(e),reject(e)}))})));case 2:case"end":return _context6.stop()}}),_callee6)}))),_formCustomUpload.apply(this,arguments)}function fileUpload(e,t){var o=localStorage.getItem("imgHost");switch(!o&&localStorage.setItem("imgHost","default"),o){case"aliOSS":return aliOSSFileUpload(e,t.name);case"txCOS":return txCOSFileUpload(t);case"qiniu":return qiniuUpload(t);case"gitee":return giteeUpload(e,t.name);case"github":return ghFileUpload(e,t.name);case"formCustom":return formCustomUpload(e,t);default:return ghFileUpload(e,t.name)}}__webpack_exports__["a"]={fileUpload:fileUpload}},4549:function(e,t,o){},"4e00":function(e,t,o){"use strict";o.r(t),o.d(t,"utf16to8",(function(){return n})),o.d(t,"utf8to16",(function(){return r})),o.d(t,"base64encode",(function(){return s})),o.d(t,"base64decode",(function(){return c})),o.d(t,"safe64",(function(){return l}));o("ac1f"),o("5319");function n(e){var t,o,n,r;for(t="",n=e.length,o=0;o<n;o++)r=e.charCodeAt(o),r>=1&&r<=127?t+=e.charAt(o):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63));return t}function r(e){var t,o,n,r,i,a;t="",n=e.length,o=0;while(o<n)switch(r=e.charCodeAt(o++),r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=e.charAt(o-1);break;case 12:case 13:i=e.charCodeAt(o++),t+=String.fromCharCode((31&r)<<6|63&i);break;case 14:i=e.charCodeAt(o++),a=e.charCodeAt(o++),t+=String.fromCharCode((15&r)<<12|(63&i)<<6|(63&a)<<0);break}return t}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",a=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function s(e){var t,o,n,r,a,s;n=e.length,o=0,t="";while(o<n){if(r=255&e.charCodeAt(o++),o==n){t+=i.charAt(r>>2),t+=i.charAt((3&r)<<4),t+="==";break}if(a=e.charCodeAt(o++),o==n){t+=i.charAt(r>>2),t+=i.charAt((3&r)<<4|(240&a)>>4),t+=i.charAt((15&a)<<2),t+="=";break}s=e.charCodeAt(o++),t+=i.charAt(r>>2),t+=i.charAt((3&r)<<4|(240&a)>>4),t+=i.charAt((15&a)<<2|(192&s)>>6),t+=i.charAt(63&s)}return t}function c(e){var t,o,n,r,i,s,c;s=e.length,i=0,c="";while(i<s){do{t=a[255&e.charCodeAt(i++)]}while(i<s&&-1==t);if(-1==t)break;do{o=a[255&e.charCodeAt(i++)]}while(i<s&&-1==o);if(-1==o)break;c+=String.fromCharCode(t<<2|(48&o)>>4);do{if(n=255&e.charCodeAt(i++),61==n)return c;n=a[n]}while(i<s&&-1==n);if(-1==n)break;c+=String.fromCharCode((15&o)<<4|(60&n)>>2);do{if(r=255&e.charCodeAt(i++),61==r)return c;r=a[r]}while(i<s&&-1==r);if(-1==r)break;c+=String.fromCharCode((3&n)<<6|r)}return c}function l(e){return e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}},"4eaa":function(e,t,o){},"537d":function(e,t,o){"use strict";o("b43f")},"56d7":function(e,t,o){"use strict";o.r(t);var n=o("5530"),r=(o("e260"),o("e6cf"),o("cca6"),o("a79d"),o("2b0e")),i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{attrs:{id:"app"}},[o("router-view")],1)},a=[],s=(o("7c55"),o("94fb"),o("2877")),c={},l=Object(s["a"])(c,i,a,!1,null,null,null),u=l.exports,d=(o("ac1f"),o("5319"),o("2f62")),_={builtinFonts:[{label:"无衬线",value:"-apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif"},{label:"衬线",value:"Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif"}],sizeOption:[{label:"12px",value:"12px",desc:"更小"},{label:"13px",value:"13px",desc:"稍小"},{label:"14px",value:"14px",desc:"推荐"},{label:"15px",value:"15px",desc:"稍大"},{label:"16px",value:"16px",desc:"更大"}],colorOption:[{label:"经典蓝",value:"rgba(15, 76, 129, 1)",desc:"最新流行"},{label:"翡翠绿",value:"rgba(0, 152, 116, 1)",desc:"优雅清新"},{label:"活力橘",value:"rgba(250, 81, 81, 1)",desc:"热情活泼"}],codeThemeOption:[{label:"github",value:"https://lib.baomitu.com/highlight.js/10.7.3/styles/github.min.css",desc:"light"},{label:"solarized-light",value:"https://lib.baomitu.com/highlight.js/11.3.1/styles/base16/solarized-light.min.css",desc:"light"},{label:"atom-one-dark",value:"https://lib.baomitu.com/highlight.js/11.3.1/styles/atom-one-dark.min.css",desc:"dark"},{label:"obsidian",value:"https://lib.baomitu.com/highlight.js/11.3.1/styles/obsidian.min.css",desc:"dark"},{label:"vs2015",value:"https://lib.baomitu.com/highlight.js/11.3.1/styles/vs2015.min.css",desc:"dark"}],form:{rows:1,cols:1}},m=o("bee2"),f=o("d4ec"),p=(o("4ec9"),o("d3b7"),o("3ca3"),o("ddb0"),o("a15b"),o("d81d"),o("99af"),o("c975"),o("1276"),o("9911"),o("2ca0"),o("7c5c")),g=o("1487"),h=o.n(g),b=Object(m["a"])((function e(t){var o=this;Object(f["a"])(this,e),this.opts=t;var n=[],r=0,i=new Map,a=function(e,t){return Object.assign({},e,t)};this.buildTheme=function(e){var t={},n=a(e.BASE,{"font-family":o.opts.fonts,"font-size":o.opts.size});for(var r in e.inline)if(e.inline.hasOwnProperty(r)){var i=e.inline[r];t[r]=a(e.BASE,i)}var s=a(n,{});for(var c in e.block)if(e.block.hasOwnProperty(c)){var l=e.block[c];t[c]=a(s,l)}return t};var s=function(e,t){var o=[],n=i[e];if(!n)return"";for(var r in n)o.push(r+":"+n[r]);return'style="'.concat(o.join(";")+(t||""),'"')},c=function(e,t){return n.push([++r,e,t]),r};this.buildFootnotes=function(){var e=n.map((function(e){return e[1]===e[2]?'<code style="font-size: 90%; opacity: 0.6;">['.concat(e[0],"]</code>: <i>").concat(e[1],"</i><br/>"):'<code style="font-size: 90%; opacity: 0.6;">['.concat(e[0],"]</code> ").concat(e[1],": <i>").concat(e[2],"</i><br/>")}));return e.length?"<h4 ".concat(s("h4"),">引用链接</h4><p ").concat(s("footnotes"),">").concat(e.join("\n"),"</p>"):""},this.buildAddition=function(){return"\n <style>\n .preview-wrapper pre::before {\n position: absolute;\n top: 0;\n right: 0;\n color: #ccc;\n text-align: center;\n font-size: 0.8em;\n padding: 5px 10px 0;\n line-height: 15px;\n height: 15px;\n font-weight: 600;\n }\n </style>\n "},this.setOptions=function(e){o.opts=a(o.opts,e)},this.hasFootnotes=function(){return 0!==n.length},this.getRenderer=function(e){n=[],r=0,i=o.buildTheme(o.opts.theme);var t=new p["Renderer"];return t.heading=function(e,t){switch(t){case 1:return"<h1 ".concat(s("h1"),">").concat(e,"</h1>");case 2:return"<h2 ".concat(s("h2"),">").concat(e,"</h2>");case 3:return"<h3 ".concat(s("h3"),">").concat(e,"</h3>");default:return"<h4 ".concat(s("h4"),">").concat(e,"</h4>")}},t.paragraph=function(e){return-1!=e.indexOf("<figure")&&-1!=e.indexOf("<img")?e:""===e.replace(/ /g,"")?"":"<p ".concat(s("p"),">").concat(e,"</p>")},t.blockquote=function(e){return e=e.replace(/<p.*?>/g,"<p ".concat(s("blockquote_p"),">")),"<blockquote ".concat(s("blockquote"),">").concat(e,"</blockquote>")},t.code=function(e,t){return t=h.a.getLanguage(t)?t:"plaintext",e=h.a.highlight(e,{language:t}).value,e=e.replace(/\r\n/g,"<br/>").replace(/\n/g,"<br/>").replace(/(>[^<]+)|(^[^<]+)/g,(function(e){return e.replace(/\s/g,"&nbsp;")})),'<pre class="hljs code__pre" '.concat(s("code_pre"),'><code class="prettyprint language-').concat(t,'" ').concat(s("code"),">").concat(e,"</code></pre>")},t.codespan=function(e,t){return"<code ".concat(s("codespan"),">").concat(e,"</code>")},t.listitem=function(e){return"<span ".concat(s("listitem"),'><span style="margin-right: 10px;"><%s/></span>').concat(e,"</span>")},t.list=function(e,t,o){e=e.replace(/<\/*p.*?>/g,"");var n=e.split("<%s/>");if(!t)return e=n.join("•"),"<p ".concat(s("ul"),">").concat(e,"</p>");e=n[0];for(var r=1;r<n.length;r++)e=e+r+"."+n[r];return"<p ".concat(s("ol"),">").concat(e,"</p>")},t.image=function(e,t,o){var n="";o&&(n="<figcaption ".concat(s("figcaption"),">").concat(o,"</figcaption>"));var r=s("figure"),i=s("image");return"<figure ".concat(r,"><img ").concat(i,' src="').concat(e,'" title="').concat(t,'" alt="').concat(o,'"/>').concat(n,"</figure>")},t.link=function(t,o,n){if(t.startsWith("https://mp.weixin.qq.com"))return'<a href="'.concat(t,'" title="').concat(o||n,'" ').concat(s("wx_link"),">").concat(n,"</a>");if(t===n)return n;if(e){var r=c(o||n,t);return"<span ".concat(s("link"),">").concat(n,"<sup>[").concat(r,"]</sup></span>")}return"<span ".concat(s("link"),">").concat(n,"</span>")},t.strong=function(e){return"<strong ".concat(s("strong"),">").concat(e,"</strong>")},t.em=function(e){return'<span style="font-style: italic;">'.concat(e,"</span>")},t.table=function(e,t){return'<section style="padding:0 8px;"><table class="preview-table"><thead '.concat(s("thead"),">").concat(e,"</thead><tbody>").concat(t,"</tbody></table></section>")},t.tablecell=function(e,t){return"<td ".concat(s("td"),">").concat(e,"</td>")},t.hr=function(){return"<hr ".concat(s("hr"),">")},t}})),C=b,v=o("56b3"),O=o.n(v),k='# 示例文章Google 搜索的即时自动补全功能究竟是如何“工作”的?\r\n\r\n> Google 搜索**自动补全功能**的强大,相信不少朋友都能感受到,它帮助我们更快地“补全”我们所要输入的搜索关键字。那么,它怎么知道我们要输入什么内容?它又是如何工作的?在这篇文章里,我们一起来看看。\r\n\r\n## 使用自动补全\r\n\r\nGoogle 搜索的自动补全功能可以在 Google 搜索应用的大多数位置使用,包括 [Google](https://www.google.com/) 主页、适用于 IOS 和 Android 的 Google 应用,我们只需要在 Google 搜索框上开始键入关键字,就可以看到联想词了。\r\n\r\n![](https://gitee.com/yanglbme/resource/raw/master/doocs-md/juejin.gif)\r\n\r\n在上图示例中我们可以看到输入关键字 `juej`Google 搜索会联想到“掘金”、“掘金小册”、“绝句”等等,好处就是,我们无须输入完整的关键字即可轻松完成针对这些 topics 的搜索。\r\n\r\n谷歌搜索的自动补全功能对于使用移动设备的用户来说特别有用用户可以轻松在难以键入的小屏幕上完成搜索。当然对于移动设备用户和台式机用户而言这都节省了大量的时间。根据 Google 官方报告,自动补全功能可以减少大约 25% 的打字,累积起来,预计每天可以节省 200 多年的打字时间。是的,每天!\r\n\r\n> 注意,本文所提到的“**联想词**”与“**预测**”,是同一个意思。\r\n\r\n## 基于“预测”而非“建议”\r\n\r\nGoogle 官方将自动补全功能称之为“预测”,而不是“建议”,为什么呢?其实是有充分理由的。自动补全功能是为了**帮助用户完成他们打算进行的搜索**,而不是建议用户要执行什么搜索。\r\n\r\n那么Google 是如何确定这些“预测”的其实Google 会根据趋势搜索 [trends](https://trends.google.com/trends/?geo=US) 给到我们这些“预测”。简单来说,哪个热门、哪个搜索频率高,就更可能推给我们。当然,这也与我们当前所处的位置以及我们的搜索历史相关。\r\n\r\n另外这些“预测”也会随着我们键入的关键字的变更而更改。例如当我们把键入的关键字从 `juej` 更改为 `juex` 时,与“掘金”相关的预测会“消失”,同时,与“觉醒”、“决心”相关联的词会出现。\r\n\r\n![](https://gitee.com/yanglbme/resource/raw/master/doocs-md/juex.gif)\r\n\r\n## 为什么看不到某些联想词?\r\n\r\n如果我们在输入某个关键字时看不到联想词那么表明 Google 的算法可能检测到:\r\n\r\n- 这个关键字不是热门字词;\r\n- 搜索的字词太新了,我们可能需要等待几天或几周才能看到联想词;\r\n- 这是一个侮辱性或敏感字词,这个搜索字词违反了 Google 的相关政策。更加详细的情况,可以了解 [Google 搜索自动补全政策](https://support.google.com/websearch/answer/7368877)。\r\n\r\n## 为什么会看到某些不当的联想词?\r\n\r\nGoogle 拥有专门设计的系统可以自动捕获不适当的预测结果而不显示出来。然而Google 每天需要处理数十亿次搜索,这意味着 Google 每天会显示数十亿甚至上百亿条预测。再好的系统,也可能存在缺陷,不正确的预测也可能随时会出现。\r\n\r\n我们作为 Google 搜索的用户,如果认定某条预测违反了相关的搜索自动补全政策,可以进行举报反馈,点击右下角“**举报不当的联想查询**”并勾选相关选项即可。\r\n\r\n![](https://gitee.com/yanglbme/resource/raw/master/doocs-md/report.gif)\r\n\r\n## 如何实现自动补全算法?\r\n\r\n目前Google 官方似乎并没有公开搜索自动补全的算法实现,但是业界在这方面已经有了不少研究。\r\n\r\n一个好的自动补全器必须是快速的并且在用户键入下一个字符后立即更新联想词列表。**自动补全器的核心是一个函数,它接受输入的前缀,并搜索以给定前缀开头的词汇或语句列表**。通常来说,只需要返回少量的数目即可。\r\n\r\n接下来我们先从一个简单且低效的实现开始并在此基础上逐步构建更高效的方法。\r\n\r\n### 词汇表实现\r\n\r\n一个**简单粗暴的实现方式**是:顺序查找词汇表,依次检查每个词汇,看它是否以给定的前缀开头。\r\n\r\n但是此方法需要将前缀与每个词汇进行匹配检查若词汇量较少这种方式可能勉强行得通。但是如果词汇量规模较大效率就太低了。\r\n\r\n一个**更好的实现方式是**:让词汇按字典顺序排序。借助二分搜索算法,可以快速搜索有序词汇表中的前缀。由于二分搜索的每一步都会将搜索的范围减半,因此,总的搜索时间与词汇表中单词数量的对数成正比,即时间复杂度是 `O(log N)`。二分搜索的性能很好,但有没有更好的实现呢?当然有,往下看。\r\n\r\n### 前缀树实现\r\n\r\n通常来说许多词汇都以相同的前缀开头比如 `need`、`nested` 都以 `ne` 开头,`seed`、`speed` 都以 `s` 开头。要是为每个单词分别存储公共前缀似乎很浪费。\r\n\r\n![](https://gitee.com/yanglbme/resource/raw/master/doocs-md/pretree.png)\r\n\r\n前缀树是一种利用公共前缀来加速补全速度的数据结构。前缀树在节点树中排列一组单词单词沿着从根节点到叶子节点的路径存储树的层次对应于前缀的字母位置。\r\n\r\n前缀的补全是顺着前缀定义的路径来查找的。例如在上图的前缀树中前缀 `ne` 对应于从子节点取左边缘 `N` 和唯一边缘 `E` 的路径。然后可以通过继续遍历从 `E` 节点可以达到的所有叶节点来生成补全列表。在图中,`ne` 的补全可以是两个分支:`-ed` 和 `-sted`。如果在数中找不到由前缀定义的路径,则说明词汇表中不包含以该前缀开头的单词。\r\n\r\n### 有限状态自动机(DFA)实现\r\n\r\n前缀树可以有效处理公共前缀但是对于其他共享词部分仍会分别存储在每个分支中。比如后缀 `ed`、`ing`、`tion` 在英文单词中特别常见。在上一个例子中,`e`、`d` 分别存放在了每一个分支上。\r\n\r\n有没有一种方法可以更加节省存储空间呢有的那就是 DFA。\r\n\r\n<center>\r\n<img src="https://gitee.com/yanglbme/resource/raw/master/doocs-md/dfa.gif" style="width: 50%;"></center>\r\n\r\n在上面的例子中单词 `need`、`nested`、`seed` 和 `speed` 仅由 9 个节点组成,而上一张图中的前缀树包含了 17 个节点。\r\n\r\n可以看出最小化前缀树 DFA 可以在很大程度上减少数据结构的大小。即使词汇量很大,最小化 DFA 通常也适合在内存中存储,避免昂贵的磁盘访问是实现快速自动补全的关键。\r\n\r\n### 一些扩展\r\n\r\n上面介绍了如何利用合理的数据结构实现基本的自动补全功能。这些数据结构可以通过多种方式进行扩展从而改善用户体验。\r\n\r\n通常满足特定前缀的词汇可能很多而用户界面上能够显示的却不多我们更希望能显示最常搜索或者最有价值的词汇。这通常可以通过为词汇表中的每个单词增加一个代表单词值的**权重** `weight`,并且按照权重高低来排序自动补全列表。\r\n\r\n- 对于排序后的词汇表来说,在词汇表每个元素上增加 `weight` 属性并不难;\r\n- 对于前缀树来说,将 `weight` 存储在叶子节点中,也是很简单的一个实现;\r\n- 对于 `DFA` 来说,则较为复杂。因为一个叶子节点可以通过多条路径到达。一种解决方案是将权重关联到路径而不是叶子节点。\r\n\r\n目前有不少开源库都提供了这个功能比如主流的搜索引擎框架 [Elasticsearch](https://www.elastic.co/products/elasticsearch)、[Solr](https://lucene.apache.org/solr/) 等,基于此,我们可以实现高效而强大的自动补全功能。\r\n\r\n#### 推荐阅读\r\n\r\n- [阿里又一个 20k+ stars 开源项目诞生,恭喜 fastjson](https://mp.weixin.qq.com/s/RNKDCK2KoyeuMeEs6GUrow)\r\n- [刷掉 90% 候选人的互联网大厂海量数据面试题(附题解 + 方法总结)](https://mp.weixin.qq.com/s/rjGqxUvrEqJNlo09GrT1Dw)\r\n- [好用!期待已久的文本块功能究竟如何在 Java 13 中发挥作用?](https://mp.weixin.qq.com/s/kalGv5T8AZGxTnLHr2wDsA)\r\n- [2019 GitHub 开源贡献排行榜新鲜出炉!微软谷歌领头,阿里跻身前 12](https://mp.weixin.qq.com/s/_q812aGD1b9QvZ2WFI0Qgw)\r\n\r\n---\r\n\r\n欢迎关注我的公众号“**Doocs 开源社区**”,原创技术文章第一时间推送。\r\n\r\n<center>\r\n <img src="https://gitee.com/yanglbme/resource/raw/master/doocs-md/qrcode.png" style="width: 100px;">\r\n</center>\r\n',E="/*\n 按Ctrl+F可格式化\n*/\n/* 一级标题样式 */\nh1 {\n}\n/* 二级标题样式 */\nh2 {\n}\n/* 三级标题样式 */\nh3 {\n}\n/* 四级标题样式 */\nh4 {\n}\n/* 图片样式 */\nimage {\n}\n/* 引用样式 */\nblockquote {\n}\n/* 引用段落样式 */\nblockquote_p {\n}\n/* 段落样式 */\np {\n}\n/* 分割线样式 */\nhr {\n}\n/* 行内代码样式 */\ncodespan {\n}\n/* 粗体样式 */\nstrong {\n}\n/* 链接样式 */\nlink {\n}\n/* 微信链接样式 */\nwx_link {\n}\n/* 有序列表样式 */\nol {\n}\n/* 无序列表样式 */\nul {\n}\n/* 列表项样式 */\nli {\n}\n/* 代码块样式 */\ncode {\n}\n",y=o("3835"),S=(o("e9c4"),o("4160"),o("159b"),o("498a"),o("4de4"),o("b64b"),o("fb6a"),o("2b3d"),o("9861"),o("a630"),o("caad"),o("2532"),o("00b4"),o("b0c0"),o("4fadc"),o("4e82"),o("466d"),"#3f3f3f"),w={BASE:{"text-align":"left","line-height":"1.75"},block:{h1:{"font-size":"1.2em","text-align":"center","font-weight":"bold",display:"table",margin:"2em auto 1em",padding:"0 1em","border-bottom":"2px solid rgba(0, 152, 116, 0.9)",color:S},h2:{"font-size":"1.2em","text-align":"center","font-weight":"bold",display:"table",margin:"4em auto 2em",padding:"0 0.2em",background:"rgba(0, 152, 116, 0.9)",color:"#fff"},h3:{"font-weight":"bold","font-size":"1.1em",margin:"2em 8px 0.75em 0","line-height":"1.2","padding-left":"8px","border-left":"3px solid rgba(0, 152, 116, 0.9)",color:S},h4:{"font-weight":"bold","font-size":"1em",margin:"2em 8px 0.5em",color:"rgba(66, 185, 131, 0.9)"},p:{margin:"1.5em 8px","letter-spacing":"0.1em",color:S},blockquote:{"font-style":"normal","border-left":"none",padding:"1em","border-radius":"8px",color:"rgba(0,0,0,0.5)",background:"#f7f7f7",margin:"2em 8px"},blockquote_p:{"letter-spacing":"0.1em",color:"rgb(80, 80, 80)","font-size":"1em",display:"block"},code_pre:{"font-size":"14px","overflow-x":"auto","border-radius":"8px",padding:"1em","line-height":"1.5",margin:"10px 8px"},code:{margin:0,"white-space":"nowrap","font-family":"Menlo, Operator Mono, Consolas, Monaco, monospace"},image:{"border-radius":"4px",display:"block",margin:"0.1em auto 0.5em",width:"100% !important"},ol:{"margin-left":"0","padding-left":"1em",color:S},ul:{"margin-left":"0","padding-left":"1em","list-style":"circle",color:S},footnotes:{margin:"0.5em 8px","font-size":"80%",color:S},figure:{margin:"1.5em 8px",color:S},hr:{"border-style":"solid","border-width":"1px 0 0","border-color":"rgba(0,0,0,0.1)","-webkit-transform-origin":"0 0","-webkit-transform":"scale(1, 0.5)","transform-origin":"0 0",transform:"scale(1, 0.5)"}},inline:{listitem:{"text-indent":"-1em",display:"block",margin:"0.2em 8px",color:S},codespan:{"font-size":"90%","white-space":"pre",color:"#d14",background:"rgba(27,31,35,.05)",padding:"3px 5px","border-radius":"4px"},link:{color:"#576b95"},wx_link:{color:"#576b95","text-decoration":"none"},strong:{color:"rgba(15, 76, 129, 0.9)","font-weight":"bold"},table:{"border-collapse":"collapse","text-align":"center",margin:"1em 8px",color:S},thead:{background:"rgba(0, 0, 0, 0.05)","font-weight":"bold",color:S},td:{border:"1px solid #dfdfdf",padding:"0.25em 0.5em",color:S},footnote:{"font-size":"12px",color:S},figcaption:{"text-align":"center",color:"#888","font-size":"0.8em"}}},x=o("325b"),M=o.n(x),T=o("4fc3"),D=o.n(T),j=o("d238"),P=o.n(j);function I(e){return function(t){var o=JSON.parse(JSON.stringify(e));return o.block.h1["border-bottom"]="2px solid ".concat(t),o.block.h2["background"]=t,o.block.h3["border-left"]="3px solid ".concat(t),o.block.h4["color"]=t,o.inline.strong["color"]=t,o}}var A=function(e,t){var o=JSON.parse(JSON.stringify(e));return o.block.h1["border-bottom"]="2px solid ".concat(t),o.block.h2["background"]=t,o.block.h3["border-left"]="3px solid ".concat(t),o.block.h4["color"]=t,o.inline.strong["color"]=t,o};function R(e){return function(t){var o=JSON.parse(JSON.stringify(e));return o.block.h1["font-size"]="".concat(1.14*t,"px"),o.block.h2["font-size"]="".concat(1.1*t,"px"),o.block.h3["font-size"]="".concat(t,"px"),o.block.h4["font-size"]="".concat(t,"px"),o}}var U=I(w),K=R(w);function L(e,t,o){var n=JSON.parse(JSON.stringify(o));return n.block.h1["border-bottom"]="2px solid ".concat(t),n.block.h2["background"]=t,n.block.h3["border-left"]="3px solid ".concat(t),n.block.h4["color"]=t,n.inline.strong["color"]=t,n.block.h1=Object.assign(n.block.h1,e.h1),n.block.h2=Object.assign(n.block.h2,e.h2),n.block.h3=Object.assign(n.block.h3,e.h3),n.block.h4=Object.assign(n.block.h4,e.h4),n.block.code=Object.assign(n.block.code,e.code),n.block.p=Object.assign(n.block.p,e.p),n.block.hr=Object.assign(n.block.hr,e.hr),n.block.blockquote=Object.assign(n.block.blockquote,e.blockquote),n.block.blockquote_p=Object.assign(n.block.blockquote_p,e.blockquote_p),n.block.image=Object.assign(n.block.image,e.image),n.inline.strong=Object.assign(n.inline.strong,e.strong),n.inline.codespan=Object.assign(n.inline.codespan,e.codespan),n.inline.link=Object.assign(n.inline.link,e.link),n.inline.wx_link=Object.assign(n.inline.wx_link,e.wx_link),n.block.ul=Object.assign(n.block.ul,e.ul),n.block.ol=Object.assign(n.block.ol,e.ol),n.inline.listitem=Object.assign(n.inline.listitem,e.li),n}function B(e){var t,o;while(-1!==(t=e.indexOf("/*"))&&-1!==(o=e.indexOf("*/")))e=e.substring(0,t)+e.substring(o+2);var n={},r=function(){var t=e.indexOf("{"),o=e.indexOf("}");function r(e){var t={};return e.forEach((function(e){var o=e.indexOf(":"),n=e.substring(0,o).trim(),r=e.substring(o+1).trim();t[n]=r})),t}var i=e.substring(t+1,o).split(";").map((function(e){return e.trim()})).filter((function(e){return e.length>0}));i=r(i);var a=e.substring(0,t).split(",").map((function(e){return e.trim()}));a.forEach((function(e){n[e]||(n[e]={}),Object.keys(i).forEach((function(t){n[e][t]=i[t]}))})),e=e.slice(o+1).trim()};while(e.length>0&&-1!==e.indexOf("{")&&-1!==e.indexOf("}"))r();return n}function $(e,t){var o=e.getValue(0);o?localStorage.setItem(t,o):localStorage.removeItem(t)}function q(e){var t=M.a.format(e,{parser:"markdown",plugins:[D.a]});return t}function W(e){var t=M.a.format(e,{parser:"css",plugins:[P.a]});return t}function G(e){var t=document.createElement("a");t.download="content.md",t.style.display="none";var o=new Blob([e]);t.href=URL.createObjectURL(o),document.body.appendChild(t),t.click(),document.body.removeChild(t)}function F(){var e=document.querySelector("#output");r(e);var t=e.innerHTML,o=document.createElement("a");o.download="content.html",o.style.display="none";var n=new Blob(['<html><head><meta charset="utf-8" /></head><body><div style="width: 750px; margin: auto;">'.concat(t,"</div></body></html>")]);function r(e){switch(!0){case t(e):case o(e):case n(e):e.setAttribute("style",V(e));default:}function t(e){return"PRE"===e.tagName&&Array.from(e.classList).includes("code__pre")}function o(e){return"CODE"===e.tagName&&Array.from(e.classList).includes("prettyprint")}function n(e){return"SPAN"===e.tagName&&(o(e.parentElement)||o(e.parentElement.parentElement))}e.children.length&&Array.from(e.children).forEach((function(e){return r(e)}))}o.href=URL.createObjectURL(n),document.body.appendChild(o),o.click(),document.body.removeChild(o)}function z(e){for(var t=e.data,o=e.rows,n=e.cols,r="",i=[],a=0;a<o+2;++a){r+="|\t",i=[];for(var s=0;s<n;++s){var c=a>1?a-1:a;1===a?i.push("---\t"):i.push(t["k_".concat(c,"_").concat(s)]||"")}r+=i.join("\t|\t"),r+="\t|\n"}return r}var H=function(e){return new Promise((function(t,o){var n=new FileReader;n.readAsDataURL(e),n.onload=function(){return t(n.result.split(",").pop())},n.onerror=function(e){return o(e)}}))};function N(e){var t=/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(e.name);if(!t)return{ok:!1,msg:"请上传 JPG/PNG/GIF 格式的图片"};var o=10,n=e.size/1024/1024<=o;return n?{ok:!0}:{ok:!1,msg:"由于公众号限制,图片大小不能超过 ".concat(o,"M")}}function V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height"],o=getComputedStyle(e,null);return Object.entries(o).filter((function(e){var n=Object(y["a"])(e,1),r=n[0];return o.getPropertyValue(r)&&!t.includes(r)})).map((function(e){var t=Object(y["a"])(e,2),o=t[0],n=t[1];return"".concat(o,":").concat(n,";")})).join("")}function Q(e){var t=e.split("\n"),o=t.filter((function(e){return e.trim()})).map((function(e){return e.match(/(^\s+)?/)[0].length})).sort((function(e,t){return e-t}))[0],n=t.map((function(e){return e.slice(o)})).join("\n");return n}r["default"].use(d["a"]);var J={wxRenderer:null,output:"",html:"",editor:null,cssEditor:null,currentFont:"",currentSize:"",currentColor:"",citeStatus:0,nightMode:!1,codeTheme:_.codeThemeOption[0].value,rightClickMenuVisible:!1},Y={setEditorValue:function(e,t){e.editor.setValue(t)},setCssEditorValue:function(e,t){e.cssEditor.setValue(t)},setWxRendererOptions:function(e,t){e.wxRenderer.setOptions(t)},setCiteStatus:function(e,t){e.citeStatus=t,localStorage.setItem("citeStatus",t)},setCurrentFont:function(e,t){e.currentFont=t,localStorage.setItem("fonts",t)},setCurrentSize:function(e,t){e.currentSize=t,localStorage.setItem("size",t)},setCurrentColor:function(e,t){e.currentColor=t,localStorage.setItem("color",t)},setCurrentCodeTheme:function(e,t){e.codeTheme=t,localStorage.setItem("codeTheme",t)},setRightClickMenuVisible:function(e,t){e.rightClickMenuVisible=t},themeChanged:function(e){e.nightMode=!e.nightMode,localStorage.setItem("nightMode",e.nightMode)},initEditorState:function(e){e.currentFont=localStorage.getItem("fonts")||_.builtinFonts[0].value,e.currentColor=localStorage.getItem("color")||_.colorOption[0].value,e.currentSize=localStorage.getItem("size")||_.sizeOption[2].value,e.codeTheme=localStorage.getItem("codeTheme")||_.codeThemeOption[0].value,e.citeStatus="true"===localStorage.getItem("citeStatus"),e.nightMode="true"===localStorage.getItem("nightMode"),e.wxRenderer=new C({theme:U(e.currentColor),fonts:e.currentFont,size:e.currentSize})},initEditorEntity:function(e){var t=document.getElementById("editor");t.value||(t.value=localStorage.getItem("__editor_content")||q(k)),e.editor=O.a.fromTextArea(t,{mode:"text/x-markdown",theme:"xq-light",lineNumbers:!1,lineWrapping:!0,styleActiveLine:!0,autoCloseBrackets:!0,extraKeys:{"Ctrl-F":function(e){var t=q(e.getValue(0));localStorage.setItem("__editor_content",t),e.setValue(t)},"Ctrl-S":function(e){},"Ctrl-B":function(e){var t=e.getSelection();e.replaceSelection("**".concat(t,"**"))},"Ctrl-D":function(e){var t=e.getSelection();e.replaceSelection("~~".concat(t,"~~"))},"Ctrl-I":function(e){var t=e.getSelection();e.replaceSelection("*".concat(t,"*"))}}})},initCssEditorEntity:function(e){var t=document.getElementById("cssEditor");t.value||(t.value=localStorage.getItem("__css_content")||E),e.cssEditor=O.a.fromTextArea(t,{mode:"css",theme:"style-mirror",lineNumbers:!1,lineWrapping:!0,matchBrackets:!0,autofocus:!0,extraKeys:{"Ctrl-F":function(e){var t=W(e.getValue(0));localStorage.setItem("__css_content",t),e.setValue(t)},"Ctrl-S":function(e){}}})},editorRefresh:function(e){var t=e.wxRenderer.getRenderer(e.citeStatus);p["marked"].setOptions({renderer:t});var o=p["marked"].parse(e.editor.getValue(0));o=o.replace(/(style=".*?)"/,'$1;margin-top: 0"'),e.citeStatus&&(o+=e.wxRenderer.buildFootnotes(),o+=e.wxRenderer.buildAddition()),e.output=o}},Z=new d["a"].Store({state:J,mutations:Y,actions:{}}),X=o("5c96"),ee=o.n(X);o("0fae");r["default"].component(X["Message"].name,X["Message"]),r["default"].prototype.$loading=X["Loading"].service,r["default"].prototype.$message=X["Message"];o("a7be"),o("8d7e"),o("7b00"),o("959b"),o("10b2"),o("8c33"),o("31c5"),o("9b74"),o("111b");var te=o("8c4f"),oe=function(){var e=this,t=e.$createElement,o=e._self._c||t;return e.loading?o("transition",{attrs:{name:"fade"}},[o("loading")],1):o("codemirror-editor")},ne=[],re=(o("4795"),o("3a5e")),ie=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"container",class:{container_night:e.nightMode}},[o("el-container",[o("el-header",{staticClass:"editor__header"},[o("editor-header",{ref:"header",on:{refresh:e.onEditorRefresh,cssChanged:e.cssChanged,download:e.downloadEditorContent,export:e.exportEditorContent,showCssEditor:function(t){e.showCssEditor=!e.showCssEditor},"show-about-dialog":function(t){e.aboutDialogVisible=!0},"show-dialog-form":function(t){e.dialogFormVisible=!0},"show-dialog-upload-img":function(t){e.dialogUploadImgVisible=!0},startCopy:function(t){e.isCoping=!0,e.backLight=!0},endCopy:e.endCopy}})],1),o("el-main",{staticClass:"main-body"},[o("el-row",{staticClass:"main-section"},[o("el-col",{staticClass:"codeMirror-wrapper",attrs:{span:12},nativeOn:{contextmenu:function(t){return t.preventDefault(),e.openMenu(t)}}},[o("textarea",{directives:[{name:"model",rawName:"v-model",value:e.source,expression:"source"}],attrs:{id:"editor",type:"textarea",placeholder:"Your markdown text here."},domProps:{value:e.source},on:{input:function(t){t.target.composing||(e.source=t.target.value)}}})]),o("el-col",{ref:"preview",staticClass:"preview-wrapper",class:{"preview-wrapper_night":e.nightMode&&e.isCoping},attrs:{span:12,id:"preview"}},[o("section",{class:{output_night:e.nightMode&&!e.backLight},attrs:{id:"output-wrapper"}},[o("div",{staticClass:"preview"},[o("section",{attrs:{id:"output"},domProps:{innerHTML:e._s(e.output)}}),e.nightMode&&e.isCoping?o("div",{staticClass:"loading-mask"},[o("div",{staticClass:"loading__img"}),o("span",[e._v("正在生成")])]):e._e()])])]),o("transition",{attrs:{name:"custom-classes-transition","enter-active-class":"bounceInRight"}},[o("el-col",{directives:[{name:"show",rawName:"v-show",value:e.showCssEditor,expression:"showCssEditor"}],staticClass:"cssEditor-wrapper",attrs:{id:"cssBox",span:12}},[o("textarea",{attrs:{id:"cssEditor",type:"textarea",placeholder:"Your custom css here."}})])],1)],1)],1)],1),o("upload-img-dialog",{on:{close:function(t){e.dialogUploadImgVisible=!1},beforeUpload:e.beforeUpload,uploadImage:e.uploadImage,uploaded:e.uploaded},model:{value:e.dialogUploadImgVisible,callback:function(t){e.dialogUploadImgVisible=t},expression:"dialogUploadImgVisible"}}),o("about-dialog",{model:{value:e.aboutDialogVisible,callback:function(t){e.aboutDialogVisible=t},expression:"aboutDialogVisible"}}),o("insert-form-dialog",{model:{value:e.dialogFormVisible,callback:function(t){e.dialogFormVisible=t},expression:"dialogFormVisible"}}),o("right-click-menu",{attrs:{left:e.mouseLeft,top:e.mouseTop},on:{menuTick:e.onMenuEvent,closeMenu:e.closeRightClickMenu},model:{value:e.rightClickMenuVisible,callback:function(t){e.rightClickMenuVisible=t},expression:"rightClickMenuVisible"}})],1)},ae=[],se=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-container",{staticClass:"top is-dark"},[o("div",{staticClass:"left-side"},[o("el-tooltip",{attrs:{effect:e.effect,content:"上传图片",placement:"bottom-start"}},[o("i",{staticClass:"el-icon-upload",attrs:{size:"medium"},on:{click:function(t){return e.$emit("show-dialog-upload-img")}}})]),o("el-tooltip",{staticClass:"header__item",attrs:{effect:e.effect,content:"导出 Markdown 文档",placement:"bottom-start"}},[o("i",{staticClass:"el-icon-download",attrs:{size:"medium"},on:{click:function(t){return e.$emit("download")}}})]),o("el-tooltip",{staticClass:"header__item",attrs:{effect:e.effect,content:"导出 HTML 页面",placement:"bottom-start"}},[o("i",{staticClass:"el-icon-document",attrs:{size:"medium"},on:{click:function(t){return e.$emit("export")}}})]),o("el-tooltip",{staticClass:"header__item",attrs:{effect:e.effect,content:"重置样式",placement:"bottom-start"}},[o("i",{staticClass:"el-icon-refresh",attrs:{size:"medium"},on:{click:function(t){e.showResetConfirm=!0}}})]),o("el-tooltip",{staticClass:"header__item header__item_last",attrs:{effect:e.effect,content:"插入表格",placement:"bottom-start"}},[o("i",{staticClass:"el-icon-s-grid",attrs:{size:"medium"},on:{click:function(t){return e.$emit("show-dialog-form")}}})]),o("el-select",{attrs:{size:"mini",placeholder:"选择字体",clearable:""},on:{change:e.fontChanged},model:{value:e.selectFont,callback:function(t){e.selectFont=t},expression:"selectFont"}},e._l(e.config.builtinFonts,(function(t){return o("el-option",{key:t.value,style:{fontFamily:t.value},attrs:{label:t.label,value:t.value}},[o("span",{staticClass:"select-item-left"},[e._v(e._s(t.label))]),o("span",{staticClass:"select-item-right"},[e._v("Abc")])])})),1),o("el-select",{attrs:{size:"mini",placeholder:"选择段落字号",clearable:""},on:{change:e.sizeChanged},model:{value:e.selectSize,callback:function(t){e.selectSize=t},expression:"selectSize"}},e._l(e.config.sizeOption,(function(t){return o("el-option",{key:t.value,attrs:{label:t.label,value:t.value}},[o("span",{staticClass:"select-item-left"},[e._v(e._s(t.label))]),o("span",{staticClass:"select-item-right"},[e._v(e._s(t.desc))])])})),1),o("el-select",{attrs:{size:"mini",placeholder:"选择颜色",clearable:""},on:{change:e.colorChanged},model:{value:e.selectColor,callback:function(t){e.selectColor=t},expression:"selectColor"}},e._l(e.config.colorOption,(function(t){return o("el-option",{key:t.value,attrs:{label:t.label,value:t.value}},[o("span",{staticClass:"select-item-left"},[e._v(e._s(t.label))]),o("span",{staticClass:"select-item-right"},[e._v(e._s(t.desc))])])})),1),o("el-select",{attrs:{size:"mini",placeholder:"代码主题"},on:{change:e.codeThemeChanged},model:{value:e.selectCodeTheme,callback:function(t){e.selectCodeTheme=t},expression:"selectCodeTheme"}},e._l(e.config.codeThemeOption,(function(t){return o("el-option",{key:t.value,attrs:{label:t.label,value:t.value}},[o("span",{staticClass:"select-item-left"},[e._v(e._s(t.label))]),o("span",{staticClass:"select-item-right"},[e._v(e._s(t.desc))])])})),1),o("el-tooltip",{attrs:{content:"自定义颜色",effect:e.effect,placement:"top"}},[o("el-color-picker",{attrs:{size:"mini","show-alpha":""},on:{change:e.colorChanged},model:{value:e.selectColor,callback:function(t){e.selectColor=t},expression:"selectColor"}})],1),o("el-tooltip",{attrs:{content:"微信外链自动转为文末引用",effect:e.effect,placement:"top"}},[o("el-switch",{staticClass:"header__switch",attrs:{"active-color":"#67c23a","inactive-color":"#dcdfe6"},on:{change:e.statusChanged},model:{value:e.citeStatus,callback:function(t){e.citeStatus=t},expression:"citeStatus"}})],1)],1),o("div",{staticClass:"right-side"},[o("el-tooltip",{staticClass:"item",attrs:{effect:e.effect,content:"自定义CSS样式",placement:"left"}},[o("el-button",{attrs:{type:e.btnType,plain:"",size:"medium",icon:"el-icon-setting"},on:{click:e.customStyle}})],1),o("el-button",{attrs:{type:e.btnType,plain:"",size:"medium",placement:"bottom-start"},on:{click:e.copy}},[e._v("复制")]),o("el-button",{staticClass:"about",attrs:{type:e.btnType,plain:"",size:"medium"},on:{click:function(t){return e.$emit("show-about-dialog")}}},[e._v("关于")]),o("el-tooltip",{attrs:{content:e.btnContent,effect:e.effect,placement:"bottom-start"}},[e.nightMode?o("div",{staticClass:"mode__switch mode__switch_black",on:{click:e.themeChanged}}):o("div",{staticClass:"mode__switch",on:{click:e.themeChanged}})])],1),o("resetDialog",{attrs:{showResetConfirm:e.showResetConfirm},on:{confirm:e.confirmReset,close:e.cancelReset}})],1)},ce=[],le=o("1da1"),ue=(o("96cf"),o("466b")),de=o.n(ue);function _e(){for(var e=document.getElementById("output"),t=e.getElementsByTagName("img"),o=0;o<t.length;o++){var n=t[o],r=n.getAttribute("width"),i=n.getAttribute("height");n.removeAttribute("width"),n.removeAttribute("height"),n.style.width=r,n.style.height=i}}function me(){var e=document.getElementById("output-wrapper"),t=e.innerHTML,o="";return o=de.a.inlineContent(t,{inlinePseudoElements:!0,preserveImportant:!0}),o}var fe=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-dialog",{staticClass:"reset__dialog",attrs:{title:"提示",visible:e.showResetConfirm},on:{close:function(t){return e.$emit("close")}}},[o("div",{staticClass:"text"},[e._v("此操作将丢失本地自定义样式,是否继续?")]),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{type:e.btnType,plain:""},on:{click:function(t){return e.$emit("close")}}},[e._v("取 消")]),o("el-button",{attrs:{type:e.btnType,plain:""},on:{click:function(t){return e.$emit("confirm")}}},[e._v("确 定")])],1)])},pe=[],ge={props:{showResetConfirm:{type:Boolean,default:!1}},computed:Object(n["a"])({btnType:function(){return this.nightMode?"default":"primary"}},Object(d["c"])({nightMode:function(e){return e.nightMode}}))},he=ge,be=(o("1280"),Object(s["a"])(he,fe,pe,!1,null,"0e0dc0ee",null)),Ce=be.exports,ve={name:"editor-header",data:function(){return{config:_,citeStatus:!1,showResetConfirm:!1,selectFont:"",selectSize:"",selectColor:"",selectCodeTheme:_.codeThemeOption[0].value}},components:{resetDialog:Ce},computed:Object(n["a"])({effect:function(){return this.nightMode?"dark":"light"},btnContent:function(){return this.nightMode?"浅色模式":"暗黑模式"},btnType:function(){return this.nightMode?"default":"primary"}},Object(d["c"])({output:function(e){return e.output},editor:function(e){return e.editor},cssEditor:function(e){return e.cssEditor},currentFont:function(e){return e.currentFont},currentSize:function(e){return e.currentSize},currentColor:function(e){return e.currentColor},codeTheme:function(e){return e.codeTheme},nightMode:function(e){return e.nightMode},currentCiteStatus:function(e){return e.citeStatus}})),methods:Object(n["a"])({fontChanged:function(e){this.setWxRendererOptions({fonts:e}),this.setCurrentFont(e),this.$emit("refresh")},sizeChanged:function(e){var t=K(e.replace("px",""));t=A(t,this.currentColor),this.setWxRendererOptions({size:e,theme:t}),this.setCurrentSize(e),this.$emit("refresh")},colorChanged:function(e){var t=K(this.currentSize.replace("px",""));t=A(t,e),this.setWxRendererOptions({theme:t}),this.setCurrentColor(e),this.$emit("refresh")},codeThemeChanged:function(e){this.setCurrentCodeTheme(e),this.$emit("refresh")},statusChanged:function(e){this.setCiteStatus(e),this.$emit("refresh")},copy:function(e){var t=this;this.$emit("startCopy"),setTimeout((function(){var e=document.getElementById("output");_e(),me(),e.focus(),window.getSelection().removeAllRanges();var o=document.createRange();o.setStartBefore(e.firstChild),o.setEndAfter(e.lastChild),window.getSelection().addRange(o),document.execCommand("copy"),window.getSelection().removeAllRanges(),e.innerHTML=t.output,t.$notify({showClose:!0,message:"已复制渲染后的文章到剪贴板,可直接到公众号后台粘贴",offset:80,duration:1600,type:"success"}),t.$emit("refresh"),t.$emit("endCopy")}),350)},customStyle:function(){var e=this;return Object(le["a"])(regeneratorRuntime.mark((function t(){var o;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.$emit("showCssEditor"),e.$nextTick((function(){e.cssEditor||e.cssEditor.refresh()})),setTimeout((function(){e.cssEditor.refresh()}),50),t.next=5,localStorage.getItem("__css_content");case 5:o=t.sent,o||e.setCssEditorValue(E);case 7:case"end":return t.stop()}}),t)})))()},confirmReset:function(){localStorage.clear(),this.cssEditor.setValue(E),this.citeStatus=!1,this.statusChanged(!1),this.fontChanged(this.config.builtinFonts[0].value),this.colorChanged(this.config.colorOption[0].value),this.sizeChanged(this.config.sizeOption[2].value),this.codeThemeChanged(this.config.codeThemeOption[0].value),this.$emit("cssChanged"),this.selectFont=this.currentFont,this.selectSize=this.currentSize,this.selectColor=this.currentColor,this.showResetConfirm=!1,this.selectCodeTheme=this.codeTheme},cancelReset:function(){this.showResetConfirm=!1,this.editor.focus()}},Object(d["b"])(["setCurrentColor","setCiteStatus","themeChanged","setCurrentFont","setCurrentSize","setCssEditorValue","setCurrentCodeTheme","setWxRendererOptions"])),mounted:function(){this.selectFont=this.currentFont,this.selectSize=this.currentSize,this.selectColor=this.currentColor,this.selectCodeTheme=this.codeTheme,this.citeStatus=this.currentCiteStatus}},Oe=ve,ke=(o("f265"),Object(s["a"])(Oe,se,ce,!1,null,"20f359ed",null)),Ee=ke.exports,ye=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-dialog",{staticClass:"about__dialog",attrs:{title:"关于",visible:e.value,width:"30%",center:""},on:{close:function(t){return e.$emit("input",!1)}}},[o("div",{staticStyle:{"text-align":"center"}},[o("h3",[e._v("一款高度简洁的微信 Markdown 编辑器")])]),o("div",{staticStyle:{"text-align":"center","margin-top":"10px"}},[o("p",[e._v("扫码关注我的公众号,原创技术文章第一时间推送!")]),o("img",{staticStyle:{width:"40%",display:"block",margin:"20px auto 10px"},attrs:{src:"https://gitee.com/yanglbme/resource/raw/master/doocs-md/qrcode.png"}})]),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{type:"primary",plain:""},on:{click:function(t){return e.onRedirect("https://github.com/doocs/md")}}},[e._v("GitHub 仓库")]),o("el-button",{attrs:{type:"primary",plain:""},on:{click:function(t){return e.onRedirect("https://gitee.com/doocs/md")}}},[e._v("Gitee 仓库")])],1)])},Se=[],we={props:{value:{type:Boolean,default:!1}},methods:{onRedirect:function(e){window.open(e)}}},xe=we,Me=(o("c081"),Object(s["a"])(xe,ye,Se,!1,null,"70c50907",null)),Te=Me.exports,De=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-dialog",{staticClass:"insert__dialog",attrs:{title:"插入表格",visible:e.value,border:""},on:{close:function(t){return e.$emit("input",!1)}}},[o("el-row",{staticClass:"tb-options",attrs:{type:"flex",align:"middle",gutter:10}},[o("el-col",[e._v(" 行数: "),o("el-input-number",{attrs:{"controls-position":"right",min:1,max:100,size:"small"},model:{value:e.rowNum,callback:function(t){e.rowNum=t},expression:"rowNum"}})],1),o("el-col",[e._v(" 列数: "),o("el-input-number",{attrs:{"controls-position":"right",min:1,max:100,size:"small"},model:{value:e.colNum,callback:function(t){e.colNum=t},expression:"colNum"}})],1)],1),o("table",{staticClass:"input-table",staticStyle:{"border-collapse":"collapse"}},e._l(e.rowNum+1,(function(t){return o("tr",{key:t,class:{"head-style":1===t}},e._l(e.colNum,(function(n){return o("td",{key:n},[o("el-input",{attrs:{align:"center",placeholder:1===t?"表头":""},model:{value:e.tableData["k_"+(t-1)+"_"+(n-1)],callback:function(o){e.$set(e.tableData,"k_"+(t-1)+"_"+(n-1),o)},expression:"tableData[`k_${row - 1}_${col - 1}`]"}})],1)})),0)})),0),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{type:e.btnType,plain:""},on:{click:function(t){return e.$emit("input",!1)}}},[e._v("取 消")]),o("el-button",{attrs:{type:e.btnType,plain:""},on:{click:e.insertTable}},[e._v("确 定")])],1)],1)},je=[],Pe={props:{value:{type:Boolean,default:!1}},data:function(){return{config:_,rowNum:3,colNum:3,tableData:{}}},computed:Object(n["a"])({btnType:function(){return this.nightMode?"default":"primary"}},Object(d["c"])({nightMode:function(e){return e.nightMode},editor:function(e){return e.editor}})),methods:Object(n["a"])({insertTable:function(){this.editor.getCursor();var e=z({data:this.tableData,rows:this.rowNum,cols:this.colNum});this.tableData={},this.rowNum=3,this.colNum=3,this.editor.replaceSelection("\n".concat(e,"\n"),"end"),this.$emit("input",!1),this.editorRefresh()}},Object(d["b"])(["editorRefresh"]))},Ie=Pe,Ae=(o("64e1"),Object(s["a"])(Ie,De,je,!1,null,"4dd4e7e2",null)),Re=Ae.exports,Ue=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("ul",{directives:[{name:"show",rawName:"v-show",value:e.value,expression:"value"}],staticClass:"menu",style:"left: "+e.left+"px;top: "+e.top+"px;",attrs:{id:"menu"}},e._l(e.menu,(function(t,n){return o("div",{key:n,staticClass:"menu__group"},e._l(t,(function(t){return o("li",{key:t.key,staticClass:"menu_item",on:{mousedown:function(o){return e.onMouseDown(t.key)}}},[o("span",[e._v(e._s(t.text))])])})),0)})),0)},Ke=[],Le=(o("a9e3"),{props:{value:{type:Boolean,default:!1},top:{type:Number,default:0},left:{type:Number,default:0}},data:function(){return{menu:[[{text:"上传图片",key:"insertPic"},{text:"插入表格",key:"insertTable"},{text:"恢复默认样式",key:"resetStyle"}],[{text:"导入 Markdown 文档",key:"importMarkdown"},{text:"导出 Markdown 文档",key:"download"},{text:"导出 HTML 页面",key:"export"},{text:"格式化 Markdown 文档",key:"formatMarkdown"}]]}},methods:{closeCB:function(){this.$emit("input",!1)},onMouseDown:function(e){this.$emit("menuTick",e),this.$emit("closeMenu",!1)}}}),Be=Le,$e=(o("8166"),Object(s["a"])(Be,Ue,Ke,!1,null,"0a3b7c09",null)),qe=$e.exports,We=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("el-dialog",{staticClass:"upload__dialog",attrs:{title:"本地上传",visible:e.value},on:{close:function(t){return e.$emit("close")}}},[o("el-tabs",{attrs:{type:"activeName"},model:{value:e.activeName,callback:function(t){e.activeName=t},expression:"activeName"}},[o("el-tab-pane",{staticClass:"upload-panel",attrs:{label:"选择上传",name:"upload"}},[o("el-select",{attrs:{placeholder:"请选择",size:"small"},on:{change:e.changeImgHost},model:{value:e.imgHost,callback:function(t){e.imgHost=t},expression:"imgHost"}},e._l(e.options,(function(e){return o("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1),o("el-upload",{attrs:{drag:"",action:"",headers:{"Content-Type":"multipart/form-data"},"show-file-list":!1,multiple:!0,accept:".jpg, .jpeg, .png, .gif",name:"file","before-upload":e.beforeImageUpload,"http-request":e.uploadImage}},[o("i",{staticClass:"el-icon-upload"}),o("div",{staticClass:"el-upload__text"},[e._v(" 将图片拖到此处,或 "),o("em",[e._v("点击上传")])])])],1),o("el-tab-pane",{staticClass:"github-panel",attrs:{label:"Gitee 图床",name:"gitee"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formGitee,"label-position":"right","label-width":"140px"}},[o("el-form-item",{attrs:{label:"Gitee 仓库",required:!0}},[o("el-input",{attrs:{placeholder:"如gitee.com/yanglbme/resource"},model:{value:e.formGitee.repo,callback:function(t){e.$set(e.formGitee,"repo","string"===typeof t?t.trim():t)},expression:"formGitee.repo"}})],1),o("el-form-item",{attrs:{label:"分支"}},[o("el-input",{attrs:{placeholder:"如release可不填默认 master"},model:{value:e.formGitee.branch,callback:function(t){e.$set(e.formGitee,"branch","string"===typeof t?t.trim():t)},expression:"formGitee.branch"}})],1),o("el-form-item",{attrs:{label:"私人令牌",required:!0}},[o("el-input",{attrs:{"show-password":"",placeholder:"如cc1d0c1426d0fd0902bd2d7184b14da61b8abc46"},model:{value:e.formGitee.accessToken,callback:function(t){e.$set(e.formGitee,"accessToken","string"===typeof t?t.trim():t)},expression:"formGitee.accessToken"}}),o("el-link",{attrs:{type:"primary",href:"https://gitee.com/profile/personal_access_tokens",target:"_blank"}},[e._v("请在 Gitee「设置->安全设置->私人令牌」中生成")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.saveGiteeConfiguration}},[e._v("保存配置")])],1)],1)],1),o("el-tab-pane",{staticClass:"github-panel",attrs:{label:"GitHub 图床",name:"github"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formGitHub,"label-position":"right","label-width":"140px"}},[o("el-form-item",{attrs:{label:"GitHub 仓库",required:!0}},[o("el-input",{attrs:{placeholder:"如github.com/yanglbme/resource"},model:{value:e.formGitHub.repo,callback:function(t){e.$set(e.formGitHub,"repo","string"===typeof t?t.trim():t)},expression:"formGitHub.repo"}})],1),o("el-form-item",{attrs:{label:"分支"}},[o("el-input",{attrs:{placeholder:"如release可不填默认 master"},model:{value:e.formGitHub.branch,callback:function(t){e.$set(e.formGitHub,"branch","string"===typeof t?t.trim():t)},expression:"formGitHub.branch"}})],1),o("el-form-item",{attrs:{label:"Token",required:!0}},[o("el-input",{attrs:{"show-password":"",placeholder:"如cc1d0c1426d0fd0902bd2d7184b14da61b8abc46"},model:{value:e.formGitHub.accessToken,callback:function(t){e.$set(e.formGitHub,"accessToken","string"===typeof t?t.trim():t)},expression:"formGitHub.accessToken"}}),o("el-link",{attrs:{type:"primary",href:"https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token",target:"_blank"}},[e._v("如何获取 GitHub Token")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.saveGitHubConfiguration}},[e._v("保存配置")])],1)],1)],1),o("el-tab-pane",{staticClass:"github-panel",attrs:{label:"阿里云 OSS",name:"aliOSS"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formAliOSS,"label-position":"right","label-width":"140px"}},[o("el-form-item",{attrs:{label:"AccessKey ID",required:!0}},[o("el-input",{attrs:{placeholder:"如LTAI4GdoocsmdoxUf13ylbaNHk"},model:{value:e.formAliOSS.accessKeyId,callback:function(t){e.$set(e.formAliOSS,"accessKeyId","string"===typeof t?t.trim():t)},expression:"formAliOSS.accessKeyId"}})],1),o("el-form-item",{attrs:{label:"AccessKey Secret",required:!0}},[o("el-input",{attrs:{"show-password":"",placeholder:"如cc1d0c142doocs0902bd2d7md4b14da6ylbabc46"},model:{value:e.formAliOSS.accessKeySecret,callback:function(t){e.$set(e.formAliOSS,"accessKeySecret","string"===typeof t?t.trim():t)},expression:"formAliOSS.accessKeySecret"}})],1),o("el-form-item",{attrs:{label:"Bucket",required:!0}},[o("el-input",{attrs:{placeholder:"如doocs"},model:{value:e.formAliOSS.bucket,callback:function(t){e.$set(e.formAliOSS,"bucket","string"===typeof t?t.trim():t)},expression:"formAliOSS.bucket"}})],1),o("el-form-item",{attrs:{label:"Bucket 所在区域",required:!0}},[o("el-input",{attrs:{placeholder:"如oss-cn-shenzhen"},model:{value:e.formAliOSS.region,callback:function(t){e.$set(e.formAliOSS,"region","string"===typeof t?t.trim():t)},expression:"formAliOSS.region"}})],1),o("el-form-item",{attrs:{label:"自定义 CDN 域名",required:!1}},[o("el-input",{attrs:{placeholder:"如https://imagecdn.alidaodao.com可不填"},model:{value:e.formAliOSS.cdnHost,callback:function(t){e.$set(e.formAliOSS,"cdnHost","string"===typeof t?t.trim():t)},expression:"formAliOSS.cdnHost"}})],1),o("el-form-item",{attrs:{label:"存储路径"}},[o("el-input",{attrs:{placeholder:"如img可不填默认为根目录"},model:{value:e.formAliOSS.path,callback:function(t){e.$set(e.formAliOSS,"path","string"===typeof t?t.trim():t)},expression:"formAliOSS.path"}}),o("el-link",{attrs:{type:"primary",href:"https://help.aliyun.com/document_detail/31883.html",target:"_blank"}},[e._v("如何使用阿里云 OSS")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.saveAliOSSConfiguration}},[e._v("保存配置")])],1)],1)],1),o("el-tab-pane",{staticClass:"github-panel",attrs:{label:"腾讯云 COS",name:"txCOS"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formTxCOS,"label-position":"right","label-width":"140px"}},[o("el-form-item",{attrs:{label:"SecretId",required:!0}},[o("el-input",{attrs:{placeholder:"如AKIDnQp1w3DOOCSs8F5MDp9tdoocsmdUPonW3"},model:{value:e.formTxCOS.secretId,callback:function(t){e.$set(e.formTxCOS,"secretId","string"===typeof t?t.trim():t)},expression:"formTxCOS.secretId"}})],1),o("el-form-item",{attrs:{label:"SecretKey",required:!0}},[o("el-input",{attrs:{"show-password":"",placeholder:"如ukLmdtEJ9271f3DOocsMDsCXdS3YlbW0"},model:{value:e.formTxCOS.secretKey,callback:function(t){e.$set(e.formTxCOS,"secretKey","string"===typeof t?t.trim():t)},expression:"formTxCOS.secretKey"}})],1),o("el-form-item",{attrs:{label:"Bucket",required:!0}},[o("el-input",{attrs:{placeholder:"如doocs-3212520134"},model:{value:e.formTxCOS.bucket,callback:function(t){e.$set(e.formTxCOS,"bucket","string"===typeof t?t.trim():t)},expression:"formTxCOS.bucket"}})],1),o("el-form-item",{attrs:{label:"Bucket 所在区域",required:!0}},[o("el-input",{attrs:{placeholder:"如ap-guangzhou"},model:{value:e.formTxCOS.region,callback:function(t){e.$set(e.formTxCOS,"region","string"===typeof t?t.trim():t)},expression:"formTxCOS.region"}})],1),o("el-form-item",{attrs:{label:"自定义 CDN 域名",required:!1}},[o("el-input",{attrs:{placeholder:"如https://imagecdn.alidaodao.com可不填"},model:{value:e.formTxCOS.cdnHost,callback:function(t){e.$set(e.formTxCOS,"cdnHost","string"===typeof t?t.trim():t)},expression:"formTxCOS.cdnHost"}})],1),o("el-form-item",{attrs:{label:"存储路径"}},[o("el-input",{attrs:{placeholder:"如img可不填默认根目录"},model:{value:e.formTxCOS.path,callback:function(t){e.$set(e.formTxCOS,"path","string"===typeof t?t.trim():t)},expression:"formTxCOS.path"}}),o("el-link",{attrs:{type:"primary",href:"https://cloud.tencent.com/document/product/436/38484",target:"_blank"}},[e._v("如何使用腾讯云 COS")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.saveTxCOSConfiguration}},[e._v("保存配置")])],1)],1)],1),o("el-tab-pane",{staticClass:"github-panel",attrs:{label:"七牛云 Kodo",name:"qiniu"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formQiniu,"label-position":"right","label-width":"140px"}},[o("el-form-item",{attrs:{label:"AccessKey",required:!0}},[o("el-input",{attrs:{placeholder:"如6DD3VaLJ_SQgOdoocsyTV_YWaDmdnL2n8EGx7kG"},model:{value:e.formQiniu.accessKey,callback:function(t){e.$set(e.formQiniu,"accessKey","string"===typeof t?t.trim():t)},expression:"formQiniu.accessKey"}})],1),o("el-form-item",{attrs:{label:"SecretKey",required:!0}},[o("el-input",{attrs:{"show-password":"",placeholder:"如qgZa5qrvDOOcsmdKStD1oCjZ9nB7MDvJUs_34SIm"},model:{value:e.formQiniu.secretKey,callback:function(t){e.$set(e.formQiniu,"secretKey","string"===typeof t?t.trim():t)},expression:"formQiniu.secretKey"}})],1),o("el-form-item",{attrs:{label:"Bucket",required:!0}},[o("el-input",{attrs:{placeholder:"如md"},model:{value:e.formQiniu.bucket,callback:function(t){e.$set(e.formQiniu,"bucket","string"===typeof t?t.trim():t)},expression:"formQiniu.bucket"}})],1),o("el-form-item",{attrs:{label:"Bucket 对应域名",required:!0}},[o("el-input",{attrs:{placeholder:"如https://images.123ylb.cn"},model:{value:e.formQiniu.domain,callback:function(t){e.$set(e.formQiniu,"domain","string"===typeof t?t.trim():t)},expression:"formQiniu.domain"}})],1),o("el-form-item",{attrs:{label:"存储区域",required:!0}},[o("el-input",{attrs:{placeholder:"如z2"},model:{value:e.formQiniu.region,callback:function(t){e.$set(e.formQiniu,"region","string"===typeof t?t.trim():t)},expression:"formQiniu.region"}})],1),o("el-form-item",{attrs:{label:"存储路径",required:!1}},[o("el-input",{attrs:{placeholder:"如img可不填默认为根目录"},model:{value:e.formQiniu.path,callback:function(t){e.$set(e.formQiniu,"path","string"===typeof t?t.trim():t)},expression:"formQiniu.path"}}),o("el-link",{attrs:{type:"primary",href:"https://developer.qiniu.com/kodo",target:"_blank"}},[e._v("如何使用七牛云 Kodo")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.saveQiniuConfiguration}},[e._v("保存配置")])],1)],1)],1),o("el-tab-pane",{staticClass:"github-panel formCustom",attrs:{label:"自定义代码",name:"formCustom"}},[o("el-form",{staticClass:"setting-form",attrs:{model:e.formCustom,"label-position":"right"}},[o("el-form-item",{attrs:{label:"",required:!0}},[o("el-input",{ref:"formCustomElInput",staticClass:"formCustomElInput",attrs:{type:"textarea",resize:"none",placeholder:"Your custom code here."},model:{value:e.formCustom.code,callback:function(t){e.$set(e.formCustom,"code",t)},expression:"formCustom.code"}}),o("el-link",{attrs:{type:"primary",href:"https://github.com/doocs/md#自定义上传逻辑",target:"_blank"}},[e._v("参数详情?")])],1),o("el-form-item",[o("el-button",{attrs:{type:"primary"},on:{click:e.formCustomSave}},[e._v("保存配置")])],1)],1)],1)],1)],1)},Ge=[],Fe={props:{value:{type:Boolean,default:!1}},data:function(){return{activeName:"upload",formGitHub:{repo:"",branch:"",accessToken:""},formGitee:{repo:"",branch:"",accessToken:""},formAliOSS:{accessKeyId:"",accessKeySecret:"",bucket:"",region:"",path:"",cdnHost:""},formTxCOS:{secretId:"",secretKey:"",bucket:"",region:"",path:"",cdnHost:""},formQiniu:{accessKey:"",secretKey:"",bucket:"",domain:"",region:""},formCustom:{code:localStorage.getItem("formCustomConfig")||Q("\n const {file, util, okCb, errCb} = CUSTOM_ARG\n const param = new FormData()\n param.append('file', file)\n util.axios.post('http://127.0.0.1:9000/upload', param, {\n headers: { 'Content-Type': 'multipart/form-data' }\n }).then(res => {\n okCb(res.url)\n }).catch(err => {\n errCb(err)\n })\n ").trim(),editor:void 0},options:[{value:"default",label:"默认"},{value:"gitee",label:"Gitee"},{value:"github",label:"GitHub"},{value:"aliOSS",label:"阿里云"},{value:"txCOS",label:"腾讯云"},{value:"qiniu",label:"七牛云"},{value:"formCustom",label:"自定义代码"}],imgHost:"default"}},created:function(){localStorage.getItem("githubConfig")&&(this.formGitHub=JSON.parse(localStorage.getItem("githubConfig"))),localStorage.getItem("giteeConfig")&&(this.formGitee=JSON.parse(localStorage.getItem("giteeConfig"))),localStorage.getItem("aliOSSConfig")&&(this.formAliOSS=JSON.parse(localStorage.getItem("aliOSSConfig"))),localStorage.getItem("txCOSConfig")&&(this.formTxCOS=JSON.parse(localStorage.getItem("txCOSConfig"))),localStorage.getItem("imgHost")&&(this.imgHost=localStorage.getItem("imgHost"))},methods:{changeImgHost:function(){localStorage.setItem("imgHost",this.imgHost),this.$message.success("已成功切换图床")},saveGitHubConfiguration:function(){if(this.formGitHub.repo&&this.formGitHub.accessToken)localStorage.setItem("githubConfig",JSON.stringify(this.formGitHub)),this.$message.success("保存成功");else{var e=this.formGitHub.repo?"token":"GitHub 仓库";this.$message.error("参数「​".concat(e,"」不能为空"))}},saveGiteeConfiguration:function(){if(this.formGitee.repo&&this.formGitee.accessToken)localStorage.setItem("giteeConfig",JSON.stringify(this.formGitee)),this.$message.success("保存成功");else{var e=this.formGitee.repo?"私人令牌":"Gitee 仓库";this.$message.error("参数「​".concat(e,"」不能为空"))}},saveAliOSSConfiguration:function(){this.formAliOSS.accessKeyId&&this.formAliOSS.accessKeySecret&&this.formAliOSS.bucket&&this.formAliOSS.region?(localStorage.setItem("aliOSSConfig",JSON.stringify(this.formAliOSS)),this.$message.success("保存成功")):this.$message.error("阿里云 OSS 参数配置不全")},saveTxCOSConfiguration:function(){this.formTxCOS.secretId&&this.formTxCOS.secretKey&&this.formTxCOS.bucket&&this.formTxCOS.region?(localStorage.setItem("txCOSConfig",JSON.stringify(this.formTxCOS)),this.$message.success("保存成功")):this.$message.error("腾讯云 COS 参数配置不全")},saveQiniuConfiguration:function(){this.formQiniu.accessKey&&this.formQiniu.secretKey&&this.formQiniu.bucket&&this.formQiniu.domain&&this.formQiniu.region?(localStorage.setItem("qiniuConfig",JSON.stringify(this.formQiniu)),this.$message.success("保存成功")):this.$message.error("七牛云 Kodo 参数配置不全")},formCustomSave:function(){var e=this.formCustom.editor.getValue();localStorage.setItem("formCustomConfig",e),this.$message.success("保存成功")},beforeImageUpload:function(e){var t=N(e);if(!t.ok)return this.$message.error(t.msg),!1;var o=localStorage.getItem("imgHost");o=o||"default",localStorage.setItem("imgHost",o);var n=localStorage.getItem("".concat(o,"Config")),r="default"==o||n;return!!r||(this.$message.error("请先配置 ".concat(o," 图床参数")),!1)},uploadImage:function(e){this.$emit("uploadImage",e.file)}},watch:{activeName:{immediate:!0,handler:function(e){var t=this;"formCustom"===e&&this.$nextTick((function(){var e=t.$refs.formCustomElInput.$el.querySelector("textarea");t.formCustom.editor=t.formCustom.editor||O.a.fromTextArea(e,{mode:"javascript"}),t.formCustom.editor.setValue(t.formCustom.code)}))}}},mounted:function(){}},ze=Fe,He=(o("aaca"),Object(s["a"])(ze,We,Ge,!1,null,"6b7f927f",null)),Ne=He.exports,Ve=o("3f5e");o("f9d4");var Qe={data:function(){return{showCssEditor:!1,aboutDialogVisible:!1,dialogUploadImgVisible:!1,dialogFormVisible:!1,isCoping:!1,isImgLoading:!1,backLight:!1,timeout:null,changeTimer:null,source:"",mouseLeft:0,mouseTop:0}},components:{editorHeader:Ee,aboutDialog:Te,insertFormDialog:Re,rightClickMenu:qe,uploadImgDialog:Ne},computed:Object(n["a"])({},Object(d["c"])({wxRenderer:function(e){return e.wxRenderer},output:function(e){return e.output},editor:function(e){return e.editor},cssEditor:function(e){return e.cssEditor},currentSize:function(e){return e.currentSize},currentColor:function(e){return e.currentColor},nightMode:function(e){return e.nightMode},rightClickMenuVisible:function(e){return e.rightClickMenuVisible},codeTheme:function(e){return e.codeTheme}})),created:function(){var e=this;this.initEditorState(),this.$nextTick((function(){e.initEditor(),e.initCssEditor(),e.onEditorRefresh()}))},methods:Object(n["a"])({initEditor:function(){var e=this;this.initEditorEntity(),this.editor.on("change",(function(t,o){e.changeTimer&&clearTimeout(e.changeTimer),e.changeTimer=setTimeout((function(){e.onEditorRefresh(),$(e.editor,"__editor_content")}),300)})),this.editor.on("paste",(function(t,o){if(o.clipboardData&&o.clipboardData.items&&!e.isImgLoading)for(var n=0,r=o.clipboardData.items.length;n<r;++n){var i=o.clipboardData.items[n];if("file"===i.kind){var a=i.getAsFile(),s=e.beforeUpload(a);if(!s)continue;e.uploadImage(a)}}})),this.editor.on("mousedown",(function(){e.$store.commit("setRightClickMenuVisible",!1)})),this.editor.on("blur",(function(){
//!影响到右键菜单的点击事件右键菜单的点击事件在组件内通过mousedown触发
e.$store.commit("setRightClickMenuVisible",!1)})),this.editor.on("scroll",(function(){e.$store.commit("setRightClickMenuVisible",!1)}))},initCssEditor:function(){var e=this;this.initCssEditorEntity(),this.cssEditor.on("keyup",(function(e,t){(t.keyCode>=65&&t.keyCode<=90||189===t.keyCode)&&e.showHint(t)})),this.cssEditor.on("update",(function(t){e.cssChanged(),$(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=B(this.cssEditor.getValue(0)),t=K(this.currentSize.replace("px",""));t=L(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},codeThemeChanged:function(){var e=this.codeTheme,t=document.getElementById("hljs");if(void 0!=t)t.setAttribute("href",e);else{var o=document.createElement("link");o.setAttribute("type","text/css"),o.setAttribute("rel","stylesheet"),o.setAttribute("href",e),o.setAttribute("id","hljs"),document.head.appendChild(o)}},beforeUpload:function(e){var t=N(e);if(!t.ok)return this.$message.error(t.msg),!1;var o=localStorage.getItem("imgHost");o=o||"default",localStorage.setItem("imgHost",o);var n=localStorage.getItem("".concat(o,"Config")),r="default"==o||n;return!!r||(this.$message.error("请先配置 ".concat(o," 图床参数")),!1)},uploadImage:function(e){var t=this;this.isImgLoading=!0,H(e).then((function(o){Ve["a"].fileUpload(o,e).then((function(e){t.uploaded(e)}))["catch"]((function(e){t.$message.error(e.message)}))}))["catch"]((function(e){t.$message.error(e.message)})),this.isImgLoading=!1},uploaded:function(e){if(e){this.dialogUploadImgVisible=!1;var t=this.editor.getCursor(),o=e,n="![](".concat(o,")");this.editor.replaceSelection("\n".concat(n,"\n"),t),this.$message.success("图片上传成功"),this.onEditorRefresh()}else this.$message.error("上传图片未知异常")},leftAndRightScroll:function(){var e=this,t=function(t){var r,i;clearTimeout(e.timeout),"preview"===t?(r=e.$refs.preview.$el,i=document.getElementsByClassName("CodeMirror-scroll")[0],e.editor.off("scroll",o),e.timeout=setTimeout((function(){e.editor.on("scroll",o)}),300)):"editor"===t&&(r=document.getElementsByClassName("CodeMirror-scroll")[0],i=e.$refs.preview.$el,i.removeEventListener("scroll",n,!1),e.timeout=setTimeout((function(){i.addEventListener("scroll",n,!1)}),300));var a=r.scrollTop/(r.scrollHeight-r.offsetHeight),s=a*(i.scrollHeight-i.offsetHeight);i.scrollTo(0,s)},o=function(){t("editor")},n=function(){t("preview")};this.$refs.preview.$el.addEventListener("scroll",n,!1),this.editor.on("scroll",o)},onEditorRefresh:function(){this.codeThemeChanged(this.codeTheme),this.editorRefresh(),setTimeout((function(){return PR.prettyPrint()}),0)},endCopy:function(){var e=this;this.backLight=!1,setTimeout((function(){e.isCoping=!1}),800)},downloadEditorContent:function(){G(this.editor.getValue(0))},exportEditorContent:function(){this.$nextTick((function(){F()}))},importMarkdownContent:function(){var e=this,t=document.getElementById("menu"),o=document.createElement("input");o.type="file",o.name="filename",o.accept=".txt,.md",t.appendChild(o),o.onchange=function(){if(o.files){var t=o.files[0];if(/\.(txt|TXT|MD|md)$/.test(t.name)){var n=new FileReader;n.readAsText(t),n.onload=function(t){var o=t.target.result;o=q(o),o&&(localStorage.setItem("__editor_content",o),e.editor.setValue(o),e.$message.success("文档导入成功"))}}else e.$message.error("不支持的文档格式")}},o.click(),t.removeChild(o)},formatContent:function(){var e=q(this.editor.getValue(0));localStorage.setItem("__editor_content",e),this.editor.setValue(e)},openMenu:function(e){var t=105,o=this.$el.getBoundingClientRect().left,n=this.$el.offsetWidth,r=n-t,i=e.clientX-o;this.mouseLeft=Math.min(r,i),this.mouseTop=e.clientY+10,this.$store.commit("setRightClickMenuVisible",!0)},closeRightClickMenu:function(){this.$store.commit("setRightClickMenuVisible",!1)},onMenuEvent:function(e){switch(e){case"resetStyle":this.$refs.header.showResetConfirm=!0;break;case"insertPic":this.dialogUploadImgVisible=!0;break;case"download":this.downloadEditorContent();break;case"export":this.exportEditorContent();break;case"insertTable":this.dialogFormVisible=!0;break;case"importMarkdown":this.importMarkdownContent();break;case"formatMarkdown":this.formatContent();break;default:break}}},Object(d["b"])(["initEditorState","initEditorEntity","setWxRendererOptions","editorRefresh","initCssEditorEntity"])),mounted:function(){var e=this;setTimeout((function(){e.leftAndRightScroll(),PR.prettyPrint()}),300)}},Je=Qe,Ye=(o("b9e4"),o("c5e7"),o("b719"),Object(s["a"])(Je,ie,ae,!1,null,"469b2134",null)),Ze=Ye.exports,Xe={name:"App",components:{Loading:re["default"],CodemirrorEditor:Ze},data:function(){return{loading:!0}},mounted:function(){var e=this;setTimeout((function(){e.loading=!1}),100)}},et=Xe,tt=(o("537d"),Object(s["a"])(et,oe,ne,!1,null,"8e90ad4c",null)),ot=tt.exports;r["default"].use(te["a"]);var nt=[{path:"/",name:"index",component:ot}],rt=new te["a"]({mode:"history",base:"/md/",routes:nt}),it=rt;r["default"].use(ee.a),r["default"].config.productionTip=!1,u.mpType="app";var at=new r["default"](Object(n["a"])({router:it,store:Z},u));at.$mount("#app")},6003:function(e,t,o){},6052:function(e,t,o){},"64e1":function(e,t,o){"use strict";o("7321")},7321:function(e,t,o){},"7c55":function(e,t,o){"use strict";o("2395")},8166:function(e,t,o){"use strict";o("6052")},"8c0a":function(e,t,o){},"94fb":function(e,t,o){"use strict";o("3ea0")},"9ae8":function(e,t,o){},aaca:function(e,t,o){"use strict";o("9ae8")},aae9:function(e,t,o){"use strict";o.d(t,"a",(function(){return n})),o.d(t,"b",(function(){return r}));var n=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},r=[function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"loading",attrs:{id:"loading"}},[o("div",{staticClass:"loading-wrapper"},[o("div",{staticClass:"loading-anim"}),o("div",{staticClass:"loading-text"},[e._v("致力于让 Markdown 编辑更简单")])])])}]},b43f:function(e,t,o){},b719:function(e,t,o){"use strict";o("4eaa")},b9e4:function(e,t,o){"use strict";o("2b77")},c081:function(e,t,o){"use strict";o("4549")},c5e7:function(e,t,o){"use strict";o("37e4")},cb57:function(e,t,o){"use strict";var n=o("eff7"),r=o.n(n);t["default"]=r.a},da71:function(e,t,o){"use strict";o.d(t,"b",(function(){return n})),o.d(t,"a",(function(){return r}));o("a630"),o("3ca3");var n={username:"filess",repoList:Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],(function(e){return"img".concat(e)})),branch:"main",accessTokenList:["7715d7ca67b5d3837cfdoocsmde8c38421815aa423510af","c411415bf95dbe39625doocsmd5047ba9b7a2a6c9642abe","2821cd8819fa345c053doocsmdca86ac653f8bc20db1f1b","445f0dae46ef1f2a4d6doocsmdc797301e94797b4750a4c","cc1d0c1426d0fd0902bdoocsmdd2d7184b14da61b86ec46","b67e9d15cb6f910492fdoocsmdac6b44d379c953bb19eff","618c4dc2244ccbbc088doocsmd125d17fd31b7d06a50cf3","a4b581732e1c1507458doocsmdc5b223b27dae5e2e16a55","77904db41aee57ad79bdoocsmd760f848201dac9c96fd5e","02f251cb14ac62ab100doocsmdddbfc8527d773f1f04ce1","eb321079a95ba7028d9doocsmde2e84c502dac70de7cf08","22f74fcfb071a961fa2doocsmde28dabc746f0503a15e5d","85124c2bfe7abba0938doocsmd0af7f67918b99d085a5fd","0a561b4d4bbecb2de7edoocsmdd9ba3833d11dbc5e430f5","e8a01491188d8d5a097doocsmd03ede0aad1fe9e3af24e9","36e1f420d7e5bdebd67doocsmd65463562f5f25b20b8377"]},r={username:"filesss",repoList:Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],(function(e){return"img".concat(e)})),branch:"main",accessTokenList:["ed5fc9866bd6c2fdoocsmddd433f806fd2f399c","5448ffebbbf1151doocsmdc4e337cf814fc8a62","25b05efd2557ca2doocsmd75b5c0835e3395911","11628c7a5aef015doocsmd2eeff9fb9566f0458","cb2f5145ed938dedoocsmdbd063b4ed244eecf8","d8c0b57500672c1doocsmd55f48b866b5ebcd98","78c56eadb88e453doocsmd43ddd95753351771a","03e1a688003948fdoocsmda16fcf41e6f03f1f0","c49121cf4d191fbdoocsmdd6a7877ed537e474a","adfeb2fadcdc4aadoocsmdfe1ee869ac9c968ff","116c94549ca4a0ddoocsmd192653af5c0694616","ecf30ed7f2eb184doocsmd51ea4ec8300371d9e","5837cf2bd5afd93doocsmd73904bed31934949e","b5b7e1c7d57e01fdoocsmd5266f552574297d78","684d55564ffbd0bdoocsmd7d747e5cc23aed6d6","3fc04a9d272ab71doocsmd010c56cb57d88d2ba"]}},e1d2:function(e,t,o){"use strict";o("ac1f"),o("00b4"),o("d3b7");var n=o("bc3a"),r=o.n(n),i=r.a.create({baseURL:"",timeout:3e4});i.interceptors.request.use((function(e){return/^(post)|(put)|(delete)$/i.test(e.method)&&e.data&&e.data.upload&&(e.headers["Content-Type"]="multipart/form-data"),e}),(function(e){Promise.reject(e)})),i.interceptors.response.use((function(e){return e.data?e.data:Promise.reject(e)}),(function(e){return Promise.reject(e)})),t["a"]=i},eff7:function(e,t){},f265:function(e,t,o){"use strict";o("6003")}});
//# sourceMappingURL=app.1789491a.js.map