@amityco/ts-sdk 6.35.2-cd7f86f.0 → 6.35.3-fa3d4ac.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -102,8 +102,8 @@ const PostContentType = Object.freeze({
102
102
 
103
103
  function getVersion() {
104
104
  try {
105
- // the string ''v6.35.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
- return 'v6.35.1-cjs';
105
+ // the string ''v6.35.2-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
+ return 'v6.35.2-cjs';
107
107
  }
108
108
  catch (error) {
109
109
  return '__dev__';
package/dist/index.esm.js CHANGED
@@ -87,8 +87,8 @@ const PostContentType = Object.freeze({
87
87
 
88
88
  function getVersion() {
89
89
  try {
90
- // the string ''v6.35.1-esm'' should be replaced by actual value by @rollup/plugin-replace
91
- return 'v6.35.1-esm';
90
+ // the string ''v6.35.2-esm'' should be replaced by actual value by @rollup/plugin-replace
91
+ return 'v6.35.2-esm';
92
92
  }
93
93
  catch (error) {
94
94
  return '__dev__';
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- var Amity=function(e){"use strict";const t=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video"}),n=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),r=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),s=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"});var i;e.FileAccessTypeEnum=void 0,(i=e.FileAccessTypeEnum||(e.FileAccessTypeEnum={})).PUBLIC="public",i.NETWORK="network";const a=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),o=Object.freeze({ONLY_ADMIN_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!0},ADMIN_REVIEW_POST_REQUIRED:{needApprovalOnPostCreation:!0,onlyAdminCanPost:!1},ANYONE_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!1}}),l="ONLY_ADMIN_CAN_POST",c=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"}),d=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),u=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll"});const h=function(){try{return"v6.35.1-umd"}catch(e){return"__dev__"}}(),f=5,p="cache_then_server",g="For using Live Collection feature you need to enable Cache!",m="Observing unsynced object is not supported by Live Object.",y=1e3,v=864e5,b=6e5,w="dead",C=6e4,S=e=>JSON.stringify(e,((e,t)=>{return"object"==typeof t?(n=t,Object.keys(n).sort().reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:n[t]})),{})):t;var n})),E=e=>JSON.parse(e),T=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((n=>T(e[n],t[n])))),I=e=>[400400,400300].includes(e),k="function"==typeof atob,A="function"==typeof btoa,_="function"==typeof Buffer,R="function"==typeof TextDecoder?new TextDecoder:void 0,O="function"==typeof TextEncoder?new TextEncoder:void 0,L=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),D=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(L),x=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,P=String.fromCharCode.bind(String),M="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),F=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),U=A?e=>btoa(e):_?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,s,i="";const a=e.length%3;for(let a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|s,i+=L[t>>18&63]+L[t>>12&63]+L[t>>6&63]+L[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},N=_?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(P.apply(null,e.subarray(n,n+4096)));return U(t.join(""))},B=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?P(192|t>>>6)+P(128|63&t):P(224|t>>>12&15)+P(128|t>>>6&63)+P(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return P(240|t>>>18&7)+P(128|t>>>12&63)+P(128|t>>>6&63)+P(128|63&t)},j=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,$=_?e=>Buffer.from(e,"utf8").toString("base64"):O?e=>N(O.encode(e)):e=>U(e.replace(j,B)),q=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,K=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return P(55296+(t>>>10))+P(56320+(1023&t));case 3:return P((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return P((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},G=k?e=>atob(F(e)):_?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!x.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,s="";for(let i=0;i<e.length;)t=D[e.charAt(i++)]<<18|D[e.charAt(i++)]<<12|(n=D[e.charAt(i++)])<<6|(r=D[e.charAt(i++)]),s+=64===n?P(t>>16&255):64===r?P(t>>16&255,t>>8&255):P(t>>16&255,t>>8&255,255&t);return s},H=_?e=>M(Buffer.from(e,"base64")):e=>M(G(e),(e=>e.charCodeAt(0))),V=_?e=>Buffer.from(e,"base64").toString("utf8"):R?e=>R.decode(H(e)):e=>G(e).replace(q,K),z=e=>V(F(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),W=e=>["skip"].some((t=>t in e)),Y=e=>["after","before","first","last","limit"].some((t=>t in e)),Q=e=>"limit"in e,X=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),J=(e,t)=>{var n;if(!e||!Object.keys(e).length)return;let r={};return"skiplimit"===t?r={skip:null!==(n=e.after)&&void 0!==n?n:0,limit:e.limit}:"afterbefore"===t&&Y(e)?((null==e?void 0:e.before)&&(r=Object.assign(Object.assign({},r),{before:e.before})),(null==e?void 0:e.after)&&(r=Object.assign(Object.assign({},r),{after:e.after})),Number.isNaN(Number(null==e?void 0:e.limit))||(r=Object.assign(Object.assign({},r),{limit:e.limit}))):"afterbeforeraw"===t&&(r=e),Object.keys(r).length?((e,t=!1)=>t?(e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")))($(e)):$(e))(JSON.stringify(r)):void 0},Z=e=>{if(!e)return;const t=JSON.parse(z(e));if(W(t))return{after:t.skip,limit:t.limit};if(Y(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},ee=e=>"locally"in e,te=e=>"optimistically"in e,ne=e=>ee(e)||te(e),re=e=>null==e?void 0:e.hasOwnProperty("cachedAt"),se=(e,t=6e4)=>{var n;return Date.now()-(null!==(n=null==e?void 0:e.cachedAt)&&void 0!==n?n:0)<=t},ie=(e,...t)=>({func:e,args:t}),ae=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<C?C:t},oe=({func:e,args:t},n,r=ae("cache_then_server"))=>{let s;const{lifeSpan:i}=ae("cache_then_server",r.lifeSpan);if(ne(e)){try{s=te(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==n||n(le(void 0,{origin:"local",loading:!1,error:e}))}const r=re(s)&&se(s,i);if(null==n||n(le(s,{origin:"local",loading:!(ee(e)&&r)})),r)return}else null==n||n(le(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==n||n(le(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(le(void 0,{origin:"server",loading:!1,error:e}))}))};function le(e,t){return X(e)||re(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}const ce={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelInternalId:e})=>e,subChannel:({subChannelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e,referenceId:t})=>null!=t?t:e,messagePreviewChannel:({channelId:e})=>`${e}`,messagePreviewSubChannel:({subChannelId:e})=>`${e}`,channelUnreadInfo:({channelId:e})=>e,subChannelUnreadInfo:({subChannelId:e})=>e,channelMarker:({entityId:e,userId:t})=>`${e}#${t}`,subChannelMarker:({entityId:e,feedId:t,userId:n})=>`${e}#${t}#${n}`,messageMarker:({feedId:e,contentId:t,creatorId:n})=>`${e}#${t}#${n}`,feedMarker:({feedId:e,entityId:t})=>`${e}#${t}`,userMarker:({userId:e})=>e,community:({communityId:e})=>e,category:({categoryId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,commentChildren:({commentId:e})=>e,poll:({pollId:e})=>e,reaction:({referenceType:e,referenceId:t})=>`${e}#${t}`,reactor:({reactionId:e})=>e,stream:({streamId:e})=>e,streamModeration:({streamId:e})=>e,follow:({from:e,to:t})=>`${e}#${t}`,followInfo:({userId:e})=>e,followCount:({userId:e})=>e,feed:({targetId:e,feedId:t})=>`${e}#${t}`,story:({referenceId:e})=>e,storyTarget:({targetId:e})=>e,ad:({adId:e})=>e,advertiser:({advertiserId:e})=>e,pin:({placement:e,referenceId:t})=>`${e}#${t}`,pinTarget:({targetId:e})=>e},de=e=>ce[e],ue=e=>e.startsWith("LOCAL_"),he={users:"user",files:"file",roles:"role",stories:"story",storyTargets:"storyTarget",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",messages:"message",messagePreviewChannel:"messagePreviewChannel",messagePreviewSubChannel:"messagePreviewSubChannel",channelUnreadInfo:"channelUnreadInfo",subChannelUnreadInfo:"subChannelUnreadInfo",userEntityMarkers:"channelMarker",userFeedMarkers:"subChannelMarker",contentMarkers:"messageMarker",feedMarkers:"feedMarker",userMarkers:"userMarker",communities:"community",categories:"category",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",commentChildren:"comment",polls:"poll",reactors:"reactor",reactions:"reaction",videoStreamings:"stream",videoStreamModerations:"streamModeration",follows:"follow",followCounts:"followCount",feeds:"feed",ads:"ad",advertisers:"advertiser",pinTargets:"pinTarget",pins:"pin"};function fe(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class pe extends Error{constructor(e,t,n){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=n,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,pe)}}class ge extends pe{constructor(e,t,n){super(e,t,n)}}class me extends pe{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class ye extends pe{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let ve=null;const be=()=>{if(!ve)throw new pe("There is no active client",8e5,"fatal");return ve},we=e=>{ve=e},Ce=e=>{const{log:t,cache:n}=be();if(n)return t("cache/api/queryCache",{key:e}),Object.keys(n.data).filter((t=>{const n=E(t);return T(e,n)})).map((e=>n.data[e]))},Se=e=>{const{log:t,cache:n}=be();if(!n)return;t("cache/api/pullFromCache",e);const r=S(e);return n.data[r]?n.data[r]:void 0},Ee=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/pushToCache",{key:e,data:t,options:n}),!(null==n?void 0:n.hasOwnProperty("offline"))&&s.persistIf&&(n.offline=s.persistIf(e,t));const i=S(e);return s.data[i]=Object.assign({key:e,data:t},n),!0},Te=(e,t,n)=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/mergeInCache",{key:e,mutation:t});const i=Se(e);if(!i)return!1;const a="function"==typeof t?t(i.data):Object.assign(Object.assign({},i.data),t);return o=i.data,!("updatedAt"in(l=a)&&"updatedAt"in l&&new Date(l.updatedAt)<new Date(o.updatedAt))&&(Ee(e,a,n),!0);var o,l},Ie=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/upsertInCache",{key:e,data:t,options:n});return Se(e)?Te(e,t,n):Ee(e,t,n)},ke=(e,t=!1)=>{const{log:n,cache:r}=be();if(!r)return!1;if(n("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(r.data).map((e=>E(e))).filter((t=>T(e,t))).map((e=>ke(e,!0))).every((e=>e));const s=S(e);return s in r.data&&(delete r.data[s],!0)},Ae=(e,t,n)=>void 0!==n?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(n))):e,_e=(e,t,n)=>void 0!==n?e.filter((e=>"string"==typeof e[t]&&"string"==typeof n&&String(e[t]).toLowerCase().match(n.toLowerCase()))):e,Re=(e,t,n)=>(null==n?void 0:n.length)?e.filter((e=>Array.isArray(e[t])&&n.some((n=>e[t].includes(n))))):e,Oe=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;if("community"===e.type)return!0;const s=de("channelUsers")({channelId:e.channelPublicId,userId:n}),i=null===(r=Se(["channelUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),Le=(e,t)=>e.filter((({targetId:e,feedId:n})=>{var r;const s=null===(r=Se(["feed","get",de("feed")({targetId:e,feedId:n})]))||void 0===r?void 0:r.data;return s&&s.feedType===t})),De=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;const s=de("communityUsers")({communityId:e.communityId,userId:n}),i=null===(r=Se(["communityUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),xe=(e,t)=>e.reduce(((e,n)=>{var r;if(null==t?void 0:t.includes(n.dataType))return[...e,n];if(((null==n?void 0:n.children)||[]).length>0){const s=null===(r=Se(["post","get",n.children[0]]))||void 0===r?void 0:r.data;return(null==t?void 0:t.includes(null==s?void 0:s.dataType))?e:[...e,n]}return e}),[]),Pe=(e,t)=>{const n=new RegExp(t,"i");return e.filter((e=>{var t;return!!e.userId.match(n)||e.user&&(null===(t=e.user.displayName)||void 0===t?void 0:t.match(n))}))},Me=({displayName:e},{displayName:t})=>e&&t?e.localeCompare(t):e?-1:1,Fe=({name:e},{name:t})=>e&&t?e.localeCompare(t):e?-1:1,Ue=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),Ne=({localSortingDate:e},{localSortingDate:t})=>new Date(t).getTime()-new Date(e).getTime(),Be=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),je=({updatedAt:e=0},{updatedAt:t=0})=>new Date(e).valueOf()-new Date(t).valueOf(),$e=({updatedAt:e=0},{updatedAt:t=0})=>new Date(t).valueOf()-new Date(e).valueOf(),qe=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let Ke=null;const Ge=()=>{if(!Ke)throw new pe("Connect client first",8e5,"fatal");return Ke},He=e=>{Ke={_id:e._id,userId:e.userId,path:e.path}};let Ve,ze=[];const We=e=>{clearTimeout(Ve),ze.push(e),Ve=setTimeout((()=>{ze.forEach((e=>e())),ze=[]}),0)},Ye=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired","v3.video-streaming.didRecord","v3.video-streaming.didStart","v3.video-streaming.didStop"],Qe=["connect","message","disconnect","error","close","end","reconnect","user.didGlobalBan"],Xe=()=>{return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}};var e},Je=(e,t,n,r)=>{const{log:s,emitter:i}=e,a=Date.now();s(`${t}(tmpid: ${a}) > listen`);const o=(...e)=>{s(`${t}(tmpid: ${a}) > trigger`,e);try{r(...e)}catch(e){s(`${t}(tmpid: ${a}) > error`,e)}};return i.on(n,o),()=>{s(`${t}(tmpid: ${a}) > dispose`),i.off(n,o)}},Ze=(e,t)=>{const{emitter:n}=be();We((()=>{n.emit(e,t)}))};let et,tt;async function nt(){var e;const{mqtt:t,emitter:n,token:r}=be();if(!t)return;const s=null!==(e=null==r?void 0:r.accessToken)&&void 0!==e?e:"",i=Ge();et===s&&tt===i._id||(et=s,tt=i._id,await t.connect({accessToken:et,userId:tt}),((e,t)=>{Qe.forEach((n=>{null==e||e.on(n,((...e)=>{t.emit(n,1===e.length?e[0]:e)}))})),e.on("message",((e,n)=>{const r=JSON.parse(n.toString());t.emit(r.eventType,r.data)}))})(t,n))}var rt;e.SubscriptionLevels=void 0,(rt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",rt.POST="post",rt.COMMENT="comment",rt.POST_AND_COMMENT="post_and_comment",rt.USER="user";const st=(e,t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}},it=e=>e.path.split("/user/")[0],at=({path:t},n=e.SubscriptionLevels.USER)=>st(n===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),n),ot=({channelId:e,subChannelId:t})=>{const n=Ge();return`${it(n)}/marker/channel/${e}/message/${t}`},lt=()=>{const e=Ge();return`${it(e)}/marker/user/${e._id}`},ct=()=>it(Ge()),dt=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/channels`},ut=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/messagefeeds`},ht=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/messages`};function ft(e,t){const{mqtt:n}=be();return n?(nt(),n.subscribe(e,t)):()=>null}var pt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mt(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var yt,vt,bt={exports:{}};function wt(){if(vt)return yt;vt=1;var e=1e3,t=60*e,n=60*t,r=24*n,s=7*r,i=365.25*r;function a(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}return yt=function(o,l){l=l||{};var c=typeof o;if("string"===c&&o.length>0)return function(a){if((a=String(a)).length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!o)return;var l=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*r;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(o);if("number"===c&&isFinite(o))return l.long?function(s){var i=Math.abs(s);if(i>=r)return a(s,i,r,"day");if(i>=n)return a(s,i,n,"hour");if(i>=t)return a(s,i,t,"minute");if(i>=e)return a(s,i,e,"second");return s+" ms"}(o):function(s){var i=Math.abs(s);if(i>=r)return Math.round(s/r)+"d";if(i>=n)return Math.round(s/n)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))},yt}var Ct=function(e){function t(e){let r,s,i,a=null;function o(...e){if(!o.enabled)return;const n=o,s=Number(new Date),i=s-(r||s);n.diff=i,n.prev=r,n.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const i=t.formatters[s];if("function"==typeof i){const t=e[a];r=i.call(n,t),e.splice(a,1),a--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=wt(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ct(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(bt,bt.exports);var St,Et=bt.exports;const Tt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:It={}}=Tt,kt="production"===(null===(St=It.env)||void 0===St?void 0:St.NODE_ENV),At={EU:"eu",SG:"sg",US:"us"},_t={http:"https://api.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function Rt(e,t){return _t[e].replace("{region}",t)}function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:Lt}=Object.prototype,{getPrototypeOf:Dt}=Object,xt=(Pt=Object.create(null),e=>{const t=Lt.call(e);return Pt[t]||(Pt[t]=t.slice(8,-1).toLowerCase())});var Pt;const Mt=e=>(e=e.toLowerCase(),t=>xt(t)===e),Ft=e=>t=>typeof t===e,{isArray:Ut}=Array,Nt=Ft("undefined");const Bt=Mt("ArrayBuffer");const jt=Ft("string"),$t=Ft("function"),qt=Ft("number"),Kt=e=>null!==e&&"object"==typeof e,Gt=e=>{if("object"!==xt(e))return!1;const t=Dt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Ht=Mt("Date"),Vt=Mt("File"),zt=Mt("Blob"),Wt=Mt("FileList"),Yt=Mt("URLSearchParams");function Qt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),Ut(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let a;for(r=0;r<i;r++)a=s[r],t.call(null,e[a],a,e)}}function Xt(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Zt=e=>!Nt(e)&&e!==Jt;const en=(tn="undefined"!=typeof Uint8Array&&Dt(Uint8Array),e=>tn&&e instanceof tn);var tn;const nn=Mt("HTMLFormElement"),rn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),sn=Mt("RegExp"),an=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Qt(n,((n,s)=>{!1!==t(n,s,e)&&(r[s]=n)})),Object.defineProperties(e,r)};var on={isArray:Ut,isArrayBuffer:Bt,isBuffer:function(e){return null!==e&&!Nt(e)&&null!==e.constructor&&!Nt(e.constructor)&&$t(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||Lt.call(e)===t||$t(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Bt(e.buffer),t},isString:jt,isNumber:qt,isBoolean:e=>!0===e||!1===e,isObject:Kt,isPlainObject:Gt,isUndefined:Nt,isDate:Ht,isFile:Vt,isBlob:zt,isRegExp:sn,isFunction:$t,isStream:e=>Kt(e)&&$t(e.pipe),isURLSearchParams:Yt,isTypedArray:en,isFileList:Wt,forEach:Qt,merge:function e(){const{caseless:t}=Zt(this)&&this||{},n={},r=(r,s)=>{const i=t&&Xt(n,s)||s;Gt(n[i])&&Gt(r)?n[i]=e(n[i],r):Gt(r)?n[i]=e({},r):Ut(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Qt(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(Qt(t,((t,r)=>{n&&$t(t)?e[r]=Ot(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,i,a;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],r&&!r(a,e,t)||o[a]||(t[a]=e[a],o[a]=!0);e=!1!==n&&Dt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:xt,kindOfTest:Mt,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ut(e))return e;let t=e.length;if(!qt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:nn,hasOwnProperty:rn,hasOwnProp:rn,reduceDescriptors:an,freezeMethods:e=>{an(e,((t,n)=>{if($t(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];$t(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return Ut(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:Xt,global:Jt,isContextDefined:Zt,toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Kt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const s=Ut(e)?[]:{};return Qt(e,((e,t)=>{const i=n(e,r+1);!Nt(i)&&(s[t]=i)})),t[r]=void 0,s}}return e};return n(e,0)}};function ln(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}on.inherits(ln,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:on.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cn=ln.prototype,dn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{dn[e]={value:e}})),Object.defineProperties(ln,dn),Object.defineProperty(cn,"isAxiosError",{value:!0}),ln.from=(e,t,n,r,s,i)=>{const a=Object.create(cn);return on.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ln.call(a,e.message,t,n,r,s),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};var un="object"==typeof self?self.FormData:window.FormData;function hn(e){return on.isPlainObject(e)||on.isArray(e)}function fn(e){return on.endsWith(e,"[]")?e.slice(0,-2):e}function pn(e,t,n){return e?e.concat(t).map((function(e,t){return e=fn(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const gn=on.toFlatObject(on,{},null,(function(e){return/^is[A-Z]/.test(e)}));function mn(e,t,n){if(!on.isObject(e))throw new TypeError("target must be an object");t=t||new(un||FormData);const r=(n=on.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!on.isUndefined(t[e])}))).metaTokens,s=n.visitor||d,i=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((l=t)&&on.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);var l;if(!on.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(on.isDate(e))return e.toISOString();if(!o&&on.isBlob(e))throw new ln("Blob is not supported. Use a Buffer instead.");return on.isArrayBuffer(e)||on.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(on.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(on.isArray(e)&&function(e){return on.isArray(e)&&!e.some(hn)}(e)||on.isFileList(e)||on.endsWith(n,"[]")&&(o=on.toArray(e)))return n=fn(n),o.forEach((function(e,r){!on.isUndefined(e)&&null!==e&&t.append(!0===a?pn([n],r,i):null===a?n:n+"[]",c(e))})),!1;return!!hn(e)||(t.append(pn(s,n,i),c(e)),!1)}const u=[],h=Object.assign(gn,{defaultVisitor:d,convertValue:c,isVisitable:hn});if(!on.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!on.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),on.forEach(n,(function(n,i){!0===(!(on.isUndefined(n)||null===n)&&s.call(t,n,on.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t}function yn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function vn(e,t){this._pairs=[],e&&mn(e,this,t)}const bn=vn.prototype;function wn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Cn(e,t,n){if(!t)return e;const r=n&&n.encode||wn,s=n&&n.serialize;let i;if(i=s?s(t,n):on.isURLSearchParams(t)?t.toString():new vn(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}bn.append=function(e,t){this._pairs.push([e,t])},bn.toString=function(e){const t=e?function(t){return e.call(this,t,yn)}:yn;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Sn{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){on.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var En={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Tn="undefined"!=typeof URLSearchParams?URLSearchParams:vn,In=FormData;const kn=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),An="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var _n={isBrowser:!0,classes:{URLSearchParams:Tn,FormData:In,Blob:Blob},isStandardBrowserEnv:kn,isStandardBrowserWebWorkerEnv:An,protocols:["http","https","file","blob","url","data"]};function Rn(e){function t(e,n,r,s){let i=e[s++];const a=Number.isFinite(+i),o=s>=e.length;if(i=!i&&on.isArray(r)?r.length:i,o)return on.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&on.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],s)&&on.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}(r[i])),!a}if(on.isFormData(e)&&on.isFunction(e.entries)){const n={};return on.forEachEntry(e,((e,r)=>{t(function(e){return on.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const On={"Content-Type":void 0};const Ln={transitional:En,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=on.isObject(e);s&&on.isHTMLForm(e)&&(e=new FormData(e));if(on.isFormData(e))return r&&r?JSON.stringify(Rn(e)):e;if(on.isArrayBuffer(e)||on.isBuffer(e)||on.isStream(e)||on.isFile(e)||on.isBlob(e))return e;if(on.isArrayBufferView(e))return e.buffer;if(on.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return mn(e,new _n.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return _n.isNode&&on.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=on.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return mn(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(on.isString(e))try{return(t||JSON.parse)(e),on.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ln.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&on.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw ln.from(e,ln.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_n.classes.FormData,Blob:_n.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};on.forEach(["delete","get","head"],(function(e){Ln.headers[e]={}})),on.forEach(["post","put","patch"],(function(e){Ln.headers[e]=on.merge(On)}));const Dn=on.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const xn=Symbol("internals");function Pn(e){return e&&String(e).trim().toLowerCase()}function Mn(e){return!1===e||null==e?e:on.isArray(e)?e.map(Mn):String(e)}function Fn(e,t,n,r){return on.isFunction(r)?r.call(this,t,n):on.isString(t)?on.isString(r)?-1!==t.indexOf(r):on.isRegExp(r)?r.test(t):void 0:void 0}class Un{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Pn(t);if(!s)throw new Error("header name must be a non-empty string");const i=on.findKey(r,s);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Mn(e))}const i=(e,t)=>on.forEach(e,((e,n)=>s(e,n,t)));return on.isPlainObject(e)||e instanceof this.constructor?i(e,t):on.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Dn[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=Pn(e)){const n=on.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(on.isFunction(t))return t.call(this,e,n);if(on.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Pn(e)){const n=on.findKey(this,e);return!(!n||t&&!Fn(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Pn(e)){const s=on.findKey(n,e);!s||t&&!Fn(0,n[s],s,t)||(delete n[s],r=!0)}}return on.isArray(e)?e.forEach(s):s(e),r}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,n={};return on.forEach(this,((r,s)=>{const i=on.findKey(n,s);if(i)return t[i]=Mn(r),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Mn(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return on.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&on.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[xn]=this[xn]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Pn(e);t[r]||(!function(e,t){const n=on.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})}))}(n,e),t[r]=!0)}return on.isArray(e)?e.forEach(r):r(e),this}}function Nn(e,t){const n=this||Ln,r=t||n,s=Un.from(r.headers);let i=r.data;return on.forEach(e,(function(e){i=e.call(n,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function Bn(e){return!(!e||!e.__CANCEL__)}function jn(e,t,n){ln.call(this,null==e?"canceled":e,ln.ERR_CANCELED,t,n),this.name="CanceledError"}Un.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),on.freezeMethods(Un.prototype),on.freezeMethods(Un),on.inherits(jn,ln,{__CANCEL__:!0});var $n=_n.isStandardBrowserEnv?{write:function(e,t,n,r,s,i){const a=[];a.push(e+"="+encodeURIComponent(t)),on.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),on.isString(r)&&a.push("path="+r),on.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function qn(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Kn=_n.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=on.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Gn(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,i=0,a=0;return t=void 0!==t?t:1e3,function(o){const l=Date.now(),c=r[a];s||(s=l),n[i]=o,r[i]=l;let d=a,u=0;for(;d!==i;)u+=n[d++],d%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),l-s<t)return;const h=c&&l-c;return h?Math.round(1e3*u/h):void 0}}(50,250);return s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,o=i-n,l=r(o);n=i;const c={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&i<=a?(a-i)/l:void 0,event:s};c[t?"download":"upload"]=!0,e(c)}}var Hn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const s=Un.from(e.headers).normalize(),i=e.responseType;let a;function o(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}on.isFormData(r)&&(_n.isStandardBrowserEnv||_n.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const c=qn(e.baseURL,e.url);function d(){if(!l)return;const r=Un.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ln("Request failed with status code "+n.status,[ln.ERR_BAD_REQUEST,ln.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),o()}),(function(e){n(e),o()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Cn(c,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new ln("Request aborted",ln.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new ln("Network Error",ln.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||En;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new ln(t,r.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,e,l)),l=null},_n.isStandardBrowserEnv){const t=(e.withCredentials||Kn(c))&&e.xsrfCookieName&&$n.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===r&&s.setContentType(null),"setRequestHeader"in l&&on.forEach(s.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),on.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",Gn(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Gn(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{l&&(n(!t||t.type?new jn(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const u=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);u&&-1===_n.protocols.indexOf(u)?n(new ln("Unsupported protocol "+u+":",ln.ERR_BAD_REQUEST,e)):l.send(r||null)}))};const Vn={http:null,xhr:Hn};on.forEach(Vn,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var zn=e=>{e=on.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let s=0;s<t&&(n=e[s],!(r=on.isString(n)?Vn[n.toLowerCase()]:n));s++);if(!r){if(!1===r)throw new ln(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(on.hasOwnProp(Vn,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!on.isFunction(r))throw new TypeError("adapter is not a function");return r};function Wn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new jn(null,e)}function Yn(e){Wn(e),e.headers=Un.from(e.headers),e.data=Nn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return zn(e.adapter||Ln.adapter)(e).then((function(t){return Wn(e),t.data=Nn.call(e,e.transformResponse,t),t.headers=Un.from(t.headers),t}),(function(t){return Bn(t)||(Wn(e),t&&t.response&&(t.response.data=Nn.call(e,e.transformResponse,t.response),t.response.headers=Un.from(t.response.headers))),Promise.reject(t)}))}const Qn=e=>e instanceof Un?e.toJSON():e;function Xn(e,t){t=t||{};const n={};function r(e,t,n){return on.isPlainObject(e)&&on.isPlainObject(t)?on.merge.call({caseless:n},e,t):on.isPlainObject(t)?on.merge({},t):on.isArray(t)?t.slice():t}function s(e,t,n){return on.isUndefined(t)?on.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!on.isUndefined(t))return r(void 0,t)}function a(e,t){return on.isUndefined(t)?on.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function o(n,s,i){return i in t?r(n,s):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t)=>s(Qn(e),Qn(t),!0)};return on.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=l[r]||s,a=i(e[r],t[r],r);on.isUndefined(a)&&i!==o||(n[r]=a)})),n}const Jn="1.2.3",Zn={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Zn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const er={};Zn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,i)=>{if(!1===e)throw new ln(r(s," has been removed"+(t?" in "+t:"")),ln.ERR_DEPRECATED);return t&&!er[s]&&(er[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,i)}};var tr={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new ln("option "+i+" must be "+n,ln.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new ln("Unknown option "+i,ln.ERR_BAD_OPTION)}},validators:Zn};const nr=tr.validators;class rr{constructor(e){this.defaults=e,this.interceptors={request:new Sn,response:new Sn}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Xn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;let i;void 0!==n&&tr.assertOptions(n,{silentJSONParsing:nr.transitional(nr.boolean),forcedJSONParsing:nr.transitional(nr.boolean),clarifyTimeoutError:nr.transitional(nr.boolean)},!1),void 0!==r&&tr.assertOptions(r,{encode:nr.function,serialize:nr.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=s&&on.merge(s.common,s[t.method]),i&&on.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Un.concat(i,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let d,u=0;if(!o){const e=[Yn.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=a.length;let h=t;for(u=0;u<d;){const e=a[u++],t=a[u++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=Yn.call(this,h)}catch(e){return Promise.reject(e)}for(u=0,d=l.length;u<d;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Cn(qn((e=Xn(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}on.forEach(["delete","get","head","options"],(function(e){rr.prototype[e]=function(t,n){return this.request(Xn(n||{},{method:e,url:t,data:(n||{}).data}))}})),on.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,s){return this.request(Xn(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}rr.prototype[e]=t(),rr.prototype[e+"Form"]=t(!0)}));class sr{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,s){n.reason||(n.reason=new jn(e,r,s),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new sr((function(t){e=t})),cancel:e}}}const ir={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ir).forEach((([e,t])=>{ir[t]=e}));const ar=function e(t){const n=new rr(t),r=Ot(rr.prototype.request,n);return on.extend(r,rr.prototype,n,{allOwnKeys:!0}),on.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xn(t,n))},r}(Ln);ar.Axios=rr,ar.CanceledError=jn,ar.CancelToken=sr,ar.isCancel=Bn,ar.VERSION=Jn,ar.toFormData=mn,ar.AxiosError=ln,ar.Cancel=ar.CanceledError,ar.all=function(e){return Promise.all(e)},ar.spread=function(e){return function(t){return e.apply(null,t)}},ar.isAxiosError=function(e){return on.isObject(e)&&!0===e.isAxiosError},ar.mergeConfig=Xn,ar.AxiosHeaders=Un,ar.formToJSON=e=>Rn(on.isHTMLForm(e)?new FormData(e):e),ar.HttpStatusCode=ir,ar.default=ar;var or={exports:{}};or.exports=cr;var lr=or.exports.HttpsAgent=cr;function cr(){}class dr{constructor(){this._listener=new Map}onNetworkActivities(e){return this._listener.set(e,e),()=>{this._listener.delete(e)}}setNetworkActivities(e,t){this._listener.forEach((n=>n(e,t)))}destroy(){this._listener.clear()}}let ur;var hr,fr=()=>(ur||(ur=new dr),ur);!function(e){e.UserDeleted="User Deleted",e.UserGlobalBanned="User Global Banned",e.TokenExpired="Token Expired"}(hr||(hr={}));const pr=new AbortController,gr=e=>{switch(e){case hr.UserGlobalBanned:throw new pe(e,400312,"fatal");case hr.UserDeleted:throw new pe(e,400100,"fatal");case hr.TokenExpired:throw Ze("tokenExpired","tokenExpired"),new pe(e,800403,"fatal");default:throw new pe("Request Aborted",8e5,"error")}},mr=e=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},n=ar.create({baseURL:e,httpAgent:new or.exports(t),httpsAgent:new lr(t),signal:pr.signal});return n.defaults.withCredentials=!1,n.interceptors.request.use((e=>{if("/api/v5/sessions"===e.url)return e;if(e.metadata){const{tokenExpiry:t,isGlobalBanned:n,isUserDeleted:r}=e.metadata;n&&(pr.abort(),gr(hr.UserGlobalBanned)),r&&(pr.abort(),gr(hr.UserDeleted)),t&&Date.now()>=Date.parse(t)&&(pr.abort(hr.UserDeleted),gr(hr.TokenExpired))}return e})),n.interceptors.response.use((e=>{const t=new Headers;return Object.entries(e.headers).forEach((([e,n])=>{"string"==typeof n&&t.append(e,n)})),fr().setNetworkActivities(new Request(e.request.url,{method:e.request.method,headers:e.request.headers,body:e.request.data}),{data:e.data,status:e.status,statusText:e.statusText,headers:t}),e}),(e=>{var t,n;const{response:r}=e;if(400100===(null==r?void 0:r.data.code)&&Ze("tokenTerminated","terminated"),(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.status)&&(e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new me(e.code);if("error"===e.status)throw new ge(e.message,e.code,"error")})(null==r?void 0:r.data),pr.signal.aborted)throw e;throw new Error(null!==(n=null==r?void 0:r.data)&&void 0!==n?n:e)})),n.defaults.paramsSerializer={encode:e=>encodeURIComponent(e)},n};var yr={exports:{}},vr=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,br=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],wr=function(e){var t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));for(var s=vr.exec(e||""),i={},a=14;a--;)i[br[a]]=s[a]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},Cr={exports:{}},Sr={exports:{}},Er=1e3,Tr=6e4,Ir=60*Tr,kr=24*Ir,Ar=365.25*kr,_r=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Ar;case"days":case"day":case"d":return n*kr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ir;case"minutes":case"minute":case"mins":case"min":case"m":return n*Tr;case"seconds":case"second":case"secs":case"sec":case"s":return n*Er;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return Rr(e,kr,"day")||Rr(e,Ir,"hour")||Rr(e,Tr,"minute")||Rr(e,Er,"second")||e+" ms"}(e):function(e){if(e>=kr)return Math.round(e/kr)+"d";if(e>=Ir)return Math.round(e/Ir)+"h";if(e>=Tr)return Math.round(e/Tr)+"m";if(e>=Er)return Math.round(e/Er)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Rr(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function s(){if(s.enabled){var e=s,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var l=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;l++;var s=t.formatters[r];if("function"==typeof s){var i=a[l];n=s.call(e,i),a.splice(l,1),l--}return n})),t.formatArgs.call(e,a);var c=s.log||t.log||console.log.bind(console);c.apply(e,a)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),s.destroy=r,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=_r,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Sr,Sr.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Sr.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Cr,Cr.exports);var Or=wr,Lr=Cr.exports("socket.io-client:url"),Dr=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Lr("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Lr("parse %s",e),n=Or(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n};var xr={},Pr={exports:{}},Mr={exports:{}},Fr=1e3,Ur=6e4,Nr=60*Ur,Br=24*Nr,jr=365.25*Br,$r=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*jr;case"days":case"day":case"d":return n*Br;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Nr;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ur;case"seconds":case"second":case"secs":case"sec":case"s":return n*Fr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return qr(e,Br,"day")||qr(e,Nr,"hour")||qr(e,Ur,"minute")||qr(e,Fr,"second")||e+" ms"}(e):function(e){if(e>=Br)return Math.round(e/Br)+"d";if(e>=Nr)return Math.round(e/Nr)+"h";if(e>=Ur)return Math.round(e/Ur)+"m";if(e>=Fr)return Math.round(e/Fr)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function qr(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function s(){if(s.enabled){var e=s,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var l=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;l++;var s=t.formatters[r];if("function"==typeof s){var i=a[l];n=s.call(e,i),a.splice(l,1),l--}return n})),t.formatArgs.call(e,a);var c=s.log||t.log||console.log.bind(console);c.apply(e,a)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),s.destroy=r,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=$r,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Mr,Mr.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Mr.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Pr,Pr.exports);var Kr={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Kr);var Gr={},Hr={}.toString,Vr=Array.isArray||function(e){return"[object Array]"==Hr.call(e)},zr=function(e){return Wr&&Buffer.isBuffer(e)||Yr&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},Wr="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,Yr="function"==typeof ArrayBuffer;var Qr=Vr,Xr=zr,Jr=Object.prototype.toString,Zr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Jr.call(Blob),es="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Jr.call(File);function ts(e,t){if(!e)return e;if(Xr(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(Qr(e)){for(var r=new Array(e.length),s=0;s<e.length;s++)r[s]=ts(e[s],t);return r}if("object"==typeof e&&!(e instanceof Date)){r={};for(var i in e)r[i]=ts(e[i],t);return r}return e}function ns(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(Qr(e))for(var n=0;n<e.length;n++)e[n]=ns(e[n],t);else if("object"==typeof e)for(var r in e)e[r]=ns(e[r],t);return e}Gr.deconstructPacket=function(e){var t=[],n=e.data,r=e;return r.data=ts(n,t),r.attachments=t.length,{packet:r,buffers:t}},Gr.reconstructPacket=function(e,t){return e.data=ns(e.data,t),e.attachments=void 0,e},Gr.removeBlobs=function(e,t){var n=0,r=e;!function e(s,i,a){if(!s)return s;if(Zr&&s instanceof Blob||es&&s instanceof File){n++;var o=new FileReader;o.onload=function(){a?a[i]=this.result:r=this.result,--n||t(r)},o.readAsArrayBuffer(s)}else if(Qr(s))for(var l=0;l<s.length;l++)e(s[l],l,s);else if("object"==typeof s&&!Xr(s))for(var c in s)e(s[c],c,s)}(r),n||t(r)},function(e){var t=Pr.exports("socket.io-parser"),n=Kr.exports,r=Gr,s=Vr,i=zr;function a(){}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=a,e.Decoder=c;var o=e.ERROR+'"encode error"';function l(n){var r=""+n.type;if(e.BINARY_EVENT!==n.type&&e.BINARY_ACK!==n.type||(r+=n.attachments+"-"),n.nsp&&"/"!==n.nsp&&(r+=n.nsp+","),null!=n.id&&(r+=n.id),null!=n.data){var s=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(n.data);if(!1===s)return o;r+=s}return t("encoded %j as %s",n,r),r}function c(){this.reconstructor=null}function d(e){this.reconPack=e,this.buffers=[]}function u(t){return{type:e.ERROR,data:"parser error: "+t}}a.prototype.encode=function(n,s){(t("encoding packet %j",n),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type)?function(e,t){function n(e){var n=r.deconstructPacket(e),s=l(n.packet),i=n.buffers;i.unshift(s),t(i)}r.removeBlobs(e,n)}(n,s):s([l(n)])},n(c.prototype),c.prototype.add=function(n){var r;if("string"==typeof n)r=function(n){var r=0,i={type:Number(n.charAt(0))};if(null==e.types[i.type])return u("unknown packet type "+i.type);if(e.BINARY_EVENT===i.type||e.BINARY_ACK===i.type){for(var a=r+1;"-"!==n.charAt(++r)&&r!=n.length;);var o=n.substring(a,r);if(o!=Number(o)||"-"!==n.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===n.charAt(r+1)){for(a=r+1;++r;){if(","===(c=n.charAt(r)))break;if(r===n.length)break}i.nsp=n.substring(a,r)}else i.nsp="/";var l=n.charAt(r+1);if(""!==l&&Number(l)==l){for(a=r+1;++r;){var c;if(null==(c=n.charAt(r))||Number(c)!=c){--r;break}if(r===n.length)break}i.id=Number(n.substring(a,r+1))}if(n.charAt(++r)){var d=function(e){try{return JSON.parse(e)}catch(e){return!1}}(n.substr(r));if(!(!1!==d&&(i.type===e.ERROR||s(d))))return u("invalid payload");i.data=d}return t("decoded %s as %j",n,i),i}(n),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new d(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!i(n)&&!n.base64)throw new Error("Unknown type: "+n);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(n))&&(this.reconstructor=null,this.emit("decoded",r))}},c.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=r.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}(xr);var rs={exports:{}},ss={},is={exports:{}};try{is.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){is.exports=!1}var as,os,ls,cs,ds=is.exports,us=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ds))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},hs={exports:{}},fs={},ps=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t};function gs(){if(cs)return ls;cs=1;var e=function(){if(os)return as;os=1;var e={}.toString;return as=Array.isArray||function(t){return"[object Array]"==e.call(t)}}(),t=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===t.call(Blob),r="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===t.call(File);return ls=function t(s){if(!s||"object"!=typeof s)return!1;if(e(s)){for(var i=0,a=s.length;i<a;i++)if(t(s[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(s)||"function"==typeof ArrayBuffer&&s instanceof ArrayBuffer||n&&s instanceof Blob||r&&s instanceof File)return!0;if(s.toJSON&&"function"==typeof s.toJSON&&1===arguments.length)return t(s.toJSON(),!0);for(var o in s)if(Object.prototype.hasOwnProperty.call(s,o)&&t(s[o]))return!0;return!1},ls}var ms=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var s=new Uint8Array(e),i=new Uint8Array(n-t),a=t,o=0;a<n;a++,o++)i[o]=s[a];return i.buffer},ys=function(e,t,n){var r=!1;return n=n||vs,s.count=e,0===e?t():s;function s(e,i){if(s.count<=0)throw new Error("after called too many times");--s.count,e?(r=!0,t(e),t=n):0!==s.count||r||t(null,i)}};function vs(){}
1
+ var Amity=function(e){"use strict";const t=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video"}),n=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),r=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),s=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"});var i;e.FileAccessTypeEnum=void 0,(i=e.FileAccessTypeEnum||(e.FileAccessTypeEnum={})).PUBLIC="public",i.NETWORK="network";const a=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),o=Object.freeze({ONLY_ADMIN_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!0},ADMIN_REVIEW_POST_REQUIRED:{needApprovalOnPostCreation:!0,onlyAdminCanPost:!1},ANYONE_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!1}}),l="ONLY_ADMIN_CAN_POST",c=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"}),d=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),u=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll"});const h=function(){try{return"v6.35.2-umd"}catch(e){return"__dev__"}}(),f=5,p="cache_then_server",g="For using Live Collection feature you need to enable Cache!",m="Observing unsynced object is not supported by Live Object.",y=1e3,v=864e5,b=6e5,w="dead",C=6e4,S=e=>JSON.stringify(e,((e,t)=>{return"object"==typeof t?(n=t,Object.keys(n).sort().reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:n[t]})),{})):t;var n})),E=e=>JSON.parse(e),T=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((n=>T(e[n],t[n])))),I=e=>[400400,400300].includes(e),k="function"==typeof atob,A="function"==typeof btoa,_="function"==typeof Buffer,R="function"==typeof TextDecoder?new TextDecoder:void 0,O="function"==typeof TextEncoder?new TextEncoder:void 0,L=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),D=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(L),x=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,P=String.fromCharCode.bind(String),M="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),F=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),U=A?e=>btoa(e):_?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,s,i="";const a=e.length%3;for(let a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|s,i+=L[t>>18&63]+L[t>>12&63]+L[t>>6&63]+L[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},N=_?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(P.apply(null,e.subarray(n,n+4096)));return U(t.join(""))},B=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?P(192|t>>>6)+P(128|63&t):P(224|t>>>12&15)+P(128|t>>>6&63)+P(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return P(240|t>>>18&7)+P(128|t>>>12&63)+P(128|t>>>6&63)+P(128|63&t)},j=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,$=_?e=>Buffer.from(e,"utf8").toString("base64"):O?e=>N(O.encode(e)):e=>U(e.replace(j,B)),q=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,K=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return P(55296+(t>>>10))+P(56320+(1023&t));case 3:return P((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return P((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},G=k?e=>atob(F(e)):_?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!x.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,s="";for(let i=0;i<e.length;)t=D[e.charAt(i++)]<<18|D[e.charAt(i++)]<<12|(n=D[e.charAt(i++)])<<6|(r=D[e.charAt(i++)]),s+=64===n?P(t>>16&255):64===r?P(t>>16&255,t>>8&255):P(t>>16&255,t>>8&255,255&t);return s},H=_?e=>M(Buffer.from(e,"base64")):e=>M(G(e),(e=>e.charCodeAt(0))),V=_?e=>Buffer.from(e,"base64").toString("utf8"):R?e=>R.decode(H(e)):e=>G(e).replace(q,K),z=e=>V(F(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),W=e=>["skip"].some((t=>t in e)),Y=e=>["after","before","first","last","limit"].some((t=>t in e)),Q=e=>"limit"in e,X=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),J=(e,t)=>{var n;if(!e||!Object.keys(e).length)return;let r={};return"skiplimit"===t?r={skip:null!==(n=e.after)&&void 0!==n?n:0,limit:e.limit}:"afterbefore"===t&&Y(e)?((null==e?void 0:e.before)&&(r=Object.assign(Object.assign({},r),{before:e.before})),(null==e?void 0:e.after)&&(r=Object.assign(Object.assign({},r),{after:e.after})),Number.isNaN(Number(null==e?void 0:e.limit))||(r=Object.assign(Object.assign({},r),{limit:e.limit}))):"afterbeforeraw"===t&&(r=e),Object.keys(r).length?((e,t=!1)=>t?(e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")))($(e)):$(e))(JSON.stringify(r)):void 0},Z=e=>{if(!e)return;const t=JSON.parse(z(e));if(W(t))return{after:t.skip,limit:t.limit};if(Y(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},ee=e=>"locally"in e,te=e=>"optimistically"in e,ne=e=>ee(e)||te(e),re=e=>null==e?void 0:e.hasOwnProperty("cachedAt"),se=(e,t=6e4)=>{var n;return Date.now()-(null!==(n=null==e?void 0:e.cachedAt)&&void 0!==n?n:0)<=t},ie=(e,...t)=>({func:e,args:t}),ae=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<C?C:t},oe=({func:e,args:t},n,r=ae("cache_then_server"))=>{let s;const{lifeSpan:i}=ae("cache_then_server",r.lifeSpan);if(ne(e)){try{s=te(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==n||n(le(void 0,{origin:"local",loading:!1,error:e}))}const r=re(s)&&se(s,i);if(null==n||n(le(s,{origin:"local",loading:!(ee(e)&&r)})),r)return}else null==n||n(le(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==n||n(le(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(le(void 0,{origin:"server",loading:!1,error:e}))}))};function le(e,t){return X(e)||re(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}const ce={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelInternalId:e})=>e,subChannel:({subChannelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e,referenceId:t})=>null!=t?t:e,messagePreviewChannel:({channelId:e})=>`${e}`,messagePreviewSubChannel:({subChannelId:e})=>`${e}`,channelUnreadInfo:({channelId:e})=>e,subChannelUnreadInfo:({subChannelId:e})=>e,channelMarker:({entityId:e,userId:t})=>`${e}#${t}`,subChannelMarker:({entityId:e,feedId:t,userId:n})=>`${e}#${t}#${n}`,messageMarker:({feedId:e,contentId:t,creatorId:n})=>`${e}#${t}#${n}`,feedMarker:({feedId:e,entityId:t})=>`${e}#${t}`,userMarker:({userId:e})=>e,community:({communityId:e})=>e,category:({categoryId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,commentChildren:({commentId:e})=>e,poll:({pollId:e})=>e,reaction:({referenceType:e,referenceId:t})=>`${e}#${t}`,reactor:({reactionId:e})=>e,stream:({streamId:e})=>e,streamModeration:({streamId:e})=>e,follow:({from:e,to:t})=>`${e}#${t}`,followInfo:({userId:e})=>e,followCount:({userId:e})=>e,feed:({targetId:e,feedId:t})=>`${e}#${t}`,story:({referenceId:e})=>e,storyTarget:({targetId:e})=>e,ad:({adId:e})=>e,advertiser:({advertiserId:e})=>e,pin:({placement:e,referenceId:t})=>`${e}#${t}`,pinTarget:({targetId:e})=>e},de=e=>ce[e],ue=e=>e.startsWith("LOCAL_"),he={users:"user",files:"file",roles:"role",stories:"story",storyTargets:"storyTarget",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",messages:"message",messagePreviewChannel:"messagePreviewChannel",messagePreviewSubChannel:"messagePreviewSubChannel",channelUnreadInfo:"channelUnreadInfo",subChannelUnreadInfo:"subChannelUnreadInfo",userEntityMarkers:"channelMarker",userFeedMarkers:"subChannelMarker",contentMarkers:"messageMarker",feedMarkers:"feedMarker",userMarkers:"userMarker",communities:"community",categories:"category",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",commentChildren:"comment",polls:"poll",reactors:"reactor",reactions:"reaction",videoStreamings:"stream",videoStreamModerations:"streamModeration",follows:"follow",followCounts:"followCount",feeds:"feed",ads:"ad",advertisers:"advertiser",pinTargets:"pinTarget",pins:"pin"};function fe(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class pe extends Error{constructor(e,t,n){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=n,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,pe)}}class ge extends pe{constructor(e,t,n){super(e,t,n)}}class me extends pe{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class ye extends pe{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let ve=null;const be=()=>{if(!ve)throw new pe("There is no active client",8e5,"fatal");return ve},we=e=>{ve=e},Ce=e=>{const{log:t,cache:n}=be();if(n)return t("cache/api/queryCache",{key:e}),Object.keys(n.data).filter((t=>{const n=E(t);return T(e,n)})).map((e=>n.data[e]))},Se=e=>{const{log:t,cache:n}=be();if(!n)return;t("cache/api/pullFromCache",e);const r=S(e);return n.data[r]?n.data[r]:void 0},Ee=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/pushToCache",{key:e,data:t,options:n}),!(null==n?void 0:n.hasOwnProperty("offline"))&&s.persistIf&&(n.offline=s.persistIf(e,t));const i=S(e);return s.data[i]=Object.assign({key:e,data:t},n),!0},Te=(e,t,n)=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/mergeInCache",{key:e,mutation:t});const i=Se(e);if(!i)return!1;const a="function"==typeof t?t(i.data):Object.assign(Object.assign({},i.data),t);return o=i.data,!("updatedAt"in(l=a)&&"updatedAt"in l&&new Date(l.updatedAt)<new Date(o.updatedAt))&&(Ee(e,a,n),!0);var o,l},Ie=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=be();if(!s)return!1;r("cache/api/upsertInCache",{key:e,data:t,options:n});return Se(e)?Te(e,t,n):Ee(e,t,n)},ke=(e,t=!1)=>{const{log:n,cache:r}=be();if(!r)return!1;if(n("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(r.data).map((e=>E(e))).filter((t=>T(e,t))).map((e=>ke(e,!0))).every((e=>e));const s=S(e);return s in r.data&&(delete r.data[s],!0)},Ae=(e,t,n)=>void 0!==n?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(n))):e,_e=(e,t,n)=>void 0!==n?e.filter((e=>"string"==typeof e[t]&&"string"==typeof n&&String(e[t]).toLowerCase().match(n.toLowerCase()))):e,Re=(e,t,n)=>(null==n?void 0:n.length)?e.filter((e=>Array.isArray(e[t])&&n.some((n=>e[t].includes(n))))):e,Oe=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;if("community"===e.type)return!0;const s=de("channelUsers")({channelId:e.channelPublicId,userId:n}),i=null===(r=Se(["channelUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),Le=(e,t)=>e.filter((({targetId:e,feedId:n})=>{var r;const s=null===(r=Se(["feed","get",de("feed")({targetId:e,feedId:n})]))||void 0===r?void 0:r.data;return s&&s.feedType===t})),De=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;const s=de("communityUsers")({communityId:e.communityId,userId:n}),i=null===(r=Se(["communityUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),xe=(e,t)=>e.reduce(((e,n)=>{var r;if(null==t?void 0:t.includes(n.dataType))return[...e,n];if(((null==n?void 0:n.children)||[]).length>0){const s=null===(r=Se(["post","get",n.children[0]]))||void 0===r?void 0:r.data;return(null==t?void 0:t.includes(null==s?void 0:s.dataType))?e:[...e,n]}return e}),[]),Pe=(e,t)=>{const n=new RegExp(t,"i");return e.filter((e=>{var t;return!!e.userId.match(n)||e.user&&(null===(t=e.user.displayName)||void 0===t?void 0:t.match(n))}))},Me=({displayName:e},{displayName:t})=>e&&t?e.localeCompare(t):e?-1:1,Fe=({name:e},{name:t})=>e&&t?e.localeCompare(t):e?-1:1,Ue=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),Ne=({localSortingDate:e},{localSortingDate:t})=>new Date(t).getTime()-new Date(e).getTime(),Be=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),je=({updatedAt:e=0},{updatedAt:t=0})=>new Date(e).valueOf()-new Date(t).valueOf(),$e=({updatedAt:e=0},{updatedAt:t=0})=>new Date(t).valueOf()-new Date(e).valueOf(),qe=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let Ke=null;const Ge=()=>{if(!Ke)throw new pe("Connect client first",8e5,"fatal");return Ke},He=e=>{Ke={_id:e._id,userId:e.userId,path:e.path}};let Ve,ze=[];const We=e=>{clearTimeout(Ve),ze.push(e),Ve=setTimeout((()=>{ze.forEach((e=>e())),ze=[]}),0)},Ye=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired","v3.video-streaming.didRecord","v3.video-streaming.didStart","v3.video-streaming.didStop"],Qe=["connect","message","disconnect","error","close","end","reconnect","user.didGlobalBan"],Xe=()=>{return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}};var e},Je=(e,t,n,r)=>{const{log:s,emitter:i}=e,a=Date.now();s(`${t}(tmpid: ${a}) > listen`);const o=(...e)=>{s(`${t}(tmpid: ${a}) > trigger`,e);try{r(...e)}catch(e){s(`${t}(tmpid: ${a}) > error`,e)}};return i.on(n,o),()=>{s(`${t}(tmpid: ${a}) > dispose`),i.off(n,o)}},Ze=(e,t)=>{const{emitter:n}=be();We((()=>{n.emit(e,t)}))};let et,tt;async function nt(){var e;const{mqtt:t,emitter:n,token:r}=be();if(!t)return;const s=null!==(e=null==r?void 0:r.accessToken)&&void 0!==e?e:"",i=Ge();et===s&&tt===i._id||(et=s,tt=i._id,await t.connect({accessToken:et,userId:tt}),((e,t)=>{Qe.forEach((n=>{null==e||e.on(n,((...e)=>{t.emit(n,1===e.length?e[0]:e)}))})),e.on("message",((e,n)=>{const r=JSON.parse(n.toString());t.emit(r.eventType,r.data)}))})(t,n))}var rt;e.SubscriptionLevels=void 0,(rt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",rt.POST="post",rt.COMMENT="comment",rt.POST_AND_COMMENT="post_and_comment",rt.USER="user";const st=(e,t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}},it=e=>e.path.split("/user/")[0],at=({path:t},n=e.SubscriptionLevels.USER)=>st(n===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),n),ot=({channelId:e,subChannelId:t})=>{const n=Ge();return`${it(n)}/marker/channel/${e}/message/${t}`},lt=()=>{const e=Ge();return`${it(e)}/marker/user/${e._id}`},ct=()=>it(Ge()),dt=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/channels`},ut=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/messagefeeds`},ht=()=>{const e=Ge();return`${it(e)}/smartfeed/${e._id}/messages`};function ft(e,t){const{mqtt:n}=be();return n?(nt(),n.subscribe(e,t)):()=>null}var pt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mt(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var yt,vt,bt={exports:{}};function wt(){if(vt)return yt;vt=1;var e=1e3,t=60*e,n=60*t,r=24*n,s=7*r,i=365.25*r;function a(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}return yt=function(o,l){l=l||{};var c=typeof o;if("string"===c&&o.length>0)return function(a){if((a=String(a)).length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!o)return;var l=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*r;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(o);if("number"===c&&isFinite(o))return l.long?function(s){var i=Math.abs(s);if(i>=r)return a(s,i,r,"day");if(i>=n)return a(s,i,n,"hour");if(i>=t)return a(s,i,t,"minute");if(i>=e)return a(s,i,e,"second");return s+" ms"}(o):function(s){var i=Math.abs(s);if(i>=r)return Math.round(s/r)+"d";if(i>=n)return Math.round(s/n)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))},yt}var Ct=function(e){function t(e){let r,s,i,a=null;function o(...e){if(!o.enabled)return;const n=o,s=Number(new Date),i=s-(r||s);n.diff=i,n.prev=r,n.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const i=t.formatters[s];if("function"==typeof i){const t=e[a];r=i.call(n,t),e.splice(a,1),a--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=wt(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ct(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(bt,bt.exports);var St,Et=bt.exports;const Tt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:It={}}=Tt,kt="production"===(null===(St=It.env)||void 0===St?void 0:St.NODE_ENV),At={EU:"eu",SG:"sg",US:"us"},_t={http:"https://api.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function Rt(e,t){return _t[e].replace("{region}",t)}function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:Lt}=Object.prototype,{getPrototypeOf:Dt}=Object,xt=(Pt=Object.create(null),e=>{const t=Lt.call(e);return Pt[t]||(Pt[t]=t.slice(8,-1).toLowerCase())});var Pt;const Mt=e=>(e=e.toLowerCase(),t=>xt(t)===e),Ft=e=>t=>typeof t===e,{isArray:Ut}=Array,Nt=Ft("undefined");const Bt=Mt("ArrayBuffer");const jt=Ft("string"),$t=Ft("function"),qt=Ft("number"),Kt=e=>null!==e&&"object"==typeof e,Gt=e=>{if("object"!==xt(e))return!1;const t=Dt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Ht=Mt("Date"),Vt=Mt("File"),zt=Mt("Blob"),Wt=Mt("FileList"),Yt=Mt("URLSearchParams");function Qt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),Ut(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let a;for(r=0;r<i;r++)a=s[r],t.call(null,e[a],a,e)}}function Xt(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Zt=e=>!Nt(e)&&e!==Jt;const en=(tn="undefined"!=typeof Uint8Array&&Dt(Uint8Array),e=>tn&&e instanceof tn);var tn;const nn=Mt("HTMLFormElement"),rn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),sn=Mt("RegExp"),an=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Qt(n,((n,s)=>{!1!==t(n,s,e)&&(r[s]=n)})),Object.defineProperties(e,r)};var on={isArray:Ut,isArrayBuffer:Bt,isBuffer:function(e){return null!==e&&!Nt(e)&&null!==e.constructor&&!Nt(e.constructor)&&$t(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||Lt.call(e)===t||$t(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Bt(e.buffer),t},isString:jt,isNumber:qt,isBoolean:e=>!0===e||!1===e,isObject:Kt,isPlainObject:Gt,isUndefined:Nt,isDate:Ht,isFile:Vt,isBlob:zt,isRegExp:sn,isFunction:$t,isStream:e=>Kt(e)&&$t(e.pipe),isURLSearchParams:Yt,isTypedArray:en,isFileList:Wt,forEach:Qt,merge:function e(){const{caseless:t}=Zt(this)&&this||{},n={},r=(r,s)=>{const i=t&&Xt(n,s)||s;Gt(n[i])&&Gt(r)?n[i]=e(n[i],r):Gt(r)?n[i]=e({},r):Ut(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Qt(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(Qt(t,((t,r)=>{n&&$t(t)?e[r]=Ot(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,i,a;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],r&&!r(a,e,t)||o[a]||(t[a]=e[a],o[a]=!0);e=!1!==n&&Dt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:xt,kindOfTest:Mt,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ut(e))return e;let t=e.length;if(!qt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:nn,hasOwnProperty:rn,hasOwnProp:rn,reduceDescriptors:an,freezeMethods:e=>{an(e,((t,n)=>{if($t(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];$t(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return Ut(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:Xt,global:Jt,isContextDefined:Zt,toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Kt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const s=Ut(e)?[]:{};return Qt(e,((e,t)=>{const i=n(e,r+1);!Nt(i)&&(s[t]=i)})),t[r]=void 0,s}}return e};return n(e,0)}};function ln(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}on.inherits(ln,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:on.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cn=ln.prototype,dn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{dn[e]={value:e}})),Object.defineProperties(ln,dn),Object.defineProperty(cn,"isAxiosError",{value:!0}),ln.from=(e,t,n,r,s,i)=>{const a=Object.create(cn);return on.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ln.call(a,e.message,t,n,r,s),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};var un="object"==typeof self?self.FormData:window.FormData;function hn(e){return on.isPlainObject(e)||on.isArray(e)}function fn(e){return on.endsWith(e,"[]")?e.slice(0,-2):e}function pn(e,t,n){return e?e.concat(t).map((function(e,t){return e=fn(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const gn=on.toFlatObject(on,{},null,(function(e){return/^is[A-Z]/.test(e)}));function mn(e,t,n){if(!on.isObject(e))throw new TypeError("target must be an object");t=t||new(un||FormData);const r=(n=on.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!on.isUndefined(t[e])}))).metaTokens,s=n.visitor||d,i=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((l=t)&&on.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);var l;if(!on.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(on.isDate(e))return e.toISOString();if(!o&&on.isBlob(e))throw new ln("Blob is not supported. Use a Buffer instead.");return on.isArrayBuffer(e)||on.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(on.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(on.isArray(e)&&function(e){return on.isArray(e)&&!e.some(hn)}(e)||on.isFileList(e)||on.endsWith(n,"[]")&&(o=on.toArray(e)))return n=fn(n),o.forEach((function(e,r){!on.isUndefined(e)&&null!==e&&t.append(!0===a?pn([n],r,i):null===a?n:n+"[]",c(e))})),!1;return!!hn(e)||(t.append(pn(s,n,i),c(e)),!1)}const u=[],h=Object.assign(gn,{defaultVisitor:d,convertValue:c,isVisitable:hn});if(!on.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!on.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),on.forEach(n,(function(n,i){!0===(!(on.isUndefined(n)||null===n)&&s.call(t,n,on.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t}function yn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function vn(e,t){this._pairs=[],e&&mn(e,this,t)}const bn=vn.prototype;function wn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Cn(e,t,n){if(!t)return e;const r=n&&n.encode||wn,s=n&&n.serialize;let i;if(i=s?s(t,n):on.isURLSearchParams(t)?t.toString():new vn(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}bn.append=function(e,t){this._pairs.push([e,t])},bn.toString=function(e){const t=e?function(t){return e.call(this,t,yn)}:yn;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Sn{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){on.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var En={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Tn="undefined"!=typeof URLSearchParams?URLSearchParams:vn,In=FormData;const kn=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),An="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var _n={isBrowser:!0,classes:{URLSearchParams:Tn,FormData:In,Blob:Blob},isStandardBrowserEnv:kn,isStandardBrowserWebWorkerEnv:An,protocols:["http","https","file","blob","url","data"]};function Rn(e){function t(e,n,r,s){let i=e[s++];const a=Number.isFinite(+i),o=s>=e.length;if(i=!i&&on.isArray(r)?r.length:i,o)return on.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&on.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],s)&&on.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}(r[i])),!a}if(on.isFormData(e)&&on.isFunction(e.entries)){const n={};return on.forEachEntry(e,((e,r)=>{t(function(e){return on.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const On={"Content-Type":void 0};const Ln={transitional:En,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=on.isObject(e);s&&on.isHTMLForm(e)&&(e=new FormData(e));if(on.isFormData(e))return r&&r?JSON.stringify(Rn(e)):e;if(on.isArrayBuffer(e)||on.isBuffer(e)||on.isStream(e)||on.isFile(e)||on.isBlob(e))return e;if(on.isArrayBufferView(e))return e.buffer;if(on.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return mn(e,new _n.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return _n.isNode&&on.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=on.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return mn(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(on.isString(e))try{return(t||JSON.parse)(e),on.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ln.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&on.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw ln.from(e,ln.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_n.classes.FormData,Blob:_n.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};on.forEach(["delete","get","head"],(function(e){Ln.headers[e]={}})),on.forEach(["post","put","patch"],(function(e){Ln.headers[e]=on.merge(On)}));const Dn=on.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const xn=Symbol("internals");function Pn(e){return e&&String(e).trim().toLowerCase()}function Mn(e){return!1===e||null==e?e:on.isArray(e)?e.map(Mn):String(e)}function Fn(e,t,n,r){return on.isFunction(r)?r.call(this,t,n):on.isString(t)?on.isString(r)?-1!==t.indexOf(r):on.isRegExp(r)?r.test(t):void 0:void 0}class Un{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Pn(t);if(!s)throw new Error("header name must be a non-empty string");const i=on.findKey(r,s);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Mn(e))}const i=(e,t)=>on.forEach(e,((e,n)=>s(e,n,t)));return on.isPlainObject(e)||e instanceof this.constructor?i(e,t):on.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Dn[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=Pn(e)){const n=on.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(on.isFunction(t))return t.call(this,e,n);if(on.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Pn(e)){const n=on.findKey(this,e);return!(!n||t&&!Fn(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Pn(e)){const s=on.findKey(n,e);!s||t&&!Fn(0,n[s],s,t)||(delete n[s],r=!0)}}return on.isArray(e)?e.forEach(s):s(e),r}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,n={};return on.forEach(this,((r,s)=>{const i=on.findKey(n,s);if(i)return t[i]=Mn(r),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Mn(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return on.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&on.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[xn]=this[xn]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Pn(e);t[r]||(!function(e,t){const n=on.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})}))}(n,e),t[r]=!0)}return on.isArray(e)?e.forEach(r):r(e),this}}function Nn(e,t){const n=this||Ln,r=t||n,s=Un.from(r.headers);let i=r.data;return on.forEach(e,(function(e){i=e.call(n,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function Bn(e){return!(!e||!e.__CANCEL__)}function jn(e,t,n){ln.call(this,null==e?"canceled":e,ln.ERR_CANCELED,t,n),this.name="CanceledError"}Un.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),on.freezeMethods(Un.prototype),on.freezeMethods(Un),on.inherits(jn,ln,{__CANCEL__:!0});var $n=_n.isStandardBrowserEnv?{write:function(e,t,n,r,s,i){const a=[];a.push(e+"="+encodeURIComponent(t)),on.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),on.isString(r)&&a.push("path="+r),on.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function qn(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Kn=_n.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=on.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Gn(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,i=0,a=0;return t=void 0!==t?t:1e3,function(o){const l=Date.now(),c=r[a];s||(s=l),n[i]=o,r[i]=l;let d=a,u=0;for(;d!==i;)u+=n[d++],d%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),l-s<t)return;const h=c&&l-c;return h?Math.round(1e3*u/h):void 0}}(50,250);return s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,o=i-n,l=r(o);n=i;const c={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&i<=a?(a-i)/l:void 0,event:s};c[t?"download":"upload"]=!0,e(c)}}var Hn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const s=Un.from(e.headers).normalize(),i=e.responseType;let a;function o(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}on.isFormData(r)&&(_n.isStandardBrowserEnv||_n.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const c=qn(e.baseURL,e.url);function d(){if(!l)return;const r=Un.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ln("Request failed with status code "+n.status,[ln.ERR_BAD_REQUEST,ln.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),o()}),(function(e){n(e),o()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Cn(c,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new ln("Request aborted",ln.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new ln("Network Error",ln.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||En;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new ln(t,r.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,e,l)),l=null},_n.isStandardBrowserEnv){const t=(e.withCredentials||Kn(c))&&e.xsrfCookieName&&$n.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===r&&s.setContentType(null),"setRequestHeader"in l&&on.forEach(s.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),on.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",Gn(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Gn(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{l&&(n(!t||t.type?new jn(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const u=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);u&&-1===_n.protocols.indexOf(u)?n(new ln("Unsupported protocol "+u+":",ln.ERR_BAD_REQUEST,e)):l.send(r||null)}))};const Vn={http:null,xhr:Hn};on.forEach(Vn,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var zn=e=>{e=on.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let s=0;s<t&&(n=e[s],!(r=on.isString(n)?Vn[n.toLowerCase()]:n));s++);if(!r){if(!1===r)throw new ln(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(on.hasOwnProp(Vn,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!on.isFunction(r))throw new TypeError("adapter is not a function");return r};function Wn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new jn(null,e)}function Yn(e){Wn(e),e.headers=Un.from(e.headers),e.data=Nn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return zn(e.adapter||Ln.adapter)(e).then((function(t){return Wn(e),t.data=Nn.call(e,e.transformResponse,t),t.headers=Un.from(t.headers),t}),(function(t){return Bn(t)||(Wn(e),t&&t.response&&(t.response.data=Nn.call(e,e.transformResponse,t.response),t.response.headers=Un.from(t.response.headers))),Promise.reject(t)}))}const Qn=e=>e instanceof Un?e.toJSON():e;function Xn(e,t){t=t||{};const n={};function r(e,t,n){return on.isPlainObject(e)&&on.isPlainObject(t)?on.merge.call({caseless:n},e,t):on.isPlainObject(t)?on.merge({},t):on.isArray(t)?t.slice():t}function s(e,t,n){return on.isUndefined(t)?on.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!on.isUndefined(t))return r(void 0,t)}function a(e,t){return on.isUndefined(t)?on.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function o(n,s,i){return i in t?r(n,s):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t)=>s(Qn(e),Qn(t),!0)};return on.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=l[r]||s,a=i(e[r],t[r],r);on.isUndefined(a)&&i!==o||(n[r]=a)})),n}const Jn="1.2.3",Zn={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Zn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const er={};Zn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,i)=>{if(!1===e)throw new ln(r(s," has been removed"+(t?" in "+t:"")),ln.ERR_DEPRECATED);return t&&!er[s]&&(er[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,i)}};var tr={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new ln("option "+i+" must be "+n,ln.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new ln("Unknown option "+i,ln.ERR_BAD_OPTION)}},validators:Zn};const nr=tr.validators;class rr{constructor(e){this.defaults=e,this.interceptors={request:new Sn,response:new Sn}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Xn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;let i;void 0!==n&&tr.assertOptions(n,{silentJSONParsing:nr.transitional(nr.boolean),forcedJSONParsing:nr.transitional(nr.boolean),clarifyTimeoutError:nr.transitional(nr.boolean)},!1),void 0!==r&&tr.assertOptions(r,{encode:nr.function,serialize:nr.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=s&&on.merge(s.common,s[t.method]),i&&on.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Un.concat(i,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let d,u=0;if(!o){const e=[Yn.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=a.length;let h=t;for(u=0;u<d;){const e=a[u++],t=a[u++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=Yn.call(this,h)}catch(e){return Promise.reject(e)}for(u=0,d=l.length;u<d;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Cn(qn((e=Xn(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}on.forEach(["delete","get","head","options"],(function(e){rr.prototype[e]=function(t,n){return this.request(Xn(n||{},{method:e,url:t,data:(n||{}).data}))}})),on.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,s){return this.request(Xn(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}rr.prototype[e]=t(),rr.prototype[e+"Form"]=t(!0)}));class sr{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,s){n.reason||(n.reason=new jn(e,r,s),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new sr((function(t){e=t})),cancel:e}}}const ir={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ir).forEach((([e,t])=>{ir[t]=e}));const ar=function e(t){const n=new rr(t),r=Ot(rr.prototype.request,n);return on.extend(r,rr.prototype,n,{allOwnKeys:!0}),on.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xn(t,n))},r}(Ln);ar.Axios=rr,ar.CanceledError=jn,ar.CancelToken=sr,ar.isCancel=Bn,ar.VERSION=Jn,ar.toFormData=mn,ar.AxiosError=ln,ar.Cancel=ar.CanceledError,ar.all=function(e){return Promise.all(e)},ar.spread=function(e){return function(t){return e.apply(null,t)}},ar.isAxiosError=function(e){return on.isObject(e)&&!0===e.isAxiosError},ar.mergeConfig=Xn,ar.AxiosHeaders=Un,ar.formToJSON=e=>Rn(on.isHTMLForm(e)?new FormData(e):e),ar.HttpStatusCode=ir,ar.default=ar;var or={exports:{}};or.exports=cr;var lr=or.exports.HttpsAgent=cr;function cr(){}class dr{constructor(){this._listener=new Map}onNetworkActivities(e){return this._listener.set(e,e),()=>{this._listener.delete(e)}}setNetworkActivities(e,t){this._listener.forEach((n=>n(e,t)))}destroy(){this._listener.clear()}}let ur;var hr,fr=()=>(ur||(ur=new dr),ur);!function(e){e.UserDeleted="User Deleted",e.UserGlobalBanned="User Global Banned",e.TokenExpired="Token Expired"}(hr||(hr={}));const pr=new AbortController,gr=e=>{switch(e){case hr.UserGlobalBanned:throw new pe(e,400312,"fatal");case hr.UserDeleted:throw new pe(e,400100,"fatal");case hr.TokenExpired:throw Ze("tokenExpired","tokenExpired"),new pe(e,800403,"fatal");default:throw new pe("Request Aborted",8e5,"error")}},mr=e=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},n=ar.create({baseURL:e,httpAgent:new or.exports(t),httpsAgent:new lr(t),signal:pr.signal});return n.defaults.withCredentials=!1,n.interceptors.request.use((e=>{if("/api/v5/sessions"===e.url)return e;if(e.metadata){const{tokenExpiry:t,isGlobalBanned:n,isUserDeleted:r}=e.metadata;n&&(pr.abort(),gr(hr.UserGlobalBanned)),r&&(pr.abort(),gr(hr.UserDeleted)),t&&Date.now()>=Date.parse(t)&&(pr.abort(hr.UserDeleted),gr(hr.TokenExpired))}return e})),n.interceptors.response.use((e=>{const t=new Headers;return Object.entries(e.headers).forEach((([e,n])=>{"string"==typeof n&&t.append(e,n)})),fr().setNetworkActivities(new Request(e.request.url,{method:e.request.method,headers:e.request.headers,body:e.request.data}),{data:e.data,status:e.status,statusText:e.statusText,headers:t}),e}),(e=>{var t,n;const{response:r}=e;if(400100===(null==r?void 0:r.data.code)&&Ze("tokenTerminated","terminated"),(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.status)&&(e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new me(e.code);if("error"===e.status)throw new ge(e.message,e.code,"error")})(null==r?void 0:r.data),pr.signal.aborted)throw e;throw new Error(null!==(n=null==r?void 0:r.data)&&void 0!==n?n:e)})),n.defaults.paramsSerializer={encode:e=>encodeURIComponent(e)},n};var yr={exports:{}},vr=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,br=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],wr=function(e){var t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));for(var s=vr.exec(e||""),i={},a=14;a--;)i[br[a]]=s[a]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},Cr={exports:{}},Sr={exports:{}},Er=1e3,Tr=6e4,Ir=60*Tr,kr=24*Ir,Ar=365.25*kr,_r=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Ar;case"days":case"day":case"d":return n*kr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ir;case"minutes":case"minute":case"mins":case"min":case"m":return n*Tr;case"seconds":case"second":case"secs":case"sec":case"s":return n*Er;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return Rr(e,kr,"day")||Rr(e,Ir,"hour")||Rr(e,Tr,"minute")||Rr(e,Er,"second")||e+" ms"}(e):function(e){if(e>=kr)return Math.round(e/kr)+"d";if(e>=Ir)return Math.round(e/Ir)+"h";if(e>=Tr)return Math.round(e/Tr)+"m";if(e>=Er)return Math.round(e/Er)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Rr(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function s(){if(s.enabled){var e=s,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var l=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;l++;var s=t.formatters[r];if("function"==typeof s){var i=a[l];n=s.call(e,i),a.splice(l,1),l--}return n})),t.formatArgs.call(e,a);var c=s.log||t.log||console.log.bind(console);c.apply(e,a)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),s.destroy=r,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=_r,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Sr,Sr.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Sr.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Cr,Cr.exports);var Or=wr,Lr=Cr.exports("socket.io-client:url"),Dr=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Lr("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Lr("parse %s",e),n=Or(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n};var xr={},Pr={exports:{}},Mr={exports:{}},Fr=1e3,Ur=6e4,Nr=60*Ur,Br=24*Nr,jr=365.25*Br,$r=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*jr;case"days":case"day":case"d":return n*Br;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Nr;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ur;case"seconds":case"second":case"secs":case"sec":case"s":return n*Fr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return qr(e,Br,"day")||qr(e,Nr,"hour")||qr(e,Ur,"minute")||qr(e,Fr,"second")||e+" ms"}(e):function(e){if(e>=Br)return Math.round(e/Br)+"d";if(e>=Nr)return Math.round(e/Nr)+"h";if(e>=Ur)return Math.round(e/Ur)+"m";if(e>=Fr)return Math.round(e/Fr)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function qr(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function s(){if(s.enabled){var e=s,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var l=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;l++;var s=t.formatters[r];if("function"==typeof s){var i=a[l];n=s.call(e,i),a.splice(l,1),l--}return n})),t.formatArgs.call(e,a);var c=s.log||t.log||console.log.bind(console);c.apply(e,a)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),s.destroy=r,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=$r,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Mr,Mr.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Mr.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Pr,Pr.exports);var Kr={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Kr);var Gr={},Hr={}.toString,Vr=Array.isArray||function(e){return"[object Array]"==Hr.call(e)},zr=function(e){return Wr&&Buffer.isBuffer(e)||Yr&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},Wr="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,Yr="function"==typeof ArrayBuffer;var Qr=Vr,Xr=zr,Jr=Object.prototype.toString,Zr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Jr.call(Blob),es="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Jr.call(File);function ts(e,t){if(!e)return e;if(Xr(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(Qr(e)){for(var r=new Array(e.length),s=0;s<e.length;s++)r[s]=ts(e[s],t);return r}if("object"==typeof e&&!(e instanceof Date)){r={};for(var i in e)r[i]=ts(e[i],t);return r}return e}function ns(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(Qr(e))for(var n=0;n<e.length;n++)e[n]=ns(e[n],t);else if("object"==typeof e)for(var r in e)e[r]=ns(e[r],t);return e}Gr.deconstructPacket=function(e){var t=[],n=e.data,r=e;return r.data=ts(n,t),r.attachments=t.length,{packet:r,buffers:t}},Gr.reconstructPacket=function(e,t){return e.data=ns(e.data,t),e.attachments=void 0,e},Gr.removeBlobs=function(e,t){var n=0,r=e;!function e(s,i,a){if(!s)return s;if(Zr&&s instanceof Blob||es&&s instanceof File){n++;var o=new FileReader;o.onload=function(){a?a[i]=this.result:r=this.result,--n||t(r)},o.readAsArrayBuffer(s)}else if(Qr(s))for(var l=0;l<s.length;l++)e(s[l],l,s);else if("object"==typeof s&&!Xr(s))for(var c in s)e(s[c],c,s)}(r),n||t(r)},function(e){var t=Pr.exports("socket.io-parser"),n=Kr.exports,r=Gr,s=Vr,i=zr;function a(){}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=a,e.Decoder=c;var o=e.ERROR+'"encode error"';function l(n){var r=""+n.type;if(e.BINARY_EVENT!==n.type&&e.BINARY_ACK!==n.type||(r+=n.attachments+"-"),n.nsp&&"/"!==n.nsp&&(r+=n.nsp+","),null!=n.id&&(r+=n.id),null!=n.data){var s=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(n.data);if(!1===s)return o;r+=s}return t("encoded %j as %s",n,r),r}function c(){this.reconstructor=null}function d(e){this.reconPack=e,this.buffers=[]}function u(t){return{type:e.ERROR,data:"parser error: "+t}}a.prototype.encode=function(n,s){(t("encoding packet %j",n),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type)?function(e,t){function n(e){var n=r.deconstructPacket(e),s=l(n.packet),i=n.buffers;i.unshift(s),t(i)}r.removeBlobs(e,n)}(n,s):s([l(n)])},n(c.prototype),c.prototype.add=function(n){var r;if("string"==typeof n)r=function(n){var r=0,i={type:Number(n.charAt(0))};if(null==e.types[i.type])return u("unknown packet type "+i.type);if(e.BINARY_EVENT===i.type||e.BINARY_ACK===i.type){for(var a=r+1;"-"!==n.charAt(++r)&&r!=n.length;);var o=n.substring(a,r);if(o!=Number(o)||"-"!==n.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(o)}if("/"===n.charAt(r+1)){for(a=r+1;++r;){if(","===(c=n.charAt(r)))break;if(r===n.length)break}i.nsp=n.substring(a,r)}else i.nsp="/";var l=n.charAt(r+1);if(""!==l&&Number(l)==l){for(a=r+1;++r;){var c;if(null==(c=n.charAt(r))||Number(c)!=c){--r;break}if(r===n.length)break}i.id=Number(n.substring(a,r+1))}if(n.charAt(++r)){var d=function(e){try{return JSON.parse(e)}catch(e){return!1}}(n.substr(r));if(!(!1!==d&&(i.type===e.ERROR||s(d))))return u("invalid payload");i.data=d}return t("decoded %s as %j",n,i),i}(n),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new d(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!i(n)&&!n.base64)throw new Error("Unknown type: "+n);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(n))&&(this.reconstructor=null,this.emit("decoded",r))}},c.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=r.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}(xr);var rs={exports:{}},ss={},is={exports:{}};try{is.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){is.exports=!1}var as,os,ls,cs,ds=is.exports,us=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ds))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},hs={exports:{}},fs={},ps=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t};function gs(){if(cs)return ls;cs=1;var e=function(){if(os)return as;os=1;var e={}.toString;return as=Array.isArray||function(t){return"[object Array]"==e.call(t)}}(),t=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===t.call(Blob),r="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===t.call(File);return ls=function t(s){if(!s||"object"!=typeof s)return!1;if(e(s)){for(var i=0,a=s.length;i<a;i++)if(t(s[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(s)||"function"==typeof ArrayBuffer&&s instanceof ArrayBuffer||n&&s instanceof Blob||r&&s instanceof File)return!0;if(s.toJSON&&"function"==typeof s.toJSON&&1===arguments.length)return t(s.toJSON(),!0);for(var o in s)if(Object.prototype.hasOwnProperty.call(s,o)&&t(s[o]))return!0;return!1},ls}var ms=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var s=new Uint8Array(e),i=new Uint8Array(n-t),a=t,o=0;a<n;a++,o++)i[o]=s[a];return i.buffer},ys=function(e,t,n){var r=!1;return n=n||vs,s.count=e,0===e?t():s;function s(e,i){if(s.count<=0)throw new Error("after called too many times");--s.count,e?(r=!0,t(e),t=n):0!==s.count||r||t(null,i)}};function vs(){}
2
2
  /*! https://mths.be/utf8js v2.1.2 by @mathias */var bs,ws,Cs,Ss=String.fromCharCode;function Es(e){for(var t,n,r=[],s=0,i=e.length;s<i;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<i?56320==(64512&(n=e.charCodeAt(s++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),s--):r.push(t);return r}function Ts(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Is(e,t){return Ss(e>>t&63|128)}function ks(e,t){if(0==(4294967168&e))return Ss(e);var n="";return 0==(4294965248&e)?n=Ss(e>>6&31|192):0==(4294901760&e)?(Ts(e,t)||(e=65533),n=Ss(e>>12&15|224),n+=Is(e,6)):0==(4292870144&e)&&(n=Ss(e>>18&7|240),n+=Is(e,12),n+=Is(e,6)),n+=Ss(63&e|128)}function As(){if(Cs>=ws)throw Error("Invalid byte index");var e=255&bs[Cs];if(Cs++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function _s(e){var t,n;if(Cs>ws)throw Error("Invalid byte index");if(Cs==ws)return!1;if(t=255&bs[Cs],Cs++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|As())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|As()<<6|As())>=2048)return Ts(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|As()<<12|As()<<6|As())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Rs,Os,Ls,Ds={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=Es(e),s=r.length,i=-1,a="";++i<s;)a+=ks(r[i],n);return a},decode:function(e,t){var n=!1!==(t=t||{}).strict;bs=Es(e),ws=bs.length,Cs=0;for(var r,s=[];!1!==(r=_s(n));)s.push(r);return function(e){for(var t,n=e.length,r=-1,s="";++r<n;)(t=e[r])>65535&&(s+=Ss((t-=65536)>>>10&1023|55296),t=56320|1023&t),s+=Ss(t);return s}(s)}},xs={};function Ps(){if(Ls)return Os;Ls=1;var e=void 0!==e?e:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,t=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),n=t&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),r=e&&e.prototype.append&&e.prototype.getBlob;function s(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function i(t,n){n=n||{};var r=new e;return s(t).forEach((function(e){r.append(e)})),n.type?r.getBlob(n.type):r.getBlob()}function a(e,t){return new Blob(s(e),t||{})}return"undefined"!=typeof Blob&&(i.prototype=Blob.prototype,a.prototype=Blob.prototype),Os=t?n?Blob:a:r?i:void 0}!function(e){var t,n=ps,r=gs(),s=ms,i=ys,a=Ds;"undefined"!=typeof ArrayBuffer&&(Rs||(Rs=1,function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256),n=0;n<e.length;n++)t[e.charCodeAt(n)]=n;xs.encode=function(t){var n,r=new Uint8Array(t),s=r.length,i="";for(n=0;n<s;n+=3)i+=e[r[n]>>2],i+=e[(3&r[n])<<4|r[n+1]>>4],i+=e[(15&r[n+1])<<2|r[n+2]>>6],i+=e[63&r[n+2]];return s%3==2?i=i.substring(0,i.length-1)+"=":s%3==1&&(i=i.substring(0,i.length-2)+"=="),i},xs.decode=function(e){var n,r,s,i,a,o=.75*e.length,l=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var d=new ArrayBuffer(o),u=new Uint8Array(d);for(n=0;n<l;n+=4)r=t[e.charCodeAt(n)],s=t[e.charCodeAt(n+1)],i=t[e.charCodeAt(n+2)],a=t[e.charCodeAt(n+3)],u[c++]=r<<2|s>>4,u[c++]=(15&s)<<4|i>>2,u[c++]=(3&i)<<6|63&a;return d}}()),t=xs);var o="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),l="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),c=o||l;e.protocol=3;var d=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},u=n(d),h={type:"error",data:"parser error"},f=Ps();function p(e,t,n){for(var r=new Array(e.length),s=i(e.length,n),a=function(e,n,s){t(n,(function(t,n){r[e]=n,s(t,r)}))},o=0;o<e.length;o++)a(o,e[o],s)}e.encodePacket=function(t,n,r,s){"function"==typeof n&&(s=n,n=!1),"function"==typeof r&&(s=r,r=null);var 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 s=t.data,i=new Uint8Array(s),a=new Uint8Array(1+s.byteLength);a[0]=d[t.type];for(var o=0;o<i.length;o++)a[o+1]=i[o];return r(a.buffer)}(t,n,s);if(void 0!==f&&i instanceof f)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(c)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var s=new FileReader;return s.onload=function(){e.encodePacket({type:t.type,data:s.result},n,!0,r)},s.readAsArrayBuffer(t.data)}(t,n,r);var s=new Uint8Array(1);s[0]=d[t.type];var i=new f([s.buffer,t.data]);return r(i)}(t,n,s);if(i&&i.base64)return function(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}(t,s);var o=d[t.type];return void 0!==t.data&&(o+=r?a.encode(String(t.data),{strict:!1}):String(t.data)),s(""+o)},e.encodeBase64Packet=function(t,n){var r,s="b"+e.packets[t.type];if(void 0!==f&&t.data instanceof f){var i=new FileReader;return i.onload=function(){var e=i.result.split(",")[1];n(s+e)},i.readAsDataURL(t.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var a=new Uint8Array(t.data),o=new Array(a.length),l=0;l<a.length;l++)o[l]=a[l];r=String.fromCharCode.apply(null,o)}return s+=btoa(r),n(s)},e.decodePacket=function(t,n,r){if(void 0===t)return h;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r&&!1===(t=function(e){try{e=a.decode(e,{strict:!1})}catch(e){return!1}return e}(t)))return h;var i=t.charAt(0);return Number(i)==i&&u[i]?t.length>1?{type:u[i],data:t.substring(1)}:{type:u[i]}:h}i=new Uint8Array(t)[0];var o=s(t,1);return f&&"blob"===n&&(o=new f([o])),{type:u[i],data:o}},e.decodeBase64Packet=function(e,n){var r=u[e.charAt(0)];if(!t)return{type:r,data:{base64:!0,data:e.substr(1)}};var s=t.decode(e.substr(1));return"blob"===n&&f&&(s=new f([s])),{type:r,data:s}},e.encodePayload=function(t,n,s){"function"==typeof n&&(s=n,n=null);var i=r(t);if(n&&i)return f&&!c?e.encodePayloadAsBlob(t,s):e.encodePayloadAsArrayBuffer(t,s);if(!t.length)return s("0:");p(t,(function(t,r){e.encodePacket(t,!!i&&n,!1,(function(e){r(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return s(t.join(""))}))},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);var s;if("function"==typeof n&&(r=n,n=null),""===t)return r(h,0,1);for(var i,a,o="",l=0,c=t.length;l<c;l++){var d=t.charAt(l);if(":"===d){if(""===o||o!=(i=Number(o)))return r(h,0,1);if(o!=(a=t.substr(l+1,i)).length)return r(h,0,1);if(a.length){if(s=e.decodePacket(a,n,!1),h.type===s.type&&h.data===s.data)return r(h,0,1);if(!1===r(s,l+i,c))return}l+=i,o=""}else o+=d}return""!==o?r(h,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){if(!t.length)return n(new ArrayBuffer(0));p(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){return n(null,e)}))}),(function(e,t){var r=t.reduce((function(e,t){var n;return e+(n="string"==typeof t?t.length:t.byteLength).toString().length+n+2}),0),s=new Uint8Array(r),i=0;return t.forEach((function(e){var t="string"==typeof e,n=e;if(t){for(var r=new Uint8Array(e.length),a=0;a<e.length;a++)r[a]=e.charCodeAt(a);n=r.buffer}s[i++]=t?0:1;var o=n.byteLength.toString();for(a=0;a<o.length;a++)s[i++]=parseInt(o[a]);s[i++]=255;for(r=new Uint8Array(n),a=0;a<r.length;a++)s[i++]=r[a]})),n(s.buffer)}))},e.encodePayloadAsBlob=function(t,n){p(t,(function(t,n){e.encodePacket(t,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var r=new Uint8Array(e.length),s=0;s<e.length;s++)r[s]=e.charCodeAt(s);e=r.buffer,t[0]=0}var i=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),a=new Uint8Array(i.length+1);for(s=0;s<i.length;s++)a[s]=parseInt(i[s]);if(a[i.length]=255,f){var o=new f([t.buffer,a.buffer,e]);n(null,o)}}))}),(function(e,t){return n(new f(t))}))},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var i=t,a=[];i.byteLength>0;){for(var o=new Uint8Array(i),l=0===o[0],c="",d=1;255!==o[d];d++){if(c.length>310)return r(h,0,1);c+=o[d]}i=s(i,2+c.length),c=parseInt(c);var u=s(i,0,c);if(l)try{u=String.fromCharCode.apply(null,new Uint8Array(u))}catch(e){var f=new Uint8Array(u);u="";for(d=0;d<f.length;d++)u+=String.fromCharCode(f[d])}a.push(u),i=s(i,c)}var p=a.length;a.forEach((function(t,s){r(e.decodePacket(t,n,!0),s,p)}))}}(fs);var Ms,Fs,Us={exports:{}};function Ns(){if(Fs)return Ms;Fs=1;var e=fs;function t(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}return Ms=t,(0,Us.exports)(t.prototype),t.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},t.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},t.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},t.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},t.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},t.prototype.onData=function(t){var n=e.decodePacket(t,this.socket.binaryType);this.onPacket(n)},t.prototype.onPacket=function(e){this.emit("packet",e)},t.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Ms}!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Us);var Bs,js={};function $s(){return Bs||(Bs=1,js.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},js.decode=function(e){for(var t={},n=e.split("&"),r=0,s=n.length;r<s;r++){var i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}),js}var qs,Ks=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Gs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Hs={},Vs=0,zs=0;function Ws(e){var t="";do{t=Gs[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function Ys(){var e=Ws(+new Date);return e!==qs?(Vs=0,qs=e):e+"."+Ws(Vs++)}for(;zs<64;zs++)Hs[Gs[zs]]=zs;Ys.encode=Ws,Ys.decode=function(e){var t=0;for(zs=0;zs<e.length;zs++)t=64*t+Hs[e.charAt(zs)];return t};var Qs=Ys,Xs={exports:{}},Js={exports:{}},Zs=1e3,ei=60*Zs,ti=60*ei,ni=24*ti,ri=365.25*ni,si=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*ri;case"days":case"day":case"d":return n*ni;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ti;case"minutes":case"minute":case"mins":case"min":case"m":return n*ei;case"seconds":case"second":case"secs":case"sec":case"s":return n*Zs;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){return ii(e,ni,"day")||ii(e,ti,"hour")||ii(e,ei,"minute")||ii(e,Zs,"second")||e+" ms"}(e):function(e){if(e>=ni)return Math.round(e/ni)+"d";if(e>=ti)return Math.round(e/ti)+"h";if(e>=ei)return Math.round(e/ei)+"m";if(e>=Zs)return Math.round(e/Zs)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ii(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}!function(e,t){function n(e){var n;function s(){if(s.enabled){var e=s,r=+new Date,i=r-(n||r);e.diff=i,e.prev=n,e.curr=r,n=r;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var l=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;l++;var s=t.formatters[r];if("function"==typeof s){var i=a[l];n=s.call(e,i),a.splice(l,1),l--}return n})),t.formatArgs.call(e,a);var c=s.log||t.log||console.log.bind(console);c.apply(e,a)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),s.destroy=r,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var i=t.instances[n];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=si,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Js,Js.exports),function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Js.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())}(Xs,Xs.exports);var ai=Ns(),oi=$s(),li=fs,ci=Ks,di=Qs,ui=Xs.exports("engine.io-client:polling"),hi=pi,fi=null!=new us({xdomain:!1}).responseType;function pi(e){var t=e&&e.forceBase64;fi&&!t||(this.supportsBinary=!1),ai.call(this,e)}ci(pi,ai),pi.prototype.name="polling",pi.prototype.doOpen=function(){this.poll()},pi.prototype.pause=function(e){var t=this;function n(){ui("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(ui("we are currently polling - waiting to pause"),r++,this.once("pollComplete",(function(){ui("pre-pause polling complete"),--r||n()}))),this.writable||(ui("we are currently writing - waiting to pause"),r++,this.once("drain",(function(){ui("pre-pause writing complete"),--r||n()})))}else n()},pi.prototype.poll=function(){ui("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},pi.prototype.onData=function(e){var t=this;ui("polling got data %s",e);li.decodePayload(e,this.socket.binaryType,(function(e,n,r){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():ui('ignoring poll - transport state "%s"',this.readyState))},pi.prototype.doClose=function(){var e=this;function t(){ui("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(ui("transport open - closing"),t()):(ui("transport not open - deferring close"),this.once("open",t))},pi.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};li.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},pi.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=di()),this.supportsBinary||e.sid||(e.b64=1),e=oi.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e};var gi=us,mi=hi,yi=Us.exports,vi=Ks,bi=Xs.exports("engine.io-client:polling-xhr");function wi(){}function Ci(e){if(mi.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,n=location.port;n||(n=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}}function Si(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(hs.exports=Ci,hs.exports.Request=Si,vi(Ci,mi),Ci.prototype.supportsBinary=!0,Ci.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new Si(e)},Ci.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),s=this;r.on("success",t),r.on("error",(function(e){s.onError("xhr post error",e)})),this.sendXhr=r},Ci.prototype.doPoll=function(){bi("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},yi(Si.prototype),Si.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new gi(e),n=this;try{bi("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var r in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.extraHeaders[r])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){n.onLoad()},t.onerror=function(){n.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");n.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?n.onLoad():setTimeout((function(){n.onError(t.status)}),0))},bi("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){n.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Si.requestsCount++,Si.requests[this.index]=this)},Si.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Si.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},Si.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},Si.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=wi:this.xhr.onreadystatechange=wi,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Si.requests[this.index],this.xhr=null}},Si.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},Si.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},Si.prototype.abort=function(){this.cleanup()},Si.requestsCount=0,Si.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Ti);else if("function"==typeof addEventListener){var Ei="onpagehide"in self?"pagehide":"unload";addEventListener(Ei,Ti,!1)}function Ti(){for(var e in Si.requests)Si.requests.hasOwnProperty(e)&&Si.requests[e].abort()}var Ii,ki=hi,Ai=Di,_i=/\n/g,Ri=/\\n/g;function Oi(){}function Li(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==pt?pt:{}}function Di(e){if(ki.call(this,e),this.query=this.query||{},!Ii){var t=Li();Ii=t.___eio=t.___eio||[]}this.index=Ii.length;var n=this;Ii.push((function(e){n.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){n.script&&(n.script.onerror=Oi)}),!1)}Ks(Di,ki),Di.prototype.supportsBinary=!1,Di.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),ki.prototype.doClose.call(this)},Di.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},Di.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r,s=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=a,s.method="POST",s.setAttribute("accept-charset","utf-8"),i.name="d",s.appendChild(i),document.body.appendChild(s),this.form=s,this.area=i}function o(){l(),t()}function l(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';r=document.createElement(e)}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(),e=e.replace(Ri,"\\\n"),this.area.value=e.replace(_i,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&o()}:this.iframe.onload=o};var xi,Pi,Mi=mt(Object.freeze({__proto__:null,default:{}})),Fi=Ns(),Ui=fs,Ni=$s(),Bi=Ks,ji=Qs,$i=Xs.exports("engine.io-client:websocket");if("undefined"!=typeof WebSocket)xi=WebSocket;else if("undefined"!=typeof self)xi=self.WebSocket||self.MozWebSocket;else try{Pi=Mi}catch(e){}var qi=xi||Pi,Ki=Gi;function Gi(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=xi&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(qi=Pi),Fi.call(this,e)}Bi(Gi,Fi),Gi.prototype.name="websocket",Gi.prototype.supportsBinary=!0,Gi.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=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?t?new qi(e,t):new qi(e):new qi(e,t,n)}catch(e){return this.emit("error",e)}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()}},Gi.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Gi.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,r=0,s=n;r<s;r++)!function(e){Ui.encodePacket(e,t.supportsBinary,(function(r){if(!t.usingBrowserWebSocket){var s={};if(e.options&&(s.compress=e.options.compress),t.perMessageDeflate)("string"==typeof r?Buffer.byteLength(r):r.length)<t.perMessageDeflate.threshold&&(s.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(r):t.ws.send(r,s)}catch(e){$i("websocket closed before onclose event")}--n||i()}))}(e[r]);function i(){t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0)}},Gi.prototype.onClose=function(){Fi.prototype.onClose.call(this)},Gi.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},Gi.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=ji()),this.supportsBinary||(e.b64=1),(e=Ni.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},Gi.prototype.check=function(){return!(!qi||"__initialize"in qi&&this.name===Gi.prototype.name)};var Hi=us,Vi=hs.exports,zi=Ai,Wi=Ki;ss.polling=function(e){var t=!1,n=!1,r=!1!==e.jsonp;if("undefined"!=typeof location){var s="https:"===location.protocol,i=location.port;i||(i=s?443:80),t=e.hostname!==location.hostname||i!==e.port,n=e.secure!==s}if(e.xdomain=t,e.xscheme=n,"open"in new Hi(e)&&!e.forceJSONP)return new Vi(e);if(!r)throw new Error("JSONP disabled");return new zi(e)},ss.websocket=Wi;var Yi,Qi=[].indexOf,Xi=function(e,t){if(Qi)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},Ji=ss,Zi=Us.exports,ea=Xs.exports("engine.io-client:socket"),ta=Xi,na=fs,ra=wr,sa=$s(),ia=aa;function aa(e,t){if(!(this instanceof aa))return new aa(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=ra(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ra(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=sa.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}aa.priorWebsocketSuccess=!1,Zi(aa.prototype),aa.protocol=na.protocol,aa.Socket=aa,aa.Transport=Ns(),aa.transports=ss,aa.parser=fs,aa.prototype.createTransport=function(e){ea('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=na.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new Ji[e]({query:t,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,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})},aa.prototype.open=function(){var e;if(this.rememberUpgrade&&aa.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},aa.prototype.setTransport=function(e){ea("setting transport %s",e.name);var t=this;this.transport&&(ea("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},aa.prototype.probe=function(e){ea('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function s(){if(r.onlyBinaryUpgrades){var s=!this.supportsBinary&&r.transport.supportsBinary;n=n||s}n||(ea('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(s){if(!n)if("pong"===s.type&&"probe"===s.data){if(ea('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;aa.priorWebsocketSuccess="websocket"===t.name,ea('pausing current transport "%s"',r.transport.name),r.transport.pause((function(){n||"closed"!==r.readyState&&(ea("changing transport and sending upgrade packet"),d(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())}))}else{ea('probe transport "%s" failed',e);var i=new Error("probe error");i.transport=t.name,r.emit("upgradeError",i)}})))}function i(){n||(n=!0,d(),t.close(),t=null)}function a(n){var s=new Error("probe error: "+n);s.transport=t.name,i(),ea('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",s)}function o(){a("transport closed")}function l(){a("socket closed")}function c(e){t&&e.name!==t.name&&(ea('"%s" works - aborting "%s"',e.name,t.name),i())}function d(){t.removeListener("open",s),t.removeListener("error",a),t.removeListener("close",o),r.removeListener("close",l),r.removeListener("upgrading",c)}aa.priorWebsocketSuccess=!1,t.once("open",s),t.once("error",a),t.once("close",o),this.once("close",l),this.once("upgrading",c),t.open()},aa.prototype.onOpen=function(){if(ea("socket open"),this.readyState="open",aa.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){ea("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},aa.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(ea('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else ea('packet received with socket readyState "%s"',this.readyState)},aa.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},aa.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},aa.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){ea("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},aa.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},aa.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},aa.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(ea("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},aa.prototype.write=aa.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},aa.prototype.sendPacket=function(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var s={type:e,data:t,options:n};this.emit("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}},aa.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():t()})):this.upgrading?r():t()}function t(){e.onClose("forced close"),ea("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function r(){e.once("upgrade",n),e.once("upgradeError",n)}return this},aa.prototype.onError=function(e){ea("socket error %j",e),aa.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},aa.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){ea('socket close with reason: "%s"',e);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",e,t),this.writeBuffer=[],this.prevBufferLen=0}},aa.prototype.filterUpgrades=function(e){for(var t=[],n=0,r=e.length;n<r;n++)~ta(this.transports,e[n])&&t.push(e[n]);return t},(Yi=rs).exports=ia,Yi.exports.parser=fs;var oa,la,ca={exports:{}},da={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var r=0,s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(da);var ua=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}};var ha,fa=[].slice,pa=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var n=fa.call(arguments,2);return function(){return t.apply(e,n.concat(fa.call(arguments)))}};function ga(){return ha||(ha=1,function(e,t){var n=xr,r=da.exports,s=(la||(la=1,oa=function(e,t){for(var n=[],r=(t=t||0)||0;r<e.length;r++)n[r-t]=e[r];return n}),oa),i=ua,a=pa,o=Cr.exports("socket.io-client:socket"),l=$s(),c=gs();e.exports=h;var d={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},u=r.prototype.emit;function h(e,t,n){this.io=e,this.nsp=t,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()}r(h.prototype),h.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[i(e,"open",a(this,"onopen")),i(e,"packet",a(this,"onpacket")),i(e,"close",a(this,"onclose"))]}},h.prototype.open=h.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},h.prototype.send=function(){var e=s(arguments);return e.unshift("message"),this.emit.apply(this,e),this},h.prototype.emit=function(e){if(d.hasOwnProperty(e))return u.apply(this,arguments),this;var t=s(arguments),r={type:(void 0!==this.flags.binary?this.flags.binary:c(t))?n.BINARY_EVENT:n.EVENT,data:t,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(o("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this.flags={},this},h.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},h.prototype.onopen=function(){if(o("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?l.encode(this.query):this.query;o("sending connect packet with query %s",e),this.packet({type:n.CONNECT,query:e})}else this.packet({type:n.CONNECT})},h.prototype.onclose=function(e){o("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},h.prototype.onpacket=function(e){var t=e.nsp===this.nsp,r=e.type===n.ERROR&&"/"===e.nsp;if(t||r)switch(e.type){case n.CONNECT:this.onconnect();break;case n.EVENT:case n.BINARY_EVENT:this.onevent(e);break;case n.ACK:case n.BINARY_ACK:this.onack(e);break;case n.DISCONNECT:this.ondisconnect();break;case n.ERROR:this.emit("error",e.data)}},h.prototype.onevent=function(e){var t=e.data||[];o("emitting event %j",t),null!=e.id&&(o("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?u.apply(this,t):this.receiveBuffer.push(t)},h.prototype.ack=function(e){var t=this,r=!1;return function(){if(!r){r=!0;var i=s(arguments);o("sending ack %j",i),t.packet({type:c(i)?n.BINARY_ACK:n.ACK,id:e,data:i})}}},h.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(o("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):o("bad ack %s",e.id)},h.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},h.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)u.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},h.prototype.ondisconnect=function(){o("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},h.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},h.prototype.close=h.prototype.disconnect=function(){return this.connected&&(o("performing disconnect (%s)",this.nsp),this.packet({type:n.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},h.prototype.compress=function(e){return this.flags.compress=e,this},h.prototype.binary=function(e){return this.flags.binary=e,this}}(ca)),ca.exports}var ma=ya;function ya(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ya.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},ya.prototype.reset=function(){this.attempts=0},ya.prototype.setMin=function(e){this.ms=e},ya.prototype.setMax=function(e){this.max=e},ya.prototype.setJitter=function(e){this.jitter=e};var va=rs.exports,ba=ga(),wa=da.exports,Ca=xr,Sa=ua,Ea=pa,Ta=Cr.exports("socket.io-client:manager"),Ia=Xi,ka=ma,Aa=Object.prototype.hasOwnProperty,_a=Ra;function Ra(e,t){if(!(this instanceof Ra))return new Ra(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new ka({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||Ca;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Ra.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)Aa.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Ra.prototype.updateSocketIds=function(){for(var e in this.nsps)Aa.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Ra.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},wa(Ra.prototype),Ra.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Ra.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Ra.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Ra.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Ra.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Ra.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Ra.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Ra.prototype.open=Ra.prototype.connect=function(e,t){if(Ta("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Ta("opening %s",this.uri),this.engine=va(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var s=Sa(n,"open",(function(){r.onopen(),e&&e()})),i=Sa(n,"error",(function(t){if(Ta("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else r.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout;Ta("connect attempt will timeout after %d",a);var o=setTimeout((function(){Ta("connect attempt timed out after %d",a),s.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(o)}})}return this.subs.push(s),this.subs.push(i),this},Ra.prototype.onopen=function(){Ta("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Sa(e,"data",Ea(this,"ondata"))),this.subs.push(Sa(e,"ping",Ea(this,"onping"))),this.subs.push(Sa(e,"pong",Ea(this,"onpong"))),this.subs.push(Sa(e,"error",Ea(this,"onerror"))),this.subs.push(Sa(e,"close",Ea(this,"onclose"))),this.subs.push(Sa(this.decoder,"decoded",Ea(this,"ondecoded")))},Ra.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Ra.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Ra.prototype.ondata=function(e){this.decoder.add(e)},Ra.prototype.ondecoded=function(e){this.emit("packet",e)},Ra.prototype.onerror=function(e){Ta("error",e),this.emitAll("error",e)},Ra.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new ba(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",s),n.on("connect",(function(){n.id=r.generateId(e)})),this.autoConnect&&s()}function s(){~Ia(r.connecting,n)||r.connecting.push(n)}return n},Ra.prototype.destroy=function(e){var t=Ia(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Ra.prototype.packet=function(e){Ta("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var r=0;r<n.length;r++)t.engine.write(n[r],e.options);t.encoding=!1,t.processPacketQueue()})))},Ra.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Ra.prototype.cleanup=function(){Ta("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},Ra.prototype.close=Ra.prototype.disconnect=function(){Ta("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},Ra.prototype.onclose=function(e){Ta("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},Ra.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)Ta("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();Ta("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout((function(){e.skipReconnect||(Ta("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(Ta("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(Ta("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Ra.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=Dr,r=xr,s=_a,i=Cr.exports("socket.io-client");e.exports=t=o;var a=t.managers={};function o(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o=n(e),l=o.source,c=o.id,d=o.path,u=a[c]&&d in a[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||u?(i("ignoring socket cache for %s",l),r=s(l,t)):(a[c]||(i("new io instance for %s",l),a[c]=s(l,t)),r=a[c]),o.query&&!t.query&&(t.query=o.query),r.socket(o.path,t)}t.protocol=r.protocol,t.connect=o,t.Manager=_a,t.Socket=ga()}(yr,yr.exports);var Oa=yr.exports;function La(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Da={exports:{}};!function(e,t){e.exports=function(){function e(t,n,r){function s(a,o){if(!n[a]){if(!t[a]){if(!o&&La)return La(a);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,(function(e){return s(t[a][1][e]||e)}),c,c.exports,e,t,n,r)}return n[a].exports}for(var i=La,a=0;a<r.length;a++)s(r[a]);return s}return e}()({1:[function(e,t,n){(function(n,r){(function(){const s=e("events").EventEmitter,i=e("./store"),a=e("./topic-alias-recv"),o=e("./topic-alias-send"),l=e("mqtt-packet"),c=e("./default-message-id-provider"),d=e("readable-stream").Writable,u=e("inherits"),h=e("reinterval"),f=e("rfdc/default"),p=e("./validations"),g=e("xtend"),m=e("debug")("mqttjs:client"),y=n?n.nextTick:function(e){setTimeout(e,0)},v=r.setImmediate||function(e){y(e)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],C={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function S(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function E(e,t){if(5===e.options.protocolVersion&&"publish"===t.cmd){let n;t.properties&&(n=t.properties.topicAlias);const r=t.topic.toString();if(e.topicAliasSend)if(n){if(0!==r.length&&(m("applyTopicAlias :: register topic: %s - alias: %d",r,n),!e.topicAliasSend.put(r,n)))return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",r,n),new Error("Sending Topic Alias out of range")}else 0!==r.length&&(e.options.autoAssignTopicAlias?(n=e.topicAliasSend.getAliasByTopic(r),n?(t.topic="",t.properties={...t.properties,topicAlias:n},m("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",r,n)):(n=e.topicAliasSend.getLruAlias(),e.topicAliasSend.put(r,n),t.properties={...t.properties,topicAlias:n},m("applyTopicAlias :: auto assign topic: %s - alias: %d",r,n))):e.options.autoUseTopicAlias&&(n=e.topicAliasSend.getAliasByTopic(r),n&&(t.topic="",t.properties={...t.properties,topicAlias:n},m("applyTopicAlias :: auto use topic: %s - alias: %d",r,n))));else if(n)return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",r,n),new Error("Sending Topic Alias out of range")}}function T(e,t){let n;t.properties&&(n=t.properties.topicAlias);let r=t.topic.toString();if(0===r.length){if(void 0===n)return new Error("Unregistered Topic Alias");if(r=e.topicAliasSend.getTopicByAlias(n),void 0===r)return new Error("Unregistered Topic Alias");t.topic=r}n&&delete t.properties.topicAlias}function I(e,t,n){m("sendPacket :: packet: %O",t),m("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),m("sendPacket :: writing to stream");const r=l.writeToStream(t,e.stream,e.options);m("sendPacket :: writeToStream result %s",r),!r&&n&&n!==R?(m("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",n)):n&&(m("sendPacket :: invoking cb"),n())}function k(e){e&&(m("flush: queue exists? %b",!!e),Object.keys(e).forEach((function(t){"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})))}function A(e){e&&(m("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(e).forEach((function(t){e[t].volatile&&"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})))}function _(e,t,n,r){m("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd);let s,i=t;if("publish"===i.cmd&&(i=f(t),s=T(e,i),s))return n&&n(s);e.outgoingStore.put(i,(function(s){if(s)return n&&n(s);r(),I(e,t,n)}))}function R(e){m("nop ::",e)}function O(e,t){let n;const r=this;if(!(this instanceof O))return new O(e,t);for(n in this.options=t||{},b)void 0===this.options[n]?this.options[n]=b[n]:this.options[n]=t[n];m("MqttClient :: options.protocol",t.protocol),m("MqttClient :: options.protocolVersion",t.protocolVersion),m("MqttClient :: options.username",t.username),m("MqttClient :: options.keepalive",t.keepalive),m("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),m("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),m("MqttClient :: options.topicAliasMaximum",t.topicAliasMaximum),this.options.clientId="string"==typeof t.clientId?t.clientId:S(),m("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.messageIdProvider=void 0===this.options.messageIdProvider?new c:this.options.messageIdProvider,this.outgoingStore=t.outgoingStore||new i,this.incomingStore=t.incomingStore||new i,this.queueQoSZero=void 0===t.queueQoSZero||t.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,t.topicAliasMaximum>0&&(t.topicAliasMaximum>65535?m("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new a(t.topicAliasMaximum)),this.on("connect",(function(){const e=this.queue;function t(){const n=e.shift();m("deliver :: entry %o",n);let s=null;if(!n)return void r._resubscribe();s=n.packet,m("deliver :: call _sendPacket for %o",s);let i=!0;s.messageId&&0!==s.messageId&&(r.messageIdProvider.register(s.messageId)||(i=!1)),i?r._sendPacket(s,(function(e){n.cb&&n.cb(e),t()})):(m("messageId: %d has already used. The message is skipped and removed.",s.messageId),t())}m("connect :: sending queued packets"),t()})),this.on("close",(function(){m("close :: connected set to `false`"),this.connected=!1,m("close :: clearing connackTimer"),clearTimeout(this.connackTimer),m("close :: clearing ping timer"),null!==r.pingTimer&&(r.pingTimer.clear(),r.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),m("close :: calling _setupReconnect"),this._setupReconnect()})),s.call(this),m("MqttClient :: setting up stream"),this._setupStream()}u(O,s),O.prototype._setupStream=function(){const e=this,t=new d,n=l.parser(this.options);let r=null;const s=[];function i(){if(s.length)y(a);else{const e=r;r=null,e()}}function a(){m("work :: getting next packet in queue");const t=s.shift();if(t)m("work :: packet pulled from queue"),e._handlePacket(t,i);else{m("work :: no packets in queue");const e=r;r=null,m("work :: done flag is %s",!!e),e&&e()}}function o(t){m("streamErrorHandler :: error",t.message),w.includes(t.code)?(m("streamErrorHandler :: emitting error"),e.emit("error",t)):R(t)}m("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),m("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),n.on("packet",(function(e){m("parser :: on packet push to packets array."),s.push(e)})),t._write=function(e,t,s){r=s,m("writable stream :: parsing buffer"),n.parse(e),a()},m("_setupStream :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",o),this.stream.on("close",(function(){m("(%s)stream :: on close",e.options.clientId),A(e.outgoing),m("stream: emit close to MqttClient"),e.emit("close")})),m("_setupStream: sending packet `connect`");const c=Object.create(this.options);if(c.cmd="connect",this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),I(this,c),n.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return e.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket&&I(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){m("!!connectTimeout hit!! Calling _cleanUp with force `true`"),e._cleanUp(!0)}),this.options.connectTimeout)},O.prototype._handlePacket=function(e,t){const n=this.options;if(5===n.protocolVersion&&n.properties&&n.properties.maximumPacketSize&&n.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(m("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"auth":this._handleAuth(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},O.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e&&e!==R?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},O.prototype.publish=function(e,t,n,r){m("publish :: message `%s` to topic `%s`",t,e);const s=this.options;if("function"==typeof n&&(r=n,n=null),n=g({qos:0,retain:!1,dup:!1},n),this._checkDisconnecting(r))return this;const i=this,a=function(){let a=0;if((1===n.qos||2===n.qos)&&(a=i._nextId(),null===a))return m("No messageId left"),!1;const o={cmd:"publish",topic:e,payload:t,qos:n.qos,retain:n.retain,messageId:a,dup:n.dup};switch(5===s.protocolVersion&&(o.properties=n.properties),m("publish :: qos",n.qos),n.qos){case 1:case 2:i.outgoing[o.messageId]={volatile:!1,cb:r||R},m("MqttClient:publish: packet cmd: %s",o.cmd),i._sendPacket(o,void 0,n.cbStorePut);break;default:m("MqttClient:publish: packet cmd: %s",o.cmd),i._sendPacket(o,r,n.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!a())&&this._storeProcessingQueue.push({invoke:a,cbStorePut:n.cbStorePut,callback:r}),this},O.prototype.subscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];const n=[];let r=t.shift();const s=r.resubscribe;let i=t.pop()||R,a=t.pop();const o=this.options.protocolVersion;delete r.resubscribe,"string"==typeof r&&(r=[r]),"function"!=typeof i&&(a=i,i=R);const l=p.validateTopics(r);if(null!==l)return v(i,new Error("Invalid topic "+l)),this;if(this._checkDisconnecting(i))return m("subscribe: discconecting true"),this;const c={qos:0};if(5===o&&(c.nl=!1,c.rap=!1,c.rh=0),a=g(c,a),Array.isArray(r)?r.forEach((function(t){if(m("subscribe: array topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<a.qos||s){const e={topic:t,qos:a.qos};5===o&&(e.nl=a.nl,e.rap=a.rap,e.rh=a.rh,e.properties=a.properties),m("subscribe: pushing topic `%s` and qos `%s` to subs list",e.topic,e.qos),n.push(e)}})):Object.keys(r).forEach((function(t){if(m("subscribe: object topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<r[t].qos||s){const e={topic:t,qos:r[t].qos};5===o&&(e.nl=r[t].nl,e.rap=r[t].rap,e.rh=r[t].rh,e.properties=a.properties),m("subscribe: pushing `%s` to subs list",e),n.push(e)}})),!n.length)return i(null,[]),this;const d=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const r={cmd:"subscribe",subscriptions:n,qos:1,retain:!1,dup:!1,messageId:t};if(a.properties&&(r.properties=a.properties),e.options.resubscribe){m("subscribe :: resubscribe true");const t=[];n.forEach((function(n){if(e.options.reconnectPeriod>0){const r={qos:n.qos};5===o&&(r.nl=n.nl||!1,r.rap=n.rap||!1,r.rh=n.rh||0,r.properties=n.properties),e._resubscribeTopics[n.topic]=r,t.push(n.topic)}})),e.messageIdToTopic[r.messageId]=t}return e.outgoing[r.messageId]={volatile:!0,cb:function(e,t){if(!e){const e=t.granted;for(let t=0;t<e.length;t+=1)n[t].qos=e[t]}i(e,n)}},m("subscribe :: call _sendPacket"),e._sendPacket(r),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!d())&&this._storeProcessingQueue.push({invoke:d,callback:i}),this},O.prototype.unsubscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];let n=t.shift(),r=t.pop()||R,s=t.pop();"string"==typeof n&&(n=[n]),"function"!=typeof r&&(s=r,r=R);const i=p.validateTopics(n);if(null!==i)return v(r,new Error("Invalid topic "+i)),this;if(e._checkDisconnecting(r))return this;const a=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const i={cmd:"unsubscribe",qos:1,messageId:t};return"string"==typeof n?i.unsubscriptions=[n]:Array.isArray(n)&&(i.unsubscriptions=n),e.options.resubscribe&&i.unsubscriptions.forEach((function(t){delete e._resubscribeTopics[t]})),"object"==typeof s&&s.properties&&(i.properties=s.properties),e.outgoing[i.messageId]={volatile:!0,cb:r},m("unsubscribe: call _sendPacket"),e._sendPacket(i),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!a())&&this._storeProcessingQueue.push({invoke:a,callback:r}),this},O.prototype.end=function(e,t,n){const r=this;function s(){m("end :: closeStores: closing incoming and outgoing stores"),r.disconnected=!0,r.incomingStore.close((function(e){r.outgoingStore.close((function(t){if(m("end :: closeStores: emitting end"),r.emit("end"),n){const r=e||t;m("end :: closeStores: invoking callback with args"),n(r)}}))})),r._deferredReconnect&&r._deferredReconnect()}function i(){m("end :: (%s) :: finish :: calling _cleanUp with force %s",r.options.clientId,e),r._cleanUp(e,(()=>{m("end :: finish :: calling process.nextTick on closeStores"),y(s.bind(r))}),t)}return m("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(n=t||R,t=e,e=!1,"object"!=typeof t&&(n=t,t=null,"function"!=typeof n&&(n=R))),"object"!=typeof t&&(n=t,t=null),m("end :: cb? %s",!!n),n=n||R,this.disconnecting?(n(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(m("end :: (%s) :: calling finish in 10ms once outgoing is empty",r.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(m("end :: (%s) :: immediately calling finish",r.options.clientId),i()),this)},O.prototype.removeOutgoingMessage=function(e){const t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},O.prototype.reconnect=function(e){m("client reconnect");const t=this,n=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new i,t.outgoingStore=t.options.outgoingStore||new i,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},O.prototype._reconnect=function(){m("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),m("client already connected. disconnecting first.")):(m("_reconnect: calling _setupStream"),this._setupStream())},O.prototype._setupReconnect=function(){const e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(m("_setupReconnect :: emit `offline` state"),this.emit("offline"),m("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),m("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){m("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):m("_setupReconnect :: doing nothing...")},O.prototype._clearReconnect=function(){m("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},O.prototype._cleanUp=function(e,t){const n=arguments[2];if(t&&(m("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),m("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&k(this.outgoing),m("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const e=g({cmd:"disconnect"},n);m("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,v.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(m("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(m("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(m("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},O.prototype._sendPacket=function(e,t,n){m("_sendPacket :: (%s) :: start",this.options.clientId),n=n||R,t=t||R;const r=E(this,e);if(r)t(r);else{if(!this.connected)return"auth"===e.cmd?(this._shiftPingInterval(),void I(this,e,t)):(m("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,n));switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void _(this,e,t,n);default:return void I(this,e,t)}switch(e.qos){case 2:case 1:_(this,e,t,n);break;default:I(this,e,t)}m("_sendPacket :: (%s) :: end",this.options.clientId)}},O.prototype._storePacket=function(e,t,n){m("_storePacket :: packet: %o",e),m("_storePacket :: cb? %s",!!t),n=n||R;let r=e;if("publish"===r.cmd){r=f(e);const n=T(this,r);if(n)return t&&t(n)}0===(r.qos||0)&&this.queueQoSZero||"publish"!==r.cmd?this.queue.push({packet:r,cb:t}):r.qos>0?(t=this.outgoing[r.messageId]?this.outgoing[r.messageId].cb:null,this.outgoingStore.put(r,(function(e){if(e)return t&&t(e);n()}))):t&&t(new Error("No connection to broker"))},O.prototype._setupPingTimer=function(){m("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=h((function(){e._checkPing()}),1e3*this.options.keepalive))},O.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},O.prototype._checkPing=function(){m("_checkPing :: checking ping..."),this.pingResp?(m("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(m("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},O.prototype._handlePingresp=function(){this.pingResp=!0},O.prototype._handleConnack=function(e){m("_handleConnack");const t=this.options,n=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));e.properties.topicAliasMaximum>0&&(this.topicAliasSend=new o(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(0===n)this.reconnecting=!1,this._onConnect(e);else if(n>0){const e=new Error("Connection refused: "+C[n]);e.code=n,this.emit("error",e)}},O.prototype._handleAuth=function(e){const t=this.options.protocolVersion,n=5===t?e.reasonCode:e.returnCode;if(5!==t){const e=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+t);return e.code=n,void this.emit("error",e)}const r=this;this.handleAuth(e,(function(e,t){if(e)r.emit("error",e);else if(24===n)r.reconnecting=!1,r._sendPacket(t);else{const t=new Error("Connection refused: "+C[n]);e.code=n,r.emit("error",t)}}))},O.prototype.handleAuth=function(e,t){t()},O.prototype._handlePublish=function(e,t){m("_handlePublish: packet %o",e),t=void 0!==t?t:R;let n=e.topic.toString();const r=e.payload,s=e.qos,i=e.messageId,a=this,o=this.options,l=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let t;if(e.properties&&(t=e.properties.topicAlias),void 0!==t)if(0===n.length){if(!(t>0&&t<=65535))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));{const e=this.topicAliasRecv.getTopicByAlias(t);if(!e)return m("_handlePublish :: unregistered topic alias. alias: %d",t),void this.emit("error",new Error("Received unregistered Topic Alias"));n=e,m("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",n,t)}}else{if(!this.topicAliasRecv.put(n,t))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));m("_handlePublish :: registered topic: %s - alias: %d",n,t)}}switch(m("_handlePublish: qos %d",s),s){case 2:o.customHandleAcks(n,r,e,(function(n,r){return n instanceof Error||(r=n,n=null),n?a.emit("error",n):-1===l.indexOf(r)?a.emit("error",new Error("Wrong reason code for pubrec")):void(r?a._sendPacket({cmd:"pubrec",messageId:i,reasonCode:r},t):a.incomingStore.put(e,(function(){a._sendPacket({cmd:"pubrec",messageId:i},t)})))}));break;case 1:o.customHandleAcks(n,r,e,(function(s,o){return s instanceof Error||(o=s,s=null),s?a.emit("error",s):-1===l.indexOf(o)?a.emit("error",new Error("Wrong reason code for puback")):(o||a.emit("message",n,r,e),void a.handleMessage(e,(function(e){if(e)return t&&t(e);a._sendPacket({cmd:"puback",messageId:i,reasonCode:o},t)})))}));break;case 0:this.emit("message",n,r,e),this.handleMessage(e,t);break;default:m("_handlePublish: unknown QoS. Doing nothing.")}},O.prototype.handleMessage=function(e,t){t()},O.prototype._handleAck=function(e){const t=e.messageId,n=e.cmd;let r=null;const s=this.outgoing[t]?this.outgoing[t].cb:null,i=this;let a;if(s){switch(m("_handleAck :: packet type",n),n){case"pubcomp":case"puback":{const n=e.reasonCode;n&&n>0&&16!==n&&(a=new Error("Publish error: "+C[n]),a.code=n,s(a,e)),delete this.outgoing[t],this.outgoingStore.del(e,s),this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue();break}case"pubrec":{r={cmd:"pubrel",qos:2,messageId:t};const n=e.reasonCode;n&&n>0&&16!==n?(a=new Error("Publish error: "+C[n]),a.code=n,s(a,e)):this._sendPacket(r);break}case"suback":delete this.outgoing[t],this.messageIdProvider.deallocate(t);for(let n=0;n<e.granted.length;n++)if(0!=(128&e.granted[n])){const e=this.messageIdToTopic[t];e&&e.forEach((function(e){delete i._resubscribeTopics[e]}))}this._invokeStoreProcessingQueue(),s(null,e);break;case"unsuback":delete this.outgoing[t],this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue(),s(null);break;default:i.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else m("_handleAck :: Server sent an ack in error. Ignoring.")},O.prototype._handlePubrel=function(e,t){m("handling pubrel packet"),t=void 0!==t?t:R;const n=e.messageId,r=this,s={cmd:"pubcomp",messageId:n};r.incomingStore.get(e,(function(e,n){e?r._sendPacket(s,t):(r.emit("message",n.topic,n.payload,n),r.handleMessage(n,(function(e){if(e)return t(e);r.incomingStore.del(n,R),r._sendPacket(s,t)})))}))},O.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},O.prototype._nextId=function(){return this.messageIdProvider.allocate()},O.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},O.prototype._resubscribe=function(){m("_resubscribe");const e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){m("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){const n={};n[e[t]]=this._resubscribeTopics[e[t]],n.resubscribe=!0,this.subscribe(n,{properties:n[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},O.prototype._onConnect=function(e){if(this.disconnected)return void this.emit("connect",e);const t=this;function n(){let r=t.outgoingStore.createStream();function s(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function i(){r.destroy(),r=null,t._flushStoreProcessingQueue(),s()}function a(){if(!r)return;t._storeProcessing=!0;const e=r.read(1);let n;e?t._packetIdsDuringStoreProcessing[e.messageId]?a():t.disconnecting||t.reconnectTimer?r.destroy&&r.destroy():(n=t.outgoing[e.messageId]?t.outgoing[e.messageId].cb:null,t.outgoing[e.messageId]={volatile:!1,cb:function(e,t){n&&n(e,t),a()}},t._packetIdsDuringStoreProcessing[e.messageId]=!0,t.messageIdProvider.register(e.messageId)?t._sendPacket(e):m("messageId: %d has already used.",e.messageId)):r.once("readable",a)}t.once("close",i),r.on("error",(function(e){s(),t._flushStoreProcessingQueue(),t.removeListener("close",i),t.emit("error",e)})),r.on("end",(function(){let r=!0;for(const e in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[e]){r=!1;break}r?(s(),t.removeListener("close",i),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):n()})),a()}this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,n()},O.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1},O.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},O.prototype._flushStoreProcessingQueue=function(){for(const e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},t.exports=O}).call(this)}).call(this,e("_process"),void 0!==pt?pt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(e,t,n){const{Buffer:r}=e("buffer"),s=e("readable-stream").Transform,i=e("duplexify");let a,o,l,c=!1;function d(){const e=new s;return e._write=function(e,t,n){a.sendSocketMessage({data:e.buffer,success:function(){n()},fail:function(){n(new Error)}})},e._flush=function(e){a.closeSocket({success:function(){e()}})},e}function u(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}function h(e,t){const n="alis"===e.protocol?"wss":"ws";let r=n+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(r=n+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function f(){c||(c=!0,a.onSocketOpen((function(){l.setReadable(o),l.setWritable(o),l.emit("connect")})),a.onSocketMessage((function(e){if("string"==typeof e.data){const t=r.from(e.data,"base64");o.push(t)}else{const t=new FileReader;t.addEventListener("load",(function(){let e=t.result;e=e instanceof ArrayBuffer?r.from(e):r.from(e,"utf8"),o.push(e)})),t.readAsArrayBuffer(e.data)}})),a.onSocketClose((function(){l.end(),l.destroy()})),a.onSocketError((function(e){l.destroy(e)})))}function p(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";u(t);const r=h(t,e);return a=t.my,a.connectSocket({url:r,protocols:n}),o=d(),l=i.obj(),f(),l}t.exports=p},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(e,t,n){const r=e("net"),s=e("debug")("mqttjs:tcp");function i(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";const n=t.port,i=t.hostname;return s("port %d and host %s",n,i),r.createConnection(n,i)}t.exports=i},{debug:18,net:16}],4:[function(e,t,n){const r=e("tls"),s=e("net"),i=e("debug")("mqttjs:tls");function a(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===s.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,i("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);const n=r.connect(t);function a(r){t.rejectUnauthorized&&e.emit("error",r),n.end()}return n.on("secureConnect",(function(){t.rejectUnauthorized&&!n.authorized?n.emit("error",new Error("TLS not authorized")):n.removeListener("error",a)})),n.on("error",a),n}t.exports=a},{debug:18,net:16,tls:16}],5:[function(e,t,n){(function(n){(function(){const{Buffer:r}=e("buffer"),s=e("ws"),i=e("debug")("mqttjs:ws"),a=e("duplexify"),o=e("readable-stream").Transform,l=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],c=void 0!==n&&"browser"===n.title||"function"==typeof __webpack_require__;function d(e,t){let n=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}function u(e){const t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),c||"wss"!==e.protocol||l.forEach((function(n){Object.prototype.hasOwnProperty.call(e,n)&&!Object.prototype.hasOwnProperty.call(e.wsOptions,n)&&(t.wsOptions[n]=e[n])})),t}function h(e){const t=u(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}function f(e,t,n){i("createWebSocket"),i("protocol: "+n.protocolId+" "+n.protocolVersion);const r="MQIsdp"===n.protocolId&&3===n.protocolVersion?"mqttv3.1":"mqtt";return i("creating new Websocket for url: "+t+" and protocol: "+r),new s(t,[r],n.wsOptions)}function p(e,t){const n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",r=d(t,e),s=new WebSocket(r,[n]);return s.binaryType="arraybuffer",s}function g(e,t){i("streamBuilder");const n=u(t),r=d(n,e),a=f(e,r,n),o=s.createWebSocketStream(a,n.wsOptions);return o.url=r,a.on("close",(()=>{o.destroy()})),o}function m(e,t){let n;i("browserStreamBuilder");const s=h(t).browserBufferSize||524288,l=t.browserBufferTimeout||1e3,c=!t.objectMode,d=p(e,t),u=g(t,C,S);t.objectMode||(u._writev=w),u.on("close",(()=>{d.close()}));const f=void 0!==d.addEventListener;function g(e,t,n){const r=new o({objectModeMode:e.objectMode});return r._write=t,r._flush=n,r}function m(){n.setReadable(u),n.setWritable(u),n.emit("connect")}function y(){n.end(),n.destroy()}function v(e){n.destroy(e)}function b(e){let t=e.data;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),u.push(t)}function w(e,t){const n=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?n[t]=r.from(e[t],"utf8"):n[t]=e[t].chunk;this._write(r.concat(n),"binary",t)}function C(e,t,n){d.bufferedAmount>s&&setTimeout(C,l,e,t,n),c&&"string"==typeof e&&(e=r.from(e,"utf8"));try{d.send(e)}catch(e){return n(e)}n()}function S(e){d.close(),e()}return d.readyState===d.OPEN?n=u:(n=n=a(void 0,void 0,t),t.objectMode||(n._writev=w),f?d.addEventListener("open",m):d.onopen=m),n.socket=d,f?(d.addEventListener("close",y),d.addEventListener("error",v),d.addEventListener("message",b)):(d.onclose=y,d.onerror=v,d.onmessage=b),n}t.exports=c?m:g}).call(this)}).call(this,e("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(e,t,n){const{Buffer:r}=e("buffer"),s=e("readable-stream").Transform,i=e("duplexify");let a,o,l;function c(){const e=new s;return e._write=function(e,t,n){a.send({data:e.buffer,success:function(){n()},fail:function(e){n(new Error(e))}})},e._flush=function(e){a.close({success:function(){e()}})},e}function d(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}function u(e,t){const n="wxs"===e.protocol?"wss":"ws";let r=n+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(r=n+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function h(){a.onOpen((function(){l.setReadable(o),l.setWritable(o),l.emit("connect")})),a.onMessage((function(e){let t=e.data;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),o.push(t)})),a.onClose((function(){l.end(),l.destroy()})),a.onError((function(e){l.destroy(new Error(e.errMsg))}))}function f(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const n="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";d(t);const r=u(t,e);a=wx.connectSocket({url:r,protocols:[n]}),o=c(),l=i.obj(),l._destroy=function(e,t){a.close({success:function(){t&&t(e)}})};const s=l.destroy;return l.destroy=function(){l.destroy=s;const e=this;setTimeout((function(){a.close({fail:function(){e._destroy(new Error)}})}),0)}.bind(l),h(),l}t.exports=f},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(e,t,n){function r(){if(!(this instanceof r))return new r;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}r.prototype.allocate=function(){const e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},r.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},r.prototype.register=function(e){return!0},r.prototype.deallocate=function(e){},r.prototype.clear=function(){},t.exports=r},{}],8:[function(e,t,n){const r=e("xtend"),s=e("readable-stream").Readable,i={objectMode:!0},a={clean:!0};function o(e){if(!(this instanceof o))return new o(e);this.options=e||{},this.options=r(a,e),this._inflights=new Map}o.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},o.prototype.createStream=function(){const e=new s(i),t=[];let n=!1,r=0;return this._inflights.forEach((function(e,n){t.push(e)})),e._read=function(){!n&&r<t.length?this.push(t[r++]):this.push(null)},e.destroy=function(){if(n)return;const e=this;n=!0,setTimeout((function(){e.emit("close")}),0)},e},o.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},o.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},o.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},t.exports=o},{"readable-stream":69,xtend:81}],9:[function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);this.aliasToTopic={},this.max=e}r.prototype.put=function(e,t){return!(0===t||t>this.max||(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,0))},r.prototype.getTopicByAlias=function(e){return this.aliasToTopic[e]},r.prototype.clear=function(){this.aliasToTopic={}},t.exports=r},{}],10:[function(e,t,n){const r=e("lru-cache"),s=e("number-allocator").NumberAllocator;function i(e){if(!(this instanceof i))return new i(e);e>0&&(this.aliasToTopic=new r({max:e}),this.topicToAlias={},this.numberAllocator=new s(1,e),this.max=e,this.length=0)}i.prototype.put=function(e,t){if(0===t||t>this.max)return!1;const n=this.aliasToTopic.get(t);return n&&delete this.topicToAlias[n],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.length,!0},i.prototype.getTopicByAlias=function(e){return this.aliasToTopic.get(e)},i.prototype.getAliasByTopic=function(e){const t=this.topicToAlias[e];return void 0!==t&&this.aliasToTopic.get(t),t},i.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},i.prototype.getLruAlias=function(){const e=this.numberAllocator.firstVacant();return e||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},t.exports=i},{"lru-cache":37,"number-allocator":46}],11:[function(e,t,n){function r(e){const t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}function s(e){if(0===e.length)return"empty_topic_list";for(let t=0;t<e.length;t++)if(!r(e[t]))return e[t];return null}t.exports={validateTopics:s}},{}],12:[function(e,t,n){(function(n){(function(){const r=e("../client"),s=e("../store"),i=e("url"),a=e("xtend"),o=e("debug")("mqttjs"),l={};function c(e){let t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}function d(e,t){if(o("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){const n=i.parse(e,!0);if(null!=n.port&&(n.port=Number(n.port)),null===(t=a(n,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(c(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!l[t.protocol]){const e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,n){return(!e||n%2!=0)&&"function"==typeof l[t]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");function n(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),o("calling streambuilder for",t.protocol),l[t.protocol](e,t)}t.protocol&&(t.defaultProtocol=t.protocol);const s=new r(n,t);return s.on("error",(function(){})),s}void 0!==n&&"browser"!==n.title||"function"!=typeof __webpack_require__?(l.mqtt=e("./tcp"),l.tcp=e("./tcp"),l.ssl=e("./tls"),l.tls=e("./tls"),l.mqtts=e("./tls")):(l.wx=e("./wx"),l.wxs=e("./wx"),l.ali=e("./ali"),l.alis=e("./ali")),l.ws=e("./ws"),l.wss=e("./ws"),t.exports=d,t.exports.connect=d,t.exports.MqttClient=r,t.exports.Store=s}).call(this)}).call(this,e("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(e,t,n){n.byteLength=d,n.toByteArray=h,n.fromByteArray=g;for(var r=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=a.length;o<l;++o)r[o]=a[o],s[a.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function d(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function u(e,t,n){return 3*(t+n)/4-n}function h(e){var t,n,r=c(e),a=r[0],o=r[1],l=new i(u(e,a,o)),d=0,h=o>0?a-4:a;for(n=0;n<h;n+=4)t=s[e.charCodeAt(n)]<<18|s[e.charCodeAt(n+1)]<<12|s[e.charCodeAt(n+2)]<<6|s[e.charCodeAt(n+3)],l[d++]=t>>16&255,l[d++]=t>>8&255,l[d++]=255&t;return 2===o&&(t=s[e.charCodeAt(n)]<<2|s[e.charCodeAt(n+1)]>>4,l[d++]=255&t),1===o&&(t=s[e.charCodeAt(n)]<<10|s[e.charCodeAt(n+1)]<<4|s[e.charCodeAt(n+2)]>>2,l[d++]=t>>8&255,l[d++]=255&t),l}function f(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function p(e,t,n){for(var r,s=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),s.push(f(r));return s.join("")}function g(e){for(var t,n=e.length,s=n%3,i=[],a=16383,o=0,l=n-s;o<l;o+=a)i.push(p(e,o,o+a>l?l:o+a));return 1===s?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],14:[function(e,t,n){const{Buffer:r}=e("buffer"),s=Symbol.for("BufferList");function i(e){if(!(this instanceof i))return new i(e);i._init.call(this,e)}i._init=function(e){Object.defineProperty(this,s,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},i.prototype._new=function(e){return new i(e)},i.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){const r=t+this._bufs[n].length;if(e<r||n===this._bufs.length-1)return[n,e-t];t=r}},i.prototype._reverseOffset=function(e){const t=e[0];let n=e[1];for(let e=0;e<t;e++)n+=this._bufs[e].length;return n},i.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},i.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},i.prototype.copy=function(e,t,n,s){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof s||s>this.length)&&(s=this.length),n>=this.length)return e||r.alloc(0);if(s<=0)return e||r.alloc(0);const i=!!e,a=this._offset(n),o=s-n;let l=o,c=i&&t||0,d=a[1];if(0===n&&s===this.length){if(!i)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(l<=this._bufs[a[0]].length-d)return i?this._bufs[a[0]].copy(e,t,d,d+l):this._bufs[a[0]].slice(d,d+l);i||(e=r.allocUnsafe(o));for(let t=a[0];t<this._bufs.length;t++){const n=this._bufs[t].length-d;if(!(l>n)){this._bufs[t].copy(e,c,d,d+l),c+=n;break}this._bufs[t].copy(e,c,d),c+=n,l-=n,d&&(d=0)}return e.length>c?e.slice(0,c):e},i.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),s=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?s.pop():s[s.length-1]=s[s.length-1].slice(0,r[1]),0!==n[1]&&(s[0]=s[0].slice(n[1])),this._new(s)},i.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},i.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},i.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},i.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(r.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(r.from(e));return this},i.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},i.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=r.from([e]):"string"==typeof e?e=r.from(e,n):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=r.from(e.buffer,e.byteOffset,e.byteLength):r.isBuffer(e)||(e=r.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const s=this._offset(t);let i=s[0],a=s[1];for(;i<this._bufs.length;i++){const t=this._bufs[i];for(;a<t.length;)if(t.length-a>=e.length){const n=t.indexOf(e,a);if(-1!==n)return this._reverseOffset([i,n]);a=t.length-e.length+1}else{const t=this._reverseOffset([i,a]);if(this._match(t,e))return t;a++}a=0}return-1},i.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){null===e[t]?i.prototype[t]=function(e,n){return this.slice(e,e+n)[t](0,n)}:i.prototype[t]=function(n=0){return this.slice(n,n+e[t])[t](0)}}(t)}(),i.prototype._isBufferList=function(e){return e instanceof i||i.isBufferList(e)},i.isBufferList=function(e){return null!=e&&e[s]},t.exports=i},{buffer:17}],15:[function(e,t,n){const r=e("readable-stream").Duplex,s=e("inherits"),i=e("./BufferList");function a(e){if(!(this instanceof a))return new a(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}i._init.call(this,e),r.call(this)}s(a,r),Object.assign(a.prototype,i.prototype),a.prototype._new=function(e){return new a(e)},a.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},a.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},a.prototype.end=function(e){r.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},a.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},a.prototype._isBufferList=function(e){return e instanceof a||e instanceof i||a.isBufferList(e)},a.isBufferList=i.isBufferList,t.exports=a,t.exports.BufferListStream=a,t.exports.BufferList=i},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(e,t,n){},{}],17:[function(e,t,n){(function(t){(function(){var t=e("base64-js"),r=e("ieee754");n.Buffer=o,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50;var s=2147483647;function i(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var s=g(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}function u(e){return c(e),a(e<0?0:0|m(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|v(e,t),r=a(n),s=r.write(e,t);return s!==n&&(r=r.slice(0,s)),r}function f(e){for(var t=e.length<0?0:0|m(e.length),n=a(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n)).__proto__=o.prototype,r}function g(e){if(o.isBuffer(e)){var t=0|m(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(s)return r?-1:H(e).length;t=(""+t).toLowerCase(),s=!0}}function b(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function C(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:S(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):S(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function S(e,t,n,r,s){var i,a=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,o/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var d=-1;for(i=n;i<o;i++)if(c(e,i)===c(t,-1===d?0:i-d)){if(-1===d&&(d=i),i-d+1===l)return d*a}else-1!==d&&(i-=i-d),d=-1}else for(n+l>o&&(n=o-l),i=n;i>=0;i--){for(var u=!0,h=0;h<l;h++)if(c(e,i+h)!==c(t,h)){u=!1;break}if(u)return i}return-1}function E(e,t,n,r){n=Number(n)||0;var s=e.length-n;r?(r=Number(r))>s&&(r=s):r=s;var i=t.length;r>i/2&&(r=i/2);for(var a=0;a<r;++a){var o=parseInt(t.substr(2*a,2),16);if(X(o))return a;e[n+a]=o}return a}function T(e,t,n,r){return Y(H(t,e.length-n),e,n,r)}function I(e,t,n,r){return Y(V(t),e,n,r)}function k(e,t,n,r){return I(e,t,n,r)}function A(e,t,n,r){return Y(W(t),e,n,r)}function _(e,t,n,r){return Y(z(t,e.length-n),e,n,r)}function R(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],s=t;s<n;){var i,a,o,l,c=e[s],d=null,u=c>239?4:c>223?3:c>191?2:1;if(s+u<=n)switch(u){case 1:c<128&&(d=c);break;case 2:128==(192&(i=e[s+1]))&&(l=(31&c)<<6|63&i)>127&&(d=l);break;case 3:i=e[s+1],a=e[s+2],128==(192&i)&&128==(192&a)&&(l=(15&c)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:i=e[s+1],a=e[s+2],o=e[s+3],128==(192&i)&&128==(192&a)&&128==(192&o)&&(l=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,r.push(d>>>10&1023|55296),d=56320|1023&d),r.push(d),s+=u}return D(r)}n.kMaxLength=s,o.TYPED_ARRAY_SUPPORT=i(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),o.poolSize=8192,o.from=function(e,t,n){return l(e,t,n)},o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,o.alloc=function(e,t,n){return d(e,t,n)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(Q(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,s=0,i=Math.min(n,r);s<i;++s)if(e[s]!==t[s]){n=e[s],r=t[s];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).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}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=o.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var i=e[n];if(Q(i,Uint8Array)&&(i=o.from(i)),!o.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,s),s+=i.length}return r},o.byteLength=v,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)w(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):b.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},o.prototype.compare=function(e,t,n,r,s){if(Q(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(s>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),l=Math.min(i,a),c=this.slice(r,s),d=e.slice(t,n),u=0;u<l;++u)if(c[u]!==d[u]){i=c[u],a=d[u];break}return i<a?-1:a<i?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var s=this.length-t;if((void 0===n||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":return I(this,e,t,n);case"latin1":case"binary":return k(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function D(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=L));return n}function x(e,t,n){var r="";n=Math.min(e.length,n);for(var s=t;s<n;++s)r+=String.fromCharCode(127&e[s]);return r}function P(e,t,n){var r="";n=Math.min(e.length,n);for(var s=t;s<n;++s)r+=String.fromCharCode(e[s]);return r}function M(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var s="",i=t;i<n;++i)s+=G(e[i]);return s}function F(e,t,n){for(var r=e.slice(t,n),s="",i=0;i<r.length;i+=2)s+=String.fromCharCode(r[i]+256*r[i+1]);return s}function U(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,s,i){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function B(e,t,n,r,s,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,s,i){return t=+t,n>>>=0,i||B(e,t,n,4),r.write(e,t,n,s,23,4),n+4}function $(e,t,n,s,i){return t=+t,n>>>=0,i||B(e,t,n,8),r.write(e,t,n,s,52,8),n+8}o.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=o.prototype,r},o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||U(e,t,this.length);for(var r=this[e],s=1,i=0;++i<t&&(s*=256);)r+=this[e+i]*s;return r},o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||U(e,t,this.length);for(var r=this[e+--t],s=1;t>0&&(s*=256);)r+=this[e+--t]*s;return r},o.prototype.readUInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||U(e,t,this.length);for(var r=this[e],s=1,i=0;++i<t&&(s*=256);)r+=this[e+i]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||U(e,t,this.length);for(var r=t,s=1,i=this[e+--r];r>0&&(s*=256);)i+=this[e+--r]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||U(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||U(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||U(e,4,this.length),r.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||U(e,8,this.length),r.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var s=1,i=0;for(this[t]=255&e;++i<n&&(s*=256);)this[t+i]=e/s&255;return t+n},o.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||N(this,e,t,n,Math.pow(2,8*n)-1,0);var s=n-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var s=Math.pow(2,8*n-1);N(this,e,t,n,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var s=Math.pow(2,8*n-1);N(this,e,t,n,s-1,-s)}var i=n-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return $(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return $(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var s=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var i=s-1;i>=0;--i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return s},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var s=e.charCodeAt(0);("utf8"===r&&s<128||"latin1"===r)&&(e=s)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=o.isBuffer(e)?e:o.from(e,r),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%l]}return this};var q=/[^+/0-9A-Za-z-_]/g;function K(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var n;t=t||1/0;for(var r=e.length,s=null,i=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!s){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}s=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function z(e,t){for(var n,r,s,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,s=n%256,i.push(s),i.push(r);return i}function W(e){return t.toByteArray(K(e))}function Y(e,t,n,r){for(var s=0;s<r&&!(s+n>=t.length||s>=e.length);++s)t[s+n]=e[s];return s}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(e,t,n){(function(r){(function(){function s(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,n)}function a(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}}function o(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function l(){try{return localStorage}catch(e){}}n.formatArgs=i,n.save=a,n.load=o,n.useColors=s,n.storage=l(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:c}=t.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":19,_process:50}],19:[function(e,t,n){function r(t){function n(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){let t,n,i,a=null;function o(...e){if(!o.enabled)return;const n=o,s=Number(new Date),i=s-(t||s);n.diff=i,n.prev=t,n.curr=s,t=s,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,s)=>{if("%%"===t)return"%";a++;const i=r.formatters[s];if("function"==typeof i){const r=e[a];t=i.call(n,r),e.splice(a,1),a--}return t})),r.formatArgs.call(n,e),(n.log||r.log).apply(n,e)}return o.namespace=e,o.useColors=r.useColors(),o.color=r.selectColor(e),o.extend=s,o.destroy=r.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(n!==r.namespaces&&(n=r.namespaces,i=r.enabled(e)),i),set:e=>{a=e}}),"function"==typeof r.init&&r.init(o),o}function s(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){let t;r.save(e),r.namespaces=e,r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(t=0;t<s;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function a(){const e=[...r.names.map(l),...r.skips.map(l).map((e=>"-"+e))].join(",");return r.enable(""),e}function o(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1}function l(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}function c(e){return e instanceof Error?e.stack||e.message:e}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=i,r.enabled=o,r.humanize=e("ms"),r.destroy=d,Object.keys(t).forEach((e=>{r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=n,r.enable(r.load()),r}t.exports=r},{ms:45}],20:[function(e,t,n){(function(n,r){(function(){var s=e("readable-stream"),i=e("end-of-stream"),a=e("inherits"),o=e("stream-shift"),l=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),c=function(e,t){e._corked?e.once("uncork",t):t()},d=function(e,t){e._autoDestroy&&e.destroy(t)},u=function(e,t){return function(n){n?d(e,"premature close"===n.message?null:n):t&&!e._ended&&e.end()}},h=function(e,t){return e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):(e.end(),void t()):t()},f=function(){},p=function(e){return new s.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},g=function(e,t,n){if(!(this instanceof g))return new g(e,t,n);s.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!n||!1!==n.autoDestroy,this._forwardDestroy=!n||!1!==n.destroy,this._forwardEnd=!n||!1!==n.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};a(g,s.Duplex),g.obj=function(e,t,n){return n||(n={}),n.objectMode=!0,n.highWaterMark=16,new g(e,t,n)},g.prototype.cork=function(){1==++this._corked&&this.emit("cork")},g.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},g.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,r=i(e,{writable:!0,readable:!1},u(this,this._forwardEnd)),s=function(){var e=t._ondrain;t._ondrain=null,e&&e()},a=function(){t._writable.removeListener("drain",s),r()};this._unwrite&&n.nextTick(s),this._writable=e,this._writable.on("drain",s),this._unwrite=a,this.uncork()}else this.end()},g.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t=this,n=i(e,{writable:!1,readable:!0},u(this)),r=function(){t._forward()},s=function(){t.push(null)},a=function(){t._readable2.removeListener("readable",r),t._readable2.removeListener("end",s),n()};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:p(e),this._readable2.on("readable",r),this._readable2.on("end",s),this._unread=a,this._forward()}},g.prototype._read=function(){this._drained=!0,this._forward()},g.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=o(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},g.prototype.destroy=function(e,t){if(t||(t=f),this.destroyed)return t(null);this.destroyed=!0;var r=this;n.nextTick((function(){r._destroy(e),t(null)}))},g.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},g.prototype._write=function(e,t,n){if(!this.destroyed)return this._corked?c(this,this._write.bind(this,e,t,n)):e===l?this._finish(n):this._writable?void(!1===this._writable.write(e)?this._ondrain=n:this.destroyed||n()):n()},g.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,(function(){h(t._forwardEnd&&t._writable,(function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)}))}))},g.prototype.end=function(e,t,n){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(l),s.Writable.prototype.end.call(this,n))},t.exports=g}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(e,t,n){(function(n){(function(){var r=e("once"),s=function(){},i=function(e){return e.setHeader&&"function"==typeof e.abort},a=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},o=function(e,t,l){if("function"==typeof t)return o(e,null,t);t||(t={}),l=r(l||s);var c=e._writableState,d=e._readableState,u=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,f=!1,p=function(){e.writable||g()},g=function(){h=!1,u||l.call(e)},m=function(){u=!1,h||l.call(e)},y=function(t){l.call(e,t?new Error("exited with error code: "+t):null)},v=function(t){l.call(e,t)},b=function(){n.nextTick(w)},w=function(){if(!f)return(!u||d&&d.ended&&!d.destroyed)&&(!h||c&&c.ended&&!c.destroyed)?void 0:l.call(e,new Error("premature close"))},C=function(){e.req.on("finish",g)};return i(e)?(e.on("complete",g),e.on("abort",b),e.req?C():e.on("request",C)):h&&!c&&(e.on("end",p),e.on("close",p)),a(e)&&e.on("exit",y),e.on("end",m),e.on("finish",g),!1!==t.error&&e.on("error",v),e.on("close",b),function(){f=!0,e.removeListener("complete",g),e.removeListener("abort",b),e.removeListener("request",C),e.req&&e.req.removeListener("finish",g),e.removeListener("end",p),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("exit",y),e.removeListener("end",m),e.removeListener("error",v),e.removeListener("close",b)}};t.exports=o}).call(this)}).call(this,e("_process"))},{_process:50,once:48}],22:[function(e,t,n){var r=Object.create||T,s=Object.keys||I,i=Function.prototype.bind||k;function a(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._maxListeners=void 0;var o,l=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),o=0===c.x}catch(e){o=!1}function d(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,n){if(t)e.call(n);else for(var r=e.length,s=S(e,r),i=0;i<r;++i)s[i].call(n)}function h(e,t,n,r){if(t)e.call(n,r);else for(var s=e.length,i=S(e,s),a=0;a<s;++a)i[a].call(n,r)}function f(e,t,n,r,s){if(t)e.call(n,r,s);else for(var i=e.length,a=S(e,i),o=0;o<i;++o)a[o].call(n,r,s)}function p(e,t,n,r,s,i){if(t)e.call(n,r,s,i);else for(var a=e.length,o=S(e,a),l=0;l<a;++l)o[l].call(n,r,s,i)}function g(e,t,n,r){if(t)e.apply(n,r);else for(var s=e.length,i=S(e,s),a=0;a<s;++a)i[a].apply(n,r)}function m(e,t,n,s){var i,a,o;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=r(null),e._eventsCount=0),o){if("function"==typeof o?o=a[t]=s?[n,o]:[o,n]:s?o.unshift(n):o.push(n),!o.warned&&(i=d(e))&&i>0&&o.length>i){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else o=a[t]=n,++e._eventsCount;return e}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function v(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=i.call(y,r);return s.listener=n,r.wrapFn=s,s}function b(e,t,n){var r=e._events;if(!r)return[];var s=r[t];return s?"function"==typeof s?n?[s.listener||s]:[s]:n?E(s):S(s,s.length):[]}function w(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function C(e,t){for(var n=t,r=n+1,s=e.length;r<s;n+=1,r+=1)e[n]=e[r];e.pop()}function S(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function E(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function T(e){var t=function(){};return t.prototype=e,new t}function I(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t);return t}function k(e){var t=this;return function(){return t.apply(e,arguments)}}o?Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');l=e}}):a.defaultMaxListeners=l,a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return d(this)},a.prototype.emit=function(e){var t,n,r,s,i,a,o="error"===e;if(a=this._events)o=o&&null==a.error;else if(!o)return!1;if(o){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:u(n,c,this);break;case 2:h(n,c,this,arguments[1]);break;case 3:f(n,c,this,arguments[1],arguments[2]);break;case 4:p(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(r-1),i=1;i<r;i++)s[i-1]=arguments[i];g(n,c,this,s)}return!0},a.prototype.addListener=function(e,t){return m(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return m(this,e,t,!0)},a.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,v(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,v(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,s,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(s=this._events))return this;if(!(n=s[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():C(n,i),1===n.length&&(s[e]=n[0]),s.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.removeAllListeners=function(e){var t,n,i;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var a,o=s(n);for(i=0;i<o.length;++i)"removeListener"!==(a=o[i])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return b(this,e,!0)},a.prototype.rawListeners=function(e){return b(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):w.call(e,t)},a.prototype.listenerCount=w,a.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(e,t,n){
3
3
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
4
  n.read=function(e,t,n,r,s){var i,a,o=8*s-r-1,l=(1<<o)-1,c=l>>1,d=-7,u=n?s-1:0,h=n?-1:1,f=e[t+u];for(u+=h,i=f&(1<<-d)-1,f>>=-d,d+=o;d>0;i=256*i+e[t+u],u+=h,d-=8);for(a=i&(1<<-d)-1,i>>=-d,d+=r;d>0;a=256*a+e[t+u],u+=h,d-=8);if(0===i)i=1-c;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=c}return(f?-1:1)*a*Math.pow(2,i-r)},n.write=function(e,t,n,r,s,i){var a,o,l,c=8*i-s-1,d=(1<<c)-1,u=d>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+u>=1?h/l:h*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=d?(o=0,a=d):a+u>=1?(o=(t*l-1)*Math.pow(2,s),a+=u):(o=t*Math.pow(2,u-1)*Math.pow(2,s),a=0));s>=8;e[n+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*g}},{}],24:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],25:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=e,this.value=t}return e.prototype.rotateLeft=function(){var e=this.parent,t=this.brother,n=this.leftChild,r=this.rightChild;if(!r)throw new Error("unknown error");var s=r.leftChild,i=r.rightChild;return e&&(e.leftChild===this?e.leftChild=r:e.rightChild===this&&(e.rightChild=r)),r.parent=e,r.brother=t,r.leftChild=this,r.rightChild=i,t&&(t.brother=r),this.parent=r,this.brother=i,this.leftChild=n,this.rightChild=s,i&&(i.parent=r,i.brother=this),n&&(n.parent=this,n.brother=s),s&&(s.parent=this,s.brother=n),r},e.prototype.rotateRight=function(){var e=this.parent,t=this.brother,n=this.leftChild;if(!n)throw new Error("unknown error");var r=this.rightChild,s=n.leftChild,i=n.rightChild;return e&&(e.leftChild===this?e.leftChild=n:e.rightChild===this&&(e.rightChild=n)),n.parent=e,n.brother=t,n.leftChild=s,n.rightChild=this,t&&(t.brother=n),s&&(s.parent=n,s.brother=this),this.parent=n,this.brother=s,this.leftChild=i,this.rightChild=r,i&&(i.parent=this,i.brother=r),r&&(r.parent=this,r.brother=i),n},e.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},e.TreeNodeColorType={red:!0,black:!1},e}();Object.freeze(r),n.default=r},{}],26:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}};function s(e){var t=this;void 0===e&&(e=[]);var n=[],i=0,a=0,o=0,l=0,c=0,d=0;this.size=function(){return d},this.empty=function(){return 0===d},this.clear=function(){i=o=a=l=c=d=0,h.call(this,s.bucketSize),d=0},this.front=function(){return n[i][a]},this.back=function(){return n[o][l]},this.forEach=function(e){if(!this.empty()){var t=0;if(i!==o){for(c=a;c<s.bucketSize;++c)e(n[i][c],t++);for(c=i+1;c<o;++c)for(var r=0;r<s.bucketSize;++r)e(n[c][r],t++);for(c=0;c<=l;++c)e(n[o][c],t++)}else for(var c=a;c<=l;++c)e(n[i][c],t++)}};var u=function(e){var t=i*s.bucketSize+a,n=t+e,r=o*s.bucketSize+l;if(n<t||n>r)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(n/s.bucketSize),curNodePointerIndex:n%s.bucketSize}};this.getElementByPos=function(e){var t=u(e),r=t.curNodeBucketIndex,s=t.curNodePointerIndex;return n[r][s]},this.eraseElementByPos=function(e){var t=this;if(e<0||e>d)throw new Error("pos should more than 0 and less than queue's size");if(0===e)this.popFront();else if(e===this.size())this.popBack();else{for(var n=[],r=e+1;r<d;++r)n.push(this.getElementByPos(r));this.cut(e),this.popBack(),n.forEach((function(e){return t.pushBack(e)}))}},this.eraseElementByValue=function(e){if(!this.empty()){var t=[];this.forEach((function(n){n!==e&&t.push(n)}));for(var n=t.length,r=0;r<n;++r)this.setElementByPos(r,t[r]);this.cut(n-1)}};var h=function(e){for(var t=[],r=e*s.sigma,u=Math.max(Math.ceil(r/s.bucketSize),2),h=0;h<u;++h)t.push(new Array(s.bucketSize));var f=Math.ceil(e/s.bucketSize),p=Math.floor(u/2)-Math.floor(f/2),g=p,m=0;if(this.size())for(h=0;h<f;++h){for(var y=0;y<s.bucketSize;++y)if(t[p+h][y]=this.front(),this.popFront(),this.empty()){g=p+h,m=y;break}if(this.empty())break}n=t,i=p,a=0,o=g,l=m,c=u,d=e};this.pushBack=function(e){this.empty()||(o===c-1&&l===s.bucketSize-1&&h.call(this,this.size()),l<s.bucketSize-1?++l:o<c-1&&(++o,l=0)),++d,n[o][l]=e},this.popBack=function(){this.empty()||(1!==this.size()&&(l>0?--l:i<o&&(--o,l=s.bucketSize-1)),d>0&&--d)},this.setElementByPos=function(e,t){var r=u(e),s=r.curNodeBucketIndex,i=r.curNodePointerIndex;n[s][i]=t},this.insert=function(e,t,n){var r=this;if(void 0===n&&(n=1),0===e)for(;n--;)this.pushFront(t);else if(e===this.size())for(;n--;)this.pushBack(t);else{for(var s=[],i=e;i<d;++i)s.push(this.getElementByPos(i));for(this.cut(e-1),i=0;i<n;++i)this.pushBack(t);s.forEach((function(e){return r.pushBack(e)}))}},this.find=function(e){if(i===o){for(var t=a;t<=l;++t)if(n[i][t]===e)return!0;return!1}for(t=a;t<s.bucketSize;++t)if(n[i][t]===e)return!0;for(t=i+1;t<o;++t)for(var r=0;r<s.bucketSize;++r)if(n[t][r]===e)return!0;for(t=0;t<=l;++t)if(n[o][t]===e)return!0;return!1},this.reverse=function(){for(var e=0,t=d-1;e<t;){var n=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,n),++e,--t}},this.unique=function(){if(!this.empty()){var e=[],t=this.front();this.forEach((function(n,r){0!==r&&n===t||(e.push(n),t=n)}));for(var n=0;n<d;++n)this.setElementByPos(n,e[n]);this.cut(e.length-1)}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);for(var n=0;n<d;++n)this.setElementByPos(n,t[n])},this.pushFront=function(e){this.empty()||(0===i&&0===a&&h.call(this,this.size()),a>0?--a:i>0&&(--i,a=s.bucketSize-1)),++d,n[i][a]=e},this.popFront=function(){this.empty()||(1!==this.size()&&(a<s.bucketSize-1?++a:i<o&&(++i,a=0)),d>0&&--d)},this.shrinkToFit=function(){var e=this,t=[];this.forEach((function(e){t.push(e)}));var r=t.length;n=[];for(var i=Math.ceil(r/s.bucketSize),a=0;a<i;++a)n.push(new Array(s.bucketSize));this.clear(),t.forEach((function(t){return e.pushBack(t)}))},this.cut=function(e){if(e<0)this.clear();else{var t=u(e),n=t.curNodeBucketIndex,r=t.curNodePointerIndex;o=n,l=r,d=e+1}},this[Symbol.iterator]=function(){return function(){var e,t;return r(this,(function(r){switch(r.label){case 0:if(0===d)return[2];if(i!==o)return[3,5];t=a,r.label=1;case 1:return t<=l?[4,n[i][t]]:[3,4];case 2:r.sent(),r.label=3;case 3:return++t,[3,1];case 4:return[2];case 5:t=a,r.label=6;case 6:return t<s.bucketSize?[4,n[i][t]]:[3,9];case 7:r.sent(),r.label=8;case 8:return++t,[3,6];case 9:t=i+1,r.label=10;case 10:if(!(t<o))return[3,15];e=0,r.label=11;case 11:return e<s.bucketSize?[4,n[t][e]]:[3,14];case 12:r.sent(),r.label=13;case 13:return++e,[3,11];case 14:return++t,[3,10];case 15:t=0,r.label=16;case 16:return t<=l?[4,n[o][t]]:[3,19];case 17:r.sent(),r.label=18;case 18:return++t,[3,16];case 19:return[2]}}))}()},function(){var r=s.bucketSize;e.size?r=e.size():e.length&&(r=e.length);var a=r*s.sigma;c=Math.ceil(a/s.bucketSize),c=Math.max(c,3);for(var l=0;l<c;++l)n.push(new Array(s.bucketSize));var d=Math.ceil(r/s.bucketSize);i=Math.floor(c/2)-Math.floor(d/2),o=i,e.forEach((function(e){return t.pushBack(e)}))}(),Object.freeze(this)}Object.defineProperty(n,"__esModule",{value:!0}),s.sigma=3,s.bucketSize=5e3,Object.freeze(s),n.default=s},{}],27:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../LinkList/LinkList"),a=e("../Map/Map");function o(e,t,n){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=o.initSize),n=n||function(e){var t,n,r=0,i="";if("number"==typeof e)r=((r=Math.floor(e))<<5)-r,r&=r;else{i="string"!=typeof e?JSON.stringify(e):e;try{for(var a=s(i),o=a.next();!o.done;o=a.next())r=(r<<5)-r+o.value.charCodeAt(0),r&=r}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}return r^=r>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var c=0,d=[],u=Math.max(o.initSize,Math.min(o.maxSize,t));this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){c=0,u=t,d=[]},this.forEach=function(e){var t=0;d.forEach((function(n){n.forEach((function(n){e(n,t++)}))}))};var h=function(e){if(!(e>=o.maxSize)){u=2*e;var t=[];d.forEach((function(r,s){if(!r.empty()){if(r instanceof i.default&&1===r.size()){var l=r.front(),c=l.key,h=l.value;t[n(c)&u-1]=new i.default([{key:c,value:h}])}else if(r instanceof a.default){var f=new i.default,p=new i.default;r.forEach((function(t){0==(n(t.key)&e)?f.pushBack(t):p.pushBack(t)})),f.size()>o.untreeifyThreshold?t[s]=new a.default(f):f.size()&&(t[s]=f),p.size()>o.untreeifyThreshold?t[s+e]=new a.default(p):p.size()&&(t[s+e]=p)}else{var g=new i.default,m=new i.default;r.forEach((function(t){0==(n(t.key)&e)?g.pushBack(t):m.pushBack(t)})),g.size()&&(t[s]=g),m.size()&&(t[s+e]=m)}d[s].clear()}})),d=t}};this.setElement=function(e,t){var r,l;if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=t){var f=n(e)&u-1;if(d[f]){var p=d[f].size();if(d[f]instanceof i.default){try{for(var g=s(d[f]),m=g.next();!m.done;m=g.next()){var y=m.value;if(y.key===e)return void(y.value=t)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(l=g.return)&&l.call(g)}finally{if(r)throw r.error}}d[f].pushBack({key:e,value:t}),d[f].size()>=o.treeifyThreshold&&(d[f]=new a.default(d[f]))}else d[f].setElement(e,t);var v=d[f].size();c+=v-p}else++c,d[f]=new i.default([{key:e,value:t}]);c>u*o.sigma&&h.call(this,u)}else this.eraseElementByKey(e)},this.getElementByKey=function(e){var t,r,i=n(e)&u-1;if(d[i]){if(d[i]instanceof a.default)return d[i].getElementByKey(e);try{for(var o=s(d[i]),l=o.next();!l.done;l=o.next()){var c=l.value;if(c.key===e)return c.value}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}},this.eraseElementByKey=function(e){var t,r,l=n(e)&u-1;if(d[l]){var h=d[l].size();if(d[l]instanceof a.default)d[l].eraseElementByKey(e),d[l].size()<=o.untreeifyThreshold&&(d[l]=new i.default(d[l]));else{var f=-1;try{for(var p=s(d[l]),g=p.next();!g.done;g=p.next()){var m=g.value;if(++f,m.key===e){d[l].eraseElementByPos(f);break}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}}var y=d[l].size();c+=y-h}},this.find=function(e){var t,r,i=n(e)&u-1;if(!d[i])return!1;if(d[i]instanceof a.default)return d[i].find(e);try{for(var o=s(d[i]),l=o.next();!l.done;l=o.next())if(l.value.key===e)return!0}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return!1},this[Symbol.iterator]=function(){return function(){var e,t,n,i,a,o;return r(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:if(!(e<u))return[3,10];for(;e<u&&!d[e];)++e;if(e>=u)return[3,10];r.label=2;case 2:r.trys.push([2,7,8,9]),a=void 0,t=s(d[e]),n=t.next(),r.label=3;case 3:return n.done?[3,6]:[4,n.value];case 4:r.sent(),r.label=5;case 5:return n=t.next(),[3,3];case 6:return[3,9];case 7:return i=r.sent(),a={error:i},[3,9];case 8:try{n&&!n.done&&(o=t.return)&&o.call(t)}finally{if(a)throw a.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){var t=e.key,n=e.value;return l.setElement(t,n)})),Object.freeze(this)}o.initSize=16,o.maxSize=1<<30,o.sigma=.75,o.treeifyThreshold=8,o.untreeifyThreshold=6,o.minTreeifySize=64,Object.freeze(o),n.default=o},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../Set/Set"),a=e("../LinkList/LinkList");function o(e,t,n){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=o.initSize),n=n||function(e){var t=0,n="";if("number"==typeof e)t=((t=Math.floor(e))<<5)-t,t&=t;else{n="string"!=typeof e?JSON.stringify(e):e;for(var r=0;r<n.length;r++)t=(t<<5)-t+n.charCodeAt(r),t&=t}return t^=t>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var c=0,d=[],u=Math.max(o.initSize,Math.min(o.maxSize,t));this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){c=0,u=t,d=[]},this.forEach=function(e){var t=0;d.forEach((function(n){n.forEach((function(n){e(n,t++)}))}))};var h=function(e){if(!(e>=o.maxSize)){u=2*e;var t=[];d.forEach((function(r,s){if(!r.empty()){if(r instanceof a.default&&1===r.size()){var l=r.front();if(void 0===l)throw new Error("unknown error");t[n(l)&u-1]=new a.default([l])}else if(r instanceof i.default){var c=new a.default,h=new a.default;r.forEach((function(t){0==(n(t)&e)?c.pushBack(t):h.pushBack(t)})),c.size()>o.untreeifyThreshold?t[s]=new i.default(c):c.size()&&(t[s]=c),h.size()>o.untreeifyThreshold?t[s+e]=new i.default(h):h.size()&&(t[s+e]=h)}else{var f=new a.default,p=new a.default;r.forEach((function(t){0==(n(t)&e)?f.pushBack(t):p.pushBack(t)})),f.size()&&(t[s]=f),p.size()&&(t[s+e]=p)}d[s].clear()}})),d=t}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var t=n(e)&u-1;if(d[t]){var r=d[t].size();if(d[t]instanceof a.default){if(d[t].find(e))return;d[t].pushBack(e),d[t].size()>=o.treeifyThreshold&&(d[t]=new i.default(d[t]))}else d[t].insert(e);var s=d[t].size();c+=s-r}else d[t]=new a.default([e]),++c;c>u*o.sigma&&h.call(this,u)},this.eraseElementByValue=function(e){var t=n(e)&u-1;if(d[t]){var r=d[t].size();d[t].eraseElementByValue(e),d[t]instanceof i.default&&d[t].size()<=o.untreeifyThreshold&&(d[t]=new a.default(d[t]));var s=d[t].size();c+=s-r}},this.find=function(e){var t=n(e)&u-1;return!!d[t]&&d[t].find(e)},this[Symbol.iterator]=function(){return function(){var e,t,n,i,a,o;return r(this,(function(r){switch(r.label){case 0:e=0,r.label=1;case 1:if(!(e<u))return[3,10];for(;e<u&&!d[e];)++e;if(e>=u)return[3,10];r.label=2;case 2:r.trys.push([2,7,8,9]),a=void 0,t=s(d[e]),n=t.next(),r.label=3;case 3:return n.done?[3,6]:[4,n.value];case 4:r.sent(),r.label=5;case 5:return n=t.next(),[3,3];case 6:return[3,9];case 7:return i=r.sent(),a={error:i},[3,9];case 8:try{n&&!n.done&&(o=t.return)&&o.call(t)}finally{if(a)throw a.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){return l.insert(e)})),Object.freeze(this)}o.initSize=16,o.maxSize=1<<30,o.sigma=.75,o.treeifyThreshold=8,o.untreeifyThreshold=6,o.minTreeifySize=64,Object.freeze(o),n.default=o},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}};Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function e(e){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=e}return e}();function i(e){var t=this;void 0===e&&(e=[]);var n=0,i=void 0,a=void 0;this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){i=a=void 0,n=0},this.front=function(){return null==i?void 0:i.value},this.back=function(){return null==a?void 0:a.value},this.forEach=function(e){for(var t=i,n=0;t;){if(void 0===t.value)throw new Error("unknown error");e(t.value,n++),t=t.next}},this.getElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more then 0 and less then the list length");for(var t=i;e--&&t;)t=t.next;if(!t||void 0===t.value)throw new Error("unknown error");return t.value},this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("erase pos must more then 0 and less then the list length");if(0===e)this.popFront();else if(e===n-1)this.popBack();else{for(var t=i;e--;){if(!(null==t?void 0:t.next))throw new Error("unknown error");t=t.next}if(!t||!t.pre||!t.next)throw new Error("unknown error");var r=t.pre,s=t.next;s.pre=r,r.next=s,n>0&&--n}},this.eraseElementByValue=function(e){for(;i&&i.value===e;)this.popFront();for(;a&&a.value===e;)this.popBack();if(i)for(var t=i;t;){if(t.value===e){var r=t.pre,s=t.next;s&&(s.pre=r),r&&(r.next=s),n>0&&--n}t=t.next}},this.pushBack=function(e){if(null==e)throw new Error("you can't push null or undefined here");++n;var t=new s(e);a?(a.next=t,t.pre=a,a=t):i=a=t},this.popBack=function(){a&&(n>0&&--n,a&&(i===a?i=a=void 0:(a=a.pre)&&(a.next=void 0)))},this.setElementByPos=function(e,t){if(null==t)throw new Error("you can't set null or undefined here");if(e<0||e>=n)throw new Error("pos must more then 0 and less then the list length");for(var r=i;e--;){if(!r)throw new Error("unknown error");r=r.next}r&&(r.value=t)},this.insert=function(e,t,r){if(void 0===r&&(r=1),null==t)throw new Error("you can't insert null or undefined here");if(e<0||e>n)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(r<0)throw new Error("insert size must more than 0");if(0===e)for(;r--;)this.pushFront(t);else if(e===n)for(;r--;)this.pushBack(t);else{for(var a=i,o=1;o<e;++o){if(!(null==a?void 0:a.next))throw new Error("unknown error");a=null==a?void 0:a.next}if(!a)throw new Error("unknown error");var l=a.next;for(n+=r;r--;)a.next=new s(t),a.next.pre=a,a=a.next;a.next=l,l&&(l.pre=a)}},this.find=function(e){for(var t=i;t;){if(t.value===e)return!0;t=t.next}return!1},this.reverse=function(){for(var e=i,t=a,r=0;e&&t&&2*r<n;){var s=e.value;e.value=t.value,t.value=s,e=e.next,t=t.pre,++r}},this.unique=function(){for(var e=i;e;){for(var t=e;t&&t.next&&t.value===t.next.value;)t=t.next,n>0&&--n;e.next=t.next,e.next&&(e.next.pre=e),e=e.next}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);var n=i;t.forEach((function(e){n&&(n.value=e,n=n.next)}))},this.pushFront=function(e){if(null==e)throw new Error("you can't push null or undefined here");++n;var t=new s(e);i?(t.next=i,i.pre=t,i=t):i=a=t},this.popFront=function(){i&&(n>0&&--n,i&&(i===a?i=a=void 0:(i=i.next)&&(i.pre=void 0)))},this.merge=function(e){var t=this,r=i;e.forEach((function(e){for(;r&&void 0!==r.value&&r.value<=e;)r=r.next;if(void 0===r)t.pushBack(e),r=a;else if(r===i)t.pushFront(e),r=i;else{++n;var o=r.pre;o&&(o.next=new s(e),o.next.pre=o,o.next.next=r,r&&(r.pre=o.next))}}))},this[Symbol.iterator]=function(){return function(){var e;return r(this,(function(t){switch(t.label){case 0:e=i,t.label=1;case 1:if(void 0===e)return[3,3];if(!e.value)throw new Error("unknown error");return[4,e.value];case 2:return t.sent(),e=e.next,[3,1];case 3:return[2]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(i),n.default=i},{}],30:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../Base/TreeNode");function a(e,t){var n=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var a=0,o=new i.default;o.color=i.default.TreeNodeColorType.black,this.size=function(){return a},this.empty=function(){return 0===a},this.clear=function(){a=0,o.key=o.value=void 0,o.leftChild=o.rightChild=o.brother=void 0};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},c=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?c(e.rightChild):e};this.front=function(){if(!this.empty()){var e=l(o);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.back=function(){if(!this.empty()){var e=c(o);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.forEach=function(e){var t,n,r=0;try{for(var i=s(this),a=i.next();!a.done;a=i.next())e(a.value,r++)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,n;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var r=0;try{for(var i=s(this),a=i.next();!a.done;a=i.next()){var o=a.value;if(r===e)return o;++r}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new Error("unknown Error")};var d=function(e,n){if(e&&void 0!==e.key&&void 0!==e.value){var r=t(e.key,n);return 0===r?{key:e.key,value:e.value}:r<0?d(e.rightChild,n):d(e.leftChild,n)||{key:e.key,value:e.value}}};this.lowerBound=function(e){return d(o,e)};var u=function(e,n){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,n)<=0?u(e.rightChild,n):u(e.leftChild,n)||{key:e.key,value:e.value}};this.upperBound=function(e){return u(o,e)};var h=function(e,n){if(e&&void 0!==e.key&&void 0!==e.value){var r=t(e.key,n);return 0===r?{key:e.key,value:e.value}:r>0?h(e.leftChild,n):h(e.rightChild,n)||{key:e.key,value:e.value}}};this.reverseLowerBound=function(e){return h(o,e)};var f=function(e,n){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,n)>=0?f(e.leftChild,n):f(e.rightChild,n)||{key:e.key,value:e.value}};this.reverseUpperBound=function(e){return f(o,e)};var p=function(e){var t=e.parent;if(!t){if(e===o)return;throw new Error("unknown error")}if(e.color!==i.default.TreeNodeColorType.red){var n=e.brother;if(!n)throw new Error("unknown error");if(e===t.leftChild)if(n.color===i.default.TreeNodeColorType.red){n.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red;var r=t.rotateLeft();o===t&&(o=r),p(e)}else n.color===i.default.TreeNodeColorType.black&&(n.rightChild&&n.rightChild.color===i.default.TreeNodeColorType.red?(n.color=t.color,t.color=i.default.TreeNodeColorType.black,n.rightChild&&(n.rightChild.color=i.default.TreeNodeColorType.black),r=t.rotateLeft(),o===t&&(o=r),e.color=i.default.TreeNodeColorType.black):n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||!n.leftChild||n.leftChild.color!==i.default.TreeNodeColorType.red?n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||(n.color=i.default.TreeNodeColorType.red,p(t)):(n.color=i.default.TreeNodeColorType.red,n.leftChild&&(n.leftChild.color=i.default.TreeNodeColorType.black),r=n.rotateRight(),o===n&&(o=r),p(e)));else e===t.rightChild&&(n.color===i.default.TreeNodeColorType.red?(n.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red,r=t.rotateRight(),o===t&&(o=r),p(e)):n.color===i.default.TreeNodeColorType.black&&(n.leftChild&&n.leftChild.color===i.default.TreeNodeColorType.red?(n.color=t.color,t.color=i.default.TreeNodeColorType.black,n.leftChild&&(n.leftChild.color=i.default.TreeNodeColorType.black),r=t.rotateRight(),o===t&&(o=r),e.color=i.default.TreeNodeColorType.black):n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||!n.rightChild||n.rightChild.color!==i.default.TreeNodeColorType.red?n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||(n.color=i.default.TreeNodeColorType.red,p(t)):(n.color=i.default.TreeNodeColorType.red,n.rightChild&&(n.rightChild.color=i.default.TreeNodeColorType.black),r=n.rotateLeft(),o===n&&(o=r),p(e))))}else e.color=i.default.TreeNodeColorType.black},g=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var n=e.key;e.key=t.key,t.key=n;var r=e.value;e.value=t.value,t.value=r,e=t}t.leftChild&&(t=c(t.leftChild),n=e.key,e.key=t.key,t.key=n,r=e.value,e.value=t.value,t.value=r,e=t)}p(t),t&&t.remove(),--a,o.color=i.default.TreeNodeColorType.black},m=function(e,t){return!(!e||void 0===e.key)&&(!!m(e.leftChild,t)||!!t(e)||m(e.rightChild,t))};this.eraseElementByPos=function(e){if(e<0||e>=a)throw new Error("pos must more than 0 and less than set's size");var t=0;m(o,(function(n){return e===t?(g(n),!0):(++t,!1)}))},this.eraseElementByKey=function(e){if(!this.empty()){var n=b(o,e);void 0!==n&&void 0!==n.key&&0===t(n.key,e)&&g(n)}};var y=function(e,n){if(!e||void 0===e.key)throw new Error("unknown error");var r=t(n,e.key);return r<0?e.leftChild?y(e.leftChild,n):(e.leftChild=new i.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):r>0?e.rightChild?y(e.rightChild,n):(e.rightChild=new i.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},v=function(e){var t=e.parent;if(!t){if(e===o)return;throw new Error("unknown error")}if(t.color!==i.default.TreeNodeColorType.black&&t.color===i.default.TreeNodeColorType.red){var n=t.brother,r=t.parent;if(!r)throw new Error("unknown error");if(n&&n.color===i.default.TreeNodeColorType.red)n.color=t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red,v(r);else if(!n||n.color===i.default.TreeNodeColorType.black)if(t===r.leftChild)if(e===t.leftChild){t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red;var s=r.rotateRight();r===o&&(o=s)}else e===t.rightChild&&(s=t.rotateLeft(),r===o&&(o=s),v(t));else t===r.rightChild&&(e===t.leftChild?(s=t.rotateRight(),r===o&&(o=s),v(t)):e===t.rightChild&&(t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red,s=r.rotateLeft(),r===o&&(o=s)))}};this.setElement=function(e,n){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=n){if(this.empty())return++a,o.key=e,o.value=n,void(o.color=i.default.TreeNodeColorType.black);var r=y(o,e);void 0===r.key||0!==t(r.key,e)?(++a,r.key=e,r.value=n,v(r),o.color=i.default.TreeNodeColorType.black):r.value=n}else this.eraseElementByKey(e)};var b=function(e,n){if(e&&void 0!==e.key){var r=t(n,e.key);return r<0?b(e.leftChild,n):r>0?b(e.rightChild,n):e}};this.find=function(e){return!!b(o,e)},this.getElementByKey=function(e){var t=b(o,e);if(void 0===(null==t?void 0:t.key)||void 0===(null==t?void 0:t.value))throw new Error("unknown error");return t.value},this.union=function(e){var t=this;e.forEach((function(e){var n=e.key,r=e.value;return t.setElement(n,r)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(o)};var w=function(e){return r(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key&&void 0!==e.value?[5,s(w(e.leftChild))]:[2];case 1:return t.sent(),[4,{key:e.key,value:e.value}];case 2:return t.sent(),[5,s(w(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(o)},e.forEach((function(e){var t=e.key,r=e.value;return n.setElement(t,r)})),Object.freeze(this)}Object.freeze(a),n.default=a},{"../Base/TreeNode":25}],31:[function(e,t,n){function r(e,t){void 0===e&&(e=[]),t=t||function(e,t){return e>t?-1:e<t?1:0};var n=[];e.forEach((function(e){return n.push(e)}));var r=n.length,s=function(e,t){if(e<0||e>=r)throw new Error("unknown error");if(t<0||t>=r)throw new Error("unknown error");var s=n[e];n[e]=n[t],n[t]=s},i=function(e){if(e<0||e>=r)throw new Error("unknown error");var i=2*e+1,a=2*e+2;i<r&&t(n[e],n[i])>0&&s(e,i),a<r&&t(n[e],n[a])>0&&s(e,a)};!function(){for(var e=Math.floor((r-1)/2);e>=0;--e)for(var i=e,a=2*i+1;a<r;){var o=a+1,l=a;if(o<r&&t(n[a],n[o])>0&&(l=o),t(n[i],n[l])<=0)break;s(i,l),a=2*(i=l)+1}}(),this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,n.length=0},this.push=function(e){if(n.push(e),1!=++r)for(var s=r-1;s>0;){var a=Math.floor((s-1)/2);if(t(n[a],e)<=0)break;i(a),s=a}},this.pop=function(){if(!this.empty())if(1!==this.size()){var e=n[r-1];--r;for(var s=0;s<this.size();){var i=2*s+1,a=2*s+2;if(i>=this.size())break;var o=i;if(a<this.size()&&t(n[i],n[a])>0&&(o=a),t(n[o],e)>=0)break;n[s]=n[o],s=o}n[s]=e}else--r},this.top=function(){return n[0]},Object.freeze(this)}Object.defineProperty(n,"__esModule",{value:!0}),Object.freeze(r),n.default=r},{}],32:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r=e("../LinkList/LinkList");function s(e){void 0===e&&(e=[]);var t=new r.default(e);this.size=function(){return t.size()},this.empty=function(){return t.empty()},this.clear=function(){t.clear()},this.push=function(e){t.pushBack(e)},this.pop=function(){t.popFront()},this.front=function(){return t.front()},Object.freeze(this)}Object.freeze(s),n.default=s},{"../LinkList/LinkList":29}],33:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n,"__esModule",{value:!0});var i=e("../Base/TreeNode");function a(e,t){var n=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var a=0,o=new i.default;o.color=i.default.TreeNodeColorType.black,this.size=function(){return a},this.empty=function(){return 0===a},this.clear=function(){a=0,o.key=void 0,o.leftChild=o.rightChild=o.brother=o.parent=void 0,o.color=i.default.TreeNodeColorType.black};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},c=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?c(e.rightChild):e};this.front=function(){if(!this.empty())return l(o).key},this.back=function(){if(!this.empty())return c(o).key},this.forEach=function(e){var t,n,r=0;try{for(var i=s(this),a=i.next();!a.done;a=i.next())e(a.value,r++)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,n;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var r=0;try{for(var i=s(this),a=i.next();!a.done;a=i.next()){var o=a.value;if(r===e)return o;++r}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new Error("unknown error")};var d=function(e){var t=e.parent;if(!t){if(e===o)return;throw new Error("unknown error")}if(e.color!==i.default.TreeNodeColorType.red){var n=e.brother;if(!n)throw new Error("unknown error");if(e===t.leftChild)if(n.color===i.default.TreeNodeColorType.red){n.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red;var r=t.rotateLeft();o===t&&(o=r),d(e)}else n.color===i.default.TreeNodeColorType.black&&(n.rightChild&&n.rightChild.color===i.default.TreeNodeColorType.red?(n.color=t.color,t.color=i.default.TreeNodeColorType.black,n.rightChild&&(n.rightChild.color=i.default.TreeNodeColorType.black),r=t.rotateLeft(),o===t&&(o=r),e.color=i.default.TreeNodeColorType.black):n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||!n.leftChild||n.leftChild.color!==i.default.TreeNodeColorType.red?n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||(n.color=i.default.TreeNodeColorType.red,d(t)):(n.color=i.default.TreeNodeColorType.red,n.leftChild&&(n.leftChild.color=i.default.TreeNodeColorType.black),r=n.rotateRight(),o===n&&(o=r),d(e)));else e===t.rightChild&&(n.color===i.default.TreeNodeColorType.red?(n.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red,r=t.rotateRight(),o===t&&(o=r),d(e)):n.color===i.default.TreeNodeColorType.black&&(n.leftChild&&n.leftChild.color===i.default.TreeNodeColorType.red?(n.color=t.color,t.color=i.default.TreeNodeColorType.black,n.leftChild&&(n.leftChild.color=i.default.TreeNodeColorType.black),r=t.rotateRight(),o===t&&(o=r),e.color=i.default.TreeNodeColorType.black):n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||!n.rightChild||n.rightChild.color!==i.default.TreeNodeColorType.red?n.leftChild&&n.leftChild.color!==i.default.TreeNodeColorType.black||n.rightChild&&n.rightChild.color!==i.default.TreeNodeColorType.black||(n.color=i.default.TreeNodeColorType.red,d(t)):(n.color=i.default.TreeNodeColorType.red,n.rightChild&&(n.rightChild.color=i.default.TreeNodeColorType.black),r=n.rotateLeft(),o===n&&(o=r),d(e))))}else e.color=i.default.TreeNodeColorType.black},u=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var n=e.key;e.key=t.key,t.key=n,e=t}t.leftChild&&(t=c(t.leftChild),n=e.key,e.key=t.key,t.key=n,e=t)}d(t),t&&t.remove(),--a,o.color=i.default.TreeNodeColorType.black},h=function(e,t){return!(!e||void 0===e.key)&&(!!h(e.leftChild,t)||!!t(e)||h(e.rightChild,t))};this.eraseElementByPos=function(e){if(e<0||e>=a)throw new Error("pos must more than 0 and less than set's size");var t=0;h(o,(function(n){return e===t?(u(n),!0):(++t,!1)}))},this.eraseElementByValue=function(e){if(!this.empty()){var n=g(o,e);void 0!==n&&void 0!==n.key&&0===t(n.key,e)&&u(n)}};var f=function(e,n){if(!e||void 0===e.key)throw new Error("unknown error");var r=t(n,e.key);return r<0?e.leftChild?f(e.leftChild,n):(e.leftChild=new i.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):r>0?e.rightChild?f(e.rightChild,n):(e.rightChild=new i.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},p=function(e){var t=e.parent;if(!t){if(e===o)return;throw new Error("unknown error")}if(t.color!==i.default.TreeNodeColorType.black&&t.color===i.default.TreeNodeColorType.red){var n=t.brother,r=t.parent;if(!r)throw new Error("unknown error");if(n&&n.color===i.default.TreeNodeColorType.red)n.color=t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red,p(r);else if(!n||n.color===i.default.TreeNodeColorType.black)if(t===r.leftChild)if(e===t.leftChild){t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red;var s=r.rotateRight();r===o&&(o=s)}else e===t.rightChild&&(s=t.rotateLeft(),r===o&&(o=s),p(t));else t===r.rightChild&&(e===t.leftChild?(s=t.rotateRight(),r===o&&(o=s),p(t)):e===t.rightChild&&(t.color=i.default.TreeNodeColorType.black,r.color=i.default.TreeNodeColorType.red,s=r.rotateLeft(),r===o&&(o=s)))}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++a,o.key=e,void(o.color=i.default.TreeNodeColorType.black);var n=f(o,e);void 0!==n.key&&0===t(n.key,e)||(++a,n.key=e,p(n),o.color=i.default.TreeNodeColorType.black)};var g=function(e,n){if(e&&void 0!==e.key){var r=t(n,e.key);return r<0?g(e.leftChild,n):r>0?g(e.rightChild,n):e}};this.find=function(e){var n=g(o,e);return void 0!==n&&void 0!==n.key&&0===t(n.key,e)};var m=function(e,n){if(e&&void 0!==e.key){var r=t(e.key,n);if(0===r)return e.key;if(r<0)return m(e.rightChild,n);var s=m(e.leftChild,n);return void 0!==s?s:e.key}};this.lowerBound=function(e){return m(o,e)};var y=function(e,n){if(e&&void 0!==e.key){if(t(e.key,n)<=0)return y(e.rightChild,n);var r=y(e.leftChild,n);return void 0!==r?r:e.key}};this.upperBound=function(e){return y(o,e)};var v=function(e,n){if(e&&void 0!==e.key){var r=t(e.key,n);if(0===r)return e.key;if(r>0)return v(e.leftChild,n);var s=v(e.rightChild,n);return void 0!==s?s:e.key}};this.reverseLowerBound=function(e){return v(o,e)};var b=function(e,n){if(e&&void 0!==e.key){if(t(e.key,n)>=0)return b(e.leftChild,n);var r=b(e.rightChild,n);return void 0!==r?r:e.key}};this.reverseUpperBound=function(e){return b(o,e)},this.union=function(e){var t=this;e.forEach((function(e){return t.insert(e)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(o)};var w=function(e){return r(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key?[5,s(w(e.leftChild))]:[2];case 1:return t.sent(),[4,e.key];case 2:return t.sent(),[5,s(w(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(o)},e.forEach((function(e){return n.insert(e)})),Object.freeze(this)}Object.freeze(a),n.default=a},{"../Base/TreeNode":25}],34:[function(e,t,n){function r(e){var t=this;void 0===e&&(e=[]);var n=0,r=[];this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,r.length=0},this.push=function(e){r.push(e),++n},this.pop=function(){r.pop(),n>0&&--n},this.top=function(){return r[n-1]},e.forEach((function(e){return t.push(e)})),Object.freeze(this)}Object.defineProperty(n,"__esModule",{value:!0}),Object.freeze(r),n.default=r},{}],35:[function(e,t,n){var r=this&&this.__generator||function(e,t){var n,r,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(t){return l([e,t])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,s,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){s={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return a},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,s=0,i=t.length;s<i;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function o(e){var t=this;void 0===e&&(e=[]);var n=0,o=[];this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,o.length=0},this.front=function(){if(!this.empty())return o[0]},this.back=function(){if(!this.empty())return o[n-1]},this.forEach=function(e){o.forEach(e)},this.getElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than vector's size");return o[e]},this.eraseElementByPos=function(e){if(e<0||e>=n)throw new Error("pos must more than 0 and less than vector's size");for(var t=e;t<n-1;++t)o[t]=o[t+1];this.popBack()},this.eraseElementByValue=function(e){var t=[];this.forEach((function(n){n!==e&&t.push(n)})),t.forEach((function(e,t){o[t]=e}));for(var r=t.length;n>r;)this.popBack()},this.pushBack=function(e){o.push(e),++n},this.popBack=function(){o.pop(),n>0&&--n},this.setElementByPos=function(e,t){if(e<0||e>=n)throw new Error("pos must more than 0 and less than vector's size");o[e]=t},this.insert=function(e,t,r){if(void 0===r&&(r=1),e<0||e>n)throw new Error("pos must more than 0 and less than or equal to vector's size");o.splice.apply(o,i([e,0],s(new Array(r).fill(t)),!1)),n+=r},this.find=function(e){return o.includes(e)},this.reverse=function(){o.reverse()},this.unique=function(){var e,t=[];this.forEach((function(n,r){0!==r&&n===e||(t.push(n),e=n)})),t.forEach((function(e,t){o[t]=e}));for(var r=t.length;n>r;)this.popBack()},this.sort=function(e){o.sort(e)},this[Symbol.iterator]=function(){return function(){return r(this,(function(e){switch(e.label){case 0:return[5,a(o)];case 1:return[2,e.sent()]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.defineProperty(n,"__esModule",{value:!0}),Object.freeze(o),n.default=o},{}],36:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.HashMap=n.HashSet=n.Map=n.Set=n.PriorityQueue=n.Deque=n.LinkList=n.Queue=n.Stack=n.Vector=void 0;var r=e("./Vector/Vector");n.Vector=r.default;var s=e("./Stack/Stack");n.Stack=s.default;var i=e("./Queue/Queue");n.Queue=i.default;var a=e("./LinkList/LinkList");n.LinkList=a.default;var o=e("./Deque/Deque");n.Deque=o.default;var l=e("./PriorityQueue/PriorityQueue");n.PriorityQueue=l.default;var c=e("./Set/Set");n.Set=c.default;var d=e("./Map/Map");n.Map=d.default;var u=e("./HashSet/HashSet");n.HashSet=u.default;var h=e("./HashMap/HashMap");n.HashMap=h.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(e,t,n){const r=e("yallist"),s=Symbol("max"),i=Symbol("length"),a=Symbol("lengthCalculator"),o=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),d=Symbol("noDisposeOnSet"),u=Symbol("lruList"),h=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1;class g{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[s]=e.max||1/0;const t=e.length||p;if(this[a]="function"!=typeof t?p:t,this[o]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[d]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[s]=e||1/0,v(this)}get max(){return this[s]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,v(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach((e=>{e.length=this[a](e.value,e.key),this[i]+=e.length}))),v(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t=t||this;for(let n=this[u].tail;null!==n;){const r=n.prev;C(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[u].head;null!==n;){const r=n.next;C(this,e,n,t),n=r}}keys(){return this[u].toArray().map((e=>e.key))}values(){return this[u].toArray().map((e=>e.value))}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[u]=new r,this[i]=0}dump(){return this[u].map((e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[u]}set(e,t,n){if((n=n||this[l])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,o=this[a](t,e);if(this[h].has(e)){if(o>this[s])return b(this,this[h].get(e)),!1;const a=this[h].get(e).value;return this[c]&&(this[d]||this[c](e,a.value)),a.now=r,a.maxAge=n,a.value=t,this[i]+=o-a.length,a.length=o,this.get(e),v(this),!0}const f=new w(e,t,o,r,n);return f.length>this[s]?(this[c]&&this[c](e,t),!1):(this[i]+=f.length,this[u].unshift(f),this[h].set(e,this[u].head),v(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[u].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],s=r.e||0;if(0===s)this.set(r.k,r.v);else{const e=s-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[h].forEach(((e,t)=>m(this,t,!1)))}}const m=(e,t,n)=>{const r=e[h].get(t);if(r){const t=r.value;if(y(e,t)){if(b(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[l]&&n>e[l]},v=e=>{if(e[i]>e[s])for(let t=e[u].tail;e[i]>e[s]&&null!==t;){const n=t.prev;b(e,t),t=n}},b=(e,t)=>{if(t){const n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[h].delete(n.key),e[u].removeNode(t)}};class w{constructor(e,t,n,r,s){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=s||0}}const C=(e,t,n,r)=>{let s=n.value;y(e,s)&&(b(e,n),e[o]||(s=void 0)),s&&t.call(r,s.value,s.key,e)};t.exports=g},{yallist:83}],38:[function(e,t,n){(function(e){(function(){const n=t.exports;n.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},n.codes={};for(const e in n.types){const t=n.types[e];n.codes[t]=e}n.CMD_SHIFT=4,n.CMD_MASK=240,n.DUP_MASK=8,n.QOS_MASK=3,n.QOS_SHIFT=1,n.RETAIN_MASK=1,n.VARBYTEINT_MASK=127,n.VARBYTEINT_FIN_MASK=128,n.VARBYTEINT_MAX=268435455,n.SESSIONPRESENT_MASK=1,n.SESSIONPRESENT_HEADER=e.from([n.SESSIONPRESENT_MASK]),n.CONNACK_HEADER=e.from([n.codes.connack<<n.CMD_SHIFT]),n.USERNAME_MASK=128,n.PASSWORD_MASK=64,n.WILL_RETAIN_MASK=32,n.WILL_QOS_MASK=24,n.WILL_QOS_SHIFT=3,n.WILL_FLAG_MASK=4,n.CLEAN_SESSION_MASK=2,n.CONNECT_HEADER=e.from([n.codes.connect<<n.CMD_SHIFT]),n.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},n.propertiesCodes={};for(const e in n.properties){const t=n.properties[e];n.propertiesCodes[t]=e}function r(t){return[0,1,2].map((r=>[0,1].map((s=>[0,1].map((i=>{const a=e.alloc(1);return a.writeUInt8(n.codes[t]<<n.CMD_SHIFT|(s?n.DUP_MASK:0)|r<<n.QOS_SHIFT|i,0,!0),a}))))))}n.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},n.PUBLISH_HEADER=r("publish"),n.SUBSCRIBE_HEADER=r("subscribe"),n.SUBSCRIBE_OPTIONS_QOS_MASK=3,n.SUBSCRIBE_OPTIONS_NL_MASK=1,n.SUBSCRIBE_OPTIONS_NL_SHIFT=2,n.SUBSCRIBE_OPTIONS_RAP_MASK=1,n.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,n.SUBSCRIBE_OPTIONS_RH_MASK=3,n.SUBSCRIBE_OPTIONS_RH_SHIFT=4,n.SUBSCRIBE_OPTIONS_RH=[0,16,32],n.SUBSCRIBE_OPTIONS_NL=4,n.SUBSCRIBE_OPTIONS_RAP=8,n.SUBSCRIBE_OPTIONS_QOS=[0,1,2],n.UNSUBSCRIBE_HEADER=r("unsubscribe"),n.ACKS={unsuback:r("unsuback"),puback:r("puback"),pubcomp:r("pubcomp"),pubrel:r("pubrel"),pubrec:r("pubrec")},n.SUBACK_HEADER=e.from([n.codes.suback<<n.CMD_SHIFT]),n.VERSION3=e.from([3]),n.VERSION4=e.from([4]),n.VERSION5=e.from([5]),n.VERSION131=e.from([131]),n.VERSION132=e.from([132]),n.QOS=[0,1,2].map((t=>e.from([t]))),n.EMPTY={pingreq:e.from([n.codes.pingreq<<4,0]),pingresp:e.from([n.codes.pingresp<<4,0]),disconnect:e.from([n.codes.disconnect<<4,0])}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],39:[function(e,t,n){(function(n){(function(){const r=e("./writeToStream"),s=e("events");function i(e,t){const n=new a;return r(e,n,t),n.concat()}class a extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),r=this._array;let s,i=0;for(s=0;s<r.length&&void 0!==r[s];s++)"string"!=typeof r[s]?t[s]=r[s].length:t[s]=n.byteLength(r[s]),e+=t[s];const a=n.allocUnsafe(e);for(s=0;s<r.length&&void 0!==r[s];s++)"string"!=typeof r[s]?(r[s].copy(a,i),i+=t[s]):(a.write(r[s],i),i+=t[s]);return a}}t.exports=i}).call(this)}).call(this,e("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(e,t,n){n.parser=e("./parser").parser,n.generate=e("./generate"),n.writeToStream=e("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(e,t,n){(function(e){(function(){const n=65536,r={},s=e.isBuffer(e.from([1,2]).subarray(0,1));function i(t){const n=e.allocUnsafe(2);return n.writeUInt8(t>>8,0),n.writeUInt8(255&t,1),n}function a(){for(let e=0;e<n;e++)r[e]=i(e)}function o(t){const n=4;let r=0,i=0;const a=e.allocUnsafe(n);do{r=t%128|0,(t=t/128|0)>0&&(r|=128),a.writeUInt8(r,i++)}while(t>0&&i<n);return t>0&&(i=0),s?a.subarray(0,i):a.slice(0,i)}function l(t){const n=e.allocUnsafe(4);return n.writeUInt32BE(t,0),n}t.exports={cache:r,generateCache:a,generateNumber:i,genBufVariableByteInt:o,generate4ByteBuffer:l}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],42:[function(e,t,n){class r{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}t.exports=r},{}],43:[function(e,t,n){const r=e("bl"),s=e("events"),i=e("./packet"),a=e("./constants"),o=e("debug")("mqtt-packet:parser");class l extends s{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof l?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new l).parser(e)}_resetState(){o("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new i,this.error=null,this._list=r(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),o("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,o("parse: state complete. _stateCounter is now: %d",this._stateCounter),o("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return o("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),o("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),o("_parseLength %d",e.value),!!e}_parsePayload(){o("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return o("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,n,r;o("_parseConnect");const s={},i=this.packet,l=this._parseString();if(null===l)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==l&&"MQIsdp"!==l)return this._emitError(new Error("Invalid protocolId"));if(i.protocolId=l,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.protocolVersion=this._list.readUInt8(this._pos),i.protocolVersion>=128&&(i.bridgeMode=!0,i.protocolVersion=i.protocolVersion-128),3!==i.protocolVersion&&4!==i.protocolVersion&&5!==i.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(i.will={},i.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),i.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),i.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,i.keepalive=this._parseNum(),-1===i.keepalive)return this._emitError(new Error("Packet too short"));if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.properties=e)}const c=this._parseString();if(null===c)return this._emitError(new Error("Packet too short"));if(i.clientId=c,o("_parseConnect: packet.clientId: %s",i.clientId),s.will){if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(i.will.topic=e,o("_parseConnect: packet.will.topic: %s",i.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));i.will.payload=t,o("_parseConnect: packet.will.paylaod: %s",i.will.payload)}if(s.username){if(r=this._parseString(),null===r)return this._emitError(new Error("Cannot parse username"));i.username=r,o("_parseConnect: packet.username: %s",i.username)}if(s.password){if(n=this._parseBuffer(),null===n)return this._emitError(new Error("Cannot parse password"));i.password=n}return this.settings=i,o("_parseConnect: complete"),i}_parseConnack(){o("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}o("_parseConnack: complete")}_parsePublish(){o("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),o("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){o("_parseSubscribe");const e=this.packet;let t,n,r,s,i,l,c;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));n=this._parseByte(),r=n&a.SUBSCRIBE_OPTIONS_QOS_MASK,l=0!=(n>>a.SUBSCRIBE_OPTIONS_NL_SHIFT&a.SUBSCRIBE_OPTIONS_NL_MASK),i=0!=(n>>a.SUBSCRIBE_OPTIONS_RAP_SHIFT&a.SUBSCRIBE_OPTIONS_RAP_MASK),s=n>>a.SUBSCRIBE_OPTIONS_RH_SHIFT&a.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:t,qos:r},5===this.settings.protocolVersion?(c.nl=l,c.rap=i,c.rh=s):this.settings.bridgeMode&&(c.rh=0,c.rap=!0,c.nl=!0),o("_parseSubscribe: push subscription `%s` to subscription",c),e.subscriptions.push(c)}}}_parseSuback(){o("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){o("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));o("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){o("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){o("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),o("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(o("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return o("_parseDisconnect result: true"),!0}_parseAuth(){o("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),o("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(o("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),n=t+this._pos;if(-1===t||n>this._list.length||n>this.packet.length)return null;const r=this._list.toString("utf8",this._pos,n);return this._pos+=t,o("_parseString: result: %s",r),r}_parseStringPair(){return o("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const n=this._list.slice(this._pos,t);return this._pos+=e,o("_parseBuffer: result: %o",n),n}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,o("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,o("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){o("_parseVarByteNum");const t=4;let n,r=0,s=1,i=0,l=!1;const c=this._pos?this._pos:0;for(;r<t&&c+r<this._list.length;){if(n=this._list.readUInt8(c+r++),i+=s*(n&a.VARBYTEINT_MASK),s*=128,0==(n&a.VARBYTEINT_FIN_MASK)){l=!0;break}if(this._list.length<=r)break}return!l&&r===t&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=r),l=!!l&&(e?{bytes:r,value:i}:i),o("_parseVarByteNum: result: %o",l),l}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),o("_parseByte: result: %o",e),e}_parseByType(e){switch(o("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){o("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,n={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=a.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)n[t]?(Array.isArray(n[t])||(n[t]=[n[t]]),n[t].push(this._parseByType(a.propertiesTypes[t]))):n[t]=this._parseByType(a.propertiesTypes[t]);else{n[t]||(n[t]=Object.create(null));const e=this._parseByType(a.propertiesTypes[t]);if(n[t][e.name])if(Array.isArray(n[t][e.name]))n[t][e.name].push(e.value);else{const r=n[t][e.name];n[t][e.name]=[r],n[t][e.name].push(e.value)}else n[t][e.name]=e.value}}return n}_newPacket(){return o("_newPacket"),this.packet&&(this._list.consume(this.packet.length),o("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),o("_newPacket: new packet"),this.packet=new i,this._pos=0,!0}_emitError(e){o("_emitError"),this.error=e,this.emit("error",e)}}t.exports=l},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(e,t,n){(function(n){(function(){const r=e("./constants"),s=n.allocUnsafe(0),i=n.from([0]),a=e("./numbers"),o=e("process-nextick-args").nextTick,l=e("debug")("mqtt-packet:writeToStream"),c=a.cache,d=a.generateNumber,u=a.generateCache,h=a.genBufVariableByteInt,f=a.generate4ByteBuffer;let p=x,g=!0;function m(e,t,n){switch(l("generate called"),t.cork&&(t.cork(),o(y,t)),g&&(g=!1,u()),l("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return v(e,t);case"connack":return b(e,t,n);case"publish":return w(e,t,n);case"puback":case"pubrec":case"pubrel":case"pubcomp":return C(e,t,n);case"subscribe":return S(e,t,n);case"suback":return E(e,t,n);case"unsubscribe":return T(e,t,n);case"unsuback":return I(e,t,n);case"pingreq":case"pingresp":return k(e,t);case"disconnect":return A(e,t,n);case"auth":return _(e,t,n);default:return t.emit("error",new Error("Unknown command")),!1}}function y(e){e.uncork()}function v(e,t,s){const i=e||{},a=i.protocolId||"MQTT";let o=i.protocolVersion||4;const l=i.will;let c=i.clean;const d=i.keepalive||0,u=i.clientId||"",h=i.username,f=i.password,g=i.properties;void 0===c&&(c=!0);let m=0;if(!a||"string"!=typeof a&&!n.isBuffer(a))return t.emit("error",new Error("Invalid protocolId")),!1;if(m+=a.length+2,3!==o&&4!==o&&5!==o)return t.emit("error",new Error("Invalid protocol version")),!1;if(m+=1,("string"==typeof u||n.isBuffer(u))&&(u||o>=4)&&(u||c))m+=n.byteLength(u)+2;else{if(o<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*c==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof d||d<0||d>65535||d%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;if(m+=2,m+=1,5===o){var y=U(t,g);if(!y)return!1;m+=y.length}if(l){if("object"!=typeof l)return t.emit("error",new Error("Invalid will")),!1;if(!l.topic||"string"!=typeof l.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(m+=n.byteLength(l.topic)+2,m+=2,l.payload){if(!(l.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof l.payload?m+=n.byteLength(l.payload):m+=l.payload.length}var v={};if(5===o){if(!(v=U(t,l.properties)))return!1;m+=v.length}}let b=!1;if(null!=h){if(!q(h))return t.emit("error",new Error("Invalid username")),!1;b=!0,m+=n.byteLength(h)+2}if(null!=f){if(!b)return t.emit("error",new Error("Username is required to use password")),!1;if(!q(f))return t.emit("error",new Error("Invalid password")),!1;m+=$(f)+2}t.write(r.CONNECT_HEADER),O(t,m),F(t,a),i.bridgeMode&&(o+=128),t.write(131===o?r.VERSION131:132===o?r.VERSION132:4===o?r.VERSION4:5===o?r.VERSION5:r.VERSION3);let w=0;return w|=null!=h?r.USERNAME_MASK:0,w|=null!=f?r.PASSWORD_MASK:0,w|=l&&l.retain?r.WILL_RETAIN_MASK:0,w|=l&&l.qos?l.qos<<r.WILL_QOS_SHIFT:0,w|=l?r.WILL_FLAG_MASK:0,w|=c?r.CLEAN_SESSION_MASK:0,t.write(n.from([w])),p(t,d),5===o&&y.write(),F(t,u),l&&(5===o&&v.write(),L(t,l.topic),F(t,l.payload)),null!=h&&F(t,h),null!=f&&F(t,f),!0}function b(e,t,s){const a=s?s.protocolVersion:4,o=e||{},l=5===a?o.reasonCode:o.returnCode,c=o.properties;let d=2;if("number"!=typeof l)return t.emit("error",new Error("Invalid return code")),!1;let u=null;if(5===a){if(u=U(t,c),!u)return!1;d+=u.length}return t.write(r.CONNACK_HEADER),O(t,d),t.write(o.sessionPresent?r.SESSIONPRESENT_HEADER:i),t.write(n.from([l])),null!=u&&u.write(),!0}function w(e,t,i){l("publish: packet: %o",e);const a=i?i.protocolVersion:4,o=e||{},c=o.qos||0,d=o.retain?r.RETAIN_MASK:0,u=o.topic,h=o.payload||s,f=o.messageId,g=o.properties;let m=0;if("string"==typeof u)m+=n.byteLength(u)+2;else{if(!n.isBuffer(u))return t.emit("error",new Error("Invalid topic")),!1;m+=u.length+2}if(n.isBuffer(h)?m+=h.length:m+=n.byteLength(h),c&&"number"!=typeof f)return t.emit("error",new Error("Invalid messageId")),!1;c&&(m+=2);let y=null;if(5===a){if(y=U(t,g),!y)return!1;m+=y.length}return t.write(r.PUBLISH_HEADER[c][o.dup?1:0][d?1:0]),O(t,m),p(t,$(u)),t.write(u),c>0&&p(t,f),null!=y&&y.write(),l("publish: payload: %o",h),t.write(h)}function C(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.cmd||"puback",l=a.messageId,c=a.dup&&"pubrel"===o?r.DUP_MASK:0;let d=0;const u=a.reasonCode,h=a.properties;let f=5===i?3:2;if("pubrel"===o&&(d=1),"number"!=typeof l)return t.emit("error",new Error("Invalid messageId")),!1;let g=null;if(5===i&&"object"==typeof h){if(g=N(t,h,s,f),!g)return!1;f+=g.length}return t.write(r.ACKS[o][d][c][0]),O(t,f),p(t,l),5===i&&t.write(n.from([u])),null!==g&&g.write(),!0}function S(e,t,s){l("subscribe: packet: ");const i=s?s.protocolVersion:4,a=e||{},o=a.dup?r.DUP_MASK:0,c=a.messageId,d=a.subscriptions,u=a.properties;let h=0;if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;let f=null;if(5===i){if(f=U(t,u),!f)return!1;h+=f.length}if("object"!=typeof d||!d.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<d.length;e+=1){const r=d[e].topic,s=d[e].qos;if("string"!=typeof r)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof s)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===i){if("boolean"!=typeof(d[e].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(d[e].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const n=d[e].rh||0;if("number"!=typeof n||n>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}h+=n.byteLength(r)+2+1}l("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),t.write(r.SUBSCRIBE_HEADER[1][o?1:0][0]),O(t,h),p(t,c),null!==f&&f.write();let g=!0;for(const e of d){const s=e.topic,a=e.qos,o=+e.nl,l=+e.rap,c=e.rh;let d;L(t,s),d=r.SUBSCRIBE_OPTIONS_QOS[a],5===i&&(d|=o?r.SUBSCRIBE_OPTIONS_NL:0,d|=l?r.SUBSCRIBE_OPTIONS_RAP:0,d|=c?r.SUBSCRIBE_OPTIONS_RH[c]:0),g=t.write(n.from([d]))}return g}function E(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.messageId,l=a.granted,c=a.properties;let d=0;if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;if(d+=2,"object"!=typeof l||!l.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<l.length;e+=1){if("number"!=typeof l[e])return t.emit("error",new Error("Invalid qos vector")),!1;d+=1}let u=null;if(5===i){if(u=N(t,c,s,d),!u)return!1;d+=u.length}return t.write(r.SUBACK_HEADER),O(t,d),p(t,o),null!==u&&u.write(),t.write(n.from(l))}function T(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.messageId,l=a.dup?r.DUP_MASK:0,c=a.unsubscriptions,d=a.properties;let u=0;if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;if(u+=2,"object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<c.length;e+=1){if("string"!=typeof c[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;u+=n.byteLength(c[e])+2}let h=null;if(5===i){if(h=U(t,d),!h)return!1;u+=h.length}t.write(r.UNSUBSCRIBE_HEADER[1][l?1:0][0]),O(t,u),p(t,o),null!==h&&h.write();let f=!0;for(let e=0;e<c.length;e++)f=L(t,c[e]);return f}function I(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.messageId,l=a.dup?r.DUP_MASK:0,c=a.granted,d=a.properties,u=a.cmd,h=0;let f=2;if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;if(5===i){if("object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<c.length;e+=1){if("number"!=typeof c[e])return t.emit("error",new Error("Invalid qos vector")),!1;f+=1}}let g=null;if(5===i){if(g=N(t,d,s,f),!g)return!1;f+=g.length}return t.write(r.ACKS[u][h][l][0]),O(t,f),p(t,o),null!==g&&g.write(),5===i&&t.write(n.from(c)),!0}function k(e,t,n){return t.write(r.EMPTY[e.cmd])}function A(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.reasonCode,l=a.properties;let c=5===i?1:0,d=null;if(5===i){if(d=N(t,l,s,c),!d)return!1;c+=d.length}return t.write(n.from([r.codes.disconnect<<4])),O(t,c),5===i&&t.write(n.from([o])),null!==d&&d.write(),!0}function _(e,t,s){const i=s?s.protocolVersion:4,a=e||{},o=a.reasonCode,l=a.properties;let c=5===i?1:0;5!==i&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const d=N(t,l,s,c);return!!d&&(c+=d.length,t.write(n.from([r.codes.auth<<4])),O(t,c),t.write(n.from([o])),null!==d&&d.write(),!0)}Object.defineProperty(m,"cacheNumbers",{get:()=>p===x,set(e){e?(c&&0!==Object.keys(c).length||(g=!0),p=x):(g=!1,p=P)}});const R={};function O(e,t){if(t>r.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let n=R[t];return n||(n=h(t),t<16384&&(R[t]=n)),l("writeVarByteInt: writing to stream: %o",n),e.write(n)}function L(e,t){const r=n.byteLength(t);return p(e,r),l("writeString: %s",t),e.write(t,"utf8")}function D(e,t,n){L(e,t),L(e,n)}function x(e,t){return l("writeNumberCached: number: %d",t),l("writeNumberCached: %o",c[t]),e.write(c[t])}function P(e,t){const n=d(t);return l("writeNumberGenerated: %o",n),e.write(n)}function M(e,t){const n=f(t);return l("write4ByteNumber: %o",n),e.write(n)}function F(e,t){"string"==typeof t?L(e,t):t?(p(e,t.length),e.write(t)):p(e,0)}function U(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){j(e,{},0)}};let s=0;function i(t,s){let i=0;switch(r.propertiesTypes[t]){case"byte":if("boolean"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=2;break;case"int8":if("number"!=typeof s||s<0||s>255)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=2;break;case"binary":if(s&&null===s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=1+n.byteLength(s)+2;break;case"int16":if("number"!=typeof s||s<0||s>65535)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=3;break;case"int32":if("number"!=typeof s||s<0||s>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=5;break;case"var":if("number"!=typeof s||s<0||s>268435455)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=1+n.byteLength(h(s));break;case"string":if("string"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=3+n.byteLength(s.toString());break;case"pair":if("object"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=Object.getOwnPropertyNames(s).reduce(((e,t)=>{const r=s[t];return Array.isArray(r)?e+=r.reduce(((e,r)=>e+=3+n.byteLength(t.toString())+2+n.byteLength(r.toString())),0):e+=3+n.byteLength(t.toString())+2+n.byteLength(s[t].toString()),e}),0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${s}`)),!1}return i}if(t)for(const e in t){let n=0,r=0;const a=t[e];if(Array.isArray(a))for(let t=0;t<a.length;t++){if(r=i(e,a[t]),!r)return!1;n+=r}else{if(r=i(e,a),!r)return!1;n=r}if(!n)return!1;s+=n}return{length:n.byteLength(h(s))+s,write(){j(e,t,s)}}}function N(e,t,n,r){const s=["reasonString","userProperties"],i=n&&n.properties&&n.properties.maximumPacketSize?n.properties.maximumPacketSize:0;let a=U(e,t);if(i)for(;r+a.length>i;){const n=s.shift();if(!n||!t[n])return!1;delete t[n],a=U(e,t)}return a}function B(e,t,s){switch(r.propertiesTypes[t]){case"byte":e.write(n.from([r.properties[t]])),e.write(n.from([+s]));break;case"int8":e.write(n.from([r.properties[t]])),e.write(n.from([s]));break;case"binary":e.write(n.from([r.properties[t]])),F(e,s);break;case"int16":e.write(n.from([r.properties[t]])),p(e,s);break;case"int32":e.write(n.from([r.properties[t]])),M(e,s);break;case"var":e.write(n.from([r.properties[t]])),O(e,s);break;case"string":e.write(n.from([r.properties[t]])),L(e,s);break;case"pair":Object.getOwnPropertyNames(s).forEach((i=>{const a=s[i];Array.isArray(a)?a.forEach((s=>{e.write(n.from([r.properties[t]])),D(e,i.toString(),s.toString())})):(e.write(n.from([r.properties[t]])),D(e,i.toString(),a.toString()))}));break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${s}`)),!1}}function j(e,t,n){O(e,n);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&null!==t[n]){const r=t[n];if(Array.isArray(r))for(let t=0;t<r.length;t++)B(e,n,r[t]);else B(e,n,r)}}function $(e){return e?e instanceof n?e.length:n.byteLength(e):0}function q(e){return"string"==typeof e||e instanceof n}t.exports=m}).call(this)}).call(this,e("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(e,t,n){var r=1e3,s=60*r,i=60*s,a=24*i,o=7*a,l=365.25*a;function c(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*o;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function d(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+"d":t>=i?Math.round(e/i)+"h":t>=s?Math.round(e/s)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}function u(e){var t=Math.abs(e);return t>=a?h(e,t,a,"day"):t>=i?h(e,t,i,"hour"):t>=s?h(e,t,s,"minute"):t>=r?h(e,t,r,"second"):e+" ms"}function h(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return c(e);if("number"===n&&isFinite(e))return t.long?u(e):d(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],46:[function(e,t,n){const r=e("./lib/number-allocator.js");t.exports.NumberAllocator=r},{"./lib/number-allocator.js":47}],47:[function(e,t,n){const r=e("js-sdsl").Set,s=e("debug")("number-allocator:trace"),i=e("debug")("number-allocator:error");function a(e,t){this.low=e,this.high=t}function o(e,t){if(!(this instanceof o))return new o(e,t);this.min=e,this.max=t,this.ss=new r([],((e,t)=>e.compare(t))),s("Create"),this.clear()}a.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},a.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},o.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},o.prototype.alloc=function(){if(0===this.ss.size())return s("alloc():empty"),null;const e=this.ss.front(),t=e.low;return t+1<=e.high?++e.low:this.ss.eraseElementByPos(0),s("alloc():"+t),t},o.prototype.use=function(e){const t=new a(e,e),n=this.ss.lowerBound(t);if(n){if(n.equals(t))return this.ss.eraseElementByValue(n),s("use():"+e),!0;if(n.low>e)return!1;if(n.low===e)return++n.low,s("use():"+e),!0;if(n.high===e)return--n.high,s("use():"+e),!0;const r=n.low;return n.low=e+1,this.ss.insert(new a(r,e-1)),s("use():"+e),!0}return s("use():failed"),!1},o.prototype.free=function(e){if(e<this.min||e>this.max)return void i("free():"+e+" is out of range");const t=new a(e,e),n=this.ss.lowerBound(t);if(n){if(n.low<=e&&e<=n.high)return void i("free():"+e+" has already been vacant");if(n===this.ss.front())e+1===n.low?--n.low:this.ss.insert(t);else{const r=this.ss.reverseLowerBound(t);r.high+1===e?e+1===n.low?(this.ss.eraseElementByValue(r),n.low=r.low):r.high=e:e+1===n.low?n.low=e:this.ss.insert(t)}}else{if(n===this.ss.front())return void this.ss.insert(t);const r=this.ss.reverseLowerBound(t);r.high+1===e?r.high=e:this.ss.insert(t)}s("free():"+e)},o.prototype.clear=function(){s("clear()"),this.ss.clear(),this.ss.insert(new a(this.min,this.max))},o.prototype.intervalCount=function(){return this.ss.size()},o.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},t.exports=o},{debug:18,"js-sdsl":36}],48:[function(e,t,n){var r=e("wrappy");function s(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}t.exports=r(s),t.exports.strict=r(i),s.proto=s((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return s(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})}))},{wrappy:79}],49:[function(e,t,n){(function(e){(function(){function n(t,n,r,s){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,a,o=arguments.length;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,n)}));case 3:return e.nextTick((function(){t.call(null,n,r)}));case 4:return e.nextTick((function(){t.call(null,n,r,s)}));default:for(i=new Array(o-1),a=0;a<i.length;)i[a++]=arguments[a];return e.nextTick((function(){t.apply(null,i)}))}}void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:n}:t.exports=e}).call(this)}).call(this,e("_process"))},{_process:50}],50:[function(e,t,n){var r,s,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}function c(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{return s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var d,u=[],h=!1,f=-1;function p(){h&&d&&(h=!1,d.length?u=d.concat(u):f=-1,u.length&&g())}function g(){if(!h){var e=l(p);h=!0;for(var t=u.length;t;){for(d=u,u=[];++f<t;)d&&d[f].run();f=-1,t=u.length}d=null,h=!1,c(e)}}function m(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||h||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],51:[function(e,t,n){(function(e){(function(){!function(r){var s="object"==typeof n&&n&&!n.nodeType&&n,i="object"==typeof t&&t&&!t.nodeType&&t,a="object"==typeof e&&e;a.global!==a&&a.window!==a&&a.self!==a||(r=a);var o,l,c=2147483647,d=36,u=1,h=26,f=38,p=700,g=72,m=128,y="-",v=/^xn--/,b=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=d-u,E=Math.floor,T=String.fromCharCode;function I(e){throw new RangeError(C[e])}function k(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function A(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+k((e=e.replace(w,".")).split("."),t).join(".")}function _(e){for(var t,n,r=[],s=0,i=e.length;s<i;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<i?56320==(64512&(n=e.charCodeAt(s++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),s--):r.push(t);return r}function R(e){return k(e,(function(e){var t="";return e>65535&&(t+=T((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=T(e)})).join("")}function O(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:d}function L(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function D(e,t,n){var r=0;for(e=n?E(e/p):e>>1,e+=E(e/t);e>S*h>>1;r+=d)e=E(e/S);return E(r+(S+1)*e/(e+f))}function x(e){var t,n,r,s,i,a,o,l,f,p,v=[],b=e.length,w=0,C=m,S=g;for((n=e.lastIndexOf(y))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&I("not-basic"),v.push(e.charCodeAt(r));for(s=n>0?n+1:0;s<b;){for(i=w,a=1,o=d;s>=b&&I("invalid-input"),((l=O(e.charCodeAt(s++)))>=d||l>E((c-w)/a))&&I("overflow"),w+=l*a,!(l<(f=o<=S?u:o>=S+h?h:o-S));o+=d)a>E(c/(p=d-f))&&I("overflow"),a*=p;S=D(w-i,t=v.length+1,0==i),E(w/t)>c-C&&I("overflow"),C+=E(w/t),w%=t,v.splice(w++,0,C)}return R(v)}function P(e){var t,n,r,s,i,a,o,l,f,p,v,b,w,C,S,k=[];for(b=(e=_(e)).length,t=m,n=0,i=g,a=0;a<b;++a)(v=e[a])<128&&k.push(T(v));for(r=s=k.length,s&&k.push(y);r<b;){for(o=c,a=0;a<b;++a)(v=e[a])>=t&&v<o&&(o=v);for(o-t>E((c-n)/(w=r+1))&&I("overflow"),n+=(o-t)*w,t=o,a=0;a<b;++a)if((v=e[a])<t&&++n>c&&I("overflow"),v==t){for(l=n,f=d;!(l<(p=f<=i?u:f>=i+h?h:f-i));f+=d)S=l-p,C=d-p,k.push(T(L(p+S%C,0))),l=E(S/C);k.push(T(L(l,0))),i=D(n,w,r==s),n=0,++r}++n,++t}return k.join("")}function M(e){return A(e,(function(e){return v.test(e)?x(e.slice(4).toLowerCase()):e}))}function F(e){return A(e,(function(e){return b.test(e)?"xn--"+P(e):e}))}if(o={version:"1.4.1",ucs2:{decode:_,encode:R},decode:x,encode:P,toASCII:F,toUnicode:M},s&&i)if(t.exports==s)i.exports=o;else for(l in o)o.hasOwnProperty(l)&&(s[l]=o[l]);else r.punycode=o}(this)}).call(this)}).call(this,void 0!==pt?pt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],52:[function(e,t,n){function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var c=e.length;l>0&&c>l&&(c=l);for(var d=0;d<c;++d){var u,h,f,p,g=e[d].replace(o,"%20"),m=g.indexOf(n);m>=0?(u=g.substr(0,m),h=g.substr(m+1)):(u=g,h=""),f=decodeURIComponent(u),p=decodeURIComponent(h),r(a,f)?s(a[f])?a[f].push(p):a[f]=[a[f],p]:a[f]=p}return a};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],53:[function(e,t,n){var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,o){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),(function(a){var o=encodeURIComponent(r(a))+n;return s(e[a])?i(e[a],(function(e){return o+encodeURIComponent(r(e))})).join(t):o+encodeURIComponent(r(e[a]))})).join(t):o?encodeURIComponent(r(o))+n+encodeURIComponent(r(e)):""};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var a=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],54:[function(e,t,n){n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":52,"./encode":53}],55:[function(e,t,n){function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var s={};function i(e,t,n){function i(e,n,r){return"string"==typeof t?t:t(e,n,r)}n||(n=Error);var a=function(e){function t(t,n,r){return e.call(this,i(t,n,r))||this}return r(t,e),t}(n);a.prototype.name=n.name,a.prototype.code=e,s[e]=a}function a(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function o(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function l(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function c(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,s;if("string"==typeof t&&o(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be",l(e," argument"))s="The ".concat(e," ").concat(r," ").concat(a(t,"type"));else{var i=c(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(i," ").concat(r," ").concat(a(t,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=s},{}],56:[function(e,t,n){(function(n){(function(){var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=c;var s=e("./_stream_readable"),i=e("./_stream_writable");e("inherits")(c,s);for(var a=r(i.prototype),o=0;o<a.length;o++){var l=a[o];c.prototype[l]||(c.prototype[l]=i.prototype[l])}function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||n.nextTick(u,this)}function u(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(e,t,n){t.exports=s;var r=e("./_stream_transform");function s(e){if(!(this instanceof s))return new s(e);r.call(this,e)}e("inherits")(s,r),s.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":59,inherits:24}],58:[function(e,t,n){(function(n,r){(function(){var s;t.exports=_,_.ReadableState=A,e("events").EventEmitter;var i=function(e,t){return e.listeners(t).length},a=e("./internal/streams/stream"),o=e("buffer").Buffer,l=r.Uint8Array||function(){};function c(e){return o.from(e)}function d(e){return o.isBuffer(e)||e instanceof l}var u,h=e("util");u=h&&h.debuglog?h.debuglog("stream"):function(){};var f,p,g,m=e("./internal/streams/buffer_list"),y=e("./internal/streams/destroy"),v=e("./internal/streams/state").getHighWaterMark,b=e("../errors").codes,w=b.ERR_INVALID_ARG_TYPE,C=b.ERR_STREAM_PUSH_AFTER_EOF,S=b.ERR_METHOD_NOT_IMPLEMENTED,E=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(_,a);var T=y.errorOrDestroy,I=["error","close","destroy","pause","resume"];function k(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function A(t,n,r){s=s||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof s),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=v(this,t,"readableHighWaterMark",r),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=e("string_decoder/").StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function _(t){if(s=s||e("./_stream_duplex"),!(this instanceof _))return new _(t);var n=this instanceof s;this._readableState=new A(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function R(e,t,n,r,s){u("readableAddChunk",t);var i,a=e._readableState;if(null===t)a.reading=!1,M(e,a);else if(s||(i=L(a,t)),i)T(e,i);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=c(t)),r)a.endEmitted?T(e,new E):O(e,a,t,!0);else if(a.ended)T(e,new C);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?O(e,a,t,!1):N(e,a)):O(e,a,t,!1)}else r||(a.reading=!1,N(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function O(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&F(e)),N(e,t)}function L(e,t){var n;return d(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new w("chunk",["string","Buffer","Uint8Array"],t)),n}Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),_.prototype.destroy=y.destroy,_.prototype._undestroy=y.undestroy,_.prototype._destroy=function(e,t){t(e)},_.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=o.from(e,t),t=""),n=!0),R(this,e,t,!1,n)},_.prototype.unshift=function(e){return R(this,e,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(t){f||(f=e("string_decoder/").StringDecoder);var n=new f(t);this._readableState.decoder=n,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,s="";null!==r;)s+=n.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==s&&this._readableState.buffer.push(s),this._readableState.length=s.length,this};var D=1073741824;function x(e){return e>=D?e=D:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function P(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=x(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e,t){if(u("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,U(e)))}}function F(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,H(e)}function N(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(B,e,t))}function B(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(u("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function j(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,H(e))}}function $(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function q(e){u("readable nexttick read 0"),e.read(0)}function K(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(G,e,t))}function G(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),H(e),t.flowing&&!t.reading&&e.read(0)}function H(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function V(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function z(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(W,t,e))}function W(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function Y(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}_.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?z(this):F(this),null;if(0===(e=P(e,t))&&t.ended)return 0===t.length&&z(this),null;var r,s=t.needReadable;return u("need readable",s),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",s=!0),t.ended||t.reading?u("reading or ended",s=!1):s&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=P(n,t))),null===(r=e>0?V(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&z(this)),null!==r&&this.emit("data",r),r},_.prototype._read=function(e){T(this,new S("_read()"))},_.prototype.pipe=function(e,t){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,u("pipe count=%d opts=%j",s.pipesCount,t);var a=t&&!1===t.end||e===n.stdout||e===n.stderr?y:l;function o(e,t){u("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){u("onend"),e.end()}s.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",o);var c=j(r);e.on("drain",c);var d=!1;function h(){u("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",o),r.removeListener("end",l),r.removeListener("end",y),r.removeListener("data",f),d=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function f(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==Y(s.pipes,e))&&!d&&(u("false write response, pause",s.awaitDrain),s.awaitDrain++),r.pause())}function p(t){u("onerror",t),y(),e.removeListener("error",p),0===i(e,"error")&&T(e,t)}function g(){e.removeListener("finish",m),y()}function m(){u("onfinish"),e.removeListener("close",g),y()}function y(){u("unpipe"),r.unpipe(e)}return r.on("data",f),k(e,"error",p),e.once("close",g),e.once("finish",m),e.emit("pipe",r),s.flowing||(u("pipe resume"),r.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<s;i++)r[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=Y(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},_.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),s=this._readableState;return"data"===e?(s.readableListening=this.listenerCount("readable")>0,!1!==s.flowing&&this.resume()):"readable"===e&&(s.endEmitted||s.readableListening||(s.readableListening=s.needReadable=!0,s.flowing=!1,s.emittedReadable=!1,u("on readable",s.length,s.reading),s.length?F(this):s.reading||n.nextTick(q,this))),r},_.prototype.addListener=_.prototype.on,_.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick($,this),r},_.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick($,this),t},_.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,K(this,e)),e.paused=!1,this},_.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},_.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var s in e.on("end",(function(){if(u("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(s){u("wrapped data"),n.decoder&&(s=n.decoder.write(s)),n.objectMode&&null==s||(n.objectMode||s&&s.length)&&(t.push(s)||(r=!0,e.pause()))})),e)void 0===this[s]&&"function"==typeof e[s]&&(this[s]=function(t){return function(){return e[t].apply(e,arguments)}}(s));for(var i=0;i<I.length;i++)e.on(I[i],this.emit.bind(this,I[i]));return this._read=function(t){u("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(_.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=e("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(_.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(_.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),_._fromList=V,Object.defineProperty(_.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(_.from=function(t,n){return void 0===g&&(g=e("./internal/streams/from")),g(_,t,n)})}).call(this)}).call(this,e("_process"),void 0!==pt?pt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(e,t,n){t.exports=d;var r=e("../errors").codes,s=r.ERR_METHOD_NOT_IMPLEMENTED,i=r.ERR_MULTIPLE_CALLBACK,a=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=r.ERR_TRANSFORM_WITH_LENGTH_0,l=e("./_stream_duplex");function c(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new i);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function d(e){if(!(this instanceof d))return new d(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",u)}function u(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,n){h(e,t,n)}))}function h(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new o;if(e._transformState.transforming)throw new a;return e.push(null)}e("inherits")(d,l),d.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},d.prototype._transform=function(e,t,n){n(new s("_transform()"))},d.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var s=this._readableState;(r.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}},d.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},d.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(e,t,n){(function(n,r){(function(){function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){G(t,e)}}var i;t.exports=A,A.WritableState=k;var a={deprecate:e("util-deprecate")},o=e("./internal/streams/stream"),l=e("buffer").Buffer,c=r.Uint8Array||function(){};function d(e){return l.from(e)}function u(e){return l.isBuffer(e)||e instanceof c}var h,f=e("./internal/streams/destroy"),p=e("./internal/streams/state").getHighWaterMark,g=e("../errors").codes,m=g.ERR_INVALID_ARG_TYPE,y=g.ERR_METHOD_NOT_IMPLEMENTED,v=g.ERR_MULTIPLE_CALLBACK,b=g.ERR_STREAM_CANNOT_PIPE,w=g.ERR_STREAM_DESTROYED,C=g.ERR_STREAM_NULL_VALUES,S=g.ERR_STREAM_WRITE_AFTER_END,E=g.ERR_UNKNOWN_ENCODING,T=f.errorOrDestroy;function I(){}function k(t,n,r){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){M(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function A(t){var n=this instanceof(i=i||e("./_stream_duplex"));if(!n&&!h.call(A,this))return new A(t);this._writableState=new k(t,this,n),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function _(e,t){var r=new S;T(e,r),n.nextTick(t,r)}function R(e,t,r,s){var i;return null===r?i=new C:"string"==typeof r||t.objectMode||(i=new m("chunk",["string","Buffer"],r)),!i||(T(e,i),n.nextTick(s,i),!1)}function O(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,n)),t}function L(e,t,n,r,s,i){if(!n){var a=O(t,r,s);r!==a&&(n=!0,s="buffer",r=a)}var o=t.objectMode?1:r.length;t.length+=o;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:s,isBuf:n,callback:i,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else D(e,t,!1,o,r,s,i);return l}function D(e,t,n,r,s,i,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w("write")):n?e._writev(s,t.onwrite):e._write(s,i,t.onwrite),t.sync=!1}function x(e,t,r,s,i){--t.pendingcb,r?(n.nextTick(i,s),n.nextTick(q,e,t),e._writableState.errorEmitted=!0,T(e,s)):(i(s),e._writableState.errorEmitted=!0,T(e,s),q(e,t))}function P(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function M(e,t){var r=e._writableState,s=r.sync,i=r.writecb;if("function"!=typeof i)throw new v;if(P(r),t)x(e,r,s,t,i);else{var a=B(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||N(e,r),s?n.nextTick(F,e,r,a,i):F(e,r,a,i)}}function F(e,t,n,r){n||U(e,t),t.pendingcb--,r(),q(e,t)}function U(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function N(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var o=0,l=!0;n;)i[o]=n,n.isBuf||(l=!1),n=n.next,o+=1;i.allBuffers=l,D(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,u=n.callback;if(D(e,t,!1,t.objectMode?1:c.length,c,d,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function B(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function j(e,t){e._final((function(n){t.pendingcb--,n&&T(e,n),t.prefinished=!0,e.emit("prefinish"),q(e,t)}))}function $(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(j,e,t)))}function q(e,t){var n=B(t);if(n&&($(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function K(e,t,r){t.ending=!0,q(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function G(e,t,n){var r=e.entry;for(e.entry=null;r;){var s=r.callback;t.pendingcb--,s(n),r=r.next}t.corkedRequestsFree.next=e}e("inherits")(A,o),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===A&&e&&e._writableState instanceof k}})):h=function(e){return e instanceof this},A.prototype.pipe=function(){T(this,new b)},A.prototype.write=function(e,t,n){var r=this._writableState,s=!1,i=!r.objectMode&&u(e);return i&&!l.isBuffer(e)&&(e=d(e)),"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=I),r.ending?_(this,n):(i||R(this,r,e,n))&&(r.pendingcb++,s=L(this,r,i,e,t,n)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||N(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new E(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||K(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=f.destroy,A.prototype._undestroy=f.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),void 0!==pt?pt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(e,t,n){(function(n){(function(){var r;function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=e("./end-of-stream"),a=Symbol("lastResolve"),o=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),d=Symbol("lastPromise"),u=Symbol("handlePromise"),h=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[d]=null,e[a]=null,e[o]=null,t(f(n,!1)))}}function g(e){n.nextTick(p,e)}function m(e,t){return function(n,r){e.then((function(){t[c]?n(f(void 0,!0)):t[u](n,r)}),r)}}var y=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((s(r={get stream(){return this[h]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(f(void 0,!0));if(this[h].destroyed)return new Promise((function(t,r){n.nextTick((function(){e[l]?r(e[l]):t(f(void 0,!0))}))}));var r,s=this[d];if(s)r=new Promise(m(s,this));else{var i=this[h].read();if(null!==i)return Promise.resolve(f(i,!1));r=new Promise(this[u])}return this[d]=r,r}},Symbol.asyncIterator,(function(){return this})),s(r,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(f(void 0,!0))}))}))})),r),y),b=function(e){var t,n=Object.create(v,(s(t={},h,{value:e,writable:!0}),s(t,a,{value:null,writable:!0}),s(t,o,{value:null,writable:!0}),s(t,l,{value:null,writable:!0}),s(t,c,{value:e._readableState.endEmitted,writable:!0}),s(t,u,{value:function(e,t){var r=n[h].read();r?(n[d]=null,n[a]=null,n[o]=null,e(f(r,!1))):(n[a]=e,n[o]=t)},writable:!0}),t));return n[d]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[o];return null!==t&&(n[d]=null,n[a]=null,n[o]=null,t(e)),void(n[l]=e)}var r=n[a];null!==r&&(n[d]=null,n[a]=null,n[o]=null,r(f(void 0,!0))),n[c]=!0})),e.on("readable",g.bind(null,n)),n};t.exports=b}).call(this)}).call(this,e("_process"))},{"./end-of-stream":64,_process:50}],62:[function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var c=e("buffer").Buffer,d=e("util").inspect,u=d&&d.custom||"inspect";function h(e,t,n){c.prototype.copy.call(e,t,n)}t.exports=function(){function e(){a(this,e),this.head=null,this.tail=null,this.length=0}return l(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t=c.allocUnsafe(e>>>0),n=this.head,r=0;n;)h(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var s=t.data,i=e>s.length?s.length:e;if(i===s.length?r+=s:r+=s.slice(0,e),0==(e-=i)){i===s.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=s.slice(i));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var s=n.data,i=e>s.length?s.length:e;if(s.copy(t,t.length-e,0,i),0==(e-=i)){i===s.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(i));break}++r}return this.length-=r,t}},{key:u,value:function(e,t){return d(this,s({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:17,util:16}],63:[function(e,t,n){(function(e){(function(){function n(t,n){var i=this,o=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return o||l?(n?n(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(a,this,t)):e.nextTick(a,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!n&&t?i._writableState?i._writableState.errorEmitted?e.nextTick(s,i):(i._writableState.errorEmitted=!0,e.nextTick(r,i,t)):e.nextTick(r,i,t):n?(e.nextTick(s,i),n(t)):e.nextTick(s,i)})),this)}function r(e,t){a(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function a(e,t){e.emit("error",t)}function o(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}t.exports={destroy:n,undestroy:i,errorOrDestroy:o}}).call(this)}).call(this,e("_process"))},{_process:50}],64:[function(e,t,n){var r=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function s(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];e.apply(this,r)}}}function i(){}function a(e){return e.setHeader&&"function"==typeof e.abort}function o(e,t,n){if("function"==typeof t)return o(e,null,t);t||(t={}),n=s(n||i);var l=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,d=function(){e.writable||h()},u=e._writableState&&e._writableState.finished,h=function(){c=!1,u=!0,l||n.call(e)},f=e._readableState&&e._readableState.endEmitted,p=function(){l=!1,f=!0,c||n.call(e)},g=function(t){n.call(e,t)},m=function(){var t;return l&&!f?(e._readableState&&e._readableState.ended||(t=new r),n.call(e,t)):c&&!u?(e._writableState&&e._writableState.ended||(t=new r),n.call(e,t)):void 0},y=function(){e.req.on("finish",h)};return a(e)?(e.on("complete",h),e.on("abort",m),e.req?y():e.on("request",y)):c&&!e._writableState&&(e.on("end",d),e.on("close",d)),e.on("end",p),e.on("finish",h),!1!==t.error&&e.on("error",g),e.on("close",m),function(){e.removeListener("complete",h),e.removeListener("abort",m),e.removeListener("request",y),e.req&&e.req.removeListener("finish",h),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",h),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}}t.exports=o},{"../../../errors":55}],65:[function(e,t,n){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(e,t,n){var r;function s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var i=e("../../../errors").codes,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function l(e){if(e)throw e}function c(e){return e.setHeader&&"function"==typeof e.abort}function d(t,n,i,a){a=s(a);var l=!1;t.on("close",(function(){l=!0})),void 0===r&&(r=e("./end-of-stream")),r(t,{readable:n,writable:i},(function(e){if(e)return a(e);l=!0,a()}));var d=!1;return function(e){if(!l&&!d)return d=!0,c(t)?t.abort():"function"==typeof t.destroy?t.destroy():void a(e||new o("pipe"))}}function u(e){e()}function h(e,t){return e.pipe(t)}function f(e){return e.length?"function"!=typeof e[e.length-1]?l:e.pop():l}function p(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s=f(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new a("streams");var i=t.map((function(e,n){var a=n<t.length-1;return d(e,a,n>0,(function(e){r||(r=e),e&&i.forEach(u),a||(i.forEach(u),s(r))}))}));return t.reduce(h)}t.exports=p},{"../../../errors":55,"./end-of-stream":64}],67:[function(e,t,n){var r=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;function s(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}function i(e,t,n,i){var a=s(t,i,n);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new r(i?n:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}t.exports={getHighWaterMark:i}},{"../../../errors":55}],68:[function(e,t,n){t.exports=e("events").EventEmitter},{events:22}],69:[function(e,t,n){(n=t.exports=e("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js"),n.finished=e("./lib/internal/streams/end-of-stream.js"),n.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(e,t,n){function r(e,t,n){var r=this;this._callback=e,this._args=n,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,e,r._args)},this.clear=function(){r._interval&&(clearInterval(r._interval),r._interval=void 0)},this.destroy=function(){r._interval&&clearInterval(r._interval),r._callback=void 0,r._interval=void 0,r._args=void 0}}function s(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new r(arguments[0],arguments[1],e)}t.exports=s},{}],71:[function(e,t,n){t.exports=e("./index.js")()},{"./index.js":72}],72:[function(e,t,n){(function(e){(function(){function n(t){return t instanceof e?e.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function r(e){return(e=e||{}).circles?s(e):e.proto?i:r;function t(e,t){for(var r=Object.keys(e),s=new Array(r.length),i=0;i<r.length;i++){var a=r[i],o=e[a];"object"!=typeof o||null===o?s[a]=o:o instanceof Date?s[a]=new Date(o):ArrayBuffer.isView(o)?s[a]=n(o):s[a]=t(o)}return s}function r(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return t(e,r);if(e instanceof Map)return new Map(t(Array.from(e),r));if(e instanceof Set)return new Set(t(Array.from(e),r));var s={};for(var i in e)if(!1!==Object.hasOwnProperty.call(e,i)){var a=e[i];"object"!=typeof a||null===a?s[i]=a:a instanceof Date?s[i]=new Date(a):a instanceof Map?s[i]=new Map(t(Array.from(a),r)):a instanceof Set?s[i]=new Set(t(Array.from(a),r)):ArrayBuffer.isView(a)?s[i]=n(a):s[i]=r(a)}return s}function i(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return t(e,i);if(e instanceof Map)return new Map(t(Array.from(e),i));if(e instanceof Set)return new Set(t(Array.from(e),i));var r={};for(var s in e){var a=e[s];"object"!=typeof a||null===a?r[s]=a:a instanceof Date?r[s]=new Date(a):a instanceof Map?r[s]=new Map(t(Array.from(a),i)):a instanceof Set?r[s]=new Set(t(Array.from(a),i)):ArrayBuffer.isView(a)?r[s]=n(a):r[s]=i(a)}return r}}function s(e){var t=[],r=[];return e.proto?a:i;function s(e,s){for(var i=Object.keys(e),a=new Array(i.length),o=0;o<i.length;o++){var l=i[o],c=e[l];if("object"!=typeof c||null===c)a[l]=c;else if(c instanceof Date)a[l]=new Date(c);else if(ArrayBuffer.isView(c))a[l]=n(c);else{var d=t.indexOf(c);a[l]=-1!==d?r[d]:s(c)}}return a}function i(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return s(e,i);if(e instanceof Map)return new Map(s(Array.from(e),i));if(e instanceof Set)return new Set(s(Array.from(e),i));var a={};for(var o in t.push(e),r.push(a),e)if(!1!==Object.hasOwnProperty.call(e,o)){var l=e[o];if("object"!=typeof l||null===l)a[o]=l;else if(l instanceof Date)a[o]=new Date(l);else if(l instanceof Map)a[o]=new Map(s(Array.from(l),i));else if(l instanceof Set)a[o]=new Set(s(Array.from(l),i));else if(ArrayBuffer.isView(l))a[o]=n(l);else{var c=t.indexOf(l);a[o]=-1!==c?r[c]:i(l)}}return t.pop(),r.pop(),a}function a(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return s(e,a);if(e instanceof Map)return new Map(s(Array.from(e),a));if(e instanceof Set)return new Set(s(Array.from(e),a));var i={};for(var o in t.push(e),r.push(i),e){var l=e[o];if("object"!=typeof l||null===l)i[o]=l;else if(l instanceof Date)i[o]=new Date(l);else if(l instanceof Map)i[o]=new Map(s(Array.from(l),a));else if(l instanceof Set)i[o]=new Set(s(Array.from(l),a));else if(ArrayBuffer.isView(l))i[o]=n(l);else{var c=t.indexOf(l);i[o]=-1!==c?r[c]:a(l)}}return t.pop(),r.pop(),i}}t.exports=r}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],73:[function(e,t,n){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "6.35.2-cd7f86f.0",
3
+ "version": "6.35.3-fa3d4ac.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",