@msafe/sui-app-store 0.0.23 → 0.0.25
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.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.global.js
CHANGED
|
@@ -7,7 +7,7 @@ Received: "${JSON.stringify(c)}"`);let f=Object.keys(c)[0];if(f===void 0)throw n
|
|
|
7
7
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[ym]=this[ym]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=pi(s);n[a]||(A1(i,s),n[a]=!0)}return C.isArray(e)?e.forEach(o):o(e),this}};hn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);C.reduceDescriptors(hn.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});C.freezeMethods(hn);var $e=hn;function xi(t,e){let r=this||mn,n=e||r,i=$e.from(n.headers),o=n.data;return C.forEach(t,function(a){o=a.call(r,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function yi(t){return!!(t&&t.__CANCEL__)}function gm(t,e,r){Y.call(this,t??"canceled",Y.ERR_CANCELED,e,r),this.name="CanceledError"}C.inherits(gm,Y,{__CANCEL__:!0});var dr=gm;function l0(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new Y("Request failed with status code "+r.status,[Y.ERR_BAD_REQUEST,Y.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var bm=He.hasStandardBrowserEnv?{write(t,e,r,n,i,o){let s=[t+"="+encodeURIComponent(e)];C.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),C.isString(n)&&s.push("path="+n),C.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function f0(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function d0(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function gi(t,e){return t&&!f0(e)?d0(t,e):e}var wm=He.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(o){let s=o;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=i(window.location.href),function(s){let a=C.isString(s)?i(s):s;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function m0(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function B1(t,e){t=t||10;let r=new Array(t),n=new Array(t),i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=n[o];s||(s=l),r[i]=c,n[i]=l;let f=o,d=0;for(;f!==i;)d+=r[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),l-s<e)return;let m=u&&l-u;return m?Math.round(d*1e3/m):void 0}}var Em=B1;function Sm(t,e){let r=0,n=Em(50,250);return i=>{let o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,c=n(a),l=o<=s;r=o;let u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&l?(s-o)/c:void 0,event:i};u[e?"download":"upload"]=!0,t(u)}}var D1=typeof XMLHttpRequest<"u",Cm=D1&&function(t){return new Promise(function(r,n){let i=t.data,o=$e.from(t.headers).normalize(),{responseType:s,withXSRFToken:a}=t,c;function l(){t.cancelToken&&t.cancelToken.unsubscribe(c),t.signal&&t.signal.removeEventListener("abort",c)}let u;if(C.isFormData(i)){if(He.hasStandardBrowserEnv||He.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){let[x,...g]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];o.setContentType([x||"multipart/form-data",...g].join("; "))}}let f=new XMLHttpRequest;if(t.auth){let x=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(x+":"+g))}let d=gi(t.baseURL,t.url);f.open(t.method.toUpperCase(),hi(d,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function m(){if(!f)return;let x=$e.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),p={data:!s||s==="text"||s==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:x,config:t,request:f};l0(function(b){r(b),l()},function(b){n(b),l()},p),f=null}if("onloadend"in f?f.onloadend=m:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(m)},f.onabort=function(){f&&(n(new Y("Request aborted",Y.ECONNABORTED,t,f)),f=null)},f.onerror=function(){n(new Y("Network Error",Y.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let g=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",p=t.transitional||Us;t.timeoutErrorMessage&&(g=t.timeoutErrorMessage),n(new Y(g,p.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,t,f)),f=null},He.hasStandardBrowserEnv&&(a&&C.isFunction(a)&&(a=a(t)),a||a!==!1&&wm(d))){let x=t.xsrfHeaderName&&t.xsrfCookieName&&bm.read(t.xsrfCookieName);x&&o.set(t.xsrfHeaderName,x)}i===void 0&&o.setContentType(null),"setRequestHeader"in f&&C.forEach(o.toJSON(),function(g,p){f.setRequestHeader(p,g)}),C.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),s&&s!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",Sm(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",Sm(t.onUploadProgress)),(t.cancelToken||t.signal)&&(c=x=>{f&&(n(!x||x.type?new dr(null,t,f):x),f.abort(),f=null)},t.cancelToken&&t.cancelToken.subscribe(c),t.signal&&(t.signal.aborted?c():t.signal.addEventListener("abort",c)));let h=m0(d);if(h&&He.protocols.indexOf(h)===-1){n(new Y("Unsupported protocol "+h+":",Y.ERR_BAD_REQUEST,t));return}f.send(i||null)})};var h0={http:Ps,xhr:Cm};C.forEach(h0,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var vm=t=>`- ${t}`,I1=t=>C.isFunction(t)||t===null||t===!1,zs={getAdapter:t=>{t=C.isArray(t)?t:[t];let{length:e}=t,r,n,i={};for(let o=0;o<e;o++){r=t[o];let s;if(n=r,!I1(r)&&(n=h0[(s=String(r)).toLowerCase()],n===void 0))throw new Y(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=e?o.length>1?`since :
|
|
8
8
|
`+o.map(vm).join(`
|
|
9
9
|
`):" "+vm(o[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:h0};function p0(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new dr(null,t)}function Hs(t){return p0(t),t.headers=$e.from(t.headers),t.data=xi.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),zs.getAdapter(t.adapter||mn.adapter)(t).then(function(n){return p0(t),n.data=xi.call(t,t.transformResponse,n),n.headers=$e.from(n.headers),n},function(n){return yi(n)||(p0(t),n&&n.response&&(n.response.data=xi.call(t,t.transformResponse,n.response),n.response.headers=$e.from(n.response.headers))),Promise.reject(n)})}var Tm=t=>t instanceof $e?t.toJSON():t;function qt(t,e){e=e||{};let r={};function n(l,u,f){return C.isPlainObject(l)&&C.isPlainObject(u)?C.merge.call({caseless:f},l,u):C.isPlainObject(u)?C.merge({},u):C.isArray(u)?u.slice():u}function i(l,u,f){if(C.isUndefined(u)){if(!C.isUndefined(l))return n(void 0,l,f)}else return n(l,u,f)}function o(l,u){if(!C.isUndefined(u))return n(void 0,u)}function s(l,u){if(C.isUndefined(u)){if(!C.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function a(l,u,f){if(f in e)return n(l,u);if(f in t)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,u)=>i(Tm(l),Tm(u),!0)};return C.forEach(Object.keys(Object.assign({},t,e)),function(u){let f=c[u]||i,d=f(t[u],e[u],u);C.isUndefined(d)&&f!==a||(r[u]=d)}),r}var $s="1.6.7";var x0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{x0[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Am={};x0.transitional=function(e,r,n){function i(o,s){return"[Axios v"+$s+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(e===!1)throw new Y(i(s," has been removed"+(r?" in "+r:"")),Y.ERR_DEPRECATED);return r&&!Am[s]&&(Am[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,s,a):!0}};function F1(t,e,r){if(typeof t!="object")throw new Y("options must be an object",Y.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),i=n.length;for(;i-- >0;){let o=n[i],s=e[o];if(s){let a=t[o],c=a===void 0||s(a,o,t);if(c!==!0)throw new Y("option "+o+" must be "+c,Y.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Y("Unknown option "+o,Y.ERR_BAD_OPTION)}}var qs={assertOptions:F1,validators:x0};var mr=qs.validators,pn=class{constructor(e){this.defaults=e,this.interceptors={request:new o0,response:new o0}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
10
|
-
`+o):n.stack=o}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=qt(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&qs.assertOptions(n,{silentJSONParsing:mr.transitional(mr.boolean),forcedJSONParsing:mr.transitional(mr.boolean),clarifyTimeoutError:mr.transitional(mr.boolean)},!1),i!=null&&(C.isFunction(i)?r.paramsSerializer={serialize:i}:qs.assertOptions(i,{encode:mr.function,serialize:mr.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&C.merge(o.common,o[r.method]);o&&C.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),r.headers=$e.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(c=c&&x.synchronous,a.unshift(x.fulfilled,x.rejected))});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let u,f=0,d;if(!c){let h=[Hs.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),d=h.length,u=Promise.resolve(r);f<d;)u=u.then(h[f++],h[f++]);return u}d=a.length;let m=r;for(f=0;f<d;){let h=a[f++],x=a[f++];try{m=h(m)}catch(g){x.call(this,g);break}}try{u=Hs.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=qt(this.defaults,e);let r=gi(e.baseURL,e.url);return hi(r,e.params,e.paramsSerializer)}};C.forEach(["delete","get","head","options"],function(e){pn.prototype[e]=function(r,n){return this.request(qt(n||{},{method:e,url:r,data:(n||{}).data}))}});C.forEach(["post","put","patch"],function(e){function r(n){return function(o,s,a){return this.request(qt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}pn.prototype[e]=r(),pn.prototype[e+"Form"]=r(!0)});var bi=pn;var y0=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new dr(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Bm=y0;function g0(t){return function(r){return t.apply(null,r)}}function b0(t){return C.isObject(t)&&t.isAxiosError===!0}var w0={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(w0).forEach(([t,e])=>{w0[e]=t});var Dm=w0;function Im(t){let e=new bi(t),r=fi(bi.prototype.request,e);return C.extend(r,bi.prototype,e,{allOwnKeys:!0}),C.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Im(qt(t,i))},r}var Ee=Im(mn);Ee.Axios=bi;Ee.CanceledError=dr;Ee.CancelToken=Bm;Ee.isCancel=yi;Ee.VERSION=$s;Ee.toFormData=fr;Ee.AxiosError=Y;Ee.Cancel=Ee.CanceledError;Ee.all=function(e){return Promise.all(e)};Ee.spread=g0;Ee.isAxiosError=b0;Ee.mergeConfig=qt;Ee.AxiosHeaders=$e;Ee.formToJSON=t=>Ls(C.isHTMLForm(t)?new FormData(t):t);Ee.getAdapter=zs.getAdapter;Ee.HttpStatusCode=Dm;Ee.default=Ee;var Vt=Ee;var{Axios:b8,AxiosError:Fm,CanceledError:w8,isCancel:E8,CancelToken:S8,VERSION:C8,all:v8,Cancel:T8,isAxiosError:A8,spread:B8,toFormData:D8,AxiosHeaders:I8,HttpStatusCode:F8,formToJSON:O8,getAdapter:k8,mergeConfig:_8}=Vt;var xn=class extends ue{constructor(e,r){super(10,e,{context:r})}};var Vs=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof Fm)throw new xn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new xn(e.data.code)}throw new xn(e.status.toString())}async getIncomingStreams(e,r){let n=await Vt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await Vt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await Vt.post(`${this.apiURL}/stream-events`,e),n=t.parseResponseData(r);return n.data.forEach(i=>{let o=i;return o.data.type==="create_stream"?o.data.balance=BigInt(o.data.balance):o.data.type==="cancel_stream"?o.data.withdrawAmount=BigInt(o.data.withdrawAmount):o.data.type==="claim"||o.data.type==="auto_claim"?o.data.claimAmount=BigInt(o.data.claimAmount):o.data.type==="set_auto_claim"&&(o.data.enabled=!!o.data.enabled),o.createdAt=new Date(o.createdAt),o}),n}async getAllCoinTypes(e){let r=await Vt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await Vt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await Vt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var yn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Fs({url:e.rpc.url}),e.backend&&(this._backend=new Vs(e.backend.url))}static new(e,r){let n=zd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Os;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new ks;return this.signer}async walletAddress(){return this.wallet.address()}};var Gt=class extends Error{},Gs=class extends Gt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Zs=class extends Gt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Ks=class extends Gt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Bt=class extends Gt{},gn=class extends Gt{constructor(e){super(`Invalid unit ${e}`)}},Se=class extends Gt{},Dt=class extends Gt{constructor(){super("Zone is an abstract class")}};var j="numeric",It="short",Qe="long",hr={year:j,month:j,day:j},wi={year:j,month:It,day:j},E0={year:j,month:It,day:j,weekday:It},Ei={year:j,month:Qe,day:j},Si={year:j,month:Qe,day:j,weekday:Qe},Ci={hour:j,minute:j},vi={hour:j,minute:j,second:j},Ti={hour:j,minute:j,second:j,timeZoneName:It},Ai={hour:j,minute:j,second:j,timeZoneName:Qe},Bi={hour:j,minute:j,hourCycle:"h23"},Di={hour:j,minute:j,second:j,hourCycle:"h23"},Ii={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:It},Fi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Qe},Oi={year:j,month:j,day:j,hour:j,minute:j},ki={year:j,month:j,day:j,hour:j,minute:j,second:j},_i={year:j,month:It,day:j,hour:j,minute:j},Mi={year:j,month:It,day:j,hour:j,minute:j,second:j},S0={year:j,month:It,day:j,weekday:It,hour:j,minute:j},Ni={year:j,month:Qe,day:j,hour:j,minute:j,timeZoneName:It},Ri={year:j,month:Qe,day:j,hour:j,minute:j,second:j,timeZoneName:It},Pi={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,timeZoneName:Qe},ji={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,second:j,timeZoneName:Qe};var Ze=class{get type(){throw new Dt}get name(){throw new Dt}get ianaName(){return this.name}get isUniversal(){throw new Dt}offsetName(e,r){throw new Dt}formatOffset(e,r){throw new Dt}offset(e){throw new Dt}equals(e){throw new Dt}get isValid(){throw new Dt}};var C0=null,pr=class t extends Ze{static get instance(){return C0===null&&(C0=new t),C0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Ys(e,r,n)}formatOffset(e,r){return xr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Qs={};function O1(t){return Qs[t]||(Qs[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Qs[t]}var k1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function _1(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,o,s,a,c,l,u]=n;return[s,i,o,a,c,l,u]}function M1(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=k1[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Xs={},je=class t extends Ze{static create(e){return Xs[e]||(Xs[e]=new t(e)),Xs[e]}static resetCache(){Xs={},Qs={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Ys(e,r,n,this.name)}formatOffset(e,r){return xr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=O1(this.name),[i,o,s,a,c,l,u]=n.formatToParts?M1(n,r):_1(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=bn({year:i,month:o,day:s,hour:c===24?0:c,minute:l,second:u,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Om={};function N1(t,e={}){let r=JSON.stringify([t,e]),n=Om[r];return n||(n=new Intl.ListFormat(t,e),Om[r]=n),n}var v0={};function T0(t,e={}){let r=JSON.stringify([t,e]),n=v0[r];return n||(n=new Intl.DateTimeFormat(t,e),v0[r]=n),n}var A0={};function R1(t,e={}){let r=JSON.stringify([t,e]),n=A0[r];return n||(n=new Intl.NumberFormat(t,e),A0[r]=n),n}var B0={};function P1(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=B0[i];return o||(o=new Intl.RelativeTimeFormat(t,e),B0[i]=o),o}var Ui=null;function j1(){return Ui||(Ui=new Intl.DateTimeFormat().resolvedOptions().locale,Ui)}var km={};function U1(t){let e=km[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,km[t]=e}return e}function L1(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=T0(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=T0(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function W1(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function z1(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function H1(t){let e=[];for(let r=1;r<=7;r++){let n=te.utc(2016,11,13+r);e.push(t(n))}return e}function ea(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function $1(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var D0=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!r||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=R1(e,a)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):wn(e,3);return ye(r,this.padTo)}}},I0=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&je.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=T0(r,o)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},F0=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&ta()&&(this.rtf=P1(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):_m(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},q1={firstDay:1,minimalDays:4,weekend:[6,7]},se=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,i,o=!1){let s=e||ne.defaultLocale,a=s||(o?"en-US":j1()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=Li(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){Ui=null,v0={},A0={},B0={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return t.create(e,r,n,i)}constructor(e,r,n,i,o){let[s,a,c]=L1(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=W1(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=$1(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Li(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return ea(this,e,O0,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=z1(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return ea(this,e,k0,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=r?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=H1(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ea(this,void 0,()=>_0,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[te.utc(2016,11,13,9),te.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ea(this,e,M0,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[te.utc(-40,1,1),te.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new D0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new I0(e,this.intl,r)}relFormatter(e={}){return new F0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return N1(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ra()?U1(this.locale):q1}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}};var R0=null,Oe=class t extends Ze{static get utcInstance(){return R0===null&&(R0=new t(0)),R0}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Nr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${xr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${xr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return xr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var En=class extends Ze{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Ft(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ze)return t;if(Mm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?pr.instance:n==="utc"||n==="gmt"?Oe.utcInstance:Oe.parseSpecifier(n)||je.create(t)}else return Nt(t)?Oe.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new En(t)}var Nm=()=>Date.now(),Rm="system",Pm=null,jm=null,Um=null,Lm=60,Wm,zm=null,ne=class{static get now(){return Nm}static set now(e){Nm=e}static set defaultZone(e){Rm=e}static get defaultZone(){return Ft(Rm,pr.instance)}static get defaultLocale(){return Pm}static set defaultLocale(e){Pm=e}static get defaultNumberingSystem(){return jm}static set defaultNumberingSystem(e){jm=e}static get defaultOutputCalendar(){return Um}static set defaultOutputCalendar(e){Um=e}static get defaultWeekSettings(){return zm}static set defaultWeekSettings(e){zm=Li(e)}static get twoDigitCutoffYear(){return Lm}static set twoDigitCutoffYear(e){Lm=e%100}static get throwOnInvalid(){return Wm}static set throwOnInvalid(e){Wm=e}static resetCaches(){se.resetCache(),je.resetCache()}};var ke=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Hm=[0,31,59,90,120,151,181,212,243,273,304,334],$m=[0,31,60,91,121,152,182,213,244,274,305,335];function dt(t,e){return new ke("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function na(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function qm(t,e,r){return r+(Pr(t)?$m:Hm)[e-1]}function Vm(t,e){let r=Pr(t)?$m:Hm,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function ia(t,e){return(t-e+7)%7+1}function Wi(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=qm(n,i,o),a=ia(na(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=Rr(l,e,r)):c>Rr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Hi(t)}}function P0(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=ia(na(n,1,e),r),a=yr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=yr(l)):c>a?(l=n+1,c-=yr(n)):l=n;let{month:u,day:f}=Vm(l,c);return{year:l,month:u,day:f,...Hi(t)}}function oa(t){let{year:e,month:r,day:n}=t,i=qm(e,r,n);return{year:e,ordinal:i,...Hi(t)}}function j0(t){let{year:e,ordinal:r}=t,{month:n,day:i}=Vm(e,r);return{year:e,month:n,day:i,...Hi(t)}}function U0(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new Bt("Cannot mix locale-based week fields with ISO-based week fields");return H(t.localWeekday)||(t.weekday=t.localWeekday),H(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),H(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Gm(t,e=4,r=1){let n=zi(t.weekYear),i=et(t.weekNumber,1,Rr(t.weekYear,e,r)),o=et(t.weekday,1,7);return n?i?o?!1:dt("weekday",t.weekday):dt("week",t.weekNumber):dt("weekYear",t.weekYear)}function Zm(t){let e=zi(t.year),r=et(t.ordinal,1,yr(t.year));return e?r?!1:dt("ordinal",t.ordinal):dt("year",t.year)}function L0(t){let e=zi(t.year),r=et(t.month,1,12),n=et(t.day,1,Sn(t.year,t.month));return e?r?n?!1:dt("day",t.day):dt("month",t.month):dt("year",t.year)}function W0(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=et(e,0,23)||e===24&&r===0&&n===0&&i===0,s=et(r,0,59),a=et(n,0,59),c=et(i,0,999);return o?s?a?c?!1:dt("millisecond",i):dt("second",n):dt("minute",r):dt("hour",e)}function H(t){return typeof t>"u"}function Nt(t){return typeof t=="number"}function zi(t){return typeof t=="number"&&t%1===0}function Mm(t){return typeof t=="string"}function Jm(t){return Object.prototype.toString.call(t)==="[object Date]"}function ta(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ra(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ym(t){return Array.isArray(t)?t:[t]}function z0(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let o=[e(i),i];return n&&r(n[0],o[0])===n[0]?n:o},null)[1]}function Xm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function gr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Li(t){if(t==null)return null;if(typeof t!="object")throw new Se("Week settings must be an object");if(!et(t.firstDay,1,7)||!et(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!et(e,1,7)))throw new Se("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function et(t,e,r){return zi(t)&&t>=e&&t<=r}function V1(t,e){return t-e*Math.floor(t/e)}function ye(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function Zt(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function br(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function $i(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function wn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Pr(t){return t%4===0&&(t%100!==0||t%400===0)}function yr(t){return Pr(t)?366:365}function Sn(t,e){let r=V1(e-1,12)+1,n=t+(e-r)/12;return r===2?Pr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function bn(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Km(t,e,r){return-ia(na(t,1,e),r)+e-1}function Rr(t,e=4,r=1){let n=Km(t,e,r),i=Km(t+1,e,r);return(yr(t)-n+i)/7}function qi(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Ys(t,e,r,n=null){let i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(r,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Nr(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function H0(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Se(`Invalid unit value ${t}`);return e}function Cn(t,e){let r={};for(let n in t)if(gr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=H0(i)}return r}function xr(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ye(r,2)}:${ye(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${ye(r,2)}${ye(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Hi(t){return Xm(t,["hour","minute","second","millisecond"])}var G1=["January","February","March","April","May","June","July","August","September","October","November","December"],$0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Z1=["J","F","M","A","M","J","J","A","S","O","N","D"];function O0(t){switch(t){case"narrow":return[...Z1];case"short":return[...$0];case"long":return[...G1];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var q0=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],V0=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],K1=["M","T","W","T","F","S","S"];function k0(t){switch(t){case"narrow":return[...K1];case"short":return[...V0];case"long":return[...q0];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var _0=["AM","PM"],J1=["Before Christ","Anno Domini"],Y1=["BC","AD"],X1=["B","A"];function M0(t){switch(t){case"narrow":return[...X1];case"short":return[...Y1];case"long":return[...J1];default:return null}}function Qm(t){return _0[t.hour<12?0:1]}function eh(t,e){return k0(e)[t.weekday-1]}function th(t,e){return O0(e)[t.month-1]}function rh(t,e){return M0(e)[t.year<0?0:1]}function _m(t,e,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&o){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`;default:}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[t],u=n?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}function nh(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Q1={D:hr,DD:wi,DDD:Ei,DDDD:Si,t:Ci,tt:vi,ttt:Ti,tttt:Ai,T:Bi,TT:Di,TTT:Ii,TTTT:Fi,f:Oi,ff:_i,fff:Ni,ffff:Pi,F:ki,FF:Mi,FFF:Ri,FFFF:ji},_e=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?(n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return Q1[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return ye(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",a=()=>n?Qm(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?th(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?eh(e,m):o(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},f=m=>n?rh(e,m):o({era:m},"era"),d=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(m)}};return nh(t.parseFormat(r),d)}formatDurationFromString(e,r){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=c=>l=>{let u=n(l);return u?this.num(c.get(u),l.length):l},o=t.parseFormat(r),s=o.reduce((c,{literal:l,val:u})=>l?c:c.concat(u),[]),a=e.shiftTo(...s.map(n).filter(c=>c));return nh(o,i(a))}};var oh=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Tn(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function An(...t){return e=>t.reduce(([r,n,i],o)=>{let[s,a,c]=o(e,i);return[{...r,...s},a||n,c]},[{},null,1]).slice(0,2)}function Bn(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function sh(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=Zt(e[r+i]);return[n,null,r+i]}}var ah=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,eb=`(?:${ah.source}?(?:\\[(${oh.source})\\])?)?`,G0=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ch=RegExp(`${G0.source}${eb}`),Z0=RegExp(`(?:T${ch.source})?`),tb=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,rb=/(\d{4})-?W(\d\d)(?:-?(\d))?/,nb=/(\d{4})-?(\d{3})/,ib=sh("weekYear","weekNumber","weekDay"),ob=sh("year","ordinal"),sb=/(\d{4})-(\d\d)-(\d\d)/,uh=RegExp(`${G0.source} ?(?:${ah.source}|(${oh.source}))?`),ab=RegExp(`(?: ${uh.source})?`);function vn(t,e,r){let n=t[e];return H(n)?r:Zt(n)}function cb(t,e){return[{year:vn(t,e),month:vn(t,e+1,1),day:vn(t,e+2,1)},null,e+3]}function Dn(t,e){return[{hours:vn(t,e,0),minutes:vn(t,e+1,0),seconds:vn(t,e+2,0),milliseconds:$i(t[e+3])},null,e+4]}function Vi(t,e){let r=!t[e]&&!t[e+1],n=Nr(t[e+1],t[e+2]),i=r?null:Oe.instance(n);return[{},i,e+3]}function Gi(t,e){let r=t[e]?je.create(t[e]):null;return[{},r,e+1]}var ub=RegExp(`^T?${G0.source}$`),lb=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function fb(t){let[e,r,n,i,o,s,a,c,l]=t,u=e[0]==="-",f=c&&c[0]==="-",d=(m,h=!1)=>m!==void 0&&(h||m&&u)?-m:m;return[{years:d(br(r)),months:d(br(n)),weeks:d(br(i)),days:d(br(o)),hours:d(br(s)),minutes:d(br(a)),seconds:d(br(c),c==="-0"),milliseconds:d($i(l),f)}]}var db={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function K0(t,e,r,n,i,o,s){let a={year:e.length===2?qi(Zt(e)):Zt(e),month:$0.indexOf(r)+1,day:Zt(n),hour:Zt(i),minute:Zt(o)};return s&&(a.second=Zt(s)),t&&(a.weekday=t.length>3?q0.indexOf(t)+1:V0.indexOf(t)+1),a}var mb=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function hb(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=K0(e,i,n,r,o,s,a),m;return c?m=db[c]:l?m=0:m=Nr(u,f),[d,new Oe(m)]}function pb(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var xb=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,yb=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,gb=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function ih(t){let[,e,r,n,i,o,s,a]=t;return[K0(e,i,n,r,o,s,a),Oe.utcInstance]}function bb(t){let[,e,r,n,i,o,s,a]=t;return[K0(e,a,r,n,i,o,s),Oe.utcInstance]}var wb=Tn(tb,Z0),Eb=Tn(rb,Z0),Sb=Tn(nb,Z0),Cb=Tn(ch),lh=An(cb,Dn,Vi,Gi),vb=An(ib,Dn,Vi,Gi),Tb=An(ob,Dn,Vi,Gi),Ab=An(Dn,Vi,Gi);function fh(t){return Bn(t,[wb,lh],[Eb,vb],[Sb,Tb],[Cb,Ab])}function dh(t){return Bn(pb(t),[mb,hb])}function mh(t){return Bn(t,[xb,ih],[yb,ih],[gb,bb])}function hh(t){return Bn(t,[lb,fb])}var Bb=An(Dn);function ph(t){return Bn(t,[ub,Bb])}var Db=Tn(sb,ab),Ib=Tn(uh),Fb=An(Dn,Vi,Gi);function xh(t){return Bn(t,[Db,lh],[Ib,Fb])}var yh="Invalid Duration",bh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ob={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...bh},mt=146097/400,In=146097/4800,kb={years:{quarters:4,months:12,weeks:mt/7,days:mt,hours:mt*24,minutes:mt*24*60,seconds:mt*24*60*60,milliseconds:mt*24*60*60*1e3},quarters:{months:3,weeks:mt/28,days:mt/4,hours:mt*24/4,minutes:mt*24*60/4,seconds:mt*24*60*60/4,milliseconds:mt*24*60*60*1e3/4},months:{weeks:In/7,days:In,hours:In*24,minutes:In*24*60,seconds:In*24*60*60,milliseconds:In*24*60*60*1e3},...bh},jr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_b=jr.slice(0).reverse();function wr(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new le(n)}function wh(t,e){let r=e.milliseconds??0;for(let n of _b.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function gh(t,e){let r=wh(t,e)<0?-1:1;jr.reduceRight((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]*r,s=t[i][n],a=Math.floor(o/s);e[i]+=a*r,e[n]-=a*s*r}return i},null),jr.reduce((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*t[n][i]}return i},null)}function Mb(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var le=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?kb:Ob;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Se(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Cn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Nt(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Se(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=hh(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=ph(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the Duration is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Ks(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new gn(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?_e.create(this.loc,n).formatDurationFromString(this,e):yh}toHuman(e={}){if(!this.isValid)return yh;let r=jr.map(n=>{let i=this.values[n];return H(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=wn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},te.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?wh(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let i of jr)(gr(r.values,i)||gr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return wr(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=H0(e(this.values[n],n));return wr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Cn(e,t.normalizeUnit)};return wr(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return wr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return gh(this.matrix,e),wr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Mb(this.normalize().shiftToAll().toObject());return wr(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},n={},i=this.toObject(),o;for(let s of jr)if(e.indexOf(s)>=0){o=s;let a=0;for(let l in n)a+=this.matrix[l][s]*n[l],n[l]=0;Nt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else Nt(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(r[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return gh(this.matrix,r),wr(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return wr(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of jr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Fn="Invalid Interval";function Nb(t,e){return!t||!t.isValid?Kt.invalid("missing or invalid start"):!e||!e.isValid?Kt.invalid("missing or invalid end"):e<t?Kt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var Kt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the Interval is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Zs(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=On(e),i=On(r),o=Nb(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=le.fromDurationLike(r),i=On(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=le.fromDurationLike(r),i=On(e);return t.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=te.fromISO(n,r),s=o.isValid}catch{s=!1}let a,c;try{a=te.fromISO(i,r),c=a.isValid}catch{c=!1}if(s&&c)return t.fromDateTimes(o,a);if(s){let l=le.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=le.fromISO(n,r);if(l.isValid)return t.before(a,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),i;return r?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,r),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(On).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=r[o]||this.e,a=+s>+this.e?this.e:s;n.push(t.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let r=le.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(c=>c*i));o=+a>+this.e?this.e:a,s.push(t.fromDateTimes(n,o)),n=o,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],o=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((c,l)=>c.time-l.time);for(let c of a)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Fn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=hr,r={}){return this.isValid?_e.create(this.s.loc.clone(r),e).formatInterval(this):Fn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Fn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Fn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Fn}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Fn}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):le.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Jt=class{static hasDST(e=ne.defaultZone){let r=te.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return je.isValidZone(e)}static normalizeZone(e){return Ft(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return se.create(r,null,"gregory").eras(e)}static features(){return{relative:ta(),localeWeek:ra()}}};function Eh(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(le.fromMillis(n).as("days"))}function Rb(t,e,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let u=Eh(c,l);return(u-u%7)/7}],["days",Eh]],i={},o=t,s,a;for(let[c,l]of n)r.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,t=o.plus(i),t>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}function Sh(t,e,r,n){let[i,o,s,a]=Rb(t,e,r),c=e-i,l=r.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));let u=le.fromObject(o,n);return l.length>0?le.fromMillis(c,n).shiftTo(...l).plus(u):u}var J0={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Ch={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Pb=J0.hanidec.replace(/[\[|\]]/g,"").split("");function vh(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(J0.hanidec)!==-1)e+=Pb.indexOf(t[r]);else for(let i in Ch){let[o,s]=Ch[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function ht({numberingSystem:t},e=""){return new RegExp(`${J0[t||"latn"]}${e}`)}var jb="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(vh(r))}}var Ub="\xA0",Bh=`[ ${Ub}]`,Dh=new RegExp(Bh,"g");function Lb(t){return t.replace(/\./g,"\\.?").replace(Dh,Bh)}function Th(t){return t.replace(/\./g,"").replace(Dh," ").toLowerCase()}function Ot(t,e){return t===null?null:{regex:RegExp(t.map(Lb).join("|")),deser:([r])=>t.findIndex(n=>Th(r)===Th(n))+e}}function Ah(t,e){return{regex:t,deser:([,r,n])=>Nr(r,n),groups:e}}function sa(t){return{regex:t,deser:([e])=>e}}function Wb(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zb(t,e){let r=ht(e),n=ht(e,"{2}"),i=ht(e,"{3}"),o=ht(e,"{4}"),s=ht(e,"{6}"),a=ht(e,"{1,2}"),c=ht(e,"{1,3}"),l=ht(e,"{1,6}"),u=ht(e,"{1,9}"),f=ht(e,"{2,4}"),d=ht(e,"{4,6}"),m=g=>({regex:RegExp(Wb(g.val)),deser:([p])=>p,literal:!0}),x=(g=>{if(t.literal)return m(g);switch(g.val){case"G":return Ot(e.eras("short"),0);case"GG":return Ot(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,qi);case"yyyy":return ie(o);case"yyyyy":return ie(d);case"yyyyyy":return ie(s);case"M":return ie(a);case"MM":return ie(n);case"MMM":return Ot(e.months("short",!0),1);case"MMMM":return Ot(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return Ot(e.months("short",!1),1);case"LLLL":return Ot(e.months("long",!1),1);case"d":return ie(a);case"dd":return ie(n);case"o":return ie(c);case"ooo":return ie(i);case"HH":return ie(n);case"H":return ie(a);case"hh":return ie(n);case"h":return ie(a);case"mm":return ie(n);case"m":return ie(a);case"q":return ie(a);case"qq":return ie(n);case"s":return ie(a);case"ss":return ie(n);case"S":return ie(c);case"SSS":return ie(i);case"u":return sa(u);case"uu":return sa(a);case"uuu":return ie(r);case"a":return Ot(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,qi);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return Ot(e.weekdays("short",!1),1);case"EEEE":return Ot(e.weekdays("long",!1),1);case"ccc":return Ot(e.weekdays("short",!0),1);case"cccc":return Ot(e.weekdays("long",!0),1);case"Z":case"ZZ":return Ah(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Ah(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return sa(/[a-z_+-/]{1,256}?/i);case" ":return sa(/[^\S\n\r]/);default:return m(g)}})(t)||{invalidReason:jb};return x.token=t,x}var Hb={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $b(t,e,r){let{type:n,value:i}=t;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let a=Hb[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function qb(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Vb(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(gr(r,s)){let a=r[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+c))),o+=c}return[n,i]}else return[n,{}]}function Gb(t){let e=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return H(t.z)||(r=je.create(t.z)),H(t.Z)||(r||(r=new Oe(t.Z)),n=t.Z),H(t.q)||(t.M=(t.q-1)*3+1),H(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),H(t.u)||(t.S=$i(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var Y0=null;function Zb(){return Y0||(Y0=te.fromMillis(1555555555555)),Y0}function Kb(t,e){if(t.literal)return t;let r=_e.macroTokenToFormatOpts(t.val),n=eu(r,e);return n==null||n.includes(void 0)?t:n}function X0(t,e){return Array.prototype.concat(...t.map(r=>Kb(r,e)))}function Q0(t,e,r){let n=X0(_e.parseFormat(r),t),i=n.map(s=>zb(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=qb(i),c=RegExp(s,"i"),[l,u]=Vb(e,c,a),[f,d,m]=u?Gb(u):[null,null,void 0];if(gr(u,"a")&&gr(u,"H"))throw new Bt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:l,matches:u,result:f,zone:d,specificOffset:m}}}function Ih(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=Q0(t,e,r);return[n,i,o,s]}function eu(t,e){if(!t)return null;let n=_e.create(e,t).dtFormatter(Zb()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>$b(s,t,o))}var tu="Invalid DateTime",Fh=864e13;function aa(t){return new ke("unsupported zone",`the zone "${t.name}" is not supported`)}function ru(t){return t.weekData===null&&(t.weekData=Wi(t.c)),t.weekData}function nu(t){return t.localWeekData===null&&(t.localWeekData=Wi(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Ur(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new te({...r,...e,old:r})}function Ph(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=r.offset(n);return i===o?[n,i]:[t-Math.min(i,o)*60*1e3,Math.max(i,o)]}function ca(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function la(t,e,r){return Ph(bn(t),e,r)}function Oh(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...t.c,year:n,month:i,day:Math.min(t.c.day,Sn(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=le.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=bn(o),[c,l]=Ph(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Zi(t,e,r,n,i,o){let{setZone:s,zone:a}=r;if(t&&Object.keys(t).length!==0||e){let c=e||a,l=te.fromObject(t,{...r,zone:c,specificOffset:o});return s?l:l.setZone(a)}else return te.invalid(new ke("unparsable",`the input "${i}" can't be parsed as ${n}`))}function ua(t,e,r=!0){return t.isValid?_e.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function iu(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=ye(t.c.year,r?6:4),e?(n+="-",n+=ye(t.c.month),n+="-",n+=ye(t.c.day)):(n+=ye(t.c.month),n+=ye(t.c.day)),n}function kh(t,e,r,n,i,o){let s=ye(t.c.hour);return e?(s+=":",s+=ye(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=":")):s+=ye(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=ye(t.c.second),(t.c.millisecond!==0||!n)&&(s+=".",s+=ye(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!o?s+="Z":t.o<0?(s+="-",s+=ye(Math.trunc(-t.o/60)),s+=":",s+=ye(Math.trunc(-t.o%60))):(s+="+",s+=ye(Math.trunc(t.o/60)),s+=":",s+=ye(Math.trunc(t.o%60)))),o&&(s+="["+t.zone.ianaName+"]"),s}var jh={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Jb={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Yb={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Uh=["year","month","day","hour","minute","second","millisecond"],Xb=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Qb=["year","ordinal","hour","minute","second","millisecond"];function e2(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new gn(t);return e}function _h(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return e2(t)}}function Mh(t,e){let r=Ft(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Uh)H(t[l])&&(t[l]=jh[l]);let a=L0(t)||W0(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=la(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Nh(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=wn(s,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(s,a)),o=s=>r.calendary?e.hasSame(t,s)?0:e.startOf(s).diff(t.startOf(s),s).get(s):e.diff(t,s).get(s);if(r.unit)return i(o(r.unit),r.unit);for(let s of r.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(t>e?-0:0,r.units[r.units.length-1])}function Rh(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var te=class t{constructor(e){let r=e.zone||ne.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new ke("invalid input"):null)||(r.isValid?null:aa(r));this.ts=H(e.ts)?ne.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,o]=[e.old.c,e.old.o];else{let a=r.offset(this.ts);i=ca(this.ts,a),n=Number.isNaN(i.year)?new ke("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=r,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=Rh(arguments),[n,i,o,s,a,c,l]=r;return Mh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Rh(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Oe.utcInstance,Mh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Jm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=Ft(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(aa(i))}static fromMillis(e,r={}){if(Nt(e))return e<-Fh||e>Fh?t.invalid("Timestamp out of range"):new t({ts:e,zone:Ft(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Se(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(Nt(e))return new t({ts:e*1e3,zone:Ft(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Se("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Ft(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(aa(n));let i=se.fromObject(r),o=Cn(e,_h),{minDaysInFirstWeek:s,startOfWeek:a}=U0(o,i),c=ne.now(),l=H(r.specificOffset)?n.offset(c):r.specificOffset,u=!H(o.ordinal),f=!H(o.year),d=!H(o.month)||!H(o.day),m=f||d,h=o.weekYear||o.weekNumber;if((m||u)&&h)throw new Bt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Bt("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,g,p,y=ca(c,l);x?(g=Xb,p=Jb,y=Wi(y,s,a)):u?(g=Qb,p=Yb,y=oa(y)):(g=Uh,p=jh);let b=!1;for(let L of g){let A=o[L];H(A)?b?o[L]=p[L]:o[L]=y[L]:b=!0}let w=x?Gm(o,s,a):u?Zm(o):L0(o),E=w||W0(o);if(E)return t.invalid(E);let S=x?P0(o,s,a):u?j0(o):o,[O,I]=la(S,l,n),N=new t({ts:O,zone:n,o:I,loc:i});return o.weekday&&m&&e.weekday!==N.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${N.toISO()}`):N}static fromISO(e,r={}){let[n,i]=fh(e);return Zi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=dh(e);return Zi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=mh(e);return Zi(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(H(e)||H(r))throw new Se("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,c,l,u]=Ih(s,e,r);return u?t.invalid(u):Zi(a,c,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=xh(e);return Zi(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the DateTime is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Gs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=eu(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return X0(_e.parseFormat(e),se.fromObject(r)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ru(this).weekYear:NaN}get weekNumber(){return this.isValid?ru(this).weekNumber:NaN}get weekday(){return this.isValid?ru(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?nu(this).weekday:NaN}get localWeekNumber(){return this.isValid?nu(this).weekNumber:NaN}get localWeekYear(){return this.isValid?nu(this).weekYear:NaN}get ordinal(){return this.isValid?oa(this.c).ordinal:NaN}get monthShort(){return this.isValid?Jt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Jt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Jt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Jt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=bn(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*r),a=this.zone.offset(n-o*r);if(s===a)return[this];let c=n-s*r,l=n-a*r,u=ca(c,s),f=ca(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Ur(this,{ts:c}),Ur(this,{ts:l})]:[this]}get isInLeapYear(){return Pr(this.year)}get daysInMonth(){return Sn(this.year,this.month)}get daysInYear(){return this.isValid?yr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Rr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Rr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=_e.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(Oe.instance(e),r)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=Ft(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let o=e.offset(this.ts),s=this.toObject();[i]=la(s,o,e)}return Ur(this,{ts:i,zone:e})}else return t.invalid(aa(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Ur(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Cn(e,_h),{minDaysInFirstWeek:n,startOfWeek:i}=U0(r,this.loc),o=!H(r.weekYear)||!H(r.weekNumber)||!H(r.weekday),s=!H(r.ordinal),a=!H(r.year),c=!H(r.month)||!H(r.day),l=a||c,u=r.weekYear||r.weekNumber;if((l||s)&&u)throw new Bt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Bt("Can't mix ordinal dates with month/day");let f;o?f=P0({...Wi(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(Sn(f.year,f.month),f.day))):f=j0({...oa(this.c),...r});let[d,m]=la(f,this.o,this.zone);return Ur(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e);return Ur(this,Oh(this,r))}minus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e).negate();return Ur(this,Oh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=le.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(i==="weeks")if(r){let o=this.loc.getStartOfWeek(),{weekday:s}=this;s<o&&(n.weekNumber=this.weekNumber-1),n.weekday=o}else n.weekday=1;if(i==="quarters"){let o=Math.ceil(this.month/3);n.month=(o-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?_e.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):tu}toLocaleString(e=hr,r={}){return this.isValid?_e.create(this.loc.clone(r),e).formatDateTime(this):tu}toLocaleParts(e={}){return this.isValid?_e.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=iu(this,s);return a+="T",a+=kh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?iu(this,e==="extended"):null}toISOWeekDate(){return ua(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+kh(this,s==="extended",r,e,n,o):null}toRFC2822(){return ua(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ua(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?iu(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),ua(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():tu}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return le.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=Ym(r).map(le.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=Sh(a,c,o,i);return s?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?Kt.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let i=e.valueOf(),o=this.setZone(e.zone,{keepLocalTime:!0});return o.startOf(r,n)<=i&&i<=o.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),Nh(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Nh(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Se("min requires all arguments be DateTimes");return z0(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Se("max requires all arguments be DateTimes");return z0(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return Q0(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return hr}static get DATE_MED(){return wi}static get DATE_MED_WITH_WEEKDAY(){return E0}static get DATE_FULL(){return Ei}static get DATE_HUGE(){return Si}static get TIME_SIMPLE(){return Ci}static get TIME_WITH_SECONDS(){return vi}static get TIME_WITH_SHORT_OFFSET(){return Ti}static get TIME_WITH_LONG_OFFSET(){return Ai}static get TIME_24_SIMPLE(){return Bi}static get TIME_24_WITH_SECONDS(){return Di}static get TIME_24_WITH_SHORT_OFFSET(){return Ii}static get TIME_24_WITH_LONG_OFFSET(){return Fi}static get DATETIME_SHORT(){return Oi}static get DATETIME_SHORT_WITH_SECONDS(){return ki}static get DATETIME_MED(){return _i}static get DATETIME_MED_WITH_SECONDS(){return Mi}static get DATETIME_MED_WITH_WEEKDAY(){return S0}static get DATETIME_FULL(){return Ni}static get DATETIME_FULL_WITH_SECONDS(){return Ri}static get DATETIME_HUGE(){return Pi}static get DATETIME_HUGE_WITH_SECONDS(){return ji}};function On(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&Nt(t.valueOf()))return te.fromJSDate(t);if(t&&typeof t=="object")return te.fromObject(t);throw new Se(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var ou=50n,fa=10000n,Lh=25n,su=100000000n;var Rt=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Ki=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},Er=class t{constructor(e){this.result=e;return new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(r,n){if(n in r)return Reflect.get(r,n);let i=s=>new t(r.result[s]);if(n===Symbol.iterator)return function*(){let s=0;for(;;)yield i(s),s++};if(typeof n=="symbol")return;let o=parseInt(n,10);if(!(Number.isNaN(o)||o<0))return i(o)}})}moveArg(){return this.result}};var au=er(Ac());var Ji=class extends ue{constructor(e,r){super(3,e,{context:r})}};var da=class{constructor(e){this.results=e}callResult(e){return this.results.results[e]}returnValue(e,r){return e.returnValues[r]}getValue(e=0,r=0){let n=this.callResult(e);return this.returnValue(n,r)}getAddress(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="address")throw new Ji("Invalid contract return type.",{ctx:{expectType:"address",gotType:i}});return $(au.Buffer.from(n).toString("hex"))}getU64(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="u64")throw new Ji("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return au.Buffer.from(n).readBigInt64LE()}};var we=class extends ue{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var zh={groupId:"string",name:"string"},t2=64;function Hh(t){return $h(t),ae.ser(zh,t).toString("base64")}function Yi(t){let e=ae.de(zh,t,"base64");return $h(e),e}function $h(t){if(!Wh(t.name))throw new we("Invalid metadata: Name contains unknown character");if(!Wh(t.groupId))throw new we("Invalid metadata: Group ID contains unknown character");if(t.name.length>t2)throw new we("Invalid metadata: Name exceed max length 64")}function Wh(t){return/^[\x00-\x7F]+$/.test(t)}function ma(t,e){return oe(t)===oe(e)}function Sr(t,e){return oe(t)===oe(e)}var ha="txn.gas";function qh(){return crypto.randomUUID()}var Lr=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:Hh({name:e.name,groupId:qh()}),coinType:oe(e.coinType),recipients:e.recipients.map(r=>({address:r.address,cliffAmount:r.cliffAmount,amountPerEpoch:r.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let r=new ge,n=this.calculateFeesInternal(e),i=this.getCreateStreamCoinRequests(e,n),o=await this.wallet.requestCoins(i),s=await this.addMergeCoins(r,o[0]),a;i.length>1?a=await this.addMergeCoins(r,o[1]):a=s;for(let c=0;c<e.recipients.length;c++){let l=e.recipients[c],u=this.amountForRecipient(l,e.numberEpoch),f=this.getStreamFeeLocal(u),[d]=r.splitCoins(s,[r.pure(u+f,"u64")]),[m]=r.splitCoins(a,[r.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(r,{paymentCoin:new Er(d),flatFeeCoin:new Er(m),metadata:e.metadata,recipient:l.address,timeStart:e.startTime,cliff:l.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:l.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return r}calculateCreateStreamFees(e){let r=t.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:ou,denominator:fa},claimFeePercent:{numerator:Lh,denominator:fa},flatFeePerStream:su}}async addMergeCoins(e,r){let n;return r.mergedCoins&&r.mergedCoins.length?(e.mergeCoins(e.object(r.primaryCoin),r.mergedCoins.map(i=>e.object(i))),n=e.object(r.primaryCoin)):r.primaryCoin===ha?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return ma(n,ot)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:ot,amount:r.flatFeeAmount}]}calculateFeesInternal(e){let r=e.recipients.reduce((i,o)=>{let s=this.amountForRecipient(o,e.numberEpoch),a=this.getStreamFeeLocal(s);return{totalAmount:i.totalAmount+s,streamFeeAmount:i.streamFeeAmount+a}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...r}}amountForRecipient(e,r){return BigInt(e.amountPerEpoch)*BigInt(r)+BigInt(e.cliffAmount)}get flatSuiFee(){return su}getStreamFeeLocal(e){return e*ou/fa}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new ge,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new da(n).getU64()}get wallet(){return this.globals.wallet}};var Vh="0x0000000000000000000000000000000000000000000000000000000000000006";var kn=class{constructor(e,r,n){this.moduleName=e;this.config=r;this.globals=n}addContractCall(e,r){let n=`${this.config.contractId}::${this.moduleName}::${r.method}`;return e.add(ct.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Ki?i.moveArgs(e):i instanceof Rt?i.moveArg(e):i instanceof Er?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(ct.MoveCall({target:r,arguments:n.map(o=>o instanceof Ki?o.moveArgs(e):o instanceof Rt?o.moveArg(e):o instanceof Er?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new Rt(e):e}vaultObject(){return new Rt(this.config.vaultObjId)}roleObject(){return new Rt(this.config.roleObjId)}feeObject(){return new Rt(this.config.feeObjId)}clockObject(){return new Rt(Vh)}};var _n=class t extends kn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_fee,arguments:[i,o,n],typeArgs:[]})}setStreamingFlatFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_flat_fee,arguments:[i,o,n],typeArgs:[]})}setClaimFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_claim_fee,arguments:[i,o,n],typeArgs:[]})}streamingFee(r,n){let i=this.feeObject();return this.addContractCall(r,{method:t.MethodName.streaming_fee,arguments:[i,n],typeArgs:[]})}claimFee(r,n){return this.addContractCall(r,{method:t.MethodName.claim_fee,arguments:[this.feeObject(),n],typeArgs:[]})}feeDenominator(r){return this.addContractCall(r,{method:t.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}};var Pt=class t extends kn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(r,n){let i=this.feeObject(),o=this.vaultObject(),s=this.makeObject(n.paymentCoin),a=this.makeObject(n.flatFeeCoin),c=this.clockObject();return this.addContractCall(r,{method:t.MethodName.create_stream,arguments:[i,o,s,a,n.metadata,n.recipient,n.timeStart,n.cliff,n.epochInterval,n.numEpoch,n.amountPerEpoch,n.cancelable,c],typeArgs:[n.coinType]})}setAutoClaim(r,n){let i=this.makeObject(n.streamId);return this.addContractCall(r,{method:t.MethodName.set_auto_claim,arguments:[i,n.enabled],typeArgs:[n.coinType]})}cancelStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.cancel_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStreamByProxy(r,n){let i=this.makeObject(n.streamId),o=this.vaultObject(),s=this.feeObject(),a=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream_by_proxy,arguments:[i,o,s,a],typeArgs:[n.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream_by_proxy}`}};var Mn=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new _n(r,e),this.streamContract=new Pt(r,e)}feeContract;streamContract;async createStreams(e){let r=Lr.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Lr(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new ge;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new ge;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new ge;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new ge;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var pa=class extends ue{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var r2=1e3,xa=class{constructor(e){this.globals=e;this.coinMetaHelper=new cu(e.suiClient),this.createStreamHelper=new Mn(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new pa(e.effects?.status.status,e.effects?.status.error);return e.objectChanges.filter(r=>r.type==="created"&&r.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(r=>r.objectId)}calculateCreateStreamFees(e){return this.createStreamHelper.calculateCreateStreamFees(e)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=e.cliff?e.cliff:{numerator:0n,denominator:100n},n=e.totalAmount*r.numerator/r.denominator,i=(e.totalAmount-n)/e.steps,s={realTotalAmount:i*e.steps+n,cliffAmount:n,amountPerStep:i};return this.validateStreamAmount(s,e.totalAmount),s}calculateTimelineByInterval(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=e.timeStart.plus(e.interval.toMillis()*Number(e.steps)),n={timeStart:e.timeStart,timeEnd:r,interval:e.interval,steps:e.steps};return this.validateTimeline(n),n}calculateTimelineByTotalDuration(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=BigInt(e.total.toMillis())/e.steps,n=e.timeStart.plus(le.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:le.fromMillis(Number(r)),steps:e.steps};return this.validateTimeline(i),i}async getBalance(e,r){let n=await this.globals.suiClient.getBalance({owner:e,coinType:r}),i=await this.getCoinMeta(r);return{...n,coinType:oe(n.coinType),coinMeta:i}}async getAllBalance(e){let r=await this.globals.suiClient.getAllBalances({owner:e}),n=await Promise.all(r.map(i=>this.getCoinMeta(i.coinType)));return r.map((i,o)=>({...i,coinType:oe(i.coinType),coinMeta:n[o]}))}async getCoinMeta(e){return this.coinMetaHelper.getCoinMeta(e)}async simulateTransactionBlock(e){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:e,sender:await this.globals.wallet.address()})}validateStreamAmount(e,r){if(e.amountPerStep===0n)throw new we("Stream amount too small","totalAmount",r);if(e.cliffAmount>e.realTotalAmount)throw new we("Invalid cliff settings")}validateTimeline(e){if(e.interval.toMillis()<r2)throw new we("Interval shall be at least 1 second","interval",e.interval)}},cu=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||ot);if(this.coinMetaReg.has(r))return this.coinMetaReg.get(r);let n=await this.queryCoinMeta(r);return n&&this.coinMetaReg.set(r,n),n}async queryCoinMeta(e){return await this.suiClient.getCoinMetadata({coinType:e})||void 0}};var ya=class extends ue{constructor(){super(7,"Connected wallet is not creator")}};var Xi=class extends ue{constructor(){super(8,"Connected wallet is not recipient")}};var Qi=class extends ue{constructor(e,r){super(6,e,{context:r})}};var Te=class extends ue{constructor(e,r={}){super(0,e,r)}};var ga=class extends ue{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Gh=(1n<<64n)-1n,ba=1e3;function uu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ba);return te.fromMillis(r*ba)}function lu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ba);return le.fromMillis(r*ba)}var Cr=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Pt(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await t.fetchStreamData(e,r);return new t(e,r,n)}static fromObjectData(e,r,n){let i=t.parseRawStreamData(r,n);return new t(e,r,i)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await t.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new Te("Object Id does not align");this.rawData=t.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new ya;let e=new ge;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Xi;let e=new ge;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Xi;let r=new ge;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new ge;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return oe(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return lu(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Yi(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Yi(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return uu(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return lu(r)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:uu((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===Gh?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=te.now().toMillis(),r=this.timeStart.toMillis();if(e<r)return-1n;let n=Math.floor((e-r)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,r){let n=await e.suiClient.getObject({id:r,options:{showContent:!0,showType:!0}});return t.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new ga(e):new Qi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Qi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Zn(n.type),o=oe(i[0]),s=n.fields,a=s.config.fields,c=s.status.fields;return{coinType:o,autoClaim:s.auto_claim,balance:BigInt(s.balance.fields.balance),config:{amountPerEpoch:BigInt(a.amount_per_epoch),cancelable:a.cancelable,cliff:BigInt(a.cliff),creator:a.creator,epochInterval:BigInt(a.epoch_interval),metadata:a.metadata,recipient:a.recipient,timeStart:BigInt(a.time_start),totalEpoch:BigInt(a.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}};var Nn=class extends ue{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function du(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var fu=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Rn=class{constructor(e){this.requester=e;this.pager=new fu(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};var n2=25;async function hu(t,e,r){let n=new eo(e),i=new to(t,n,r);return await du(i)}var eo=class{constructor(e){this.ids=e;this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},to=class extends Rn{constructor(r,n,i){super(new mu(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},mu=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||n2,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let e=[];for(;e.length<this.pageSize&&await this.stringIter.hasNext();){let o=await this.stringIter.next();o&&e.push(o)}let r=await this.suiClient.multiGetObjects({ids:e,options:this.objectOptions}),n;if(this.filter){let{filter:i}=this;n=r.filter(o=>i?.(o))}else n=r;return{data:n,hasNext:await this.stringIter.hasNext()}}};var wa=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new Nn("stream size 0");let n=r.map(o=>o.groupId);if(new Set(n).size!==1)throw new we("Stream does not have same group ID")}type="StreamGroup";static async new(e,r){let n=await hu(e.suiClient,r);return n.forEach(i=>{if(!i)throw new Te("stream group object data undefined")}),t.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let i=await t.parseGroupStreams(e,r,n);return new t(e,i)}static checkStreamGroup(e){let r=e.map(o=>o.groupCommonInfo),n=r[0],i=!0;return r.forEach(o=>{i2(n,o)||(i=!1)}),i}async refresh(){let e=await hu(this.globals.suiClient,this.streams.map(r=>r.streamId));this.streams.forEach((r,n)=>{r.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,r)=>e+r.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,r)=>e+r.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,r)=>r.nextReleaseAmount===null?e:e+r.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,r)=>e+r.totalAmount,0n),streamed:this.streams.reduce((e,r)=>e+r.streamedAmount,0n),claimed:this.streams.reduce((e,r)=>e+r.claimedAmount,0n),claimable:this.streams.reduce((e,r)=>e+r.claimable,0n),canceled:this.streams.reduce((e,r)=>e+r.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,r,n){let i=n.map((o,s)=>Cr.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new Nn("Not same group ID");if(!this.checkStreamGroup(i))throw new Nn("Not same stream settings");return i}};function i2(t,e){return t.name===e.name&&t.groupId===e.groupId&&t.creator===e.creator&&t.start.toMillis()===e.start.toMillis()&&t.interval.toMillis()===e.interval.toMillis()&&t.steps===e.steps&&t.cancelable===e.cancelable}var ro=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await Ea.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await Ea.newOutgoing(e);return new t(r,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},Ea=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await Sa.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await Sa.newOutgoingQuery(e);return new t(r)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let r=await this.requester.doNextRequest();if(r===null)throw new Te("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new Te("No more results");return e}},Sa=class t{constructor(e,r,n,i){this.globals=e;this.recipient=r;this.groupRefs=n;this.query=i;this.current=0;let o=new eo(n.flat().map(s=>s.streamId));this.objectIter=new to(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=u2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=Zh(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=l2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=Zh(i);return new t(e.globals,n,o,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let r=await a2(this.globals,e[0].streamId,this.objectIter);return this.current++,Kh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await c2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,s2(r,this.query)?r:this.doNextRequest()}throw new Te("Stream group with no stream")}};function Zh(t){let e=new Map;return t.forEach(r=>{let n=e.get(r.groupId);n?(n.push(r),e.set(r.groupId,n)):e.set(r.groupId,[r])}),Array.from(e.values()).sort((r,n)=>te.fromISO(n[0].createDate).toMillis()-te.fromISO(r[0].createDate).toMillis())}function Kh(t,e){if(e===void 0)return!0;let r=o2(t,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?t.progress.claimable!==0n:t.progress.claimable===0n;return r&&n}return r}function o2(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function s2(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{Kh(n,e)&&(r=!0)}),r}async function a2(t,e,r){let n=await Jh(r,e);return Cr.fromObjectData(t,e,n)}async function c2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Jh(r,e[n.length]);n.push(i)}return wa.newFromObjectResponse(t,e,n)}async function Jh(t,e){if(!await t.hasNext())throw new Te("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new Te("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new Te("stream id not aligned");return r}function u2(t){return{status:pu(t?.status),coinType:Yh(t?.coinType),sender:Xh(t?.sender)}}function l2(t){return{status:pu(t?.status),coinType:Yh(t?.coinType),recipient:Xh(t?.recipient)}}function pu(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=pu(r);return!e||e===n?n:"all"},void 0):f2(t)}function f2(t){switch(t){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new we("Unknown stream filtered status")}}function Yh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function Xh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var Ca=class extends ue{constructor(r,n,i){super(4,`Not enough balance: ${r}`,{context:{coinType:r,requestAmount:n,gotAmount:i}});this.coinType=r;this.requestAmount=n;this.gotAmount=i}};var d2=25;async function Qh(t,e,r,n="0x2::sui::SUI",i=d2){let o=new xu(t,e,n,i),s=BigInt(0),a=[];for(;await o.hasNext()&&s<r;){let c=await o.next();c&&(a.push(c),s+=BigInt(c.balance))}if(s<r)throw new Ca(n,r,s);return a}var xu=class extends Rn{constructor(r,n,i,o){super(new yu(r,n,i,o));this.suiClient=r;this.owner=n;this.coinType=i;this.reqPageSize=o}},yu=class{constructor(e,r,n,i){this.suiClient=e;this.owner=r;this.coinType=n;this.reqPageSize=i;if(i<=0)throw new Te("Invalid reqPageSize")}nextCursor;async doNextRequest(){let e=await this.suiClient.getCoins({owner:this.owner,coinType:this.coinType,cursor:this.nextCursor,limit:this.reqPageSize});return this.nextCursor=e.nextCursor,{data:e.data,hasNext:e.hasNextPage}}};var gu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},pt=class{constructor(e){this.account=e}async address(){return this.account.address}},bu=class{constructor(e,r){this.singleWallet=e;this.suiClient=r}get type(){return"single"}async address(){return this.singleWallet.address()}async requestCoins(e){return Promise.all(e.map(r=>this.requestCoin(r)))}async requestCoin(e){if(ma(e.coinType,ot))return{primaryCoin:ha};if(e.amount<=0)throw new we("Invalid coin request","coinAmount",e.amount);let r=await Qh(this.suiClient,await this.address(),e.amount,e.coinType);if(r.length===0)throw new Te("no coins available");return{primaryCoin:r[0].coinObjectId,mergedCoins:r.slice(1).map(n=>n.coinObjectId)}}},xt=class{globals;helper;constructor(e,r){this.globals=yn.new(e,r),this.helper=new xa(this.globals)}connectSingleWallet(e){let r=new bu(e,this.globals.suiClient);this.globals.connectWallet(r)}connectMSafeAccount(e){let r=new gu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return Cr.new(this.globals,e)}async getIncomingStreams(e,r=10){return ro.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return ro.newOutgoing({globals:this.globals,query:e,pageSize:r})}async getCoinTypesForStreamFilter(){let e=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(e)).map(n=>oe(n))}async getRecipientsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllRecipients(r,e)).map(i=>$(i))}async getCreatorsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllSenders(r,e)).map(i=>$(i))}get wallet(){return this.globals.wallet}builder(){return new Mn(this.globals)}};var va=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).cancel()}static fromData(r){return new t(r)}};var Ta=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).claimByProxy()}static fromData(r){return new t(r)}};var Aa=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).claim()}static fromData(r){return new t(r)}};var Ba=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await o.createStream(this.data)}static fromData(r){return new t(r)}};var Yt=class t{constructor(e,r){this.moveCall=e;this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return t.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return t.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return $(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return t.getPureInputValue(n,r)}getInputParam(e){let r=this.moveCall.arguments[e];if(r.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[r.index]}static getPureInputValue(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return $(e.value.Object.ImmOrOwned.objectId)}return $(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return $(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return $(e.value.Object.Shared.objectId)}static getPureInput(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}typeArg(e){return oe(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}};var Da=class{constructor(e,r){this.globals=e;this.txb=r}decode(){let e=this.decodeCreateStreamInfo(),r=this.createStreamHelper().calculateCreateStreamFees(e),n=this.getCoinMerges();return{type:"CreateStream",info:e,fees:r,coinMerges:n}}decodeCreateStreamInfo(){let r=this.createStreamTransactions().map(n=>this.getCreationInfoFromMoveCall(n));return this.aggregateGroupStreamInfo(r)}createStreamTransactions(){let e=this.transactions.filter(r=>r.kind==="MoveCall"&&Sr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new Te("No create stream transactions");return e.map(r=>new Yt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=Yi(r),o=e.decodeInputAddress(5),s=e.decodeInputU64(6),a=e.decodeInputU64(7),c=e.decodeInputU64(8),l=e.decodeInputU64(9),u=e.decodeInputU64(10),f=e.decodeInputBool(11),d=e.typeArg(0);return{name:n,groupId:i,recipient:o,timeStart:s,cliff:a,epochInterval:c,totalEpoch:l,amountPerEpoch:u,cancelable:f,coinType:d}}aggregateGroupStreamInfo(e){if(new Set(e.map(i=>JSON.stringify({name:i.name,groupId:i.groupId,timeStart:String(i.timeStart),epochInterval:String(i.epochInterval),totalEpoch:String(i.totalEpoch),cancelable:i.cancelable,coinType:i.coinType}))).size!==1)throw new we("Stream group not have common info");let n=e.map(i=>({address:i.recipient,amountPerStep:i.amountPerEpoch,cliffAmount:i.cliff}));return{name:e[0].name,coinType:e[0].coinType,recipients:n,interval:e[0].epochInterval,steps:e[0].totalEpoch,startTimeMs:e[0].timeStart,cancelable:e[0].cancelable}}getCoinMerges(){let e=this.createStreamTransactions()[0];return this.getCoinMergeForCreateStream(e)}getCoinMergeForCreateStream(e){let r=e.typeArg(0),n=e.txArg(2),i=this.getCoinMergeFromNestedResult(n,r,e);if(r===oe(ot))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(ot),e);return[i,s]}getCoinMergeFromNestedResult(e,r,n){if(e.kind==="GasCoin")return{primary:"GAS",coinType:r};if(e.kind==="Input"){let i=this.getInputArg(e),o=Yt.getOwnedObjectId(i),s=this.transactions.find(a=>{if(a.kind!=="MergeCoins")return!1;if(a.destination.kind!=="Input")throw new Error("merge coin destination not Input type");let c=this.getInputArg(a.destination);return Yt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Yt.getOwnedObjectId(c)}),coinType:r}:{primary:o,coinType:r}}if(e.kind==="NestedResult"){let i=this.transactions[e.index];if(i.kind!=="SplitCoins")throw new we(`Transaction type not expected. Expect SplitCoins, got ${i.kind}`);return this.getCoinMergeFromNestedResult(i.coin,r,n)}throw e.kind==="Result"?new Error("Result type not expected for coin inputs"):new Error("Unknown argument kind")}mergeCoinTransactions(){return this.transactions.filter(e=>e.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new Pt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new _n(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Lr(this.globals,this.feeContract,this.contract)}getInputArg(e){if(e.kind!=="Input")throw new Error("not input type");return"value"in e?e:this.txb.blockData.inputs[e.index]}};var Ia=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Pt(e.envConfig.contract,e)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(r=>r.kind==="MoveCall"&&Sr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new Da(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let e=this.helper.decodeSharedObjectId(0),r=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:e,enabled:r}}decodeClaimTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Claim",streamId:e}}decodeClaimByProxyTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"ClaimByProxy",streamId:e}}decodeCancelStreamTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Cancel",streamId:e}}get helper(){let e=this.transactions[0];return new Yt(e,this.txb)}};var Fa=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).setAutoClaim(!0)}static fromData(r){return new t(r)}};var Oa=class{application="mpay";async deserialize(e){let{chain:r,transactionBlock:n}=e,i=yn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ia(i,n).decode();if(s.type==="CreateStream")return{txType:Ht.Stream,txSubType:s.type,intentionData:s.info};if(s.type==="Claim")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};if(s.type==="ClaimByProxy")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};if(s.type==="SetAutoClaim")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId,enabled:s.enabled}};if(s.type==="Cancel")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};throw new Error(`Unknown transaction type: ${s}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case"CreateStream":s=Ba.fromData(n);break;case"Claim":s=Aa.fromData(n);break;case"ClaimByProxy":s=Ta.fromData(n);break;case"SetAutoClaim":s=Fa.fromData(n);break;case"Cancel":s=va.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var ka=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Rd(n,this.data,i.address)}static fromData(r){return new t(r)}};var _a=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Pd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ma=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=ge.from(this.data.content);if(!$c(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Na=class{application;constructor(){this.application=jd}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(e){let{suiClient:r,account:n}=e,i;switch(e.txSubType){case an.assets.coin.send:i=ka.fromData(e.intentionData);break;case an.assets.object.send:i=_a.fromData(e.intentionData);break;case an.others.plain:i=Ma.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Ra=class{apps;constructor(e){this.apps=new Map(e.map(r=>[r.application,r]))}getAppHelper(e){let r=this.apps.get(e);if(!r)throw new Error(`${e} not registered`);return r}};var m2=er(si()),h2="msafe-plain-tx",p2=an.others.plain;var Pa=class{application;constructor(){this.application=h2}async deserialize(e){let{transactionBlock:r,suiClient:n}=e,i=await r.build({client:n});return{txType:Ht.Other,txSubType:p2,intentionData:{content:Le(i)}}}async build(e){let{suiClient:r,account:n}=e,i=ge.from(Et(e.intentionData.content)),o=await r.devInspectTransactionBlock({transactionBlock:i,sender:n.address});if(!(o.effects.status.status==="success"))throw new Error(o.effects.status.error);return i}};var x2=new Ra([new Na,new Oa,new Pa]);return bp(y2);})();
|
|
10
|
+
`+o):n.stack=o}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=qt(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&qs.assertOptions(n,{silentJSONParsing:mr.transitional(mr.boolean),forcedJSONParsing:mr.transitional(mr.boolean),clarifyTimeoutError:mr.transitional(mr.boolean)},!1),i!=null&&(C.isFunction(i)?r.paramsSerializer={serialize:i}:qs.assertOptions(i,{encode:mr.function,serialize:mr.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&C.merge(o.common,o[r.method]);o&&C.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),r.headers=$e.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(c=c&&x.synchronous,a.unshift(x.fulfilled,x.rejected))});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let u,f=0,d;if(!c){let h=[Hs.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),d=h.length,u=Promise.resolve(r);f<d;)u=u.then(h[f++],h[f++]);return u}d=a.length;let m=r;for(f=0;f<d;){let h=a[f++],x=a[f++];try{m=h(m)}catch(g){x.call(this,g);break}}try{u=Hs.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,d=l.length;f<d;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=qt(this.defaults,e);let r=gi(e.baseURL,e.url);return hi(r,e.params,e.paramsSerializer)}};C.forEach(["delete","get","head","options"],function(e){pn.prototype[e]=function(r,n){return this.request(qt(n||{},{method:e,url:r,data:(n||{}).data}))}});C.forEach(["post","put","patch"],function(e){function r(n){return function(o,s,a){return this.request(qt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}pn.prototype[e]=r(),pn.prototype[e+"Form"]=r(!0)});var bi=pn;var y0=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new dr(o,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Bm=y0;function g0(t){return function(r){return t.apply(null,r)}}function b0(t){return C.isObject(t)&&t.isAxiosError===!0}var w0={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(w0).forEach(([t,e])=>{w0[e]=t});var Dm=w0;function Im(t){let e=new bi(t),r=fi(bi.prototype.request,e);return C.extend(r,bi.prototype,e,{allOwnKeys:!0}),C.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Im(qt(t,i))},r}var Ee=Im(mn);Ee.Axios=bi;Ee.CanceledError=dr;Ee.CancelToken=Bm;Ee.isCancel=yi;Ee.VERSION=$s;Ee.toFormData=fr;Ee.AxiosError=Y;Ee.Cancel=Ee.CanceledError;Ee.all=function(e){return Promise.all(e)};Ee.spread=g0;Ee.isAxiosError=b0;Ee.mergeConfig=qt;Ee.AxiosHeaders=$e;Ee.formToJSON=t=>Ls(C.isHTMLForm(t)?new FormData(t):t);Ee.getAdapter=zs.getAdapter;Ee.HttpStatusCode=Dm;Ee.default=Ee;var Vt=Ee;var{Axios:b8,AxiosError:Fm,CanceledError:w8,isCancel:E8,CancelToken:S8,VERSION:C8,all:v8,Cancel:T8,isAxiosError:A8,spread:B8,toFormData:D8,AxiosHeaders:I8,HttpStatusCode:F8,formToJSON:O8,getAdapter:k8,mergeConfig:_8}=Vt;var xn=class extends ue{constructor(e,r){super(10,e,{context:r})}};var Vs=class t{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof Fm)throw new xn(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new xn(e.data.code)}throw new xn(e.status.toString())}async getIncomingStreams(e,r){let n=await Vt.post(`${this.apiURL}/stream`,{recipient:e,...r});return t.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await Vt.post(`${this.apiURL}/stream`,{sender:e,...r});return t.parseResponseData(n)}async getStreamHistory(e){let r=await Vt.post(`${this.apiURL}/stream-events`,e),n=t.parseResponseData(r);return n.data.forEach(i=>{let o=i;return o.data.type==="create_stream"?o.data.balance=BigInt(o.data.balance):o.data.type==="cancel_stream"?o.data.withdrawAmount=BigInt(o.data.withdrawAmount):o.data.type==="claim"||o.data.type==="auto_claim"?o.data.claimAmount=BigInt(o.data.claimAmount):o.data.type==="set_auto_claim"&&(o.data.enabled=!!o.data.enabled),o.createdAt=new Date(o.createdAt),o}),n}async getAllCoinTypes(e){let r=await Vt.post(`${this.apiURL}/stream-info`,{address:e});return t.parseResponseData(r)}async getAllRecipients(e,r){let n=await Vt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return t.parseResponseData(n)}async getAllSenders(e,r){let n=await Vt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return t.parseResponseData(n)}};var yn=class t{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Fs({url:e.rpc.url}),e.backend&&(this._backend=new Vs(e.backend.url))}static new(e,r){let n=zd(e,r);return new t(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Os;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new ks;return this.signer}async walletAddress(){return this.wallet.address()}};var Gt=class extends Error{},Gs=class extends Gt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Zs=class extends Gt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Ks=class extends Gt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Bt=class extends Gt{},gn=class extends Gt{constructor(e){super(`Invalid unit ${e}`)}},Se=class extends Gt{},Dt=class extends Gt{constructor(){super("Zone is an abstract class")}};var j="numeric",It="short",Qe="long",hr={year:j,month:j,day:j},wi={year:j,month:It,day:j},E0={year:j,month:It,day:j,weekday:It},Ei={year:j,month:Qe,day:j},Si={year:j,month:Qe,day:j,weekday:Qe},Ci={hour:j,minute:j},vi={hour:j,minute:j,second:j},Ti={hour:j,minute:j,second:j,timeZoneName:It},Ai={hour:j,minute:j,second:j,timeZoneName:Qe},Bi={hour:j,minute:j,hourCycle:"h23"},Di={hour:j,minute:j,second:j,hourCycle:"h23"},Ii={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:It},Fi={hour:j,minute:j,second:j,hourCycle:"h23",timeZoneName:Qe},Oi={year:j,month:j,day:j,hour:j,minute:j},ki={year:j,month:j,day:j,hour:j,minute:j,second:j},_i={year:j,month:It,day:j,hour:j,minute:j},Mi={year:j,month:It,day:j,hour:j,minute:j,second:j},S0={year:j,month:It,day:j,weekday:It,hour:j,minute:j},Ni={year:j,month:Qe,day:j,hour:j,minute:j,timeZoneName:It},Ri={year:j,month:Qe,day:j,hour:j,minute:j,second:j,timeZoneName:It},Pi={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,timeZoneName:Qe},ji={year:j,month:Qe,day:j,weekday:Qe,hour:j,minute:j,second:j,timeZoneName:Qe};var Ze=class{get type(){throw new Dt}get name(){throw new Dt}get ianaName(){return this.name}get isUniversal(){throw new Dt}offsetName(e,r){throw new Dt}formatOffset(e,r){throw new Dt}offset(e){throw new Dt}equals(e){throw new Dt}get isValid(){throw new Dt}};var C0=null,pr=class t extends Ze{static get instance(){return C0===null&&(C0=new t),C0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Ys(e,r,n)}formatOffset(e,r){return xr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Qs={};function O1(t){return Qs[t]||(Qs[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Qs[t]}var k1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function _1(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,o,s,a,c,l,u]=n;return[s,i,o,a,c,l,u]}function M1(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=k1[o];o==="era"?n[a]=s:H(a)||(n[a]=parseInt(s,10))}return n}var Xs={},je=class t extends Ze{static create(e){return Xs[e]||(Xs[e]=new t(e)),Xs[e]}static resetCache(){Xs={},Qs={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Ys(e,r,n,this.name)}formatOffset(e,r){return xr(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=O1(this.name),[i,o,s,a,c,l,u]=n.formatToParts?M1(n,r):_1(n,r);a==="BC"&&(i=-Math.abs(i)+1);let d=bn({year:i,month:o,day:s,hour:c===24?0:c,minute:l,second:u,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Om={};function N1(t,e={}){let r=JSON.stringify([t,e]),n=Om[r];return n||(n=new Intl.ListFormat(t,e),Om[r]=n),n}var v0={};function T0(t,e={}){let r=JSON.stringify([t,e]),n=v0[r];return n||(n=new Intl.DateTimeFormat(t,e),v0[r]=n),n}var A0={};function R1(t,e={}){let r=JSON.stringify([t,e]),n=A0[r];return n||(n=new Intl.NumberFormat(t,e),A0[r]=n),n}var B0={};function P1(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=B0[i];return o||(o=new Intl.RelativeTimeFormat(t,e),B0[i]=o),o}var Ui=null;function j1(){return Ui||(Ui=new Intl.DateTimeFormat().resolvedOptions().locale,Ui)}var km={};function U1(t){let e=km[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,km[t]=e}return e}function L1(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=T0(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=T0(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function W1(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function z1(t){let e=[];for(let r=1;r<=12;r++){let n=te.utc(2009,r,1);e.push(t(n))}return e}function H1(t){let e=[];for(let r=1;r<=7;r++){let n=te.utc(2016,11,13+r);e.push(t(n))}return e}function ea(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function $1(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var D0=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!r||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=R1(e,a)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):wn(e,3);return ye(r,this.padTo)}}},I0=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&je.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=T0(r,o)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},F0=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&ta()&&(this.rtf=P1(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):_m(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},q1={firstDay:1,minimalDays:4,weekend:[6,7]},se=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,i,o=!1){let s=e||ne.defaultLocale,a=s||(o?"en-US":j1()),c=r||ne.defaultNumberingSystem,l=n||ne.defaultOutputCalendar,u=Li(i)||ne.defaultWeekSettings;return new t(a,c,l,u,s)}static resetCache(){Ui=null,v0={},A0={},B0={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return t.create(e,r,n,i)}constructor(e,r,n,i,o){let[s,a,c]=L1(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=W1(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=$1(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Li(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return ea(this,e,O0,()=>{let n=r?{month:e,day:"numeric"}:{month:e},i=r?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=z1(o=>this.extract(o,n,"month"))),this.monthsCache[i][e]})}weekdays(e,r=!1){return ea(this,e,k0,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=r?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=H1(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return ea(this,void 0,()=>_0,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[te.utc(2016,11,13,9),te.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ea(this,e,M0,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[te.utc(-40,1,1),te.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new D0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new I0(e,this.intl,r)}relFormatter(e={}){return new F0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return N1(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ra()?U1(this.locale):q1}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}};var R0=null,Oe=class t extends Ze{static get utcInstance(){return R0===null&&(R0=new t(0)),R0}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Nr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${xr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${xr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return xr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var En=class extends Ze{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Ft(t,e){let r;if(H(t)||t===null)return e;if(t instanceof Ze)return t;if(Mm(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?pr.instance:n==="utc"||n==="gmt"?Oe.utcInstance:Oe.parseSpecifier(n)||je.create(t)}else return Nt(t)?Oe.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new En(t)}var Nm=()=>Date.now(),Rm="system",Pm=null,jm=null,Um=null,Lm=60,Wm,zm=null,ne=class{static get now(){return Nm}static set now(e){Nm=e}static set defaultZone(e){Rm=e}static get defaultZone(){return Ft(Rm,pr.instance)}static get defaultLocale(){return Pm}static set defaultLocale(e){Pm=e}static get defaultNumberingSystem(){return jm}static set defaultNumberingSystem(e){jm=e}static get defaultOutputCalendar(){return Um}static set defaultOutputCalendar(e){Um=e}static get defaultWeekSettings(){return zm}static set defaultWeekSettings(e){zm=Li(e)}static get twoDigitCutoffYear(){return Lm}static set twoDigitCutoffYear(e){Lm=e%100}static get throwOnInvalid(){return Wm}static set throwOnInvalid(e){Wm=e}static resetCaches(){se.resetCache(),je.resetCache()}};var ke=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Hm=[0,31,59,90,120,151,181,212,243,273,304,334],$m=[0,31,60,91,121,152,182,213,244,274,305,335];function dt(t,e){return new ke("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function na(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function qm(t,e,r){return r+(Pr(t)?$m:Hm)[e-1]}function Vm(t,e){let r=Pr(t)?$m:Hm,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function ia(t,e){return(t-e+7)%7+1}function Wi(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=qm(n,i,o),a=ia(na(n,i,o),r),c=Math.floor((s-a+14-e)/7),l;return c<1?(l=n-1,c=Rr(l,e,r)):c>Rr(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...Hi(t)}}function P0(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=ia(na(n,1,e),r),a=yr(n),c=i*7+o-s-7+e,l;c<1?(l=n-1,c+=yr(l)):c>a?(l=n+1,c-=yr(n)):l=n;let{month:u,day:f}=Vm(l,c);return{year:l,month:u,day:f,...Hi(t)}}function oa(t){let{year:e,month:r,day:n}=t,i=qm(e,r,n);return{year:e,ordinal:i,...Hi(t)}}function j0(t){let{year:e,ordinal:r}=t,{month:n,day:i}=Vm(e,r);return{year:e,month:n,day:i,...Hi(t)}}function U0(t,e){if(!H(t.localWeekday)||!H(t.localWeekNumber)||!H(t.localWeekYear)){if(!H(t.weekday)||!H(t.weekNumber)||!H(t.weekYear))throw new Bt("Cannot mix locale-based week fields with ISO-based week fields");return H(t.localWeekday)||(t.weekday=t.localWeekday),H(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),H(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Gm(t,e=4,r=1){let n=zi(t.weekYear),i=et(t.weekNumber,1,Rr(t.weekYear,e,r)),o=et(t.weekday,1,7);return n?i?o?!1:dt("weekday",t.weekday):dt("week",t.weekNumber):dt("weekYear",t.weekYear)}function Zm(t){let e=zi(t.year),r=et(t.ordinal,1,yr(t.year));return e?r?!1:dt("ordinal",t.ordinal):dt("year",t.year)}function L0(t){let e=zi(t.year),r=et(t.month,1,12),n=et(t.day,1,Sn(t.year,t.month));return e?r?n?!1:dt("day",t.day):dt("month",t.month):dt("year",t.year)}function W0(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=et(e,0,23)||e===24&&r===0&&n===0&&i===0,s=et(r,0,59),a=et(n,0,59),c=et(i,0,999);return o?s?a?c?!1:dt("millisecond",i):dt("second",n):dt("minute",r):dt("hour",e)}function H(t){return typeof t>"u"}function Nt(t){return typeof t=="number"}function zi(t){return typeof t=="number"&&t%1===0}function Mm(t){return typeof t=="string"}function Jm(t){return Object.prototype.toString.call(t)==="[object Date]"}function ta(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ra(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ym(t){return Array.isArray(t)?t:[t]}function z0(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let o=[e(i),i];return n&&r(n[0],o[0])===n[0]?n:o},null)[1]}function Xm(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function gr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Li(t){if(t==null)return null;if(typeof t!="object")throw new Se("Week settings must be an object");if(!et(t.firstDay,1,7)||!et(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!et(e,1,7)))throw new Se("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function et(t,e,r){return zi(t)&&t>=e&&t<=r}function V1(t,e){return t-e*Math.floor(t/e)}function ye(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function Zt(t){if(!(H(t)||t===null||t===""))return parseInt(t,10)}function br(t){if(!(H(t)||t===null||t===""))return parseFloat(t)}function $i(t){if(!(H(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function wn(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function Pr(t){return t%4===0&&(t%100!==0||t%400===0)}function yr(t){return Pr(t)?366:365}function Sn(t,e){let r=V1(e-1,12)+1,n=t+(e-r)/12;return r===2?Pr(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function bn(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Km(t,e,r){return-ia(na(t,1,e),r)+e-1}function Rr(t,e=4,r=1){let n=Km(t,e,r),i=Km(t+1,e,r);return(yr(t)-n+i)/7}function qi(t){return t>99?t:t>ne.twoDigitCutoffYear?1900+t:2e3+t}function Ys(t,e,r,n=null){let i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(r,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Nr(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function H0(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Se(`Invalid unit value ${t}`);return e}function Cn(t,e){let r={};for(let n in t)if(gr(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=H0(i)}return r}function xr(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ye(r,2)}:${ye(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${ye(r,2)}${ye(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Hi(t){return Xm(t,["hour","minute","second","millisecond"])}var G1=["January","February","March","April","May","June","July","August","September","October","November","December"],$0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Z1=["J","F","M","A","M","J","J","A","S","O","N","D"];function O0(t){switch(t){case"narrow":return[...Z1];case"short":return[...$0];case"long":return[...G1];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var q0=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],V0=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],K1=["M","T","W","T","F","S","S"];function k0(t){switch(t){case"narrow":return[...K1];case"short":return[...V0];case"long":return[...q0];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var _0=["AM","PM"],J1=["Before Christ","Anno Domini"],Y1=["BC","AD"],X1=["B","A"];function M0(t){switch(t){case"narrow":return[...X1];case"short":return[...Y1];case"long":return[...J1];default:return null}}function Qm(t){return _0[t.hour<12?0:1]}function eh(t,e){return k0(e)[t.weekday-1]}function th(t,e){return O0(e)[t.month-1]}function rh(t,e){return M0(e)[t.year<0?0:1]}function _m(t,e,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&o){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`;default:}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,l=i[t],u=n?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}function nh(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Q1={D:hr,DD:wi,DDD:Ei,DDDD:Si,t:Ci,tt:vi,ttt:Ti,tttt:Ai,T:Bi,TT:Di,TTT:Ii,TTTT:Fi,f:Oi,ff:_i,fff:Ni,ffff:Pi,F:ki,FF:Mi,FFF:Ri,FFFF:ji},_e=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?(n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return Q1[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return ye(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",a=()=>n?Qm(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,h)=>n?th(e,m):o(h?{month:m}:{month:m,day:"numeric"},"month"),l=(m,h)=>n?eh(e,m):o(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},f=m=>n?rh(e,m):o({era:m},"era"),d=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(m)}};return nh(t.parseFormat(r),d)}formatDurationFromString(e,r){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=c=>l=>{let u=n(l);return u?this.num(c.get(u),l.length):l},o=t.parseFormat(r),s=o.reduce((c,{literal:l,val:u})=>l?c:c.concat(u),[]),a=e.shiftTo(...s.map(n).filter(c=>c));return nh(o,i(a))}};var oh=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Tn(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function An(...t){return e=>t.reduce(([r,n,i],o)=>{let[s,a,c]=o(e,i);return[{...r,...s},a||n,c]},[{},null,1]).slice(0,2)}function Bn(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function sh(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=Zt(e[r+i]);return[n,null,r+i]}}var ah=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,eb=`(?:${ah.source}?(?:\\[(${oh.source})\\])?)?`,G0=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ch=RegExp(`${G0.source}${eb}`),Z0=RegExp(`(?:T${ch.source})?`),tb=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,rb=/(\d{4})-?W(\d\d)(?:-?(\d))?/,nb=/(\d{4})-?(\d{3})/,ib=sh("weekYear","weekNumber","weekDay"),ob=sh("year","ordinal"),sb=/(\d{4})-(\d\d)-(\d\d)/,uh=RegExp(`${G0.source} ?(?:${ah.source}|(${oh.source}))?`),ab=RegExp(`(?: ${uh.source})?`);function vn(t,e,r){let n=t[e];return H(n)?r:Zt(n)}function cb(t,e){return[{year:vn(t,e),month:vn(t,e+1,1),day:vn(t,e+2,1)},null,e+3]}function Dn(t,e){return[{hours:vn(t,e,0),minutes:vn(t,e+1,0),seconds:vn(t,e+2,0),milliseconds:$i(t[e+3])},null,e+4]}function Vi(t,e){let r=!t[e]&&!t[e+1],n=Nr(t[e+1],t[e+2]),i=r?null:Oe.instance(n);return[{},i,e+3]}function Gi(t,e){let r=t[e]?je.create(t[e]):null;return[{},r,e+1]}var ub=RegExp(`^T?${G0.source}$`),lb=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function fb(t){let[e,r,n,i,o,s,a,c,l]=t,u=e[0]==="-",f=c&&c[0]==="-",d=(m,h=!1)=>m!==void 0&&(h||m&&u)?-m:m;return[{years:d(br(r)),months:d(br(n)),weeks:d(br(i)),days:d(br(o)),hours:d(br(s)),minutes:d(br(a)),seconds:d(br(c),c==="-0"),milliseconds:d($i(l),f)}]}var db={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function K0(t,e,r,n,i,o,s){let a={year:e.length===2?qi(Zt(e)):Zt(e),month:$0.indexOf(r)+1,day:Zt(n),hour:Zt(i),minute:Zt(o)};return s&&(a.second=Zt(s)),t&&(a.weekday=t.length>3?q0.indexOf(t)+1:V0.indexOf(t)+1),a}var mb=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function hb(t){let[,e,r,n,i,o,s,a,c,l,u,f]=t,d=K0(e,i,n,r,o,s,a),m;return c?m=db[c]:l?m=0:m=Nr(u,f),[d,new Oe(m)]}function pb(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var xb=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,yb=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,gb=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function ih(t){let[,e,r,n,i,o,s,a]=t;return[K0(e,i,n,r,o,s,a),Oe.utcInstance]}function bb(t){let[,e,r,n,i,o,s,a]=t;return[K0(e,a,r,n,i,o,s),Oe.utcInstance]}var wb=Tn(tb,Z0),Eb=Tn(rb,Z0),Sb=Tn(nb,Z0),Cb=Tn(ch),lh=An(cb,Dn,Vi,Gi),vb=An(ib,Dn,Vi,Gi),Tb=An(ob,Dn,Vi,Gi),Ab=An(Dn,Vi,Gi);function fh(t){return Bn(t,[wb,lh],[Eb,vb],[Sb,Tb],[Cb,Ab])}function dh(t){return Bn(pb(t),[mb,hb])}function mh(t){return Bn(t,[xb,ih],[yb,ih],[gb,bb])}function hh(t){return Bn(t,[lb,fb])}var Bb=An(Dn);function ph(t){return Bn(t,[ub,Bb])}var Db=Tn(sb,ab),Ib=Tn(uh),Fb=An(Dn,Vi,Gi);function xh(t){return Bn(t,[Db,lh],[Ib,Fb])}var yh="Invalid Duration",bh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ob={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...bh},mt=146097/400,In=146097/4800,kb={years:{quarters:4,months:12,weeks:mt/7,days:mt,hours:mt*24,minutes:mt*24*60,seconds:mt*24*60*60,milliseconds:mt*24*60*60*1e3},quarters:{months:3,weeks:mt/28,days:mt/4,hours:mt*24/4,minutes:mt*24*60/4,seconds:mt*24*60*60/4,milliseconds:mt*24*60*60*1e3/4},months:{weeks:In/7,days:In,hours:In*24,minutes:In*24*60,seconds:In*24*60*60,milliseconds:In*24*60*60*1e3},...bh},jr=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_b=jr.slice(0).reverse();function wr(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new le(n)}function wh(t,e){let r=e.milliseconds??0;for(let n of _b.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function gh(t,e){let r=wh(t,e)<0?-1:1;jr.reduceRight((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]*r,s=t[i][n],a=Math.floor(o/s);e[i]+=a*r,e[n]-=a*s*r}return i},null),jr.reduce((n,i)=>{if(H(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*t[n][i]}return i},null)}function Mb(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var le=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?kb:Ob;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||se.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Se(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Cn(e,t.normalizeUnit),loc:se.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Nt(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Se(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=hh(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=ph(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the Duration is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Ks(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new gn(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?_e.create(this.loc,n).formatDurationFromString(this,e):yh}toHuman(e={}){if(!this.isValid)return yh;let r=jr.map(n=>{let i=this.values[n];return H(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=wn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},te.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?wh(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let i of jr)(gr(r.values,i)||gr(this.values,i))&&(n[i]=r.get(i)+this.get(i));return wr(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=H0(e(this.values[n],n));return wr(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Cn(e,t.normalizeUnit)};return wr(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return wr(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return gh(this.matrix,e),wr(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Mb(this.normalize().shiftToAll().toObject());return wr(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},n={},i=this.toObject(),o;for(let s of jr)if(e.indexOf(s)>=0){o=s;let a=0;for(let l in n)a+=this.matrix[l][s]*n[l],n[l]=0;Nt(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else Nt(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(r[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return gh(this.matrix,r),wr(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return wr(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of jr)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Fn="Invalid Interval";function Nb(t,e){return!t||!t.isValid?Kt.invalid("missing or invalid start"):!e||!e.isValid?Kt.invalid("missing or invalid end"):e<t?Kt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var Kt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the Interval is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Zs(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=On(e),i=On(r),o=Nb(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=le.fromDurationLike(r),i=On(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=le.fromDurationLike(r),i=On(e);return t.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=te.fromISO(n,r),s=o.isValid}catch{s=!1}let a,c;try{a=te.fromISO(i,r),c=a.isValid}catch{c=!1}if(s&&c)return t.fromDateTimes(o,a);if(s){let l=le.fromISO(i,r);if(l.isValid)return t.after(o,l)}else if(c){let l=le.fromISO(n,r);if(l.isValid)return t.before(a,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),i;return r?.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,r),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(On).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=r[o]||this.e,a=+s>+this.e?this.e:s;n.push(t.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let r=le.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(c=>c*i));o=+a>+this.e?this.e:a,s.push(t.fromDateTimes(n,o)),n=o,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],o=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((c,l)=>c.time-l.time);for(let c of a)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Fn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=hr,r={}){return this.isValid?_e.create(this.s.loc.clone(r),e).formatInterval(this):Fn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Fn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Fn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Fn}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Fn}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):le.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Jt=class{static hasDST(e=ne.defaultZone){let r=te.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return je.isValidZone(e)}static normalizeZone(e){return Ft(e,ne.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||se.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||se.create(r,n,o)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||se.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return se.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return se.create(r,null,"gregory").eras(e)}static features(){return{relative:ta(),localeWeek:ra()}}};function Eh(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(le.fromMillis(n).as("days"))}function Rb(t,e,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let u=Eh(c,l);return(u-u%7)/7}],["days",Eh]],i={},o=t,s,a;for(let[c,l]of n)r.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,t=o.plus(i),t>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}function Sh(t,e,r,n){let[i,o,s,a]=Rb(t,e,r),c=e-i,l=r.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);l.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));let u=le.fromObject(o,n);return l.length>0?le.fromMillis(c,n).shiftTo(...l).plus(u):u}var J0={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Ch={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Pb=J0.hanidec.replace(/[\[|\]]/g,"").split("");function vh(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(J0.hanidec)!==-1)e+=Pb.indexOf(t[r]);else for(let i in Ch){let[o,s]=Ch[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}function ht({numberingSystem:t},e=""){return new RegExp(`${J0[t||"latn"]}${e}`)}var jb="missing Intl.DateTimeFormat.formatToParts support";function ie(t,e=r=>r){return{regex:t,deser:([r])=>e(vh(r))}}var Ub="\xA0",Bh=`[ ${Ub}]`,Dh=new RegExp(Bh,"g");function Lb(t){return t.replace(/\./g,"\\.?").replace(Dh,Bh)}function Th(t){return t.replace(/\./g,"").replace(Dh," ").toLowerCase()}function Ot(t,e){return t===null?null:{regex:RegExp(t.map(Lb).join("|")),deser:([r])=>t.findIndex(n=>Th(r)===Th(n))+e}}function Ah(t,e){return{regex:t,deser:([,r,n])=>Nr(r,n),groups:e}}function sa(t){return{regex:t,deser:([e])=>e}}function Wb(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zb(t,e){let r=ht(e),n=ht(e,"{2}"),i=ht(e,"{3}"),o=ht(e,"{4}"),s=ht(e,"{6}"),a=ht(e,"{1,2}"),c=ht(e,"{1,3}"),l=ht(e,"{1,6}"),u=ht(e,"{1,9}"),f=ht(e,"{2,4}"),d=ht(e,"{4,6}"),m=g=>({regex:RegExp(Wb(g.val)),deser:([p])=>p,literal:!0}),x=(g=>{if(t.literal)return m(g);switch(g.val){case"G":return Ot(e.eras("short"),0);case"GG":return Ot(e.eras("long"),0);case"y":return ie(l);case"yy":return ie(f,qi);case"yyyy":return ie(o);case"yyyyy":return ie(d);case"yyyyyy":return ie(s);case"M":return ie(a);case"MM":return ie(n);case"MMM":return Ot(e.months("short",!0),1);case"MMMM":return Ot(e.months("long",!0),1);case"L":return ie(a);case"LL":return ie(n);case"LLL":return Ot(e.months("short",!1),1);case"LLLL":return Ot(e.months("long",!1),1);case"d":return ie(a);case"dd":return ie(n);case"o":return ie(c);case"ooo":return ie(i);case"HH":return ie(n);case"H":return ie(a);case"hh":return ie(n);case"h":return ie(a);case"mm":return ie(n);case"m":return ie(a);case"q":return ie(a);case"qq":return ie(n);case"s":return ie(a);case"ss":return ie(n);case"S":return ie(c);case"SSS":return ie(i);case"u":return sa(u);case"uu":return sa(a);case"uuu":return ie(r);case"a":return Ot(e.meridiems(),0);case"kkkk":return ie(o);case"kk":return ie(f,qi);case"W":return ie(a);case"WW":return ie(n);case"E":case"c":return ie(r);case"EEE":return Ot(e.weekdays("short",!1),1);case"EEEE":return Ot(e.weekdays("long",!1),1);case"ccc":return Ot(e.weekdays("short",!0),1);case"cccc":return Ot(e.weekdays("long",!0),1);case"Z":case"ZZ":return Ah(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return Ah(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return sa(/[a-z_+-/]{1,256}?/i);case" ":return sa(/[^\S\n\r]/);default:return m(g)}})(t)||{invalidReason:jb};return x.token=t,x}var Hb={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $b(t,e,r){let{type:n,value:i}=t;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let a=Hb[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function qb(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Vb(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(gr(r,s)){let a=r[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+c))),o+=c}return[n,i]}else return[n,{}]}function Gb(t){let e=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return H(t.z)||(r=je.create(t.z)),H(t.Z)||(r||(r=new Oe(t.Z)),n=t.Z),H(t.q)||(t.M=(t.q-1)*3+1),H(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),H(t.u)||(t.S=$i(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var Y0=null;function Zb(){return Y0||(Y0=te.fromMillis(1555555555555)),Y0}function Kb(t,e){if(t.literal)return t;let r=_e.macroTokenToFormatOpts(t.val),n=eu(r,e);return n==null||n.includes(void 0)?t:n}function X0(t,e){return Array.prototype.concat(...t.map(r=>Kb(r,e)))}function Q0(t,e,r){let n=X0(_e.parseFormat(r),t),i=n.map(s=>zb(s,t)),o=i.find(s=>s.invalidReason);if(o)return{input:e,tokens:n,invalidReason:o.invalidReason};{let[s,a]=qb(i),c=RegExp(s,"i"),[l,u]=Vb(e,c,a),[f,d,m]=u?Gb(u):[null,null,void 0];if(gr(u,"a")&&gr(u,"H"))throw new Bt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:l,matches:u,result:f,zone:d,specificOffset:m}}}function Ih(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=Q0(t,e,r);return[n,i,o,s]}function eu(t,e){if(!t)return null;let n=_e.create(e,t).dtFormatter(Zb()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>$b(s,t,o))}var tu="Invalid DateTime",Fh=864e13;function aa(t){return new ke("unsupported zone",`the zone "${t.name}" is not supported`)}function ru(t){return t.weekData===null&&(t.weekData=Wi(t.c)),t.weekData}function nu(t){return t.localWeekData===null&&(t.localWeekData=Wi(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Ur(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new te({...r,...e,old:r})}function Ph(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=r.offset(n);return i===o?[n,i]:[t-Math.min(i,o)*60*1e3,Math.max(i,o)]}function ca(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function la(t,e,r){return Ph(bn(t),e,r)}function Oh(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...t.c,year:n,month:i,day:Math.min(t.c.day,Sn(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=le.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=bn(o),[c,l]=Ph(a,r,t.zone);return s!==0&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function Zi(t,e,r,n,i,o){let{setZone:s,zone:a}=r;if(t&&Object.keys(t).length!==0||e){let c=e||a,l=te.fromObject(t,{...r,zone:c,specificOffset:o});return s?l:l.setZone(a)}else return te.invalid(new ke("unparsable",`the input "${i}" can't be parsed as ${n}`))}function ua(t,e,r=!0){return t.isValid?_e.create(se.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function iu(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=ye(t.c.year,r?6:4),e?(n+="-",n+=ye(t.c.month),n+="-",n+=ye(t.c.day)):(n+=ye(t.c.month),n+=ye(t.c.day)),n}function kh(t,e,r,n,i,o){let s=ye(t.c.hour);return e?(s+=":",s+=ye(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=":")):s+=ye(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(s+=ye(t.c.second),(t.c.millisecond!==0||!n)&&(s+=".",s+=ye(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!o?s+="Z":t.o<0?(s+="-",s+=ye(Math.trunc(-t.o/60)),s+=":",s+=ye(Math.trunc(-t.o%60))):(s+="+",s+=ye(Math.trunc(t.o/60)),s+=":",s+=ye(Math.trunc(t.o%60)))),o&&(s+="["+t.zone.ianaName+"]"),s}var jh={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Jb={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Yb={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Uh=["year","month","day","hour","minute","second","millisecond"],Xb=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Qb=["year","ordinal","hour","minute","second","millisecond"];function e2(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new gn(t);return e}function _h(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return e2(t)}}function Mh(t,e){let r=Ft(e.zone,ne.defaultZone),n=se.fromObject(e),i=ne.now(),o,s;if(H(t.year))o=i;else{for(let l of Uh)H(t[l])&&(t[l]=jh[l]);let a=L0(t)||W0(t);if(a)return te.invalid(a);let c=r.offset(i);[o,s]=la(t,c,r)}return new te({ts:o,zone:r,loc:n,o:s})}function Nh(t,e,r){let n=H(r.round)?!0:r.round,i=(s,a)=>(s=wn(s,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(s,a)),o=s=>r.calendary?e.hasSame(t,s)?0:e.startOf(s).diff(t.startOf(s),s).get(s):e.diff(t,s).get(s);if(r.unit)return i(o(r.unit),r.unit);for(let s of r.units){let a=o(s);if(Math.abs(a)>=1)return i(a,s)}return i(t>e?-0:0,r.units[r.units.length-1])}function Rh(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var te=class t{constructor(e){let r=e.zone||ne.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new ke("invalid input"):null)||(r.isValid?null:aa(r));this.ts=H(e.ts)?ne.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,o]=[e.old.c,e.old.o];else{let a=r.offset(this.ts);i=ca(this.ts,a),n=Number.isNaN(i.year)?new ke("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=r,this.loc=e.loc||se.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=Rh(arguments),[n,i,o,s,a,c,l]=r;return Mh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static utc(){let[e,r]=Rh(arguments),[n,i,o,s,a,c,l]=r;return e.zone=Oe.utcInstance,Mh({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=Jm(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=Ft(r.zone,ne.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:se.fromObject(r)}):t.invalid(aa(i))}static fromMillis(e,r={}){if(Nt(e))return e<-Fh||e>Fh?t.invalid("Timestamp out of range"):new t({ts:e,zone:Ft(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Se(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(Nt(e))return new t({ts:e*1e3,zone:Ft(r.zone,ne.defaultZone),loc:se.fromObject(r)});throw new Se("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Ft(r.zone,ne.defaultZone);if(!n.isValid)return t.invalid(aa(n));let i=se.fromObject(r),o=Cn(e,_h),{minDaysInFirstWeek:s,startOfWeek:a}=U0(o,i),c=ne.now(),l=H(r.specificOffset)?n.offset(c):r.specificOffset,u=!H(o.ordinal),f=!H(o.year),d=!H(o.month)||!H(o.day),m=f||d,h=o.weekYear||o.weekNumber;if((m||u)&&h)throw new Bt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Bt("Can't mix ordinal dates with month/day");let x=h||o.weekday&&!m,g,p,y=ca(c,l);x?(g=Xb,p=Jb,y=Wi(y,s,a)):u?(g=Qb,p=Yb,y=oa(y)):(g=Uh,p=jh);let b=!1;for(let L of g){let A=o[L];H(A)?b?o[L]=p[L]:o[L]=y[L]:b=!0}let w=x?Gm(o,s,a):u?Zm(o):L0(o),E=w||W0(o);if(E)return t.invalid(E);let S=x?P0(o,s,a):u?j0(o):o,[O,I]=la(S,l,n),N=new t({ts:O,zone:n,o:I,loc:i});return o.weekday&&m&&e.weekday!==N.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${N.toISO()}`):N}static fromISO(e,r={}){let[n,i]=fh(e);return Zi(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=dh(e);return Zi(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=mh(e);return Zi(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(H(e)||H(r))throw new Se("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,c,l,u]=Ih(s,e,r);return u?t.invalid(u):Zi(a,c,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=xh(e);return Zi(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Se("need to specify a reason the DateTime is invalid");let n=e instanceof ke?e:new ke(e,r);if(ne.throwOnInvalid)throw new Gs(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=eu(e,se.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return X0(_e.parseFormat(e),se.fromObject(r)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ru(this).weekYear:NaN}get weekNumber(){return this.isValid?ru(this).weekNumber:NaN}get weekday(){return this.isValid?ru(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?nu(this).weekday:NaN}get localWeekNumber(){return this.isValid?nu(this).weekNumber:NaN}get localWeekYear(){return this.isValid?nu(this).weekYear:NaN}get ordinal(){return this.isValid?oa(this.c).ordinal:NaN}get monthShort(){return this.isValid?Jt.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Jt.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Jt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Jt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=bn(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*r),a=this.zone.offset(n-o*r);if(s===a)return[this];let c=n-s*r,l=n-a*r,u=ca(c,s),f=ca(l,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Ur(this,{ts:c}),Ur(this,{ts:l})]:[this]}get isInLeapYear(){return Pr(this.year)}get daysInMonth(){return Sn(this.year,this.month)}get daysInYear(){return this.isValid?yr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Rr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Rr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=_e.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(Oe.instance(e),r)}toLocal(){return this.setZone(ne.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=Ft(e,ne.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let o=e.offset(this.ts),s=this.toObject();[i]=la(s,o,e)}return Ur(this,{ts:i,zone:e})}else return t.invalid(aa(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return Ur(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Cn(e,_h),{minDaysInFirstWeek:n,startOfWeek:i}=U0(r,this.loc),o=!H(r.weekYear)||!H(r.weekNumber)||!H(r.weekday),s=!H(r.ordinal),a=!H(r.year),c=!H(r.month)||!H(r.day),l=a||c,u=r.weekYear||r.weekNumber;if((l||s)&&u)throw new Bt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Bt("Can't mix ordinal dates with month/day");let f;o?f=P0({...Wi(this.c,n,i),...r},n,i):H(r.ordinal)?(f={...this.toObject(),...r},H(r.day)&&(f.day=Math.min(Sn(f.year,f.month),f.day))):f=j0({...oa(this.c),...r});let[d,m]=la(f,this.o,this.zone);return Ur(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e);return Ur(this,Oh(this,r))}minus(e){if(!this.isValid)return this;let r=le.fromDurationLike(e).negate();return Ur(this,Oh(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=le.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(i==="weeks")if(r){let o=this.loc.getStartOfWeek(),{weekday:s}=this;s<o&&(n.weekNumber=this.weekNumber-1),n.weekday=o}else n.weekday=1;if(i==="quarters"){let o=Math.ceil(this.month/3);n.month=(o-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?_e.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):tu}toLocaleString(e=hr,r={}){return this.isValid?_e.create(this.loc.clone(r),e).formatDateTime(this):tu}toLocaleParts(e={}){return this.isValid?_e.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;let s=e==="extended",a=iu(this,s);return a+="T",a+=kh(this,s,r,n,i,o),a}toISODate({format:e="extended"}={}){return this.isValid?iu(this,e==="extended"):null}toISOWeekDate(){return ua(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(i?"T":"")+kh(this,s==="extended",r,e,n,o):null}toRFC2822(){return ua(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ua(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?iu(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),ua(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():tu}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return le.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=Ym(r).map(le.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,l=Sh(a,c,o,i);return s?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?Kt.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let i=e.valueOf(),o=this.setZone(e.zone,{keepLocalTime:!0});return o.startOf(r,n)<=i&&i<=o.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),Nh(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?Nh(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Se("min requires all arguments be DateTimes");return z0(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Se("max requires all arguments be DateTimes");return z0(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=se.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return Q0(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return hr}static get DATE_MED(){return wi}static get DATE_MED_WITH_WEEKDAY(){return E0}static get DATE_FULL(){return Ei}static get DATE_HUGE(){return Si}static get TIME_SIMPLE(){return Ci}static get TIME_WITH_SECONDS(){return vi}static get TIME_WITH_SHORT_OFFSET(){return Ti}static get TIME_WITH_LONG_OFFSET(){return Ai}static get TIME_24_SIMPLE(){return Bi}static get TIME_24_WITH_SECONDS(){return Di}static get TIME_24_WITH_SHORT_OFFSET(){return Ii}static get TIME_24_WITH_LONG_OFFSET(){return Fi}static get DATETIME_SHORT(){return Oi}static get DATETIME_SHORT_WITH_SECONDS(){return ki}static get DATETIME_MED(){return _i}static get DATETIME_MED_WITH_SECONDS(){return Mi}static get DATETIME_MED_WITH_WEEKDAY(){return S0}static get DATETIME_FULL(){return Ni}static get DATETIME_FULL_WITH_SECONDS(){return Ri}static get DATETIME_HUGE(){return Pi}static get DATETIME_HUGE_WITH_SECONDS(){return ji}};function On(t){if(te.isDateTime(t))return t;if(t&&t.valueOf&&Nt(t.valueOf()))return te.fromJSDate(t);if(t&&typeof t=="object")return te.fromObject(t);throw new Se(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Lh=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var ou=50n,fa=10000n,Wh=25n,su=100000000n;var Rt=class{constructor(e){this.object=e}moveArg(e){return e.object(this.object)}},Ki=class{constructor(e){this.objects=e}moveArgs(e){return e.makeMoveVec({objects:this.objects.map(r=>e.object(r))})}},Er=class t{constructor(e){this.result=e;return new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(r,n){if(n in r)return Reflect.get(r,n);let i=s=>new t(r.result[s]);if(n===Symbol.iterator)return function*(){let s=0;for(;;)yield i(s),s++};if(typeof n=="symbol")return;let o=parseInt(n,10);if(!(Number.isNaN(o)||o<0))return i(o)}})}moveArg(){return this.result}};var au=er(Ac());var Ji=class extends ue{constructor(e,r){super(3,e,{context:r})}};var da=class{constructor(e){this.results=e}callResult(e){return this.results.results[e]}returnValue(e,r){return e.returnValues[r]}getValue(e=0,r=0){let n=this.callResult(e);return this.returnValue(n,r)}getAddress(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="address")throw new Ji("Invalid contract return type.",{ctx:{expectType:"address",gotType:i}});return $(au.Buffer.from(n).toString("hex"))}getU64(e=0,r=0){let[n,i]=this.getValue(e,r);if(i!=="u64")throw new Ji("Invalid contract return type.",{ctx:{expectType:"u64",gotType:i}});return au.Buffer.from(n).readBigInt64LE()}};var we=class extends ue{constructor(e,r,n){super(2,`Invalid input: ${e}`,{context:{fieldKey:r,fieldValue:n}})}};var Hh={groupId:"string",name:"string"},t2=64;function $h(t){return qh(t),ae.ser(Hh,t).toString("base64")}function Yi(t){let e=ae.de(Hh,t,"base64");return qh(e),e}function qh(t){if(!zh(t.name))throw new we("Invalid metadata: Name contains unknown character");if(!zh(t.groupId))throw new we("Invalid metadata: Group ID contains unknown character");if(t.name.length>t2)throw new we("Invalid metadata: Name exceed max length 64")}function zh(t){return/^[\x00-\x7F]+$/.test(t)}function ma(t,e){return oe(t)===oe(e)}function Sr(t,e){return oe(t)===oe(e)}var ha="txn.gas";var Lr=class t{constructor(e,r,n){this.globals=e;this.feeContract=r;this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:$h({name:e.name,groupId:Lh()}),coinType:oe(e.coinType),recipients:e.recipients.map(r=>({address:r.address,cliffAmount:r.cliffAmount,amountPerEpoch:r.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let r=new ge,n=this.calculateFeesInternal(e),i=this.getCreateStreamCoinRequests(e,n),o=await this.wallet.requestCoins(i),s=await this.addMergeCoins(r,o[0]),a;i.length>1?a=await this.addMergeCoins(r,o[1]):a=s;for(let c=0;c<e.recipients.length;c++){let l=e.recipients[c],u=this.amountForRecipient(l,e.numberEpoch),f=this.getStreamFeeLocal(u),[d]=r.splitCoins(s,[r.pure(u+f,"u64")]),[m]=r.splitCoins(a,[r.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(r,{paymentCoin:new Er(d),flatFeeCoin:new Er(m),metadata:e.metadata,recipient:l.address,timeStart:e.startTime,cliff:l.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:l.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return r}calculateCreateStreamFees(e){let r=t.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:ou,denominator:fa},claimFeePercent:{numerator:Wh,denominator:fa},flatFeePerStream:su}}async addMergeCoins(e,r){let n;return r.mergedCoins&&r.mergedCoins.length?(e.mergeCoins(e.object(r.primaryCoin),r.mergedCoins.map(i=>e.object(i))),n=e.object(r.primaryCoin)):r.primaryCoin===ha?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return ma(n,ot)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:ot,amount:r.flatFeeAmount}]}calculateFeesInternal(e){let r=e.recipients.reduce((i,o)=>{let s=this.amountForRecipient(o,e.numberEpoch),a=this.getStreamFeeLocal(s);return{totalAmount:i.totalAmount+s,streamFeeAmount:i.streamFeeAmount+a}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...r}}amountForRecipient(e,r){return BigInt(e.amountPerEpoch)*BigInt(r)+BigInt(e.cliffAmount)}get flatSuiFee(){return su}getStreamFeeLocal(e){return e*ou/fa}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new ge,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new da(n).getU64()}get wallet(){return this.globals.wallet}};var Vh="0x0000000000000000000000000000000000000000000000000000000000000006";var kn=class{constructor(e,r,n){this.moduleName=e;this.config=r;this.globals=n}addContractCall(e,r){let n=`${this.config.contractId}::${this.moduleName}::${r.method}`;return e.add(ct.MoveCall({target:n,arguments:r.arguments.map(i=>i instanceof Ki?i.moveArgs(e):i instanceof Rt?i.moveArg(e):i instanceof Er?i.moveArg():e.pure(i)),typeArguments:r.typeArgs})),e}addTransactionBlock(e,r,n=[],i=[]){e.add(ct.MoveCall({target:r,arguments:n.map(o=>o instanceof Ki?o.moveArgs(e):o instanceof Rt?o.moveArg(e):o instanceof Er?o.moveArg():e.pure(o)),typeArguments:i}))}makeObject(e){return typeof e=="string"?new Rt(e):e}vaultObject(){return new Rt(this.config.vaultObjId)}roleObject(){return new Rt(this.config.roleObjId)}feeObject(){return new Rt(this.config.feeObjId)}clockObject(){return new Rt(Vh)}};var _n=class t extends kn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_fee,arguments:[i,o,n],typeArgs:[]})}setStreamingFlatFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_streaming_flat_fee,arguments:[i,o,n],typeArgs:[]})}setClaimFee(r,n){let i=this.roleObject(),o=this.feeObject();return this.addContractCall(r,{method:t.MethodName.set_claim_fee,arguments:[i,o,n],typeArgs:[]})}streamingFee(r,n){let i=this.feeObject();return this.addContractCall(r,{method:t.MethodName.streaming_fee,arguments:[i,n],typeArgs:[]})}claimFee(r,n){return this.addContractCall(r,{method:t.MethodName.claim_fee,arguments:[this.feeObject(),n],typeArgs:[]})}feeDenominator(r){return this.addContractCall(r,{method:t.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}};var Pt=class t extends kn{constructor(r,n){super(t.ModuleName,r,n);this.config=r;this.globals=n}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(r,n){let i=this.feeObject(),o=this.vaultObject(),s=this.makeObject(n.paymentCoin),a=this.makeObject(n.flatFeeCoin),c=this.clockObject();return this.addContractCall(r,{method:t.MethodName.create_stream,arguments:[i,o,s,a,n.metadata,n.recipient,n.timeStart,n.cliff,n.epochInterval,n.numEpoch,n.amountPerEpoch,n.cancelable,c],typeArgs:[n.coinType]})}setAutoClaim(r,n){let i=this.makeObject(n.streamId);return this.addContractCall(r,{method:t.MethodName.set_auto_claim,arguments:[i,n.enabled],typeArgs:[n.coinType]})}cancelStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.cancel_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStream(r,n){let i=this.makeObject(n.streamId),o=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream,arguments:[i,o],typeArgs:[n.coinType]})}claimStreamByProxy(r,n){let i=this.makeObject(n.streamId),o=this.vaultObject(),s=this.feeObject(),a=this.clockObject();return this.addContractCall(r,{method:t.MethodName.claim_stream_by_proxy,arguments:[i,o,s,a],typeArgs:[n.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${t.ModuleName}::${t.MethodName.claim_stream_by_proxy}`}};var Mn=class{constructor(e){this.globals=e;let r=e.envConfig.contract;this.feeContract=new _n(r,e),this.streamContract=new Pt(r,e)}feeContract;streamContract;async createStreams(e){let r=Lr.convertCreateStreamInfoToInternal(e);return this.createStreamHelper().buildCreateStreamTransactionBlock(r)}createStreamHelper(){return new Lr(this.globals,this.feeContract,this.streamContract)}setAutoClaim(e,r,n){let i=new ge;return this.streamContract.setAutoClaim(i,{streamId:e,enabled:r,coinType:n})}claimStream(e,r){let n=new ge;return this.streamContract.claimStream(n,{streamId:e,coinType:r})}claimStreamByProxy(e,r){let n=new ge;return this.streamContract.claimStreamByProxy(n,{streamId:e,coinType:r})}cancelStream(e,r){let n=new ge;return this.streamContract.cancelStream(n,{streamId:e,coinType:r}),n}};var pa=class extends ue{constructor(e,r){super(12,`Transaction failed: ${r}`,{context:{status:e,msg:r}})}};var r2=1e3,xa=class{constructor(e){this.globals=e;this.coinMetaHelper=new cu(e.suiClient),this.createStreamHelper=new Mn(e).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(e){if(e.effects?.status.status!=="success")throw new pa(e.effects?.status.status,e.effects?.status.error);return e.objectChanges.filter(r=>r.type==="created"&&r.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(r=>r.objectId)}calculateCreateStreamFees(e){return this.createStreamHelper.calculateCreateStreamFees(e)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=e.cliff?e.cliff:{numerator:0n,denominator:100n},n=e.totalAmount*r.numerator/r.denominator,i=(e.totalAmount-n)/e.steps,s={realTotalAmount:i*e.steps+n,cliffAmount:n,amountPerStep:i};return this.validateStreamAmount(s,e.totalAmount),s}calculateTimelineByInterval(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=e.timeStart.plus(e.interval.toMillis()*Number(e.steps)),n={timeStart:e.timeStart,timeEnd:r,interval:e.interval,steps:e.steps};return this.validateTimeline(n),n}calculateTimelineByTotalDuration(e){if(e.steps===0n)throw new we("Invalid stream steps: 0");let r=BigInt(e.total.toMillis())/e.steps,n=e.timeStart.plus(le.fromMillis(Number(r*e.steps))),i={timeStart:e.timeStart,timeEnd:n,interval:le.fromMillis(Number(r)),steps:e.steps};return this.validateTimeline(i),i}async getBalance(e,r){let n=await this.globals.suiClient.getBalance({owner:e,coinType:r}),i=await this.getCoinMeta(r);return{...n,coinType:oe(n.coinType),coinMeta:i}}async getAllBalance(e){let r=await this.globals.suiClient.getAllBalances({owner:e}),n=await Promise.all(r.map(i=>this.getCoinMeta(i.coinType)));return r.map((i,o)=>({...i,coinType:oe(i.coinType),coinMeta:n[o]}))}async getCoinMeta(e){return this.coinMetaHelper.getCoinMeta(e)}async simulateTransactionBlock(e){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:e,sender:await this.globals.wallet.address()})}validateStreamAmount(e,r){if(e.amountPerStep===0n)throw new we("Stream amount too small","totalAmount",r);if(e.cliffAmount>e.realTotalAmount)throw new we("Invalid cliff settings")}validateTimeline(e){if(e.interval.toMillis()<r2)throw new we("Interval shall be at least 1 second","interval",e.interval)}},cu=class{constructor(e){this.suiClient=e;this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(e){let r=oe(e||ot);if(this.coinMetaReg.has(r))return this.coinMetaReg.get(r);let n=await this.queryCoinMeta(r);return n&&this.coinMetaReg.set(r,n),n}async queryCoinMeta(e){return await this.suiClient.getCoinMetadata({coinType:e})||void 0}};var ya=class extends ue{constructor(){super(7,"Connected wallet is not creator")}};var Xi=class extends ue{constructor(){super(8,"Connected wallet is not recipient")}};var Qi=class extends ue{constructor(e,r){super(6,e,{context:r})}};var Te=class extends ue{constructor(e,r={}){super(0,e,r)}};var ga=class extends ue{constructor(e){super(5,"Stream not found",{context:{streamId:e}})}};var Gh=(1n<<64n)-1n,ba=1e3;function uu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ba);return te.fromMillis(r*ba)}function lu(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/ba);return le.fromMillis(r*ba)}var Cr=class t{constructor(e,r,n){this.globals=e;this.streamId=r;this.rawData=n;this.streamContract=new Pt(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await t.fetchStreamData(e,r);return new t(e,r,n)}static fromObjectData(e,r,n){let i=t.parseRawStreamData(r,n);return new t(e,r,i)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await t.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new Te("Object Id does not align");this.rawData=t.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new ya;let e=new ge;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Xi;let e=new ge;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Xi;let r=new ge;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new ge;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return oe(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return lu(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Yi(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Yi(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return uu(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return lu(r)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:uu((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===Gh?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=te.now().toMillis(),r=this.timeStart.toMillis();if(e<r)return-1n;let n=Math.floor((e-r)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,r){let n=await e.suiClient.getObject({id:r,options:{showContent:!0,showType:!0}});return t.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new ga(e):new Qi(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new Qi("Unexpected object type",{gotType:n.dataType});let{typeParams:i}=Zn(n.type),o=oe(i[0]),s=n.fields,a=s.config.fields,c=s.status.fields;return{coinType:o,autoClaim:s.auto_claim,balance:BigInt(s.balance.fields.balance),config:{amountPerEpoch:BigInt(a.amount_per_epoch),cancelable:a.cancelable,cliff:BigInt(a.cliff),creator:a.creator,epochInterval:BigInt(a.epoch_interval),metadata:a.metadata,recipient:a.recipient,timeStart:BigInt(a.time_start),totalEpoch:BigInt(a.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}};var Nn=class extends ue{constructor(e,r){super(9,`Invalid stream group: ${e}`,{context:r})}};async function du(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var fu=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Rn=class{constructor(e){this.requester=e;this.pager=new fu(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};var n2=25;async function hu(t,e,r){let n=new eo(e),i=new to(t,n,r);return await du(i)}var eo=class{constructor(e){this.ids=e;this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},to=class extends Rn{constructor(r,n,i){super(new mu(r,n,i));this.suiClient=r;this.idIter=n;this.options=i}},mu=class{constructor(e,r,n){this.suiClient=e;this.stringIter=r;this.options=n;this.filter=n?.filter,this.pageSize=n?.pageSize||n2,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let e=[];for(;e.length<this.pageSize&&await this.stringIter.hasNext();){let o=await this.stringIter.next();o&&e.push(o)}let r=await this.suiClient.multiGetObjects({ids:e,options:this.objectOptions}),n;if(this.filter){let{filter:i}=this;n=r.filter(o=>i?.(o))}else n=r;return{data:n,hasNext:await this.stringIter.hasNext()}}};var wa=class t{constructor(e,r){this.globals=e;this.streams=r;if(r.length===0)throw new Nn("stream size 0");let n=r.map(o=>o.groupId);if(new Set(n).size!==1)throw new we("Stream does not have same group ID")}type="StreamGroup";static async new(e,r){let n=await hu(e.suiClient,r);return n.forEach(i=>{if(!i)throw new Te("stream group object data undefined")}),t.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let i=await t.parseGroupStreams(e,r,n);return new t(e,i)}static checkStreamGroup(e){let r=e.map(o=>o.groupCommonInfo),n=r[0],i=!0;return r.forEach(o=>{i2(n,o)||(i=!1)}),i}async refresh(){let e=await hu(this.globals.suiClient,this.streams.map(r=>r.streamId));this.streams.forEach((r,n)=>{r.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,r)=>e+r.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,r)=>e+r.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,r)=>r.nextReleaseAmount===null?e:e+r.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,r)=>e+r.totalAmount,0n),streamed:this.streams.reduce((e,r)=>e+r.streamedAmount,0n),claimed:this.streams.reduce((e,r)=>e+r.claimedAmount,0n),claimable:this.streams.reduce((e,r)=>e+r.claimable,0n),canceled:this.streams.reduce((e,r)=>e+r.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,r,n){let i=n.map((o,s)=>Cr.fromObjectData(e,r[s],o)).filter(o=>!!o);if(new Set(i.map(o=>o.groupId)).size!==1)throw new Nn("Not same group ID");if(!this.checkStreamGroup(i))throw new Nn("Not same stream settings");return i}};function i2(t,e){return t.name===e.name&&t.groupId===e.groupId&&t.creator===e.creator&&t.start.toMillis()===e.start.toMillis()&&t.interval.toMillis()===e.interval.toMillis()&&t.steps===e.steps&&t.cancelable===e.cancelable}var ro=class t{constructor(e,r){this.it=e;this.pageSize=r}static async newIncoming(e){let r=await Ea.newIncoming(e);return new t(r,e.pageSize)}static async newOutgoing(e){let r=await Ea.newOutgoing(e);return new t(r,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},Ea=class t{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await Sa.newIncomingQuery(e);return new t(r)}static async newOutgoing(e){let r=await Sa.newOutgoingQuery(e);return new t(r)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let r=await this.requester.doNextRequest();if(r===null)throw new Te("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new Te("No more results");return e}},Sa=class t{constructor(e,r,n,i){this.globals=e;this.recipient=r;this.groupRefs=n;this.query=i;this.current=0;let o=new eo(n.flat().map(s=>s.streamId));this.objectIter=new to(e.suiClient,o)}current=0;objectIter;static async newIncomingQuery(e){let r=u2(e.query),n=await e.globals.walletAddress(),o=(await e.globals.backend.getIncomingStreams(n,r)).filter(a=>$(a.recipient)===$(n)),s=Zh(o);return new t(e.globals,n,s,e.query)}static async newOutgoingQuery(e){let r=l2(e.query),n=await e.globals.walletAddress(),i=await e.globals.backend.getOutgoingStreams(n,r),o=Zh(i);return new t(e.globals,n,o,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let r=await a2(this.globals,e[0].streamId,this.objectIter);return this.current++,Kh(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await c2(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,s2(r,this.query)?r:this.doNextRequest()}throw new Te("Stream group with no stream")}};function Zh(t){let e=new Map;return t.forEach(r=>{let n=e.get(r.groupId);n?(n.push(r),e.set(r.groupId,n)):e.set(r.groupId,[r])}),Array.from(e.values()).sort((r,n)=>te.fromISO(n[0].createDate).toMillis()-te.fromISO(r[0].createDate).toMillis())}function Kh(t,e){if(e===void 0)return!0;let r=o2(t,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?t.progress.claimable!==0n:t.progress.claimable===0n;return r&&n}return r}function o2(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function s2(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{Kh(n,e)&&(r=!0)}),r}async function a2(t,e,r){let n=await Jh(r,e);return Cr.fromObjectData(t,e,n)}async function c2(t,e,r){let n=[];for(;n.length<e.length;){let i=await Jh(r,e[n.length]);n.push(i)}return wa.newFromObjectResponse(t,e,n)}async function Jh(t,e){if(!await t.hasNext())throw new Te("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new Te("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new Te("stream id not aligned");return r}function u2(t){return{status:pu(t?.status),coinType:Yh(t?.coinType),sender:Xh(t?.sender)}}function l2(t){return{status:pu(t?.status),coinType:Yh(t?.coinType),recipient:Xh(t?.recipient)}}function pu(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=pu(r);return!e||e===n?n:"all"},void 0):f2(t)}function f2(t){switch(t){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new we("Unknown stream filtered status")}}function Yh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>oe(e)):void 0:oe(t)}function Xh(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>$(e)):void 0:$(t)}var Ca=class extends ue{constructor(r,n,i){super(4,`Not enough balance: ${r}`,{context:{coinType:r,requestAmount:n,gotAmount:i}});this.coinType=r;this.requestAmount=n;this.gotAmount=i}};var d2=25;async function Qh(t,e,r,n="0x2::sui::SUI",i=d2){let o=new xu(t,e,n,i),s=BigInt(0),a=[];for(;await o.hasNext()&&s<r;){let c=await o.next();c&&(a.push(c),s+=BigInt(c.balance))}if(s<r)throw new Ca(n,r,s);return a}var xu=class extends Rn{constructor(r,n,i,o){super(new yu(r,n,i,o));this.suiClient=r;this.owner=n;this.coinType=i;this.reqPageSize=o}},yu=class{constructor(e,r,n,i){this.suiClient=e;this.owner=r;this.coinType=n;this.reqPageSize=i;if(i<=0)throw new Te("Invalid reqPageSize")}nextCursor;async doNextRequest(){let e=await this.suiClient.getCoins({owner:this.owner,coinType:this.coinType,cursor:this.nextCursor,limit:this.reqPageSize});return this.nextCursor=e.nextCursor,{data:e.data,hasNext:e.hasNextPage}}};var gu=class{constructor(e){this.msafe=e}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(e){return this.msafe.requestCoins(e)}},pt=class{constructor(e){this.account=e}async address(){return this.account.address}},bu=class{constructor(e,r){this.singleWallet=e;this.suiClient=r}get type(){return"single"}async address(){return this.singleWallet.address()}async requestCoins(e){return Promise.all(e.map(r=>this.requestCoin(r)))}async requestCoin(e){if(ma(e.coinType,ot))return{primaryCoin:ha};if(e.amount<=0)throw new we("Invalid coin request","coinAmount",e.amount);let r=await Qh(this.suiClient,await this.address(),e.amount,e.coinType);if(r.length===0)throw new Te("no coins available");return{primaryCoin:r[0].coinObjectId,mergedCoins:r.slice(1).map(n=>n.coinObjectId)}}},xt=class{globals;helper;constructor(e,r){this.globals=yn.new(e,r),this.helper=new xa(this.globals)}connectSingleWallet(e){let r=new bu(e,this.globals.suiClient);this.globals.connectWallet(r)}connectMSafeAccount(e){let r=new gu(e);this.globals.connectWallet(r)}async createStream(e){return this.builder().createStreams(e)}async getStream(e){return Cr.new(this.globals,e)}async getIncomingStreams(e,r=10){return ro.newIncoming({globals:this.globals,query:e,pageSize:r})}async getOutgoingStreams(e,r=10){return ro.newOutgoing({globals:this.globals,query:e,pageSize:r})}async getCoinTypesForStreamFilter(){let e=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(e)).map(n=>oe(n))}async getRecipientsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllRecipients(r,e)).map(i=>$(i))}async getCreatorsForStreamFilter(e){let r=await this.wallet.address();return(await this.globals.backend.getAllSenders(r,e)).map(i=>$(i))}get wallet(){return this.globals.wallet}builder(){return new Mn(this.globals)}};var va=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).cancel()}static fromData(r){return new t(r)}};var Ta=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).claimByProxy()}static fromData(r){return new t(r)}};var Aa=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).claim()}static fromData(r){return new t(r)}};var Ba=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await o.createStream(this.data)}static fromData(r){return new t(r)}};var Yt=class t{constructor(e,r){this.moveCall=e;this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return t.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return t.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return $(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return t.getPureInputValue(n,r)}getInputParam(e){let r=this.moveCall.arguments[e];if(r.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[r.index]}static getPureInputValue(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return $(e.value.Object.ImmOrOwned.objectId)}return $(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return $(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return $(e.value.Object.Shared.objectId)}static getPureInput(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return ae.de(r,new Uint8Array(n))}typeArg(e){return oe(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}};var Da=class{constructor(e,r){this.globals=e;this.txb=r}decode(){let e=this.decodeCreateStreamInfo(),r=this.createStreamHelper().calculateCreateStreamFees(e),n=this.getCoinMerges();return{type:"CreateStream",info:e,fees:r,coinMerges:n}}decodeCreateStreamInfo(){let r=this.createStreamTransactions().map(n=>this.getCreationInfoFromMoveCall(n));return this.aggregateGroupStreamInfo(r)}createStreamTransactions(){let e=this.transactions.filter(r=>r.kind==="MoveCall"&&Sr(r.target,this.contract.createStreamTarget));if(e.length===0)throw new Te("No create stream transactions");return e.map(r=>new Yt(r,this.txb))}getCreationInfoFromMoveCall(e){let r=e.decodeInputString(4),{name:n,groupId:i}=Yi(r),o=e.decodeInputAddress(5),s=e.decodeInputU64(6),a=e.decodeInputU64(7),c=e.decodeInputU64(8),l=e.decodeInputU64(9),u=e.decodeInputU64(10),f=e.decodeInputBool(11),d=e.typeArg(0);return{name:n,groupId:i,recipient:o,timeStart:s,cliff:a,epochInterval:c,totalEpoch:l,amountPerEpoch:u,cancelable:f,coinType:d}}aggregateGroupStreamInfo(e){if(new Set(e.map(i=>JSON.stringify({name:i.name,groupId:i.groupId,timeStart:String(i.timeStart),epochInterval:String(i.epochInterval),totalEpoch:String(i.totalEpoch),cancelable:i.cancelable,coinType:i.coinType}))).size!==1)throw new we("Stream group not have common info");let n=e.map(i=>({address:i.recipient,amountPerStep:i.amountPerEpoch,cliffAmount:i.cliff}));return{name:e[0].name,coinType:e[0].coinType,recipients:n,interval:e[0].epochInterval,steps:e[0].totalEpoch,startTimeMs:e[0].timeStart,cancelable:e[0].cancelable}}getCoinMerges(){let e=this.createStreamTransactions()[0];return this.getCoinMergeForCreateStream(e)}getCoinMergeForCreateStream(e){let r=e.typeArg(0),n=e.txArg(2),i=this.getCoinMergeFromNestedResult(n,r,e);if(r===oe(ot))return[i];let o=e.txArg(3),s=this.getCoinMergeFromNestedResult(o,oe(ot),e);return[i,s]}getCoinMergeFromNestedResult(e,r,n){if(e.kind==="GasCoin")return{primary:"GAS",coinType:r};if(e.kind==="Input"){let i=this.getInputArg(e),o=Yt.getOwnedObjectId(i),s=this.transactions.find(a=>{if(a.kind!=="MergeCoins")return!1;if(a.destination.kind!=="Input")throw new Error("merge coin destination not Input type");let c=this.getInputArg(a.destination);return Yt.getOwnedObjectId(c)===o});return s?{primary:o,merged:s.sources.map(a=>{let c=this.getInputArg(a);return Yt.getOwnedObjectId(c)}),coinType:r}:{primary:o,coinType:r}}if(e.kind==="NestedResult"){let i=this.transactions[e.index];if(i.kind!=="SplitCoins")throw new we(`Transaction type not expected. Expect SplitCoins, got ${i.kind}`);return this.getCoinMergeFromNestedResult(i.coin,r,n)}throw e.kind==="Result"?new Error("Result type not expected for coin inputs"):new Error("Unknown argument kind")}mergeCoinTransactions(){return this.transactions.filter(e=>e.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new Pt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new _n(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Lr(this.globals,this.feeContract,this.contract)}getInputArg(e){if(e.kind!=="Input")throw new Error("not input type");return"value"in e?e:this.txb.blockData.inputs[e.index]}};var Ia=class{constructor(e,r){this.globals=e;this.txb=r;this.contract=new Pt(e.envConfig.contract,e)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(r=>r.kind==="MoveCall"&&Sr(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Sr(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new Da(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let e=this.helper.decodeSharedObjectId(0),r=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:e,enabled:r}}decodeClaimTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Claim",streamId:e}}decodeClaimByProxyTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"ClaimByProxy",streamId:e}}decodeCancelStreamTransaction(){let e=this.helper.decodeSharedObjectId(0);return{type:"Cancel",streamId:e}}get helper(){let e=this.transactions[0];return new Yt(e,this.txb)}};var Fa=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{network:n,account:i}=r,o=new xt(n==="sui:mainnet"?"prod":"dev");return o.connectSingleWallet(new pt(i)),await(await o.getStream(this.data.streamId)).setAutoClaim(!0)}static fromData(r){return new t(r)}};var Oa=class{application="mpay";async deserialize(e){let{chain:r,transactionBlock:n}=e,i=yn.new(r==="sui:mainnet"?"prod":"dev"),s=new Ia(i,n).decode();if(s.type==="CreateStream")return{txType:Ht.Stream,txSubType:s.type,intentionData:s.info};if(s.type==="Claim")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};if(s.type==="ClaimByProxy")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};if(s.type==="SetAutoClaim")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId,enabled:s.enabled}};if(s.type==="Cancel")return{txType:Ht.Stream,txSubType:s.type,intentionData:{streamId:s.streamId}};throw new Error(`Unknown transaction type: ${s}`)}async build(e){let{network:r,intentionData:n,suiClient:i,account:o}=e,s;switch(e.txSubType){case"CreateStream":s=Ba.fromData(n);break;case"Claim":s=Aa.fromData(n);break;case"ClaimByProxy":s=Ta.fromData(n);break;case"SetAutoClaim":s=Fa.fromData(n);break;case"Cancel":s=va.fromData(n);break;default:throw new Error("not implemented")}return s.build({network:r,suiClient:i,account:o})}};var ka=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Rd(n,this.data,i.address)}static fromData(r){return new t(r)}};var _a=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{suiClient:n,account:i}=r;return Pd(n,this.data,i.address)}static fromData(r){return new t(r)}};var Ma=class t extends Fe{constructor(r){super(r);this.data=r}txType;txSubType;async build(r){let{account:n}=r,i=ge.from(this.data.content);if(!$c(i.blockData.sender,n.address))throw new Error("Invalid sender address");return i}static fromData(r){return new t(r)}};var Na=class{application;constructor(){this.application=jd}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(e){let{suiClient:r,account:n}=e,i;switch(e.txSubType){case an.assets.coin.send:i=ka.fromData(e.intentionData);break;case an.assets.object.send:i=_a.fromData(e.intentionData);break;case an.others.plain:i=Ma.fromData(e.intentionData);break;default:throw new Error("not implemented")}return i.build({suiClient:r,account:n})}};var Ra=class{apps;constructor(e){this.apps=new Map(e.map(r=>[r.application,r]))}getAppHelper(e){let r=this.apps.get(e);if(!r)throw new Error(`${e} not registered`);return r}};var m2=er(si()),h2="msafe-plain-tx",p2=an.others.plain;var Pa=class{application;constructor(){this.application=h2}async deserialize(e){let{transactionBlock:r,suiClient:n}=e,i=await r.build({client:n});return{txType:Ht.Other,txSubType:p2,intentionData:{content:Le(i)}}}async build(e){let{suiClient:r,account:n}=e,i=ge.from(Et(e.intentionData.content)),o=await r.devInspectTransactionBlock({transactionBlock:i,sender:n.address});if(!(o.effects.status.status==="success"))throw new Error(o.effects.status.error);return i}};var x2=new Ra([new Na,new Oa,new Pa]);return bp(y2);})();
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
ieee754/index.js:
|