@10yun/cv-mobile-ui 0.5.38 → 0.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,352 @@
1
+ /*
2
+ * HTML5 Parser By Sam Blowes
3
+ *
4
+ * Designed for HTML5 documents
5
+ *
6
+ * Original code by John Resig (ejohn.org)
7
+ * http://ejohn.org/blog/pure-javascript-html-parser/
8
+ * Original code by Erik Arvidsson, Mozilla Public License
9
+ * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
10
+ *
11
+ * ----------------------------------------------------------------------------
12
+ * License
13
+ * ----------------------------------------------------------------------------
14
+ *
15
+ * This code is triple licensed using Apache Software License 2.0,
16
+ * Mozilla Public License or GNU Public License
17
+ *
18
+ * ////////////////////////////////////////////////////////////////////////////
19
+ *
20
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
21
+ * use this file except in compliance with the License. You may obtain a copy
22
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
+ *
24
+ * ////////////////////////////////////////////////////////////////////////////
25
+ *
26
+ * The contents of this file are subject to the Mozilla Public License
27
+ * Version 1.1 (the "License"); you may not use this file except in
28
+ * compliance with the License. You may obtain a copy of the License at
29
+ * http://www.mozilla.org/MPL/
30
+ *
31
+ * Software distributed under the License is distributed on an "AS IS"
32
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
33
+ * License for the specific language governing rights and limitations
34
+ * under the License.
35
+ *
36
+ * The Original Code is Simple HTML Parser.
37
+ *
38
+ * The Initial Developer of the Original Code is Erik Arvidsson.
39
+ * Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
40
+ * Reserved.
41
+ *
42
+ * ////////////////////////////////////////////////////////////////////////////
43
+ *
44
+ * This program is free software; you can redistribute it and/or
45
+ * modify it under the terms of the GNU General Public License
46
+ * as published by the Free Software Foundation; either version 2
47
+ * of the License, or (at your option) any later version.
48
+ *
49
+ * This program is distributed in the hope that it will be useful,
50
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52
+ * GNU General Public License for more details.
53
+ *
54
+ * You should have received a copy of the GNU General Public License
55
+ * along with this program; if not, write to the Free Software
56
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
57
+ *
58
+ * ----------------------------------------------------------------------------
59
+ * Usage
60
+ * ----------------------------------------------------------------------------
61
+ *
62
+ * // Use like so:
63
+ * HTMLParser(htmlString, {
64
+ * start: function(tag, attrs, unary) {},
65
+ * end: function(tag) {},
66
+ * chars: function(text) {},
67
+ * comment: function(text) {}
68
+ * });
69
+ *
70
+ * // or to get an XML string:
71
+ * HTMLtoXML(htmlString);
72
+ *
73
+ * // or to get an XML DOM Document
74
+ * HTMLtoDOM(htmlString);
75
+ *
76
+ * // or to inject into an existing document/DOM node
77
+ * HTMLtoDOM(htmlString, document);
78
+ * HTMLtoDOM(htmlString, document.body);
79
+ *
80
+ */
81
+ // Regular Expressions for parsing tags and attributes
82
+ var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
83
+ var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
84
+ var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
85
+
86
+ var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
87
+ // fixed by xxx 将 ins 标签从块级名单中移除
88
+
89
+ var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
90
+
91
+ var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
92
+ // (and which close themselves)
93
+
94
+ var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
95
+
96
+ var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
97
+
98
+ var special = makeMap('script,style');
99
+ function HTMLParser(html, handler) {
100
+ var index;
101
+ var chars;
102
+ var match;
103
+ var stack = [];
104
+ var last = html;
105
+
106
+ stack.last = function () {
107
+ return this[this.length - 1];
108
+ };
109
+
110
+ while (html) {
111
+ chars = true; // Make sure we're not in a script or style element
112
+
113
+ if (!stack.last() || !special[stack.last()]) {
114
+ // Comment
115
+ if (html.indexOf('<!--') == 0) {
116
+ index = html.indexOf('-->');
117
+
118
+ if (index >= 0) {
119
+ if (handler.comment) {
120
+ handler.comment(html.substring(4, index));
121
+ }
122
+
123
+ html = html.substring(index + 3);
124
+ chars = false;
125
+ } // end tag
126
+
127
+ } else if (html.indexOf('</') == 0) {
128
+ match = html.match(endTag);
129
+
130
+ if (match) {
131
+ html = html.substring(match[0].length);
132
+ match[0].replace(endTag, parseEndTag);
133
+ chars = false;
134
+ } // start tag
135
+
136
+ } else if (html.indexOf('<') == 0) {
137
+ match = html.match(startTag);
138
+
139
+ if (match) {
140
+ html = html.substring(match[0].length);
141
+ match[0].replace(startTag, parseStartTag);
142
+ chars = false;
143
+ }
144
+ }
145
+
146
+ if (chars) {
147
+ index = html.indexOf('<');
148
+ var text = index < 0 ? html : html.substring(0, index);
149
+ html = index < 0 ? '' : html.substring(index);
150
+
151
+ if (handler.chars) {
152
+ handler.chars(text);
153
+ }
154
+ }
155
+ } else {
156
+ html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
157
+ text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
158
+
159
+ if (handler.chars) {
160
+ handler.chars(text);
161
+ }
162
+
163
+ return '';
164
+ });
165
+ parseEndTag('', stack.last());
166
+ }
167
+
168
+ if (html == last) {
169
+ throw 'Parse Error: ' + html;
170
+ }
171
+
172
+ last = html;
173
+ } // Clean up any remaining tags
174
+
175
+
176
+ parseEndTag();
177
+
178
+ function parseStartTag(tag, tagName, rest, unary) {
179
+ tagName = tagName.toLowerCase();
180
+
181
+ if (block[tagName]) {
182
+ while (stack.last() && inline[stack.last()]) {
183
+ parseEndTag('', stack.last());
184
+ }
185
+ }
186
+
187
+ if (closeSelf[tagName] && stack.last() == tagName) {
188
+ parseEndTag('', tagName);
189
+ }
190
+
191
+ unary = empty[tagName] || !!unary;
192
+
193
+ if (!unary) {
194
+ stack.push(tagName);
195
+ }
196
+
197
+ if (handler.start) {
198
+ var attrs = [];
199
+ rest.replace(attr, function (match, name) {
200
+ var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
201
+ attrs.push({
202
+ name: name,
203
+ value: value,
204
+ escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
205
+
206
+ });
207
+ });
208
+
209
+ if (handler.start) {
210
+ handler.start(tagName, attrs, unary);
211
+ }
212
+ }
213
+ }
214
+
215
+ function parseEndTag(tag, tagName) {
216
+ // If no tag name is provided, clean shop
217
+ if (!tagName) {
218
+ var pos = 0;
219
+ } // Find the closest opened tag of the same type
220
+ else {
221
+ for (var pos = stack.length - 1; pos >= 0; pos--) {
222
+ if (stack[pos] == tagName) {
223
+ break;
224
+ }
225
+ }
226
+ }
227
+
228
+ if (pos >= 0) {
229
+ // Close all the open elements, up the stack
230
+ for (var i = stack.length - 1; i >= pos; i--) {
231
+ if (handler.end) {
232
+ handler.end(stack[i]);
233
+ }
234
+ } // Remove the open elements from the stack
235
+
236
+
237
+ stack.length = pos;
238
+ }
239
+ }
240
+ }
241
+
242
+ function makeMap(str) {
243
+ var obj = {};
244
+ var items = str.split(',');
245
+
246
+ for (var i = 0; i < items.length; i++) {
247
+ obj[items[i]] = true;
248
+ }
249
+
250
+ return obj;
251
+ }
252
+
253
+ function removeDOCTYPE(html) {
254
+ return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
255
+ }
256
+
257
+ function parseAttrs(attrs) {
258
+ return attrs.reduce(function (pre, attr) {
259
+ var value = attr.value;
260
+ var name = attr.name;
261
+
262
+ if (pre[name]) {
263
+ pre[name] = pre[name] + " " + value;
264
+ } else {
265
+ pre[name] = value;
266
+ }
267
+
268
+ return pre;
269
+ }, {});
270
+ }
271
+
272
+ function parseHtml(html) {
273
+ html = removeDOCTYPE(html);
274
+ var stacks = [];
275
+ var results = {
276
+ node: 'root',
277
+ children: []
278
+ };
279
+ HTMLParser(html, {
280
+ start: function start(tag, attrs, unary) {
281
+ var node = {
282
+ name: tag
283
+ };
284
+
285
+ if (attrs.length !== 0) {
286
+ node.attrs = parseAttrs(attrs);
287
+ }
288
+
289
+ if (unary) {
290
+ var parent = stacks[0] || results;
291
+
292
+ if (!parent.children) {
293
+ parent.children = [];
294
+ }
295
+
296
+ parent.children.push(node);
297
+ } else {
298
+ stacks.unshift(node);
299
+ }
300
+ },
301
+ end: function end(tag) {
302
+ var node = stacks.shift();
303
+ if (node.name !== tag) console.error('invalid state: mismatch end tag');
304
+
305
+ if (stacks.length === 0) {
306
+ results.children.push(node);
307
+ } else {
308
+ var parent = stacks[0];
309
+
310
+ if (!parent.children) {
311
+ parent.children = [];
312
+ }
313
+
314
+ parent.children.push(node);
315
+ }
316
+ },
317
+ chars: function chars(text) {
318
+ var node = {
319
+ type: 'text',
320
+ text: text
321
+ };
322
+
323
+ if (stacks.length === 0) {
324
+ results.children.push(node);
325
+ } else {
326
+ var parent = stacks[0];
327
+
328
+ if (!parent.children) {
329
+ parent.children = [];
330
+ }
331
+
332
+ parent.children.push(node);
333
+ }
334
+ },
335
+ comment: function comment(text) {
336
+ var node = {
337
+ node: 'comment',
338
+ text: text
339
+ };
340
+ var parent = stacks[0];
341
+
342
+ if (!parent.children) {
343
+ parent.children = [];
344
+ }
345
+
346
+ parent.children.push(node);
347
+ }
348
+ });
349
+ return results.children;
350
+ }
351
+
352
+ export default parseHtml;
@@ -0,0 +1 @@
1
+ !function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(window,function(o,e){if(!o.jWeixin){var n,c={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},a=function(){var e={};for(var n in c)e[c[n]]=n;return e}(),i=o.document,t=i.title,r=navigator.userAgent.toLowerCase(),s=navigator.platform.toLowerCase(),d=!(!s.match("mac")&&!s.match("win")),u=-1!=r.indexOf("wxdebugger"),l=-1!=r.indexOf("micromessenger"),p=-1!=r.indexOf("android"),f=-1!=r.indexOf("iphone")||-1!=r.indexOf("ipad"),m=(n=r.match(/micromessenger\/(\d+\.\d+\.\d+)/)||r.match(/micromessenger\/(\d+\.\d+)/))?n[1]:"",g={initStartTime:L(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},h={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:f?1:p?2:-1,clientVersion:m,url:encodeURIComponent(location.href)},v={},S={_completes:[]},y={state:0,data:{}};O(function(){g.initEndTime=L()});var I=!1,_=[],w={config:function(e){B("config",v=e);var t=!1!==v.check;O(function(){if(t)M(c.config,{verifyJsApiList:C(v.jsApiList),verifyOpenTagList:C(v.openTagList)},function(){S._complete=function(e){g.preVerifyEndTime=L(),y.state=1,y.data=e},S.success=function(e){h.isPreVerifyOk=0},S.fail=function(e){S._fail?S._fail(e):y.state=-1};var t=S._completes;return t.push(function(){!function(){if(!(d||u||v.debug||m<"6.0.2"||h.systemType<0)){var i=new Image;h.appId=v.appId,h.initTime=g.initEndTime-g.initStartTime,h.preVerifyTime=g.preVerifyEndTime-g.preVerifyStartTime,w.getNetworkType({isInnerInvoke:!0,success:function(e){h.networkType=e.networkType;var n="https://open.weixin.qq.com/sdk/report?v="+h.version+"&o="+h.isPreVerifyOk+"&s="+h.systemType+"&c="+h.clientVersion+"&a="+h.appId+"&n="+h.networkType+"&i="+h.initTime+"&p="+h.preVerifyTime+"&u="+h.url;i.src=n}})}}()}),S.complete=function(e){for(var n=0,i=t.length;n<i;++n)t[n]();S._completes=[]},S}()),g.preVerifyStartTime=L();else{y.state=1;for(var e=S._completes,n=0,i=e.length;n<i;++n)e[n]();S._completes=[]}}),w.invoke||(w.invoke=function(e,n,i){o.WeixinJSBridge&&WeixinJSBridge.invoke(e,x(n),i)},w.on=function(e,n){o.WeixinJSBridge&&WeixinJSBridge.on(e,n)})},ready:function(e){0!=y.state?e():(S._completes.push(e),!l&&v.debug&&e())},error:function(e){m<"6.0.2"||(-1==y.state?e(y.data):S._fail=e)},checkJsApi:function(e){M("checkJsApi",{jsApiList:C(e.jsApiList)},(e._complete=function(e){if(p){var n=e.checkResult;n&&(e.checkResult=JSON.parse(n))}e=function(e){var n=e.checkResult;for(var i in n){var t=a[i];t&&(n[t]=n[i],delete n[i])}return e}(e)},e))},onMenuShareTimeline:function(e){P(c.onMenuShareTimeline,{complete:function(){M("shareTimeline",{title:e.title||t,desc:e.title||t,img_url:e.imgUrl||"",link:e.link||location.href,type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareAppMessage:function(n){P(c.onMenuShareAppMessage,{complete:function(e){"favorite"===e.scene?M("sendAppMessage",{title:n.title||t,desc:n.desc||"",link:n.link||location.href,img_url:n.imgUrl||"",type:n.type||"link",data_url:n.dataUrl||""}):M("sendAppMessage",{title:n.title||t,desc:n.desc||"",link:n.link||location.href,img_url:n.imgUrl||"",type:n.type||"link",data_url:n.dataUrl||""},n)}},n)},onMenuShareQQ:function(e){P(c.onMenuShareQQ,{complete:function(){M("shareQQ",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareWeibo:function(e){P(c.onMenuShareWeibo,{complete:function(){M("shareWeiboApp",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareQZone:function(e){P(c.onMenuShareQZone,{complete:function(){M("shareQZone",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},updateTimelineShareData:function(e){M("updateTimelineShareData",{title:e.title,link:e.link,imgUrl:e.imgUrl},e)},updateAppMessageShareData:function(e){M("updateAppMessageShareData",{title:e.title,desc:e.desc,link:e.link,imgUrl:e.imgUrl},e)},startRecord:function(e){M("startRecord",{},e)},stopRecord:function(e){M("stopRecord",{},e)},onVoiceRecordEnd:function(e){P("onVoiceRecordEnd",e)},playVoice:function(e){M("playVoice",{localId:e.localId},e)},pauseVoice:function(e){M("pauseVoice",{localId:e.localId},e)},stopVoice:function(e){M("stopVoice",{localId:e.localId},e)},onVoicePlayEnd:function(e){P("onVoicePlayEnd",e)},uploadVoice:function(e){M("uploadVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadVoice:function(e){M("downloadVoice",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},translateVoice:function(e){M("translateVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},chooseImage:function(e){M("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"]},(e._complete=function(e){if(p){var n=e.localIds;try{n&&(e.localIds=JSON.parse(n))}catch(e){}}},e))},getLocation:function(e){},previewImage:function(e){M(c.previewImage,{current:e.current,urls:e.urls},e)},uploadImage:function(e){M("uploadImage",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadImage:function(e){M("downloadImage",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},getLocalImgData:function(e){!1===I?(I=!0,M("getLocalImgData",{localId:e.localId},(e._complete=function(e){if(I=!1,0<_.length){var n=_.shift();wx.getLocalImgData(n)}},e))):_.push(e)},getNetworkType:function(e){M("getNetworkType",{},(e._complete=function(e){e=function(e){var n=e.errMsg;e.errMsg="getNetworkType:ok";var i=e.subtype;if(delete e.subtype,i)e.networkType=i;else{var t=n.indexOf(":"),o=n.substring(t+1);switch(o){case"wifi":case"edge":case"wwan":e.networkType=o;break;default:e.errMsg="getNetworkType:fail"}}return e}(e)},e))},openLocation:function(e){M("openLocation",{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""},e)},getLocation:function(e){M(c.getLocation,{type:(e=e||{}).type||"wgs84"},(e._complete=function(e){delete e.type},e))},hideOptionMenu:function(e){M("hideOptionMenu",{},e)},showOptionMenu:function(e){M("showOptionMenu",{},e)},closeWindow:function(e){M("closeWindow",{},e=e||{})},hideMenuItems:function(e){M("hideMenuItems",{menuList:e.menuList},e)},showMenuItems:function(e){M("showMenuItems",{menuList:e.menuList},e)},hideAllNonBaseMenuItem:function(e){M("hideAllNonBaseMenuItem",{},e)},showAllNonBaseMenuItem:function(e){M("showAllNonBaseMenuItem",{},e)},scanQRCode:function(e){M("scanQRCode",{needResult:(e=e||{}).needResult||0,scanType:e.scanType||["qrCode","barCode"]},(e._complete=function(e){if(f){var n=e.resultStr;if(n){var i=JSON.parse(n);e.resultStr=i&&i.scan_code&&i.scan_code.scan_result}}},e))},openAddress:function(e){M(c.openAddress,{},(e._complete=function(e){e=function(e){return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}(e)},e))},openProductSpecificView:function(e){M(c.openProductSpecificView,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo},e)},addCard:function(e){for(var n=e.cardList,i=[],t=0,o=n.length;t<o;++t){var r=n[t],a={card_id:r.cardId,card_ext:r.cardExt};i.push(a)}M(c.addCard,{card_list:i},(e._complete=function(e){var n=e.card_list;if(n){for(var i=0,t=(n=JSON.parse(n)).length;i<t;++i){var o=n[i];o.cardId=o.card_id,o.cardExt=o.card_ext,o.isSuccess=!!o.is_succ,delete o.card_id,delete o.card_ext,delete o.is_succ}e.cardList=n,delete e.card_list}},e))},chooseCard:function(e){M("chooseCard",{app_id:v.appId,location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:e.timestamp+"",nonce_str:e.nonceStr},(e._complete=function(e){e.cardList=e.choose_card_info,delete e.choose_card_info},e))},openCard:function(e){for(var n=e.cardList,i=[],t=0,o=n.length;t<o;++t){var r=n[t],a={card_id:r.cardId,code:r.code};i.push(a)}M(c.openCard,{card_list:i},e)},consumeAndShareCard:function(e){M(c.consumeAndShareCard,{consumedCardId:e.cardId,consumedCode:e.code},e)},chooseWXPay:function(e){M(c.chooseWXPay,V(e),e)},openEnterpriseRedPacket:function(e){M(c.openEnterpriseRedPacket,V(e),e)},startSearchBeacons:function(e){M(c.startSearchBeacons,{ticket:e.ticket},e)},stopSearchBeacons:function(e){M(c.stopSearchBeacons,{},e)},onSearchBeacons:function(e){P(c.onSearchBeacons,e)},openEnterpriseChat:function(e){M("openEnterpriseChat",{useridlist:e.userIds,chatname:e.groupName},e)},launchMiniProgram:function(e){M("launchMiniProgram",{targetAppId:e.targetAppId,path:function(e){if("string"==typeof e&&0<e.length){var n=e.split("?")[0],i=e.split("?")[1];return n+=".html",void 0!==i?n+"?"+i:n}}(e.path),envVersion:e.envVersion},e)},openBusinessView:function(e){M("openBusinessView",{businessType:e.businessType,queryString:e.queryString||"",envVersion:e.envVersion},(e._complete=function(n){if(p){var e=n.extraData;if(e)try{n.extraData=JSON.parse(e)}catch(e){n.extraData={}}}},e))},miniProgram:{navigateBack:function(e){e=e||{},O(function(){M("invokeMiniProgramAPI",{name:"navigateBack",arg:{delta:e.delta||1}},e)})},navigateTo:function(e){O(function(){M("invokeMiniProgramAPI",{name:"navigateTo",arg:{url:e.url}},e)})},redirectTo:function(e){O(function(){M("invokeMiniProgramAPI",{name:"redirectTo",arg:{url:e.url}},e)})},switchTab:function(e){O(function(){M("invokeMiniProgramAPI",{name:"switchTab",arg:{url:e.url}},e)})},reLaunch:function(e){O(function(){M("invokeMiniProgramAPI",{name:"reLaunch",arg:{url:e.url}},e)})},postMessage:function(e){O(function(){M("invokeMiniProgramAPI",{name:"postMessage",arg:e.data||{}},e)})},getEnv:function(e){O(function(){e({miniprogram:"miniprogram"===o.__wxjs_environment})})}}},T=1,k={};return i.addEventListener("error",function(e){if(!p){var n=e.target,i=n.tagName,t=n.src;if("IMG"==i||"VIDEO"==i||"AUDIO"==i||"SOURCE"==i)if(-1!=t.indexOf("wxlocalresource://")){e.preventDefault(),e.stopPropagation();var o=n["wx-id"];if(o||(o=T++,n["wx-id"]=o),k[o])return;k[o]=!0,wx.ready(function(){wx.getLocalImgData({localId:t,success:function(e){n.src=e.localData}})})}}},!0),i.addEventListener("load",function(e){if(!p){var n=e.target,i=n.tagName;n.src;if("IMG"==i||"VIDEO"==i||"AUDIO"==i||"SOURCE"==i){var t=n["wx-id"];t&&(k[t]=!1)}}},!0),e&&(o.wx=o.jWeixin=w),w}function M(n,e,i){o.WeixinJSBridge?WeixinJSBridge.invoke(n,x(e),function(e){A(n,e,i)}):B(n,i)}function P(n,i,t){o.WeixinJSBridge?WeixinJSBridge.on(n,function(e){t&&t.trigger&&t.trigger(e),A(n,e,i)}):B(n,t||i)}function x(e){return(e=e||{}).appId=v.appId,e.verifyAppId=v.appId,e.verifySignType="sha1",e.verifyTimestamp=v.timestamp+"",e.verifyNonceStr=v.nonceStr,e.verifySignature=v.signature,e}function V(e){return{timeStamp:e.timestamp+"",nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function A(e,n,i){"openEnterpriseChat"!=e&&"openBusinessView"!==e||(n.errCode=n.err_code),delete n.err_code,delete n.err_desc,delete n.err_detail;var t=n.errMsg;t||(t=n.err_msg,delete n.err_msg,t=function(e,n){var i=e,t=a[i];t&&(i=t);var o="ok";if(n){var r=n.indexOf(":");"confirm"==(o=n.substring(r+1))&&(o="ok"),"failed"==o&&(o="fail"),-1!=o.indexOf("failed_")&&(o=o.substring(7)),-1!=o.indexOf("fail_")&&(o=o.substring(5)),"access denied"!=(o=(o=o.replace(/_/g," ")).toLowerCase())&&"no permission to execute"!=o||(o="permission denied"),"config"==i&&"function not exist"==o&&(o="ok"),""==o&&(o="fail")}return n=i+":"+o}(e,t),n.errMsg=t),(i=i||{})._complete&&(i._complete(n),delete i._complete),t=n.errMsg||"",v.debug&&!i.isInnerInvoke&&alert(JSON.stringify(n));var o=t.indexOf(":");switch(t.substring(o+1)){case"ok":i.success&&i.success(n);break;case"cancel":i.cancel&&i.cancel(n);break;default:i.fail&&i.fail(n)}i.complete&&i.complete(n)}function C(e){if(e){for(var n=0,i=e.length;n<i;++n){var t=e[n],o=c[t];o&&(e[n]=o)}return e}}function B(e,n){if(!(!v.debug||n&&n.isInnerInvoke)){var i=a[e];i&&(e=i),n&&n._complete&&delete n._complete,console.log('"'+e+'",',n||"")}}function L(){return(new Date).getTime()}function O(e){l&&(o.WeixinJSBridge?e():i.addEventListener&&i.addEventListener("WeixinJSBridgeReady",e,!1))}});