UNPKG

@amityco/ts-sdk

Version:

Amity Social Cloud Typescript SDK

1 lines • 1.04 MB
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"v7.2.0-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=-5,v=1e3,b=6e5,w="dead",S=6e4,C=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<S?S: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,channelUnread:({channelId: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={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 he(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class fe 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,fe)}}class pe extends fe{constructor(e,t,n){super(e,t,n)}}class ge extends fe{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class me extends fe{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let ye=null;const ve=()=>{if(!ye)throw new fe("There is no active client",8e5,"fatal");return ye},be=e=>{ye=e},we=e=>{const{log:t,cache:n}=ve();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}=ve();if(!n)return;t("cache/api/pullFromCache",e);const r=C(e);return n.data[r]?n.data[r]:void 0},Ce=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=ve();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=C(e);return s.data[i]=Object.assign({key:e,data:t},n),!0},Ee=(e,t,n)=>{const{log:r,cache:s}=ve();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))&&(Ce(e,a,n),!0);var o,l},Te=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=ve();if(!s)return!1;r("cache/api/upsertInCache",{key:e,data:t,options:n});return Se(e)?Ee(e,t,n):Ce(e,t,n)},Ie=(e,t=!1)=>{const{log:n,cache:r}=ve();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=>Ie(e,!0))).every((e=>e));const s=C(e);return s in r.data&&(delete r.data[s],!0)},ke=(e,t,n)=>void 0!==n?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(n))):e,Ae=(e,t,n)=>void 0!==n?e.filter((e=>"string"==typeof e[t]&&"string"==typeof n&&String(e[t]).toLowerCase().match(n.toLowerCase()))):e,_e=(e,t,n)=>(null==n?void 0:n.length)?e.filter((e=>Array.isArray(e[t])&&n.some((n=>e[t].includes(n))))):e,Re=(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})),Oe=(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})),Le=(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})),De=(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}),[]),xe=(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))}))},Pe=({displayName:e},{displayName:t})=>e&&t?e.localeCompare(t):e?-1:1,Me=({name:e},{name:t})=>e&&t?e.localeCompare(t):e?-1:1,Fe=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),Ue=({localSortingDate:e},{localSortingDate:t})=>new Date(t).getTime()-new Date(e).getTime(),Ne=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),Be=({updatedAt:e=0},{updatedAt:t=0})=>new Date(e).valueOf()-new Date(t).valueOf(),je=({updatedAt:e=0},{updatedAt:t=0})=>new Date(t).valueOf()-new Date(e).valueOf(),$e=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let qe=null;const Ke=()=>{if(!qe)throw new fe("Connect client first",8e5,"fatal");return qe},Ge=e=>{qe={_id:e._id,userId:e.userId,path:e.path}};let He,Ve=[];const ze=e=>{clearTimeout(He),Ve.push(e),He=setTimeout((()=>{Ve.forEach((e=>e())),Ve=[]}),0)},We=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired"],Ye=["connect","message","disconnect","error","close","end","reconnect","video-streaming.didStart","video-streaming.didRecord","video-streaming.didStop","video-streaming.didFlag","video-streaming.didTerminate"],Qe=()=>{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},Xe=(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)}},Je=(e,t)=>{const{emitter:n}=ve();ze((()=>{n.emit(e,t)}))};let Ze,et;async function tt(){var e;const{mqtt:t,emitter:n,token:r}=ve();if(!t)return;const s=null!==(e=null==r?void 0:r.accessToken)&&void 0!==e?e:"",i=Ke();Ze===s&&et===i._id||(Ze=s,et=i._id,await t.connect({accessToken:Ze,userId:et}),((e,t)=>{Ye.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 nt;e.SubscriptionLevels=void 0,(nt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",nt.POST="post",nt.COMMENT="comment",nt.POST_AND_COMMENT="post_and_comment",nt.USER="user";const rt=(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}},st=e=>e.path.split("/user/")[0],it=({path:t},n=e.SubscriptionLevels.USER)=>rt(n===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),n),at=({channelId:e,subChannelId:t})=>{const n=Ke();return`${st(n)}/marker/channel/${e}/message/${t}`},ot=()=>{const e=Ke();return`${st(e)}/marker/user/${e._id}`},lt=()=>st(Ke()),ct=()=>{const e=Ke();return`${st(e)}/smartfeed/${e._id}/channels`},dt=()=>{const e=Ke();return`${st(e)}/smartfeed/${e._id}/messagefeeds`},ut=()=>{const e=Ke();return`${st(e)}/smartfeed/${e._id}/messages`};function ht(e,t){const{mqtt:n}=ve();return n?(tt(),n.subscribe(e,t)):()=>null}const ft=()=>{const e=Ke();return`${st(e)}/videostreaming`};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 St=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=St(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 Ct,Et=bt.exports;const Tt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:It={}}=Tt,kt="production"===(null===(Ct=It.env)||void 0===Ct?void 0:Ct.NODE_ENV),At={EU:"eu",SG:"sg",US:"us"},_t={http:"https://apix.{region}.amity.co",upload:"https://upload.{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 Sn(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 Cn{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(),Sn(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 Cn,response:new Cn}}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 Sn(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,TooMan