pages-chat-index.BXzRXtsy.js 109 KB

12345678910
  1. import{e as t,d as e,w as n,f as r,u as o,s,g as i,j as a,z as c,a9 as u,k as l,i as h,ab as p,x as f,F as d,y as g,a2 as y,v as m,bN as v,an as w,_ as b,a as _,b as k,K as x,b3 as A,T as E,H as S,bn as C,c4 as B,c as T,o as P,n as R,L,N as D,O,l as N,ax as I,af as j,ag as M,ay as U}from"./index-DNuNVpwk.js";import{_ as q}from"./su-image.CEWkxdrE.js";import{_ as H}from"./phone-international-input.CCPqViBY.js";import{a as Y,_ as F}from"./s-layout.D9p6eCz-.js";import{_ as z}from"./s-uploader.43OLueNE.js";import{_ as $}from"./phone-international-input.vue_vue_type_style_index_0_scoped_a793e264_lang.CZSqjCi7.js";import{_ as X}from"./uni-load-more.Dn3a6J_F.js";import{_ as V}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.BwI1_kKT.js";import"./s-menu-tools.CEs7fo1o.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.nx0iNK_l.js";import"./s-layout.vue_vue_type_style_index_0_scoped_d5f7c468_lang.C_5j2fBR.js";import"./s-search-block.DtORRFbA.js";import"./useGoods.CrGbmvFq.js";const W=[{name:"[笑掉牙]",file:"xiaodiaoya.png"},{name:"[可爱]",file:"keai.png"},{name:"[冷酷]",file:"lengku.png"},{name:"[闭嘴]",file:"bizui.png"},{name:"[生气]",file:"shengqi.png"},{name:"[惊恐]",file:"jingkong.png"},{name:"[瞌睡]",file:"keshui.png"},{name:"[大笑]",file:"daxiao.png"},{name:"[爱心]",file:"aixin.png"},{name:"[坏笑]",file:"huaixiao.png"},{name:"[飞吻]",file:"feiwen.png"},{name:"[疑问]",file:"yiwen.png"},{name:"[开心]",file:"kaixin.png"},{name:"[发呆]",file:"fadai.png"},{name:"[流泪]",file:"liulei.png"},{name:"[汗颜]",file:"hanyan.png"},{name:"[惊悚]",file:"jingshu.png"},{name:"[困~]",file:"kun.png"},{name:"[心碎]",file:"xinsui.png"},{name:"[天使]",file:"tianshi.png"},{name:"[晕]",file:"yun.png"},{name:"[啊]",file:"a.png"},{name:"[愤怒]",file:"fennu.png"},{name:"[睡着]",file:"shuizhuo.png"},{name:"[面无表情]",file:"mianwubiaoqing.png"},{name:"[难过]",file:"nanguo.png"},{name:"[犯困]",file:"fankun.png"},{name:"[好吃]",file:"haochi.png"},{name:"[呕吐]",file:"outu.png"},{name:"[龇牙]",file:"ziya.png"},{name:"[懵比]",file:"mengbi.png"},{name:"[白眼]",file:"baiyan.png"},{name:"[饿死]",file:"esi.png"},{name:"[凶]",file:"xiong.png"},{name:"[感冒]",file:"ganmao.png"},{name:"[流汗]",file:"liuhan.png"},{name:"[笑哭]",file:"xiaoku.png"},{name:"[流口水]",file:"liukoushui.png"},{name:"[尴尬]",file:"ganga.png"},{name:"[惊讶]",file:"jingya.png"},{name:"[大惊]",file:"dajing.png"},{name:"[不好意思]",file:"buhaoyisi.png"},{name:"[大闹]",file:"danao.png"},{name:"[不可思议]",file:"bukesiyi.png"},{name:"[爱你]",file:"aini.png"},{name:"[红心]",file:"hongxin.png"},{name:"[点赞]",file:"dianzan.png"},{name:"[恶魔]",file:"emo.png"}];let K={};W.forEach(((t,e)=>{K[Math.floor(e/30)+1]||(K[Math.floor(e/30)+1]=[]),K[Math.floor(e/30)+1].push(t)}));const J=V({__name:"goods",props:{goodsData:{type:Object,default:{}}},setup:p=>(f,d)=>{const g=l,y=h;return t(),e(y,{class:"goods ss-flex"},{default:n((()=>[r(g,{class:"image",src:o(s).$url.cdn(p.goodsData.image),mode:"aspectFill"},null,8,["src"]),r(y,{class:"ss-flex-1"},{default:n((()=>[r(y,{class:"title ss-line-2"},{default:n((()=>[i(a(p.goodsData.title),1)])),_:1}),p.goodsData.subtitle?(t(),e(y,{key:0,class:"subtitle ss-line-1"},{default:n((()=>[i(a(p.goodsData.subtitle),1)])),_:1})):c("",!0),r(y,{class:"price ss-m-t-8"},{default:n((()=>[i(" ¥"+a(o(u.isArray)(p.goodsData.price)?p.goodsData.price[0]:p.goodsData.price),1)])),_:1})])),_:1})])),_:1})}},[["__scopeId","data-v-5a0600db"]]),G=V({__name:"order",props:{from:String,orderData:{type:Object,default:{}}},setup:u=>(y,m)=>{const v=h,w=l;return t(),e(v,{class:"order"},{default:n((()=>[r(v,{class:"top ss-flex ss-row-between"},{default:n((()=>[p("span",null,a(u.orderData.order_sn),1),p("span",null,a(u.orderData.create_time.split(" ")[1]),1)])),_:1}),"msg"!=u.from?(t(!0),f(d,{key:0},g(u.orderData.items,(l=>(t(),e(v,{class:"bottom ss-flex",key:l},{default:n((()=>[r(w,{class:"image",src:o(s).$url.cdn(l.goods_image),mode:"aspectFill"},null,8,["src"]),r(v,{class:"ss-flex-1"},{default:n((()=>[r(v,{class:"title ss-line-2"},{default:n((()=>[i(a(l.goods_title),1)])),_:2},1024),l.goods_num?(t(),e(v,{key:0,class:"num ss-m-b-10"},{default:n((()=>[i(" 数量:"+a(l.goods_num),1)])),_:2},1024)):c("",!0),r(v,{class:"ss-flex ss-row-between ss-m-t-8"},{default:n((()=>[p("span",{class:"price"},"¥"+a(l.goods_price),1),p("span",{class:"status"},a(u.orderData.status_text),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128)):(t(!0),f(d,{key:1},g([u.orderData.items[0]],(c=>(t(),e(v,{class:"bottom ss-flex",key:c},{default:n((()=>[r(w,{class:"image",src:o(s).$url.cdn(c.goods_image),mode:"aspectFill"},null,8,["src"]),r(v,{class:"ss-flex-1"},{default:n((()=>[r(v,{class:"title title-1 ss-line-1"},{default:n((()=>[i(a(c.goods_title),1)])),_:2},1024),r(v,{class:"order-total ss-flex ss-row-between ss-m-t-8"},{default:n((()=>[p("span",null,"共"+a(u.orderData.items.length)+"件商品",1),p("span",null,"合计 ¥"+a(u.orderData.pay_fee),1)])),_:1}),r(v,{class:"ss-flex ss-row-right ss-m-t-8"},{default:n((()=>[p("span",{class:"status"},a(u.orderData.status_text),1)])),_:1})])),_:2},1024)])),_:2},1024)))),128))])),_:1})}},[["__scopeId","data-v-042fa813"]]),Q=V({__name:"select-popup",props:{mode:{type:String,default:"goods"},show:{type:Boolean,default:!1}},emits:["select","close"],setup(o,{emit:s}){const i=s,u=o;y((()=>u.mode),(()=>{l.pagination.data=[],u.mode&&A(l.pagination.page)}));const l=m({loadStatus:"",pagination:{data:[],current_page:1,total:1,last_page:1}});async function A(t,e=5){l.loadStatus="loading";const n="goods"==u.mode?await v.getBrowseHistoryPage({page:t,list_rows:e}):await w.getOrderPage({page:t,list_rows:e});let r=b.concat(l.pagination.data,n.data.data);l.pagination={...n.data,data:r},l.pagination.current_page<l.pagination.last_page?l.loadStatus="more":l.loadStatus="noMore"}function E(){"noMore"!==l.loadStatus&&A(l.pagination.current_page+1)}return(s,u)=>{const y=h,m=_(k("uni-load-more"),X),v=x,w=_(k("su-popup"),$);return t(),e(w,{show:o.show,showClose:"",round:"10",backgroundColor:"#eee",onClose:u[0]||(u[0]=t=>i("close"))},{default:n((()=>[r(y,{class:"select-popup"},{default:n((()=>[r(y,{class:"title"},{default:n((()=>[p("span",null,a("goods"==o.mode?"我的浏览":"我的订单"),1)])),_:1}),r(v,{class:"scroll-box","scroll-y":"true","scroll-with-animation":!0,"show-scrollbar":!1,onScrolltolower:E},{default:n((()=>[(t(!0),f(d,null,g(l.pagination.data,(r=>(t(),e(y,{class:"item",key:r,onClick:t=>i("select",{type:o.mode,data:r})},{default:n((()=>["goods"==o.mode?(t(),e(J,{key:0,goodsData:r.goods},null,8,["goodsData"])):c("",!0),"order"==o.mode?(t(),e(G,{key:1,orderData:r},null,8,["orderData"])):c("",!0)])),_:2},1032,["onClick"])))),128)),r(m,{status:l.loadStatus,"content-text":{contentdown:"上拉加载更多"}},null,8,["status"])])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-a6a8a487"]]);var Z={exports:{}};window;const tt=A(Z.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){t.exports=function(){return function(){}}},function(t,e,n){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){var r,o=n(33),s=n(16),i=n(35),a=n(36),c=n(37);"undefined"!=typeof ArrayBuffer&&(r=n(38));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),l="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),h=u||l;e.protocol=3;var p=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=o(p),d={type:"error",data:"parser error"},g=n(39);function y(t,e,n){for(var r=new Array(t.length),o=a(t.length,n),s=function(t,n,o){e(n,(function(e,n){r[t]=n,o(e,r)}))},i=0;i<t.length;i++)s(i,t[i],o)}e.encodePacket=function(t,n,r,o){"function"==typeof n&&(o=n,n=!1),"function"==typeof r&&(o=r,r=null);var s,i=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,s=new Uint8Array(o),i=new Uint8Array(1+o.byteLength);i[0]=p[t.type];for(var a=0;a<s.length;a++)i[a+1]=s[a];return r(i.buffer)}(t,n,o);if(void 0!==g&&i instanceof g)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(h)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){e.encodePacket({type:t.type,data:o.result},n,!0,r)},o.readAsArrayBuffer(t.data)}(t,n,r);var o=new Uint8Array(1);return o[0]=p[t.type],r(new g([o.buffer,t.data]))}(t,n,o);if(i&&i.base64)return s=t,o("b"+e.packets[s.type]+s.data.data);var a=p[t.type];return void 0!==t.data&&(a+=r?c.encode(String(t.data),{strict:!1}):String(t.data)),o(""+a)},e.encodeBase64Packet=function(t,n){var r,o="b"+e.packets[t.type];if(void 0!==g&&t.data instanceof g){var s=new FileReader;return s.onload=function(){var t=s.result.split(",")[1];n(o+t)},s.readAsDataURL(t.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(u){for(var i=new Uint8Array(t.data),a=new Array(i.length),c=0;c<i.length;c++)a[c]=i[c];r=String.fromCharCode.apply(null,a)}return o+=btoa(r),n(o)},e.decodePacket=function(t,n,r){if(void 0===t)return d;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&!1===(t=function(t){try{t=c.decode(t,{strict:!1})}catch(e){return!1}return t}(t)))return d;var o=t.charAt(0);return Number(o)==o&&f[o]?t.length>1?{type:f[o],data:t.substring(1)}:{type:f[o]}:d}o=new Uint8Array(t)[0];var s=i(t,1);return g&&"blob"===n&&(s=new g([s])),{type:f[o],data:s}},e.decodeBase64Packet=function(t,e){var n=f[t.charAt(0)];if(!r)return{type:n,data:{base64:!0,data:t.substr(1)}};var o=r.decode(t.substr(1));return"blob"===e&&g&&(o=new g([o])),{type:n,data:o}},e.encodePayload=function(t,n,r){"function"==typeof n&&(r=n,n=null);var o=s(t);return n&&o?g&&!h?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r):t.length?void y(t,(function(t,r){e.encodePacket(t,!!o&&n,!1,(function(t){var e;r(null,(e=t).length+":"+e)}))}),(function(t,e){return r(e.join(""))})):r("0:")},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);var o;if("function"==typeof n&&(r=n,n=null),""===t)return r(d,0,1);for(var s,i,a="",c=0,u=t.length;c<u;c++){var l=t.charAt(c);if(":"===l){if(""===a||a!=(s=Number(a)))return r(d,0,1);if(a!=(i=t.substr(c+1,s)).length)return r(d,0,1);if(i.length){if(o=e.decodePacket(i,n,!1),d.type===o.type&&d.data===o.data)return r(d,0,1);if(!1===r(o,c+s,u))return}c+=s,a=""}else a+=l}return""!==a?r(d,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){if(!t.length)return n(new ArrayBuffer(0));y(t,(function(t,n){e.encodePacket(t,!0,!0,(function(t){return n(null,t)}))}),(function(t,e){var r=e.reduce((function(t,e){var n;return t+(n="string"==typeof e?e.length:e.byteLength).toString().length+n+2}),0),o=new Uint8Array(r),s=0;return e.forEach((function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);n=r.buffer}o[s++]=e?0:1;var a=n.byteLength.toString();for(i=0;i<a.length;i++)o[s++]=parseInt(a[i]);for(o[s++]=255,r=new Uint8Array(n),i=0;i<r.length;i++)o[s++]=r[i]})),n(o.buffer)}))},e.encodePayloadAsBlob=function(t,n){y(t,(function(t,n){e.encodePacket(t,!0,!0,(function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,e[0]=0}var s=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),i=new Uint8Array(s.length+1);for(o=0;o<s.length;o++)i[o]=parseInt(s[o]);if(i[s.length]=255,g){var a=new g([e.buffer,i.buffer,t]);n(null,a)}}))}),(function(t,e){return n(new g(e))}))},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var o=t,s=[];o.byteLength>0;){for(var a=new Uint8Array(o),c=0===a[0],u="",l=1;255!==a[l];l++){if(u.length>310)return r(d,0,1);u+=a[l]}o=i(o,2+u.length),u=parseInt(u);var h=i(o,0,u);if(c)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(g){var p=new Uint8Array(h);for(h="",l=0;l<p.length;l++)h+=String.fromCharCode(p[l])}s.push(h),o=i(o,u)}var f=s.length;s.forEach((function(t,o){r(e.decodePacket(t,n,!0),o,f)}))}},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var s=n[r].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},function(t,e){t.exports=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){var r=n(0)("socket.io-parser"),o=n(1),s=n(25),i=n(10),a=n(11);function c(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=c,e.Decoder=h;var u=e.ERROR+'"encode error"';function l(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var o=function(t){try{return JSON.stringify(t)}catch(e){return!1}}(t.data);if(!1===o)return u;n+=o}return r("encoded %j as %s",t,n),n}function h(){this.reconstructor=null}function p(t){this.reconPack=t,this.buffers=[]}function f(t){return{type:e.ERROR,data:"parser error: "+t}}c.prototype.encode=function(t,n){var o,i;r("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type?(o=t,i=n,s.removeBlobs(o,(function(t){var e=s.deconstructPacket(t),n=l(e.packet),r=e.buffers;r.unshift(n),i(r)}))):n([l(t)])},o(h.prototype),h.prototype.add=function(t){var n;if("string"==typeof t)n=function(t){var n=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return f("unknown packet type "+o.type);if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var s="";"-"!==t.charAt(++n)&&(s+=t.charAt(n),n!=t.length););if(s!=Number(s)||"-"!==t.charAt(n))throw new Error("Illegal attachments");o.attachments=Number(s)}if("/"===t.charAt(n+1))for(o.nsp="";++n&&","!==(c=t.charAt(n))&&(o.nsp+=c,n!==t.length););else o.nsp="/";var a=t.charAt(n+1);if(""!==a&&Number(a)==a){for(o.id="";++n;){var c;if(null==(c=t.charAt(n))||Number(c)!=c){--n;break}if(o.id+=t.charAt(n),n===t.length)break}o.id=Number(o.id)}if(t.charAt(++n)){var u=function(t){try{return JSON.parse(t)}catch(e){return!1}}(t.substr(n));if(!1===u||o.type!==e.ERROR&&!i(u))return f("invalid payload");o.data=u}return r("decoded %s as %j",t,o),o}(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!a(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",n))}},h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){(function(t){
  2. /*!
  3. * The buffer module from node.js, for the browser.
  4. *
  5. * @author Feross Aboukhadijeh <http://feross.org>
  6. * @license MIT
  7. */
  8. var r=n(26),o=n(27),s=n(28);function i(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,n)}function u(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=p(t,e),t}(t,e,n,r):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,n),o=(t=a(t,r)).write(e,n);return o!==r&&(t=t.slice(0,o)),t}(t,e,n):function(t,e){if(c.isBuffer(e)){var n=0|f(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):p(t,e);if("Buffer"===e.type&&s(e.data))return p(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=a(t,e<0?0:0|f(e)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function p(t,e){var n=e.length<0?0:0|f(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function f(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function d(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(r)return q(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return B(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,o);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,o){var s,i=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;i=2,a/=2,c/=2,n/=2}function u(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}if(o){var l=-1;for(s=n;s<a;s++)if(u(t,s)===u(e,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*i}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var h=!0,p=0;p<c;p++)if(u(t,s+p)!==u(e,p)){h=!1;break}if(h)return s}return-1}function w(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var i=0;i<r;++i){var a=parseInt(e.substr(2*i,2),16);if(isNaN(a))return i;t[n+i]=a}return i}function b(t,e,n,r){return Y(q(e,t.length-n),t,n,r)}function _(t,e,n,r){return Y(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function k(t,e,n,r){return _(t,e,n,r)}function x(t,e,n,r){return Y(H(e),t,n,r)}function A(t,e,n,r){return Y(function(t,e){for(var n,r,o,s=[],i=0;i<t.length&&!((e-=2)<0);++i)r=(n=t.charCodeAt(i))>>8,o=n%256,s.push(o),s.push(r);return s}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var s,i,a,c,u=t[o],l=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(s=t[o+1]))&&(c=(31&u)<<6|63&s)>127&&(l=c);break;case 3:s=t[o+1],i=t[o+2],128==(192&s)&&128==(192&i)&&(c=(15&u)<<12|(63&s)<<6|63&i)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:s=t[o+1],i=t[o+2],a=t[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&(c=(15&u)<<18|(63&s)<<12|(63&i)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function B(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function T(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",s=e;s<n;++s)o+=U(t[s]);return o}function P(t,e,n){for(var r=t.slice(e,n),o="",s=0;s<r.length;s+=2)o+=String.fromCharCode(r[s]+256*r[s+1]);return o}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,n,r,o,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function D(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,s=Math.min(t.length-n,2);o<s;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function O(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,s=Math.min(t.length-n,4);o<s;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function N(t,e,n,r,o,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(t,e,n,r,s){return s||N(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,s){return s||N(t,0,n,8),o.write(t,e,n,r,52,8),n+8}e.Buffer=c,e.SlowBuffer=function(t){return+t!=t&&(t=0),c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}(),e.kMaxLength=i(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,n){return u(null,t,e,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,n){return r=null,s=e,i=n,l(o=t),o<=0?a(r,o):void 0!==s?"string"==typeof i?a(r,o).fill(s,i):a(r,o).fill(s):a(r,o);var r,o,s,i},c.allocUnsafe=function(t){return h(null,t)},c.allocUnsafeSlow=function(t){return h(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,s=Math.min(n,r);o<s;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var i=t[n];if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},c.byteLength=d,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):g.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,n,r,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(r>>>=0),i=(n>>>=0)-(e>>>=0),a=Math.min(s,i),u=this.slice(r,o),l=t.slice(e,n),h=0;h<a;++h)if(u[h]!==l[h]){s=u[h],i=l[h];break}return s<i?-1:i<s?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":return _(this,t,e,n);case"latin1":case"binary":return k(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},c.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=c.prototype;else{var o=e-t;n=new c(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+t]}return n},c.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],o=1,s=0;++s<e&&(o*=256);)r+=this[t+s]*o;return r},c.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},c.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],o=1,s=0;++s<e&&(o*=256);)r+=this[t+s]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=e,o=1,s=this[t+--r];r>0&&(o*=256);)s+=this[t+--r]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||L(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[e]=255&t;++s<n&&(o*=256);)this[e+s]=t/o&255;return e+n},c.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||L(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,s=1;for(this[e+o]=255&t;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var s=0,i=1,a=0;for(this[e]=255&t;++s<n&&(i*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/i>>0)-a&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var s=n-1,i=1,a=0;for(this[e+s]=255&t;--s>=0&&(i*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/i>>0)-a&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return I(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return I(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,s=r-n;if(this===t&&n<e&&e<r)for(o=s-1;o>=0;--o)t[o+e]=this[o+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var i=c.isBuffer(t)?t:q(new c(t,r).toString()),a=i.length;for(s=0;s<n-e;++s)this[s+e]=i[s%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function q(t,e){var n;e=e||1/0;for(var r=t.length,o=null,s=[],i=0;i<r;++i){if((n=t.charCodeAt(i))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(i+1===r){(e-=3)>-1&&s.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&s.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function H(t){return r.toByteArray(function(t){if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(M,"")).length<2)return"";for(var e;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}).call(this,n(12))},function(t,e,n){var r=n(31);t.exports=function(t){var e=t.xdomain,n=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(s){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(s){}if(!e)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(s){}}},function(t,e,n){var r=n(2),o=n(1);function s(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}t.exports=s,o(s.prototype),s.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},s.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},s.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},s.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},s.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},s.prototype.onData=function(t){var e=r.decodePacket(t,this.socket.binaryType);this.onPacket(e)},s.prototype.onPacket=function(t){this.emit("packet",t)},s.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),s=t.indexOf("]");-1!=o&&-1!=s&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var i=n.exec(t||""),a={},c=14;c--;)a[r[c]]=i[c]||"";return-1!=o&&-1!=s&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){(function(e){t.exports=function(t){return n&&e.isBuffer(t)||r&&(t instanceof ArrayBuffer||(o=t,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(o):o.buffer instanceof ArrayBuffer));var o};var n="function"==typeof e&&"function"==typeof e.isBuffer,r="function"==typeof ArrayBuffer}).call(this,n(6).Buffer)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(29),o=n(19),s=n(1),i=n(5),a=n(20),c=n(21),u=n(0)("socket.io-client:manager"),l=n(18),h=n(46),p=Object.prototype.hasOwnProperty;function f(t,e){if(!(this instanceof f))return new f(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||i;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}t.exports=f,f.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)p.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},f.prototype.updateSocketIds=function(){for(var t in this.nsps)p.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},f.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},s(f.prototype),f.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},f.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},f.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},f.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},f.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},f.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},f.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},f.prototype.open=f.prototype.connect=function(t,e){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,o=this;this.readyState="opening",this.skipReconnect=!1;var s=a(n,"open",(function(){o.onopen(),t&&t()})),i=a(n,"error",(function(e){if(u("connect_error"),o.cleanup(),o.readyState="closed",o.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else o.maybeReconnectOnOpen()}));if(!1!==this._timeout){var c=this._timeout;u("connect attempt will timeout after %d",c);var l=setTimeout((function(){u("connect attempt timed out after %d",c),s.destroy(),n.close(),n.emit("error","timeout"),o.emitAll("connect_timeout",c)}),c);this.subs.push({destroy:function(){clearTimeout(l)}})}return this.subs.push(s),this.subs.push(i),this},f.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(a(t,"data",c(this,"ondata"))),this.subs.push(a(t,"ping",c(this,"onping"))),this.subs.push(a(t,"pong",c(this,"onpong"))),this.subs.push(a(t,"error",c(this,"onerror"))),this.subs.push(a(t,"close",c(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",c(this,"ondecoded")))},f.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},f.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},f.prototype.ondata=function(t){this.decoder.add(t)},f.prototype.ondecoded=function(t){this.emit("packet",t)},f.prototype.onerror=function(t){u("error",t),this.emitAll("error",t)},f.prototype.socket=function(t,e){var n=this.nsps[t];if(!n){n=new o(this,t,e),this.nsps[t]=n;var r=this;n.on("connecting",s),n.on("connect",(function(){n.id=r.generateId(t)})),this.autoConnect&&s()}function s(){~l(r.connecting,n)||r.connecting.push(n)}return n},f.prototype.destroy=function(t){var e=l(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},f.prototype.packet=function(t){u("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,(function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()})))},f.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},f.prototype.cleanup=function(){u("cleanup");for(var t=this.subs.length,e=0;e<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},f.prototype.close=f.prototype.disconnect=function(){u("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},f.prototype.onclose=function(t){u("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},f.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();u("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout((function(){t.skipReconnect||(u("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open((function(e){e?(u("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(u("reconnect success"),t.onreconnect())})))}),e);this.subs.push({destroy:function(){clearTimeout(n)}})}},f.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){var r=n(7),o=n(32),s=n(40),i=n(41);e.polling=function(t){var e=!1,n=!1,i=!1!==t.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),e=t.hostname!==location.hostname||c!==t.port,n=t.secure!==a}if(t.xdomain=e,t.xscheme=n,"open"in new r(t)&&!t.forceJSONP)return new o(t);if(!i)throw new Error("JSONP disabled");return new s(t)},e.websocket=i},function(t,e,n){var r=n(8),o=n(3),s=n(2),i=n(4),a=n(17),c=n(0)("engine.io-client:polling");t.exports=l;var u=null!=new(n(7))({xdomain:!1}).responseType;function l(t){var e=t&&t.forceBase64;u&&!e||(this.supportsBinary=!1),r.call(this,t)}i(l,r),l.prototype.name="polling",l.prototype.doOpen=function(){this.poll()},l.prototype.pause=function(t){var e=this;function n(){c("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(c("we are currently polling - waiting to pause"),r++,this.once("pollComplete",(function(){c("pre-pause polling complete"),--r||n()}))),this.writable||(c("we are currently writing - waiting to pause"),r++,this.once("drain",(function(){c("pre-pause writing complete"),--r||n()})))}else n()},l.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},l.prototype.onData=function(t){var e=this;c("polling got data %s",t),s.decodePayload(t,this.socket.binaryType,(function(t,n,r){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},l.prototype.doClose=function(){var t=this;function e(){c("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),e()):(c("transport not open - deferring close"),this.once("open",e))},l.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};s.encodePayload(t,this.supportsBinary,(function(t){e.doWrite(t,n)}))},l.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=a()),this.supportsBinary||t.sid||(t.b64=1),t=o.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){(function(e){var r=n(34),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),i="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);t.exports=function t(n){if(!n||"object"!=typeof n)return!1;if(r(n)){for(var o=0,a=n.length;o<a;o++)if(t(n[o]))return!0;return!1}if("function"==typeof e&&e.isBuffer&&e.isBuffer(n)||"function"==typeof ArrayBuffer&&n instanceof ArrayBuffer||s&&n instanceof Blob||i&&n instanceof File)return!0;if(n.toJSON&&"function"==typeof n.toJSON&&1===arguments.length)return t(n.toJSON(),!0);for(var c in n)if(Object.prototype.hasOwnProperty.call(n,c)&&t(n[c]))return!0;return!1}}).call(this,n(6).Buffer)},function(t,e,n){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s={},i=0,a=0;function c(t){var e="";do{e=o[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function u(){var t=c(+new Date);return t!==r?(i=0,r=t):t+"."+c(i++)}for(;a<64;a++)s[o[a]]=a;u.encode=c,u.decode=function(t){var e=0;for(a=0;a<t.length;a++)e=64*e+s[t.charAt(a)];return e},t.exports=u},function(t,e){var n=[].indexOf;t.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}},function(t,e,n){var r=n(5),o=n(1),s=n(45),i=n(20),a=n(21),c=n(0)("socket.io-client:socket"),u=n(3),l=n(16);t.exports=f;var h={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},p=o.prototype.emit;function f(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}o(f.prototype),f.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[i(t,"open",a(this,"onopen")),i(t,"packet",a(this,"onpacket")),i(t,"close",a(this,"onclose"))]}},f.prototype.open=f.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},f.prototype.send=function(){var t=s(arguments);return t.unshift("message"),this.emit.apply(this,t),this},f.prototype.emit=function(t){if(h.hasOwnProperty(t))return p.apply(this,arguments),this;var e=s(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:l(e))?r.BINARY_EVENT:r.EVENT,data:e,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},f.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},f.prototype.onopen=function(){if(c("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?u.encode(this.query):this.query;c("sending connect packet with query %s",t),this.packet({type:r.CONNECT,query:t})}else this.packet({type:r.CONNECT})},f.prototype.onclose=function(t){c("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},f.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===r.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(t);break;case r.ACK:case r.BINARY_ACK:this.onack(t);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",t.data)}},f.prototype.onevent=function(t){var e=t.data||[];c("emitting event %j",e),null!=t.id&&(c("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?p.apply(this,e):this.receiveBuffer.push(e)},f.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var o=s(arguments);c("sending ack %j",o),e.packet({type:l(o)?r.BINARY_ACK:r.ACK,id:t,data:o})}}},f.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(c("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):c("bad ack %s",t.id)},f.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},f.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)p.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},f.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},f.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},f.prototype.close=f.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},f.prototype.compress=function(t){return this.flags.compress=t,this},f.prototype.binary=function(t){return this.flags.binary=t,this}},function(t,e){t.exports=function(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}},function(t,e){var n=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},function(t,e,n){t.exports=n(23)},function(t,e,n){var r=n(24),o=n(5),s=n(13),i=n(0)("socket.io-client");t.exports=e=c;var a=e.managers={};function c(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,o=r(t),c=o.source,u=o.id,l=o.path,h=a[u]&&l in a[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||h?(i("ignoring socket cache for %s",c),n=s(c,e)):(a[u]||(i("new io instance for %s",c),a[u]=s(c,e)),n=a[u]),o.query&&!e.query&&(e.query=o.query),n.socket(o.path,e)}e.protocol=o.protocol,e.connect=c,e.Manager=n(13),e.Socket=n(19)},function(t,e,n){var r=n(9),o=n(0)("socket.io-client:url");t.exports=function(t,e){var n=t;e=e||"undefined"!=typeof location&&location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(o("protocol-less url %s",t),t=void 0!==e?e.protocol+"//"+t:"https://"+t),o("parse %s",t),n=r(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var s=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(e&&e.port===n.port?"":":"+n.port),n}},function(t,e,n){var r=n(10),o=n(11),s=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===s.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===s.call(File);e.deconstructPacket=function(t){var e=[],n=t.data,s=t;return s.data=function t(e,n){if(!e)return e;if(o(e)){var s={_placeholder:!0,num:n.length};return n.push(e),s}if(r(e)){for(var i=new Array(e.length),a=0;a<e.length;a++)i[a]=t(e[a],n);return i}if("object"==typeof e&&!(e instanceof Date)){for(var c in i={},e)i[c]=t(e[c],n);return i}return e}(n,e),s.attachments=e.length,{packet:s,buffers:e}},e.reconstructPacket=function(t,e){return t.data=function t(e,n){if(!e)return e;if(e&&e._placeholder)return n[e.num];if(r(e))for(var o=0;o<e.length;o++)e[o]=t(e[o],n);else if("object"==typeof e)for(var s in e)e[s]=t(e[s],n);return e}(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){var n=0,s=t;!function t(c,u,l){if(!c)return c;if(i&&c instanceof Blob||a&&c instanceof File){n++;var h=new FileReader;h.onload=function(){l?l[u]=this.result:s=this.result,--n||e(s)},h.readAsArrayBuffer(c)}else if(r(c))for(var p=0;p<c.length;p++)t(c[p],p,c);else if("object"==typeof c&&!o(c))for(var f in c)t(c[f],f,c)}(s),n||e(s)}},function(t,e,n){e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r,i=u(t),a=i[0],c=i[1],l=new s(3*(a+(r=c))/4-r),h=0,p=c>0?a-4:a;for(n=0;n<p;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],l[h++]=e>>16&255,l[h++]=e>>8&255,l[h++]=255&e;return 2===c&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,l[h++]=255&e),1===c&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,l[h++]=e>>8&255,l[h++]=255&e),l},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,s=[],i=0,a=n-o;i<a;i+=16383)s.push(l(t,i,i+16383>a?a:i+16383));return 1===o?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],o=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=i.length;a<c;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,n){for(var o,s,i=[],a=e;a<n;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),i.push(r[(s=o)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return i.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,o){var s,i,a=8*o-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?o-1:0,p=n?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+t[e+h],h+=p,l-=8);for(i=s&(1<<-l)-1,s>>=-l,l+=r;l>0;i=256*i+t[e+h],h+=p,l-=8);if(0===s)s=1-u;else{if(s===c)return i?NaN:1/0*(f?-1:1);i+=Math.pow(2,r),s-=u}return(f?-1:1)*i*Math.pow(2,s-r)},e.write=function(t,e,n,r,o,s){var i,a,c,u=8*s-o-1,l=(1<<u)-1,h=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=l):(i=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-i))<1&&(i--,c*=2),(e+=i+h>=1?p/c:p*Math.pow(2,1-h))*c>=2&&(i++,c/=2),i+h>=l?(a=0,i=l):i+h>=1?(a=(e*c-1)*Math.pow(2,o),i+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),i=0));o>=8;t[n+f]=255&a,f+=d,a/=256,o-=8);for(i=i<<o|a,u+=o;u>0;t[n+f]=255&i,f+=d,i/=256,u-=8);t[n+f-d]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){t.exports=n(30),t.exports.parser=n(2)},function(t,e,n){var r=n(14),o=n(1),s=n(0)("engine.io-client:socket"),i=n(18),a=n(2),c=n(9),u=n(3);function l(t,e){if(!(this instanceof l))return new l(t,e);e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=c(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=c(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=u.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}t.exports=l,l.priorWebsocketSuccess=!1,o(l.prototype),l.protocol=a.protocol,l.Socket=l,l.Transport=n(8),l.transports=n(14),l.parser=n(2),l.prototype.createTransport=function(t){s('creating transport "%s"',t);var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.query);e.EIO=a.protocol,e.transport=t;var n=this.transportOptions[t]||{};return this.id&&(e.sid=this.id),new r[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,withCredentials:n.withCredentials||this.withCredentials,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},l.prototype.open=function(){var t;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout((function(){e.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},l.prototype.setTransport=function(t){s("setting transport %s",t.name);var e=this;this.transport&&(s("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",(function(){e.onDrain()})).on("packet",(function(t){e.onPacket(t)})).on("error",(function(t){e.onError(t)})).on("close",(function(){e.onClose("transport close")}))},l.prototype.probe=function(t){s('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var o=!this.supportsBinary&&r.transport.supportsBinary;n=n||o}n||(s('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(s('probe transport "%s" pong',t),r.upgrading=!0,r.emit("upgrading",e),!e)return;l.priorWebsocketSuccess="websocket"===e.name,s('pausing current transport "%s"',r.transport.name),r.transport.pause((function(){n||"closed"!==r.readyState&&(s("changing transport and sending upgrade packet"),p(),r.setTransport(e),e.send([{type:"upgrade"}]),r.emit("upgrade",e),e=null,r.upgrading=!1,r.flush())}))}else{s('probe transport "%s" failed',t);var i=new Error("probe error");i.transport=e.name,r.emit("upgradeError",i)}})))}function i(){n||(n=!0,p(),e.close(),e=null)}function a(n){var o=new Error("probe error: "+n);o.transport=e.name,i(),s('probe transport "%s" failed because of error: %s',t,n),r.emit("upgradeError",o)}function c(){a("transport closed")}function u(){a("socket closed")}function h(t){e&&t.name!==e.name&&(s('"%s" works - aborting "%s"',t.name,e.name),i())}function p(){e.removeListener("open",o),e.removeListener("error",a),e.removeListener("close",c),r.removeListener("close",u),r.removeListener("upgrading",h)}l.priorWebsocketSuccess=!1,e.once("open",o),e.once("error",a),e.once("close",c),this.once("close",u),this.once("upgrading",h),e.open()},l.prototype.onOpen=function(){if(s("socket open"),this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){s("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},l.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(s('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else s('packet received with socket readyState "%s"',this.readyState)},l.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},l.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout((function(){"closed"!==e.readyState&&e.onClose("ping timeout")}),t||e.pingInterval+e.pingTimeout)},l.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout((function(){s("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)}),t.pingInterval)},l.prototype.ping=function(){var t=this;this.sendPacket("ping",(function(){t.emit("ping")}))},l.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},l.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(s("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},l.prototype.write=l.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},l.prototype.sendPacket=function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},l.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():e()})):this.upgrading?r():e()}function e(){t.onClose("forced close"),s("socket closing - telling transport to close"),t.transport.close()}function n(){t.removeListener("upgrade",n),t.removeListener("upgradeError",n),e()}function r(){t.once("upgrade",n),t.once("upgradeError",n)}return this},l.prototype.onError=function(t){s("socket error %j",t),l.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},l.prototype.onClose=function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(s('socket close with reason: "%s"',t),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)},l.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~i(this.transports,t[n])&&e.push(t[n]);return e}},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){t.exports=!1}},function(t,e,n){var r=n(7),o=n(15),s=n(1),i=n(4),a=n(0)("engine.io-client:polling-xhr");function c(){}function u(t){if(o.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,"undefined"!=typeof location){var e="https:"===location.protocol,n=location.port;n||(n=e?443:80),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port,this.xs=t.secure!==e}}function l(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}if(t.exports=u,t.exports.Request=l,i(u,o),u.prototype.supportsBinary=!0,u.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new l(t)},u.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:n}),o=this;r.on("success",e),r.on("error",(function(t){o.onError("xhr post error",t)})),this.sendXhr=r},u.prototype.doPoll=function(){a("xhr poll");var t=this.request(),e=this;t.on("data",(function(t){e.onData(t)})),t.on("error",(function(t){e.onError("xhr poll error",t)})),this.pollXhr=t},s(l.prototype),l.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new r(t),n=this;try{a("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var o in e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&e.setRequestHeader(o,this.extraHeaders[o])}catch(s){}if("POST"===this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{e.setRequestHeader("Accept","*/*")}catch(s){}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){n.onLoad()},e.onerror=function(){n.onError(e.responseText)}):e.onreadystatechange=function(){if(2===e.readyState)try{var t=e.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(e.responseType="arraybuffer")}catch(r){}4===e.readyState&&(200===e.status||1223===e.status?n.onLoad():setTimeout((function(){n.onError("number"==typeof e.status?e.status:0)}),0))},a("xhr data %s",this.data),e.send(this.data)}catch(s){return void setTimeout((function(){n.onError(s)}),0)}"undefined"!=typeof document&&(this.index=l.requestsCount++,l.requests[this.index]=this)},l.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},l.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},l.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},l.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=c:this.xhr.onreadystatechange=c,t)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete l.requests[this.index],this.xhr=null}},l.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(n){}t=("application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&this.xhr.response||this.xhr.responseText}catch(n){this.onError(n)}null!=t&&this.onData(t)},l.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},l.prototype.abort=function(){this.cleanup()},l.requestsCount=0,l.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",p);else if("function"==typeof addEventListener){var h="onpagehide"in self?"pagehide":"unload";addEventListener(h,p,!1)}function p(){for(var t in l.requests)l.requests.hasOwnProperty(t)&&l.requests[t].abort()}},function(t,e){t.exports=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){t.exports=function(t,e,n){var r=t.byteLength;if(e=e||0,n=n||r,t.slice)return t.slice(e,n);if(e<0&&(e+=r),n<0&&(n+=r),n>r&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),s=new Uint8Array(n-e),i=e,a=0;i<n;i++,a++)s[a]=o[i];return s.buffer}},function(t,e){function n(){}t.exports=function(t,e,r){var o=!1;return r=r||n,s.count=t,0===t?e():s;function s(t,n){if(s.count<=0)throw new Error("after called too many times");--s.count,t?(o=!0,e(t),e=r):0!==s.count||o||e(null,n)}}},function(t,e){
  9. /*! https://mths.be/utf8js v2.1.2 by @mathias */
  10. var n,r,o,s=String.fromCharCode;function i(t){for(var e,n,r=[],o=0,s=t.length;o<s;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<s?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function a(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(t,e){return s(t>>e&63|128)}function u(t,e){if(0==(4294967168&t))return s(t);var n="";return 0==(4294965248&t)?n=s(t>>6&31|192):0==(4294901760&t)?(a(t,e)||(t=65533),n=s(t>>12&15|224),n+=c(t,6)):0==(4292870144&t)&&(n=s(t>>18&7|240),n+=c(t,12),n+=c(t,6)),n+s(63&t|128)}function l(){if(o>=r)throw Error("Invalid byte index");var t=255&n[o];if(o++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function h(t){var e,s;if(o>r)throw Error("Invalid byte index");if(o==r)return!1;if(e=255&n[o],o++,0==(128&e))return e;if(192==(224&e)){if((s=(31&e)<<6|l())>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&e)){if((s=(15&e)<<12|l()<<6|l())>=2048)return a(s,t)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(s=(7&e)<<18|l()<<12|l()<<6|l())>=65536&&s<=1114111)return s;throw Error("Invalid UTF-8 detected")}t.exports={version:"2.1.2",encode:function(t,e){for(var n=!1!==(e=e||{}).strict,r=i(t),o=r.length,s=-1,a="";++s<o;)a+=u(r[s],n);return a},decode:function(t,e){var a=!1!==(e=e||{}).strict;n=i(t),r=n.length,o=0;for(var c,u=[];!1!==(c=h(a));)u.push(c);return function(t){for(var e,n=t.length,r=-1,o="";++r<n;)(e=t[r])>65535&&(o+=s((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=s(e);return o}(u)}}},function(t,e){!function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;e.encode=function(e){var n,r=new Uint8Array(e),o=r.length,s="";for(n=0;n<o;n+=3)s+=t[r[n]>>2],s+=t[(3&r[n])<<4|r[n+1]>>4],s+=t[(15&r[n+1])<<2|r[n+2]>>6],s+=t[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s},e.decode=function(t){var e,r,o,s,i,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var l=new ArrayBuffer(a),h=new Uint8Array(l);for(e=0;e<c;e+=4)r=n[t.charCodeAt(e)],o=n[t.charCodeAt(e+1)],s=n[t.charCodeAt(e+2)],i=n[t.charCodeAt(e+3)],h[u++]=r<<2|o>>4,h[u++]=(15&o)<<4|s>>2,h[u++]=(3&s)<<6|63&i;return l}}()},function(t,e){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),o=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),s=n&&n.prototype.append&&n.prototype.getBlob;function i(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer}return e}return t}))}function a(t,e){e=e||{};var r=new n;return i(t).forEach((function(t){r.append(t)})),e.type?r.getBlob(e.type):r.getBlob()}function c(t,e){return new Blob(i(t),e||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,c.prototype=Blob.prototype),t.exports=r?o?Blob:c:s?a:void 0},function(t,e,n){(function(e){var r=n(15),o=n(4);t.exports=l;var s,i=/\n/g,a=/\\n/g;function c(){}function u(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{}}function l(t){if(r.call(this,t),this.query=this.query||{},!s){var e=u();s=e.___eio=e.___eio||[]}this.index=s.length;var n=this;s.push((function(t){n.onData(t)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=c)}),!1)}o(l,r),l.prototype.supportsBinary=!1,l.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),r.prototype.doClose.call(this)},l.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)}),100)},l.prototype.doWrite=function(t,e){var n=this;if(!this.form){var r,o=document.createElement("form"),s=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=c,o.method="POST",o.setAttribute("accept-charset","utf-8"),s.name="d",o.appendChild(s),document.body.appendChild(o),this.form=o,this.area=s}function u(){l(),e()}function l(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var t='<iframe src="javascript:0" name="'+n.iframeId+'">';r=document.createElement(t)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),l(),t=t.replace(a,"\\\n"),this.area.value=t.replace(i,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&u()}:this.iframe.onload=u}}).call(this,n(12))},function(t,e,n){(function(e){var r,o,s=n(8),i=n(2),a=n(3),c=n(4),u=n(17),l=n(0)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?r=WebSocket:"undefined"!=typeof self&&(r=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{o=n(42)}catch(f){}var h=r||o;function p(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=r&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(h=o),s.call(this,t)}t.exports=p,c(p,s),p.prototype.name="websocket",p.prototype.supportsBinary=!0,p.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new h(t,e):new h(t):new h(t,e,n)}catch(r){return this.emit("error",r)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},p.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},p.prototype.write=function(t){var n=this;this.writable=!1;for(var r=t.length,o=0,s=r;o<s;o++)!function(t){i.encodePacket(t,n.supportsBinary,(function(o){if(!n.usingBrowserWebSocket){var s={};t.options&&(s.compress=t.options.compress),n.perMessageDeflate&&("string"==typeof o?e.byteLength(o):o.length)<n.perMessageDeflate.threshold&&(s.compress=!1)}try{n.usingBrowserWebSocket?n.ws.send(o):n.ws.send(o,s)}catch(i){l("websocket closed before onclose event")}--r||a()}))}(t[o]);function a(){n.emit("flush"),setTimeout((function(){n.writable=!0,n.emit("drain")}),0)}},p.prototype.onClose=function(){s.prototype.onClose.call(this)},p.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},p.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=u()),this.supportsBinary||(t.b64=1),(t=a.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},p.prototype.check=function(){return!(!h||"__initialize"in h&&this.name===p.prototype.name)}}).call(this,n(6).Buffer)},function(t,e,n){const r=n(43),o=n(44),s=n(0)("@hyoga/uni-socket:"),i=["CONNECTING","OPEN","CLOSING","CLOSED"],a=uni||wx;class c extends r{constructor(t,e,n){super(),this.readyState=c.CONNECTING,this.protocol="",this._socket=null,null!==t&&(Array.isArray(e)?e=e.join(", "):"object"==typeof e&&null!==e&&(n=e,e=void 0),u.call(this,t,e,n))}get CONNECTING(){return c.CONNECTING}get CLOSING(){return c.CLOSING}get CLOSED(){return c.CLOSED}get OPEN(){return c.OPEN}addSocketEventListeners(){this._socket.onOpen((()=>{this.readyState=c.OPEN,this.onopen()})),this._socket.onClose((t=>{s("onclose: ",t),this.readyState=c.CLOSED,this.onclose(t.code,t.reason)})),this._socket.onError((t=>{s("onerror: ",t),this.onerror(t)})),this._socket.onMessage((t=>{this.onmessage(t)}))}send(t){s("send data: ",t,this.readyState),this.readyState===c.OPEN&&this._socket.send({data:t})}close(t,e){s("close socket: ",t,e),this.readyState=c.CLOSING,this._socket.close({code:t,reason:e})}}function u(t,e,n){Object.assign(n,{url:t,header:{"content-type":"application/json"},protocols:e,method:"GET"}),this._socket=function(t){const e=a.connectSocket({complete:()=>{},...t});return e||{onClose:a.onSocketClose,onOpen:a.onSocketOpen,onError:a.onSocketError,onMessage:a.onSocketMessage,send:a.sendSocketMessage,close:a.closeSocket}}(n),this.addSocketEventListeners()}i.forEach(((t,e)=>{c[i[e]]=e})),["open","error","close","message"].forEach((t=>{Object.defineProperty(c.prototype,`on${t}`,{get(){const e=this.listeners(t);for(var n=0;n<e.length;n++)if(e[n]._listener)return e[n]._listener},set(e){const n=this.listeners(t);for(var r=0;r<n.length;r++)n[r]._listener&&this.removeListener(t,n[r]);this.addEventListener(t,e)}})})),c.prototype.addEventListener=o.addEventListener,c.prototype.removeEventListener=o.removeEventListener,t.exports=c},function(t,e,n){var r,o="object"==typeof Reflect?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var o,s,i,a;if(u(n),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),void 0===i)i=s[e]=n,++t._eventsCount;else if("function"==typeof i?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=l(t))>0&&i.length>o&&!i.warned){i.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=i.length,a=c,console&&console.warn&&console.warn(a)}return t}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function d(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(o):y(o,o.length)}function g(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)s(c,this,e);else{var u=c.length,l=y(c,u);for(n=0;n<u;++n)s(l[n],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return u(e),this.on(t,f(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,f(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,o,s,i;if(u(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,i||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(o=s[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return d(this,t,!0)},a.prototype.rawListeners=function(t){return d(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){class r{constructor(t,e){this.target=e,this.type=t}}class o extends r{constructor(t,e){super("message",e),this.data=t}}class s extends r{constructor(t,e,n){super("close",n),this.wasClean=n._closeFrameReceived&&n._closeFrameSent,this.reason=e,this.code=t}}class i extends r{constructor(t){super("open",t)}}class a extends r{constructor(t,e){super("error",e),this.message=t.message,this.error=t}}const c={addEventListener(t,e){function n(t){e.call(this,new o(t,this))}function r(t,n){e.call(this,new s(t,n,this))}function c(t){e.call(this,new a(t,this))}function u(){e.call(this,new i(this))}"function"==typeof e&&("message"===t?(n._listener=e,this.on(t,n)):"close"===t?(r._listener=e,this.on(t,r)):"error"===t?(c._listener=e,this.on(t,c)):"open"===t?(u._listener=e,this.on(t,u)):this.on(t,e))},removeEventListener(t,e){const n=this.listeners(t);for(var r=0;r<n.length;r++)n[r]!==e&&n[r]._listener!==e||this.removeListener(t,n[r])}};t.exports=c},function(t,e){t.exports=function(t,e){for(var n=[],r=(e=e||0)||0;r<t.length;r++)n[r-e]=t[r];return n}},function(t,e){function n(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}]));const et=V({__name:"index",setup(u){const{socketInit:y,state:v,socketSendMsg:w,formatChatInput:b,socketHistoryList:A,onDrop:X,onPaste:V,getFocus:Z,getUserToken:et,showTime:nt,formatTime:rt}=function(t){let e=null;const n=m({chatDotNum:0,chatList:[],customerUserInfo:{},customerServerInfo:{title:"连接中...",state:"connecting",avatar:null,nickname:""},socketState:{isConnect:!0,isConnecting:!1,tip:""},chatHistoryPagination:{page:0,list_rows:10,last_id:0,lastPage:0,loadStatus:"loadmore"},templateChatList:[],chatConfig:{},isSendSucces:-1}),r=t=>{n.chatList=[],n.chatHistoryList=[],n.chatHistoryPagination={page:0,per_page:10,last_id:0,totalPage:0},i(t)},i=t=>{e.emit("connection",{auth:"user",token:E("socketUserToken")||"",session_id:E("socketSessionId")||""},(e=>{0===e.error?(a(t),S("socketSessionId",e.data.session_id),n.customerUserInfo=e.data.chat_user,n.socketState.isConnect=!0):(u({title:"服务器异常!",state:"waiting",avatar:""}),n.socketState.isConnect=!1)}))},a=t=>{e.emit("customer_login",{room_id:n.chatConfig.room_id},(e=>{n.templateChatList=e.data.questions.length?e.data.questions:[],n.chatList.push({from:"customer_service",mode:"template",date:(new Date).getTime(),content:{list:n.templateChatList}}),0===e.error&&c(t)}))},c=t=>{n.chatHistoryPagination.loadStatus="loading",n.chatHistoryPagination.page+=1,e.emit("messages",n.chatHistoryPagination,(e=>{0===e.error&&(n.chatHistoryPagination.total=e.data.messages.total,n.chatHistoryPagination.lastPage=e.data.messages.last_page,n.chatHistoryPagination.page=e.data.messages.current_page,e.data.messages.data.forEach((t=>{t.message_type&&n.chatList.unshift(p(t))})),n.chatHistoryPagination.loadStatus=n.chatHistoryPagination.page<n.chatHistoryPagination.lastPage?"loadmore":"nomore",0==n.chatHistoryPagination.last_id&&(n.chatHistoryPagination.last_id=e.data.messages.data.length?e.data.messages.data[0].id:0),1===n.chatHistoryPagination.page&&t&&t())}))},u=t=>{n.customerServerInfo={...n.customerServerInfo,...t}},l=(t,e)=>new Promise(((n,r)=>{let o=new FormData;o.append("file",e,t),o.append("group","chat"),ajax({url:"/upload",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o,success:function(t){n(t)},error:function(t){r(t)}})})),h=t=>{let e={};switch(t.mode){case"text":e={message_type:"text",message:t.content.text};break;case"image":e={message_type:"image",message:t.content.path};break;case"goods":e={message_type:"goods",message:t.content.item};break;case"order":e={message_type:"order",message:t.content.item}}return e},p=t=>{let e={};switch(t.message_type){case"system":e={from:"system",mode:"system",date:1e3*t.create_time,content:{text:t.message}};break;case"text":e={from:t.sender_identify,mode:t.message_type,date:1e3*t.create_time,sender:t.sender,content:{text:t.message,messageId:t.id}};break;case"image":e={from:t.sender_identify,mode:t.message_type,date:1e3*t.create_time,sender:t.sender,content:{url:s.$url.cdn(t.message),messageId:t.id}};break;case"goods":case"order":e={from:t.sender_identify,mode:t.message_type,date:1e3*t.create_time,sender:t.sender,content:{item:t.message,messageId:t.id}}}return e},f=t=>new Promise(((e,n)=>{const r=new Image,o=new FileReader;o.onload=function(t){r.src=t.target.result},o.onerror=function(t){n(t)},o.readAsDataURL(t),r.onload=function(){e(r)},r.onerror=function(t){n(t)}})),d=(t,e="image/jpeg",n=1e3,r=1e3,o=1)=>new Promise(((s,i)=>{const a=document.createElement("canvas"),c=a.getContext("2d"),{width:u,height:l}=t,h=n,p=r;let f=u,d=l;(u>h||l>p)&&(u/l>1?(f=h,d=Math.round(h*(l/u))):(d=p,f=Math.round(p*(u/l)))),a.width=f,a.height=d,c.clearRect(0,0,f,d),c.drawImage(t,0,0,f,d),a.toBlob((function(t){s(t)}),e,o)}));return{compressImg:d,readImg:f,formatMessage:p,formatInput:h,callBackNotice:t=>{ElNotification({title:"socket",message:t.msg,showClose:!0,type:0===t.error?"success":"warning",duration:1200})},socketInit:(t,o)=>{n.chatConfig=t,e&&e.connected||n.socketState.isConnecting||(e=tt(t.chat_domain,{reconnection:!0,reconnectionAttempts:5,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.5,timeout:2e4,transports:["websocket","polling"],...t}),e.on("connect",(async t=>{r(o),console.log("socket:connect")})),e.on("message",(t=>{0===t.error&&(t.data,n.chatList.push(p(t.data.message)),o&&o())})),e.on("customer_service_access",(t=>{0===t.error&&(u({title:t.data.customer_service.name,state:"online",avatar:t.data.customer_service.avatar}),n.chatList.push(p(t.data.message)))})),e.on("waiting_queue",(t=>{0===t.error&&u({title:t.data.title,state:"waiting",avatar:""})})),e.on("no_customer_service",(t=>{0===t.error&&u({title:"暂无客服在线...",state:"waiting",avatar:""}),n.chatList.push(p(t.data.message))})),e.on("customer_service_online",(t=>{0===t.error&&u({title:t.data.customer_service.name,state:"online",avatar:t.data.customer_service.avatar})})),e.on("customer_service_offline",(t=>{0===t.error&&u({title:t.data.customer_service.name,state:"offline",avatar:t.data.customer_service.avatar})})),e.on("customer_service_busy",(t=>{0===t.error&&u({title:t.data.customer_service.name,state:"busy",avatar:t.data.customer_service.avatar})})),e.on("customer_service_break",(t=>{0===t.error&&(u({title:"客服服务结束",state:"offline",avatar:""}),n.socketState.isConnect=!1,n.socketState.tip="当前服务已结束"),n.chatList.push(p(t.data.message))})),e.on("custom_error",(t=>{u({title:t.msg,state:"offline",avatar:""}),console.log("custom_error:",t)})),e.on("error",(t=>{console.log("error:",t)})),e.on("connect_error",(t=>{console.log("connect_error")})),e.on("connect_timeout",(t=>{console.log(t,"connect_timeout")})),e.on("disconnect",(t=>{console.log(t,"disconnect")})),e.on("reconnect",(t=>{console.log(t,"reconnect")})),e.on("reconnect_attempt",(t=>{n.socketState.isConnect=!1,n.socketState.isConnecting=!0,u({title:`重连中,第${t}次尝试...`,state:"waiting",avatar:""}),console.log(t,"reconnect_attempt")})),e.on("reconnecting",(t=>{console.log(t,"reconnecting")})),e.on("reconnect_error",(t=>{console.log("reconnect_error")})),e.on("reconnect_failed",(t=>{n.socketState.isConnecting=!1,u({title:"重连失败,请刷新重试~",state:"waiting",avatar:""}),console.log(t,"reconnect_failed"),n.isSendSucces=1})))},socketSendMsg:(t,r)=>{n.isSendSucces=-1,n.chatList.push(t),r&&r(),e.emit("message",{message:h(t),...t.customData},(t=>{n.isSendSucces=t.error}))},socketClose:()=>{e.emit("customer_logout",{},(t=>{console.log("socket:退出",t)}))},socketHistoryList:c,getFocus:t=>{if(window.getSelection){let e=o(t);e.focus();let n=window.getSelection();n.selectAllChildren(e),n.collapseToEnd()}else if(document.selection){let t=document.selection.createRange();t.moveToElementText(chatInput),t.collapse(!1),t.select()}},formatChatInput:(t,e)=>{let n="",r=Array.from(t.childNodes);if(r.forEach(((t,o)=>{if("#text"===t.nodeName){if(n+=t.nodeValue,r[o+1]&&"IMG"===r[o+1].nodeName&&r[o+1]&&"emoji"!==r[o+1].name){const t={from:"customer",mode:"text",date:(new Date).getTime(),content:{text:filterXSS(n)}};e&&e(t),n=""}}else if("BR"===t.nodeName)n+="<br/>";else if("IMG"===t.nodeName)if("emoji"!==t.name){let n=/src=[\'\']?([^\'\']*)[\'\']?/i,r=t.outerHTML.match(n);const o={from:"customer",mode:"image",date:(new Date).getTime(),content:{url:r[1],path:r[1].replace(/http:\/\/[^\/]*/,"")}};e&&e(o)}else n+=t.outerHTML;else"DIV"===t.nodeName&&(n+=`<div style='width:200px; white-space: nowrap;'>${t.outerHTML}</div>`)})),n){const t={from:"customer",mode:"text",date:(new Date).getTime(),content:{text:filterXSS(n)}};e&&e(t)}o(t).innerHTML=""},onDrop:async t=>{t.preventDefault(),Array.from(t.dataTransfer.files).forEach((async t=>{if(t&&t.type.includes("image")){let e=t;const n=await f(e),r=await d(n,e.type),{data:o}=await l(e.name,r);let s=`<img class="full-url" src='${o.fullurl}' >`;document.execCommand("insertHTML",!1,s)}else ElMessage({message:"禁止拖拽非图片资源",type:"warning"})}))},onPaste:async t=>{let e=t.clipboardData||window.clipboardData;Array.from(e.files).forEach((async n=>{if(n&&n.type.includes("image")){t.preventDefault();let e=n;const r=await f(e),o=await d(r,e.type),{data:s}=await l(e.name,o);let i=`<img class="full-url" src='${s.fullurl}'>`;document.execCommand("insertHTML",!1,i)}else document.execCommand("insertHTML",!1,e.getData("text"))}))},upload:l,getUserToken:async t=>{const e=await chat.unifiedToken();return 0===e.error&&S("socketUserToken",e.data.token),e},state:n,socketTest:()=>{e.emit("test",{},(t=>{console.log("test:test",t)}))},showTime:(t,e)=>{if(o(n.chatList)[e+1]){let r=C(o(n.chatList)[e+1].date).fromNow();return r!==C(o(t).date).fromNow()&&(r=C(o(t).date).fromNow(),!0)}return!1},formatTime:t=>{let e=(new Date).getTime()-t;return e>4032e4?C(t).format("MM/DD HH:mm"):e>145152e5?C(t).format("YYYY/MM/DD HH:mm"):C(t).fromNow()}}}(),ot=B(v).chatList,st=B(v).customerServerInfo,it=B(v).chatHistoryPagination,at=B(v).customerUserInfo,ct=B(v).socketState,ut=s.$platform.navbar,lt=T((()=>s.$store("app").chat)),{screenHeight:ht,safeAreaInsets:pt,safeArea:ft,screenWidth:dt}=s.$platform.device,gt=ft.height-44-35-50,yt={loadmore:{title:"查看更多",icon:"el-icon-d-arrow-left"},nomore:{title:"没有更多了",icon:""},loading:{title:"加载中... ",icon:"el-icon-loading"}},mt=()=>{it.value.page<it.value.lastPage&&A()},vt=m({msg:"",scrollInto:"",showTools:!1,toolsMode:"",showSelect:!1,selectMode:"",chatStyle:{mode:"inner",color:"#F8270F",type:"color",alwaysShow:1,src:"",list:{}}});function wt(t){ct.value.isConnect?(vt.toolsMode&&vt.toolsMode!==t||(vt.showTools=!vt.showTools),vt.toolsMode=t,vt.showTools||(vt.toolsMode="")):s.$helper.toast(ct.value.tip||"您已掉线!请返回重试")}function bt(t){vt.showTools=!1,vt.showSelect=!0,vt.selectMode=t}async function _t({type:t,data:e}){let n="";switch(t){case"image":const{path:t,fullurl:r}=await s.$api.app.upload(e.tempFiles[0].path,"default");n={from:"customer",mode:"image",date:(new Date).getTime(),content:{url:r,path:t}};break;case"goods":n={from:"customer",mode:"goods",date:(new Date).getTime(),content:{item:{id:e.goods.id,title:e.goods.title,image:e.goods.image,price:e.goods.price,stock:e.goods.stock}}};break;case"order":n={from:"customer",mode:"order",date:(new Date).getTime(),content:{item:{id:e.id,order_sn:e.order_sn,create_time:e.create_time,pay_fee:e.pay_fee,items:e.items.filter((t=>({goods_id:t.goods_id,goods_title:t.goods_title,goods_image:t.goods_image,goods_price:t.goods_price}))),status_text:e.status_text}}}}n&&(w(n,(()=>{At()})),vt.showTools=!1,vt.showSelect=!1,vt.selectMode="")}function kt(){if(!ct.value.isConnect)return void s.$helper.toast(ct.value.tip||"您已掉线!请返回重试");if(!vt.msg)return;const t={from:"customer",mode:"text",date:(new Date).getTime(),content:{text:vt.msg}};w(t,(()=>{At()})),vt.showTools=!1,setTimeout((()=>{vt.msg=""}),100)}function xt(t){let e=t;if("object"!=typeof e){let t=/\[(.+?)\]/g,n=e.match(t);n&&n.forEach((t=>{let n=function(t){for(let e in W)if(W[e].name===t)return W[e].file;return!1}(t);e=e.replace(t,`<image class="chat-img" style="width: 24px;height: 24px;margin: 0 3px;" src="${s.$url.cdn("/static/img/chat/emoji/"+n)}"/></image>`)}))}return e}function At(){let t=null;vt.scrollInto="",clearTimeout(t),t=setTimeout((()=>{vt.scrollInto="scrollBottom"}),100)}return P((async()=>{const{error:t}=await et();0===t?y(lt.value,(()=>{At()})):ct.value.isConnect=!1})),(u,y)=>{const m=O,b=h,A=l,E=_(k("su-image"),q),S=x,C=_(k("uni-easyinput"),H),B=N,T=_(k("su-fixed"),Y),P=U,X=I,V=_(k("s-uploader"),z),W=_(k("su-popup"),$),Z=_(k("s-layout"),F);return t(),e(Z,{class:"chat-wrap",title:"客服",navbar:"inner"},{default:n((()=>[p("div",{class:"status"},a(o(ct).isConnect?o(st).title:"网络已断开,请检查网络后刷新重试"),1),p("div",{class:"page-bg",style:R({height:o(ut)+"px"})},null,4),r(b,{class:"chat-box",style:R({height:gt+"px"})},{default:n((()=>[r(S,{style:R({height:gt+"px"}),"scroll-y":"true","scroll-with-animation":!1,"enable-back-to-top":!0,"scroll-into-view":vt.scrollInto},{default:n((()=>[o(ot).length&&o(it).lastPage>1&&yt[o(it).loadStatus].title?(t(),e(m,{key:0,class:"loadmore-btn ss-reset-button",onClick:mt},{default:n((()=>[i(a(yt[o(it).loadStatus].title)+" ",1),p("i",{class:L(["loadmore-icon sa-m-l-6",yt[o(it).loadStatus].icon])},null,2)])),_:1})):c("",!0),(t(!0),f(d,null,g(o(ot),((l,h)=>(t(),e(b,{class:"message-item ss-flex-col",key:h},{default:n((()=>[r(b,{class:"ss-flex ss-row-center ss-col-center"},{default:n((()=>["system"!==l.from&&o(nt)(l,h)?(t(),e(b,{key:0,class:"date-message"},{default:n((()=>[i(a(o(rt)(l.date)),1)])),_:2},1024)):c("",!0),"system"===l.from?(t(),e(b,{key:1,class:"system-message"},{default:n((()=>[i(a(l.content.text),1)])),_:2},1024)):c("",!0)])),_:2},1024),"template"===l.mode&&l.content.list.length?(t(),e(b,{key:0,class:"template-wrap"},{default:n((()=>[r(b,{class:"title"},{default:n((()=>[i("猜你想问")])),_:1}),(t(!0),f(d,null,g(l.content.list,((r,o)=>(t(),e(b,{class:"item",key:o,onClick:t=>function(t){if(!ct.value.isConnect)return void s.$helper.toast(ct.value.tip||"您已掉线!请返回重试");const e={from:"customer",mode:"text",date:(new Date).getTime(),content:{text:t.title},customData:{question_id:t.id}};w(e,(()=>{At()}))}(r)},{default:n((()=>[i(" * "+a(r.title),1)])),_:2},1032,["onClick"])))),128))])),_:2},1024)):c("",!0),"customer_service"===l.from&&"template"!==l.mode||"customer"===l.from?(t(),e(b,{key:1,class:L(["ss-flex ss-col-top",["customer_service"===l.from?"ss-row-left":"customer"===l.from?"ss-row-right":""]])},{default:n((()=>{var i;return[j(r(A,{class:"chat-avatar ss-m-r-24",src:o(s).$url.cdn(null==(i=null==l?void 0:l.sender)?void 0:i.avatar)||o(s).$url.static("/static/images/default.png"),mode:"aspectFill"},null,8,["src"]),[[M,"customer_service"===l.from]]),"customer"===l.from&&h==o(v).chatList.length-1&&0!==o(v).isSendSucces?(t(),f("span",{key:0,class:"send-status"},[-1==o(v).isSendSucces?(t(),e(A,{key:0,class:"loading",src:o(s).$url.static("/static/images/loading.png"),mode:"aspectFill"},null,8,["src"])):c("",!0)])):c("",!0),"text"===l.mode?(t(),e(b,{key:1,class:L(["message-box",[l.from]])},{default:n((()=>[p("div",{class:"message-text ss-flex ss-flex-wrap",onClick:y[0]||(y[0]=(...t)=>u.onRichtext&&u.onRichtext(...t)),innerHTML:xt(l.content.text)},null,8,["innerHTML"])])),_:2},1032,["class"])):c("",!0),"image"===l.mode?(t(),e(b,{key:2,class:L(["message-box",[l.from]]),style:{width:"200rpx"}},{default:n((()=>[r(E,{class:"message-img",isPreview:"",previewList:[o(s).$url.cdn(l.content.url)],current:0,src:o(s).$url.cdn(l.content.url),height:200,width:200,mode:"aspectFill"},null,8,["previewList","src"])])),_:2},1032,["class"])):c("",!0),"goods"===l.mode?(t(),e(J,{key:3,goodsData:l.content.item,onClick:t=>o(s).$router.go("/pages/goods/index",{id:l.content.item.id})},null,8,["goodsData","onClick"])):c("",!0),"order"===l.mode?(t(),e(G,{key:4,from:"msg",orderData:l.content.item,onClick:t=>o(s).$router.go("/pages/order/detail",{id:l.content.item.id})},null,8,["orderData","onClick"])):c("",!0),j(r(A,{class:"chat-avatar ss-m-l-24",src:o(s).$url.cdn(o(at).avatar),mode:"aspectFill"},null,8,["src"]),[[M,"customer"===l.from]])]})),_:2},1032,["class"])):c("",!0)])),_:2},1024)))),128)),r(b,{id:"scrollBottom"})])),_:1},8,["style","scroll-into-view"])])),_:1},8,["style"]),r(T,{bottom:""},{default:n((()=>[r(b,{class:"send-wrap ss-flex"},{default:n((()=>[r(b,{class:"left ss-flex ss-flex-1"},{default:n((()=>[r(C,{class:"ss-flex-1 ss-p-l-22",inputBorder:!1,clearable:!1,modelValue:vt.msg,"onUpdate:modelValue":y[1]||(y[1]=t=>vt.msg=t),placeholder:"请输入你要咨询的问题"},null,8,["modelValue"])])),_:1}),r(B,{class:"sicon-basic bq",onClick:y[2]||(y[2]=D((t=>wt("emoji")),["stop"]))}),vt.msg?c("",!0):(t(),e(B,{key:0,class:L(["sicon-edit",{"is-active":"tools"==vt.toolsMode}]),onClick:y[3]||(y[3]=D((t=>wt("tools")),["stop"]))},null,8,["class"])),vt.msg?(t(),e(m,{key:1,class:"ss-reset-button send-btn",onClick:kt},{default:n((()=>[i(" 发送 ")])),_:1})):c("",!0)])),_:1})])),_:1}),r(W,{show:vt.showTools,onClose:y[10]||(y[10]=t=>{vt.showTools=!1,vt.toolsMode=""})},{default:n((()=>[r(b,{class:"ss-modal-box ss-flex-col"},{default:n((()=>[r(b,{class:"send-wrap ss-flex"},{default:n((()=>[r(b,{class:"left ss-flex ss-flex-1"},{default:n((()=>[r(C,{class:"ss-flex-1 ss-p-l-22",inputBorder:!1,clearable:!1,modelValue:vt.msg,"onUpdate:modelValue":y[4]||(y[4]=t=>vt.msg=t),placeholder:"请输入你要咨询的问题"},null,8,["modelValue"])])),_:1}),r(B,{class:"sicon-basic bq",onClick:y[5]||(y[5]=D((t=>wt("emoji")),["stop"]))}),r(B),vt.msg?c("",!0):(t(),e(B,{key:0,class:L(["sicon-edit",{"is-active":"tools"==vt.toolsMode}]),onClick:y[6]||(y[6]=D((t=>wt("tools")),["stop"]))},null,8,["class"])),vt.msg?(t(),e(m,{key:1,class:"ss-reset-button send-btn",onClick:kt},{default:n((()=>[i(" 发送 ")])),_:1})):c("",!0)])),_:1}),r(b,{class:"content ss-flex ss-flex-1"},{default:n((()=>["emoji"==vt.toolsMode?(t(),e(X,{key:0,class:"emoji-swiper","indicator-dots":!0,circular:"","indicator-active-color":"#7063D2","indicator-color":"rgba(235, 231, 255, 1)",autoplay:!1,interval:3e3,duration:1e3},{default:n((()=>[(t(!0),f(d,null,g(o(K),(i=>(t(),e(P,{key:i},{default:n((()=>[r(b,{class:"ss-flex ss-flex-wrap"},{default:n((()=>[(t(!0),f(d,null,g(i,(n=>(t(),e(A,{key:n,class:"emoji-img",src:o(s).$url.cdn(`/static/img/chat/emoji/${n.file}`),onClick:t=>function(t){vt.msg+=t.name}(n)},null,8,["src","onClick"])))),128))])),_:2},1024)])),_:2},1024)))),128))])),_:1})):(t(),f(d,{key:1},[r(b,{class:"image"},{default:n((()=>[r(V,{"file-mediatype":"image",imageStyles:{width:50,height:50,border:!1},onSelect:y[7]||(y[7]=t=>_t({type:"image",data:t}))},{default:n((()=>[r(A,{class:"icon",src:o(s).$url.static("/static/images/image.png"),mode:"aspectFill"},null,8,["src"])])),_:1}),r(b,null,{default:n((()=>[i("图片")])),_:1})])),_:1}),r(b,{class:"goods",onClick:y[8]||(y[8]=t=>bt("goods"))},{default:n((()=>[r(A,{class:"icon",src:o(s).$url.static("/static/images/goods.png"),mode:"aspectFill"},null,8,["src"]),r(b,null,{default:n((()=>[i("商品")])),_:1})])),_:1}),r(b,{class:"order",onClick:y[9]||(y[9]=t=>bt("order"))},{default:n((()=>[r(A,{class:"icon",src:o(s).$url.static("/static/images/order.png"),mode:"aspectFill"},null,8,["src"]),r(b,null,{default:n((()=>[i("订单")])),_:1})])),_:1})],64))])),_:1})])),_:1})])),_:1},8,["show"]),r(Q,{mode:vt.selectMode,show:vt.showSelect,onSelect:_t,onClose:y[11]||(y[11]=t=>vt.showSelect=!1)},null,8,["mode","show"])])),_:1})}}},[["__scopeId","data-v-69ce6166"]]);export{et as default};