!function(){var e=window||this,o=e.nx||require("next-js-core2"),n=e.wx=e.wx||require("wechat-jssdk"),a=e.Q||require("q"),t=o.Qqueue||require("next-qqueue"),i=["ready","checkJsApi","error","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","onMenuShareQZone","chooseImage","previewImage","uploadImage","downloadImage","getLocalImgData","closeWindow","hideOptionMenu","showOptionMenu","startRecord","stopRecord","onVoiceRecordEnd","openLocation","getLocation","scanQRCode","chooseWXPay","openAdreess"],c=o.declare("nxWxsdk",{statics:{VERSION:"1.2.0",wx:n,SHARE_TAYPES:["Timeline","AppMessage","QQ","Weibo","QZone"],defaults:{debug:!0,jsApiList:["onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareQZone","onMenuShareWeibo","chooseImage","previewImage","uploadImage","downloadImage","getLocalImgData","closeWindow","hideOptionMenu","showOptionMenu","openLocation","getLocation","scanQRCode","chooseWXPay","openAdreess"]},__config:null,param:function(){return{url:e.location.href.split("#")[0]}},updateTitle:function(e){function o(){setTimeout(function(){n.removeEventListener("load",o),document.body.removeChild(n)},0)}document.getElementsByTagName("body")[0];document.title=e;var n=document.createElement("iframe");n.setAttribute("src","favicon.ico"),n.style.visibility="hidden",n.style.position="absolute",n.style.zIndex=-1,n.addEventListener("load",o),document.body.appendChild(n)},initialize:function(e){switch(this.__config=e,!0){case o.isBoolean(e.optionMenu):n.ready(function(){c.optionMenu(e.optionMenu)})}},config:function(e,a){var t=o.mix(c.defaults,e,a);c.initialize(t),void 0!==n?n.config(t):o.error('Must import this wx api script: <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" charset="utf-8"><\/script>')},share:function(e,o){(o||c.SHARE_TAYPES).forEach(function(o){n["onMenuShare"+o](e)})},optionMenu:function(e){return e?n.showOptionMenu():n.hideOptionMenu()},syncChooseImage:function(e){var n=o.mix({count:9,sizeType:["original","compressed"],sourceType:["album","camera"]},e);return c.__wrapToQPromise("chooseImage",n)},syncDownloadImage:function(e){return c.__wrapToQPromise("downloadImage",e)},syncGetLocalImageData:function(e){return c.__wrapToQPromise("getLocalImgData",e)},syncGetLocalImageDatas:function(e,o){var n=c.__makeOptionList(e,o);return t.queue(n,c.syncGetLocalImageData)},syncUploadImage:function(e){var n=o.mix({isShowProgressTips:1},e);return c.__wrapToQPromise("uploadImage",n)},syncUploadImages:function(e,o){var n=c.__makeOptionList(e,o);return t.queue(n,c.syncUploadImage)},syncChooseImageWithData:function(e,o){var n=a.defer();return c.syncChooseImage(e).then(function(e){c.syncGetLocalImageDatas(e.localIds,o).then(function(o){o.map(function(e){return e.localData});n.resolve({localIds:e.localIds,localDatas:o})},function(e){n.reject(e)})},function(e){n.reject(e)}),n.promise},syncChooseImageDataToUpload:function(e,o){var n=a.defer();return c.syncChooseImageWithData(e).then(function(e){c.syncUploadImages(e.localIds,o).then(function(o){o.forEach(function(o,n){o.localData=e.localDatas[n]}),n.resolve(o)},function(e){n.reject(e)})},function(e){n.reject(e)}),n.promise},syncChooseImageToUpload:function(e,n){var t=a.defer();return c.syncChooseImage(e).then(function(e){var a=e.localIds;n.choosedCallback&&n.choosedCallback(a),c.syncUploadImages(a,n).then(function(e){var n=e.map(function(e,n){return o.mix(e,{localId:a[n]})});t.resolve(n)},function(e){t.reject(e)})},function(e){t.reject(e)}),t.promise},__wrapToQPromise:function(e,t){var i=a.defer();return n[e](o.mix(t,{success:function(e){i.resolve(e)},fail:function(e){i.reject(e)}})),i.promise},__makeOptionList:function(e,n){var a=[];return e.forEach(function(e){var t=o.mix({},n,{localId:e});a.push(t)}),a}}});i.forEach(function(e){o.defineStatic(c,e,n[e])}),"undefined"!=typeof module&&module.exports&&(module.exports=c)}();