(function(n,t){var u={generalPost:1,post:2,preview:3},f={image:1,video:2,audio:3,text:4},i={version:"1.1.1",msgQueue:[],callbackCache:[],callbackId:0,processingMsg:!1},r;i.create=function(){i.bridgeIframe=document.createElement("iframe");i.bridgeIframe.style.display="none";document.documentElement.appendChild(i.bridgeIframe)};i.getCallbackId=function(){return i.callbackId++};i.prepareProcessingMessages=function(){i.processingMsg=!0};i.fetchMessages=function(){if(i.msgQueue.length>0){var n=JSON.stringify(i.msgQueue);return i.msgQueue.length=0,n}return i.processingMsg=!1,null};i.onCallback=function(n,t){i.callbackCache[n]&&i.callbackCache[n](t)};i.formatParams=function(n){var t=JSON.parse(n);return t.postType=u[t.postType]||1,t.taskType=f[t.taskType]||1,JSON.stringify(t)};i.onPushH5=function(n){r.emit("onProgress",n)};i.callNative=function(r,u,f,e){var o={},s;o.clz=r;o.method=u;f!=t&&(o.args=f);e&&(s=i.getCallbackId(),i.callbackCache[s]=e,console.log(o),o.args?o.args.callbackId=s.toString():o.args={callbackId:s.toString()});n.jsBridgeChannelApi&&n.jsBridgeChannelApi.postMessage(JSON.stringify(o))};i.invoke=function(n,t,r,u){if(Object.prototype.toString.call(n)==="[object Object]"?(t=n.method,r=n.args||{},u=n.callback||null,n=n.clz||"jsBridgeChannelApi"):(n=n||"jsBridgeChannelApi",r=r||{}),u){i.callNative(n,t,r,u);return}i.callNative(n,t,r);return};r={eventList:{},on:function(n,t){return(r.eventList[n]||(r.eventList[n]=[])).push(t),r},emit:function(){var i=[].shift.call(arguments),t=[],n,u;if(!r.eventList[i])return!1;for(n=0;n<r.eventList[i].length;n++)t.push(r.eventList[i][n]);if(!t||t.length===0)return!1;for(n=0;n<t.length;n++)u=t[n],u.apply(r,arguments);return r},excuting:function(n,t){return i.invoke({method:"excuting",args:{data:i.formatParams(n)},callback:t})},pickImage:function(n){return i.invoke({method:"uploadReportImage",callback:n})}};console.log("%cMecordJS","color:#B2A0F4",i.version);n.ApiBridge=i;n.MekongJS=r;n.MecordJS=r})(window);