vart=require("./parser"),n=[require("./markdown/index.js"),require("./audio/index.js"),require("./emoji/index.js"),require("./highlight/index.js"),require("./style/index.js")];Component({data:{nodes:[]},properties:{markdown:Boolean,containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:Boolean,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(vare=n.length;e--;)this.plugins.push(newn[e](this))},detached:function(){clearInterval(this._timer),this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){vari=this;returnt=this._ids[decodeURI(t)]||t,newPromise(function(r,o){if(!i.data.useAnchor)returnvoido(Error("Anchor is disabled"));vara=wx.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])returnvoido(Error("Label not found"));vara=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),r()})})},getText:function(e){vart="";returnfunctione(n){for(vari=0;i<n.length;i++){varr=n[i];if("text"===r.type)t+=r.text.replace(/&/g,"&");elseif("br"===r.name)t+="\n";else{varo="p"===r.name||"div"===r.name||"tr"===r.name||"li"===r.name||"h"===r.name[0]&&r.name[1]>"0"&&r.name[1]<"7";o&&t&&"\n"!==t[t.length-1]&&(t+="\n"),r.children&&e(r.children),o&&"\n"!==t[t.length-1]?t+="\n":"td"!==r.name&&"th"!==r.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){vare=this;returnnewPromise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){returne[0]?t(e[0]):n(Error("Root label not found"))})})},setContent:function(e,n){vari=this;this.imgList&&n||(this.imgList=[]),this._videos=[];varr={},o=newt(this).parse(e);if(n)for(vara=this.data.nodes.length,l=o.length;l--;)r["nodes[".concat(a+l,"]")]=o[l];elser.nodes=o;this.setData(r,function(){i._hook("onLoad"),i.triggerEvent("load")});vars;clearInterval(this._timer),this._timer=setInterval(function(){i.getRect().then(function(e){e.height===s&&(i.triggerEvent("ready",e),clearInterval(i._timer)),s=e.height}).catch(function(){})},350)},_hook:function(e){for(vart=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});
\ No newline at end of file
vart=require("./parser"),n=[require("./markdown/index.js"),require("./audio/index.js"),require("./emoji/index.js"),require("./highlight/index.js"),require("./style/index.js")];Component({data:{nodes:[]},properties:{markdown:Boolean,containerStyle:String,content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:Boolean,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(vare=n.length;e--;)this.plugins.push(newn[e](this))},detached:function(){this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){vari=this;returnt=this._ids[decodeURI(t)]||t,newPromise(function(o,r){if(!i.data.useAnchor)returnvoidr(Error("Anchor is disabled"));vara=wx.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();i._in?a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])returnvoidr(Error("Label not found"));vara=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.data.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),o()})})},getText:function(e){vart="";returnfunctione(n){for(vari=0;i<n.length;i++){varo=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");elseif("br"===o.name)t+="\n";else{varr="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){vare=this;returnnewPromise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){returne[0]?t(e[0]):n(Error("Root label not found"))})})},pauseMedia:function(){for(vare=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(vart=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){vari=this;this.imgList&&n||(this.imgList=[]),this._videos=[];varo={},r=newt(this).parse(e);if(n)for(vara=this.data.nodes.length,s=r.length;s--;)o["nodes[".concat(a+s,"]")]=r[s];elseo.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.triggerEvent("load")}),this.data.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){varl,c=functione(t){t.height===l?i.triggerEvent("ready",t):(l=t.height,setTimeout(function(){i.getRect().then(e)},350))};this.getRect().then(c)}elsethis.imgList._unloadimgs||this.getRect(function(e){i.triggerEvent("ready",e)})},_hook:function(e){for(vart=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});
"use strict";functiont(e){"@babel/helpers - typeof";return(t="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(t){returntypeoft}:function(t){returnt&&"function"==typeofSymbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeoft})(e)}functione(){functionr(t,e,r){returnObject.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}functionn(t,e,r,n){vari=e&&e.prototypeinstanceofa?e:a,s=Object.create(i.prototype),c=newp(n||[]);returns._invoke=function(t,e,r){varn="suspendedStart";returnfunction(a,i){if("executing"===n)thrownewError("Generator is already running");if("completed"===n){if("throw"===a)throwi;returng()}for(r.method=a,r.arg=i;;){vars=r.delegate;if(s){varc=l(s,r);if(c){if(c===L)continue;returnc}}if("next"===r.method)r.sent=r._sent=r.arg;elseif("throw"===r.method){if("suspendedStart"===n)thrown="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";varu=o(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===L)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,c),s}functiono(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}functiona(){}functioni(){}functions(){}functionc(t){["next","throw","return"].forEach(function(e){r(t,e,function(t){returnthis._invoke(e,t)})})}functionu(e,r){functionn(a,i,s,c){varu=o(e[a],e,i);if("throw"!==u.type){varl=u.arg,d=l.value;returnd&&"object"==t(d)&&w.call(d,"__await")?r.resolve(d.__await).then(function(t){n("next",t,s,c)},function(t){n("throw",t,s,c)}):r.resolve(d).then(function(t){l.value=t,s(l)},function(t){returnn("throw",t,s,c)})}c(u.arg)}vara;this._invoke=function(t,e){functiono(){returnnewr(function(r,o){n(t,e,r,o)})}returna=a?a.then(o,o):o()}}functionl(t,e){varr=t.iterator[e.method];if(void0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void0,l(t,e),"throw"===e.method))returnL;e.method="throw",e.arg=newTypeError("The iterator does not provide a 'throw' method")}returnL}varn=o(r,t.iterator,e.arg);if("throw"===n.type)returne.method="throw",e.arg=n.arg,e.delegate=null,L;vara=n.arg;returna?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void0),e.delegate=null,L):a:(e.method="throw",e.arg=newTypeError("iterator result is not an object"),e.delegate=null,L)}functiond(t){vare={tryLoc:t[0]};1int&&(e.catchLoc=t[1]),2int&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}functionh(t){vare=t.completion||{};e.type="normal",deletee.arg,t.completion=e}functionp(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(d,this),this.reset(!0)}functionf(t){if(t){vare=t[x];if(e)returne.call(t);if("function"==typeoft.next)returnt;if(!isNaN(t.length)){varr=-1,n=functione(){for(;++r<t.length;)if(w.call(t,r))returne.value=t[r],e.done=!1,e;returne.value=void0,e.done=!0,e};returnn.next=n}}return{next:g}}functiong(){return{value:void0,done:!0}}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){returnv};varv={},y=Object.prototype,w=y.hasOwnProperty,m="function"==typeofSymbol?Symbol:{},x=m.iterator||"@@iterator",b=m.asyncIterator||"@@asyncIterator",T=m.toStringTag||"@@toStringTag";try{r({},"")}catch(t){r=function(t,e,r){returnt[e]=r}}v.wrap=n;varL={},E={};r(E,x,function(){returnthis});vark=Object.getPrototypeOf,_=k&&k(k(f([])));_&&_!==y&&w.call(_,x)&&(E=_);varN=s.prototype=a.prototype=Object.create(E);returni.prototype=s,r(N,"constructor",s),r(s,"constructor",i),i.displayName=r(s,T,"GeneratorFunction"),v.isGeneratorFunction=function(t){vare="function"==typeoft&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},v.mark=function(t){returnObject.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,r(t,T,"GeneratorFunction")),t.prototype=Object.create(N),t},v.awrap=function(t){return{__await:t}},c(u.prototype),r(u.prototype,b,function(){returnthis}),v.AsyncIterator=u,v.async=function(t,e,r,o,a){void0===a&&(a=Promise);vari=newu(n(t,e,r,o),a);returnv.isGeneratorFunction(e)?i:i.next().then(function(t){returnt.done?t.value:i.next()})},c(N),r(N,T,"Generator"),r(N,x,function(){returnthis}),r(N,"toString",function(){return"[object Generator]"}),v.keys=function(t){vare=[];for(varrint)e.push(r);returne.reverse(),functionr(){for(;e.length;){varn=e.pop();if(nint)returnr.value=n,r.done=!1,r}returnr.done=!0,r}},v.values=f,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void0,this.done=!1,this.delegate=null,this.method="next",this.arg=void0,this.tryEntries.forEach(h),!t)for(vareinthis)"t"===e.charAt(0)&&w.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void0)},stop:function(){this.done=!0;vart=this.tryEntries[0].completion;if("throw"===t.type)throwt.arg;returnthis.rval},dispatchException:function(t){functione(e,n){returna.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void0),!!n}if(this.done)throwt;for(varr=this,n=this.tryEntries.length-1;n>=0;--n){varo=this.tryEntries[n],a=o.completion;if("root"===o.tryLoc)returne("end");if(o.tryLoc<=this.prev){vari=w.call(o,"catchLoc"),s=w.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)returne(o.catchLoc,!0);if(this.prev<o.finallyLoc)returne(o.finallyLoc)}elseif(i){if(this.prev<o.catchLoc)returne(o.catchLoc,!0)}else{if(!s)thrownewError("try statement without catch or finally");if(this.prev<o.finallyLoc)returne(o.finallyLoc)}}}},abrupt:function(t,e){for(varr=this.tryEntries.length-1;r>=0;--r){varn=this.tryEntries[r];if(n.tryLoc<=this.prev&&w.call(n,"finallyLoc")&&this.prev<n.finallyLoc){varo=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);vara=o?o.completion:{};returna.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,L):this.complete(a)},complete:function(t,e){if("throw"===t.type)throwt.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),L},finish:function(t){for(vare=this.tryEntries.length-1;e>=0;--e){varr=this.tryEntries[e];if(r.finallyLoc===t)returnthis.complete(r.completion,r.afterLoc),h(r),L}},catch:function(t){for(vare=this.tryEntries.length-1;e>=0;--e){varr=this.tryEntries[e];if(r.tryLoc===t){varn=r.completion;if("throw"===n.type){varo=n.arg;h(r)}returno}}thrownewError("illegal catch attempt")},delegateYield:function(t,e,r){returnthis.delegate={iterator:f(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void0),L}},v}functionr(t,e,r,n,o,a,i){try{vars=t[a](i),c=s.value}catch(t){returnvoidr(t)}s.done?e(c):Promise.resolve(c).then(n,o)}functionn(t){returnfunction(){vare=this,n=arguments;returnnewPromise(function(o,a){functioni(t){r(c,o,a,i,s,"next",t)}functions(t){r(c,o,a,i,s,"throw",t)}varc=t.apply(e,n);i(void0)})}}functiono(t,e,r){returneint?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{},isiOS:wx.getSystemInfoSync().system.includes("iOS")},properties:{childs:Array,opts:Array},options:{addGlobalClass:!0},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{copyCode:function(t){wx.showActionSheet({itemList:["复制代码"],success:function(){returnwx.setClipboardData({data:t.currentTarget.dataset.content})}})},noop:function(){},getNode:function(t){try{for(vare=t.split("_"),r=this.data.childs[e[0]],n=1;n<e.length;n++)r=r.children[e[n]];returnr}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){if(this.root.triggerEvent("play"),this.root.data.pauseVideo){for(vare=!1,r=t.target.id,n=this.root._videos.length;n--;)this.root._videos[n].id===r?e=!0:this.root._videos[n].pause();if(!e){varo=wx.createVideoContext(r,this);o.id=r,this.root.playbackRate&&o.playbackRate(this.root.playbackRate),this.root._videos.push(o)}}},imgTap:function(t){vare=this.getNode(t.target.dataset.i);if(e.a)returnthis.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){varr=this.root.imgList[e.i];wx.previewImage({showmenu:this.root.data.showImgMenu,current:r,urls:this.root.imgList})}},imgLoad:function(t){vare,r=t.target.dataset.i,n=this.getNode(r);n.w?(this.data.opts[1]&&!this.data.ctrl[r]||-1===this.data.ctrl[r])&&(e=1):e=t.detail.width,e&&this.setData(o({},"ctrl."+r,e)),this.checkReady()},checkReady:function(){vart=this;this.root.data.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.triggerEvent("ready",e)})},350))},linkTap:function(t){vare=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,n=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),n&&("#"===n[0]?this.root.navigateTo(n.substring(1)).catch(function(){}):n.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:n,success:function(){returnwx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:n,fail:function(){wx.switchTab({url:n,fail:function(){}})}}))},mediaError:function(t){vare=t.target.dataset.i,r=this.getNode(e);if("video"===r.name||"audio"===r.name){varn=(this.data.ctrl[e]||0)+1;if(n>r.src.length&&(n=0),n<r.src.length)returnthis.setData(o({},"ctrl."+e,n))}else"img"===r.name&&(this.data.opts[2]&&this.setData(o({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:r.name,attrs:r.attrs,errMsg:t.detail.errMsg})},previewImage:function(t){vare=t.currentTarget.dataset.imgallsrc,r=t.currentTarget.dataset.imgsrc;wx.previewImage({current:r,urls:e})},goTo:function(t){vare=t.currentTarget.dataset.appid,r=t.currentTarget.dataset.redirectype,n=t.currentTarget.dataset.path,o=t.currentTarget.dataset.url,a=t.currentTarget.dataset.jumptype;"apppage"==r?wx.navigateTo({url:n}):"webpage"==r?(o="../webview/webview?url="+o,wx.navigateTo({url:o})):"miniapp"==r&&("embedded"==a?wx.openEmbeddedMiniProgram({appId:e,path:n}):wx.navigateToMiniProgram({appId:e,path:n}))},goChannels:function(t){vare=t.currentTarget.dataset.channelsid;wx.openChannelsUserProfile({finderUserName:e})},openActivity:function(t){vare=t.currentTarget.dataset.channelsid,r=t.currentTarget.dataset.feedid;wx.openChannelsActivity({finderUserName:e,feedId:r})},openEvent:function(t){vare=t.currentTarget.dataset.channelsid,r=t.currentTarget.dataset.eventid;wx.openChannelsEvent({finderUserName:e,eventId:r})},goToSinshopproduct:function(t){vare=t.currentTarget.dataset.path;wx.navigateTo({url:e})},openmap:function(t){vare=Number(t.currentTarget.dataset.latitude),r=Number(t.currentTarget.dataset.longitude),n=t.currentTarget.dataset.address,o=t.currentTarget.dataset.title;wx.openLocation({latitude:e,longitude:r,scale:15,name:o,address:n})},onTapATag:function(t){vare=t.currentTarget.dataset.src,r=t.currentTarget.dataset.appid,n=t.currentTarget.dataset.redirectype,o=t.currentTarget.dataset.path;if(/\.(doc|docx|xls|xlsx|ppt|pptx|pdf)$/.test(e))returnvoidthis.openLinkDoc(t);n?"apppage"==n?wx.navigateTo({url:o}):"webpage"==n?(e="../webview/webview?url="+e,wx.navigateTo({url:e})):"miniapp"==n&&wx.navigateToMiniProgram({appId:r,path:o}):wx.setClipboardData({data:e,success:function(){returnwx.showToast({title:"链接已复制"})}})},onbaiPanCopy:function(t){vare=t.currentTarget.dataset.code;if(!e)returnvoidwx.showToast({title:"提取码不存在!",icon:"none",duration:3e3});wx.setClipboardData({data:e,success:function(t){wx.getClipboardData({success:function(t){wx.showToast({title:"复制成功",icon:"success",duration:3e3})}})}})},onbaiduPanOpen:function(t){vare=t.currentTarget.dataset.key;if(e){varr="pages/netdisk_share/share?scene=".concat(e);wx.navigateToMiniProgram({appId:"wxdcd3d073e47d1742",path:r})}elsewx.showToast({title:"链接不存在!",icon:"none",duration:3e3})},openLinkDoc:function(t){returnn(e().mark(functionr(){varn,o,a,i,s,c,u,l;returne().wrap(function(e){for(;;)switch(e.prev=e.next){case0:returna=t.currentTarget.dataset.src||"",e.next=3,getApp().$api.getBaseConfig();case3:if(i=e.sent,console.log("domains"),console.log(i),s=i.settings||{},c=s.downloadfile_domain&&s.downloadfile_domain.split(",")||[],u=c.find(function(t){returna.includes(t)})){e.next=12;break}returnwx.setClipboardData({data:a,success:function(){returnwx.showToast({title:"链接已复制"})}}),e.abrupt("return");case12:l=/\.(doc|docx|xls|xlsx|ppt|pptx|pdf)$/.test(a),a&&l?(n=a,o=/doc|docx|xls|xlsx|ppt|pptx|pdf$/.exec(a)[0]):(n=t.currentTarget.dataset.filelink,o=t.currentTarget.dataset.filetype),wx.downloadFile({url:n,success:function(t){vare=t.tempFilePath;wx.openDocument({showMenu:!0,filePath:e})}});case15:case"end":returne.stop()}},r)}))()}}});