"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(t,e,i){returne=r(e),eint?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}functionr(e){varr=i(e,"string");return"symbol"===t(r)?r:String(r)}functioni(e,r){if("object"!==t(e)||null===e)returne;vari=e[Symbol.toPrimitive];if(void0!==i){varo=i.call(e,r||"default");if("object"!==t(o))returno;thrownewTypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}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]],i=1;i<e.length;i++)r=r.children[e[i]];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,i=this.root._videos.length;i--;)this.root._videos[i].id===r?e=!0:this.root._videos[i].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){varr,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.data.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(r=1):r=t.detail.width,r&&this.setData(e({},"ctrl."+i,r)),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)}).catch(function(){t.root.triggerEvent("ready",{})})},350))},linkTap:function(t){vare=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:i,success:function(){returnwx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:i,fail:function(){wx.switchTab({url:i,fail:function(){wx.setClipboardData({data:i,success:function(){returnwx.showToast({title:"链接已复制"})}})}})}}))},mediaError:function(t){varr=t.target.dataset.i,i=this.getNode(r);if("video"===i.name||"audio"===i.name){varo=(this.data.ctrl[r]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)returnthis.setData(e({},"ctrl."+r,o))}else"img"===i.name&&(this.data.opts[2]&&this.setData(e({},"ctrl."+r,-1)),this.checkReady());this.root&&this.root.triggerEvent("error",{source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}});