@configdirector/openfeature-server-provider 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import{OpenFeatureEventEmitter as e,ProviderEvents as t}from"@openfeature/server-sdk";import n,{EventEmitter as r}from"node:events";import{createHash as i,randomUUID as a}from"node:crypto";var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(e&&(t=e(e=0)),t),p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:o(u(e)),h(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)),_=e=>d.call(e,`module.exports`)?e[`module.exports`]:h(s({},`__esModule`,{value:!0}),e),v=class e extends Error{constructor(t,n){super(t),this.name=`ConfigDirectorConnectionError`,this.status=n,Object.setPrototypeOf(this,e.prototype)}},y=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorValidationError`,Object.setPrototypeOf(this,e.prototype)}},ee=class e extends Error{constructor(t){super(t),this.name=`StreamClosedError`,Object.setPrototypeOf(this,e.prototype)}},te=class e extends Error{constructor(t){super(t),this.name=`MissingResponseBodyError`,Object.setPrototypeOf(this,e.prototype)}},ne=class e extends Error{constructor(t){super(t),this.name=`InvalidOptionError`,Object.setPrototypeOf(this,e.prototype)}},b=class e extends Error{constructor(t){super(t),this.name=`ValueOutOfRangeError`,Object.setPrototypeOf(this,e.prototype)}},re=class{constructor(e){this.isFirstChunk=!0,this.bufferedInput=``,this.currentEvent={data:``},this.currentEvent={data:``},this.onEvent=e.onEvent??(()=>{}),this.onRetry=e.onRetry,this.onComment=e.onComment}parse(e){let t=e;this.isFirstChunk&&(this.isFirstChunk=!1,t.startsWith(``)?t=t.slice(1):t.startsWith(``)&&(t=t.slice(3)));let n=this.scanLines(this.bufferedInput+t);for(let e of n)this.dispatchLine(e)}finish(){this.bufferedInput=``}scanLines(e){let t=[],n=0,r=0;for(;r<e.length;){let i=e[r];i===`\r`||i===`
1
+ import{OpenFeatureEventEmitter as e,ProviderEvents as t}from"@openfeature/server-sdk";import n,{EventEmitter as r}from"node:events";import{createHash as i,randomUUID as a}from"node:crypto";var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),p=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},m=(e,t,n)=>(n=e==null?{}:o(u(e)),p(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)),h=class e extends Error{constructor(t,n){super(t),this.name=`ConfigDirectorConnectionError`,this.status=n,Object.setPrototypeOf(this,e.prototype)}},g=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorValidationError`,Object.setPrototypeOf(this,e.prototype)}},_=class e extends Error{constructor(t){super(t),this.name=`StreamClosedError`,Object.setPrototypeOf(this,e.prototype)}},v=class e extends Error{constructor(t){super(t),this.name=`MissingResponseBodyError`,Object.setPrototypeOf(this,e.prototype)}},y=class e extends Error{constructor(t){super(t),this.name=`InvalidOptionError`,Object.setPrototypeOf(this,e.prototype)}},ee=class e extends Error{constructor(t){super(t),this.name=`ValueOutOfRangeError`,Object.setPrototypeOf(this,e.prototype)}},te=class{constructor(e){this.isFirstChunk=!0,this.bufferedInput=``,this.currentEvent={data:``},this.currentEvent={data:``},this.onEvent=e.onEvent??(()=>{}),this.onRetry=e.onRetry,this.onComment=e.onComment}parse(e){let t=e;this.isFirstChunk&&(this.isFirstChunk=!1,t.startsWith(``)?t=t.slice(1):t.startsWith(``)&&(t=t.slice(3)));let n=this.scanLines(this.bufferedInput+t);for(let e of n)this.dispatchLine(e)}finish(){this.bufferedInput=``}scanLines(e){let t=[],n=0,r=0;for(;r<e.length;){let i=e[r];i===`\r`||i===`
2
2
  `?(t.push(e.slice(n,r)),i===`\r`&&e[r+1]===`
3
3
  `&&r++,r++,n=r):r++}return this.bufferedInput=e.slice(n),t}dispatchLine(e){if(e.startsWith(`:`)){this.onComment?.(this.extractValue(e,1));return}if(e===``){this.emitEvent();return}this.applyField(this.parseField(e))}emitEvent(){let e=this.currentEvent.data.endsWith(`
4
4
  `)?this.currentEvent.data.slice(0,-1):this.currentEvent.data;e!==``&&this.onEvent({...this.currentEvent,id:this.lastEventId,data:e}),this.currentEvent={data:``}}applyField(e){switch(e.field){case`event`:this.currentEvent.type=e.value;break;case`data`:this.currentEvent.data+=e.value+`
5
- `;break;case`id`:e.value.includes(`\0`)||(this.lastEventId=e.value);break;case`retry`:/^\d+$/.test(e.value)&&this.onRetry?.(Number.parseInt(e.value,10));break;default:break}}parseField(e){let t=e.indexOf(`:`);return t===-1?{field:e,value:``}:{field:e.slice(0,t),value:this.extractValue(e,t+1)}}extractValue(e,t){return e[t]===` `?e.slice(t+1):e.slice(t)}};let x=function(e){return e.OPEN=`open`,e.CLOSED=`closed`,e.CONNECTING=`connecting`,e}({});var ie=class{constructor(e){this.DEFAULT_SHOULD_RECONNECT=()=>!0,this.DEFAULT_CALCULATE_RECONNECT_DELAY=()=>this.serverReconnectionTime,this.reconnectAttempt=0,this.abortController=new AbortController,this._readyState=x.CLOSED,this.serverReconnectionTime=2e3,this.url=e.url.toString(),this.lastEventId=e.lastEventId,this.headers={Accept:`text/event-stream`,...e.headers};let t=e.body;this.body=typeof t==`function`?t:()=>t,this.requestOptions={method:e.method??`GET`,mode:e.mode,credentials:e.credentials,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy},this._fetch=e.fetch??((e,t)=>fetch(e,t)),this._onError=this.resolveCallback(e.onError,()=>{},`onError`),this._onConnect=this.resolveCallback(e.onConnect,()=>{},`onConnect`),this._onDisconnect=this.resolveCallback(e.onDisconnect,()=>{},`onDisconnect`),this._onMessage=this.resolveCallback(e.onMessage,()=>{},`onMessage`),this._onComment=this.resolveCallback(e.onComment,()=>{},`onComment`),this._shouldReconnect=this.resolveCallback(e.shouldReconnect,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`),this._calculateReconnectDelay=this.resolveCallback(e.calculateReconnectDelay,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`calculateReconnectDelay`)}set onError(e){this._onError=this.resolveCallback(e,()=>{},`onError`)}set onMessage(e){this._onMessage=this.resolveCallback(e,()=>{},`onMessage`)}set onComment(e){this._onComment=this.resolveCallback(e,()=>{},`onComment`)}set onConnect(e){this._onConnect=this.resolveCallback(e,()=>{},`onConnect`)}set onDisconnect(e){this._onDisconnect=this.resolveCallback(e,()=>{},`onDisconnect`)}set shouldReconnect(e){this._shouldReconnect=this.resolveCallback(e,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`)}set calculateReconnectDelay(e){this._calculateReconnectDelay=this.resolveCallback(e,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`shouldReconnect`)}get readyState(){return this._readyState}connect(){this._readyState===x.CLOSED&&(this.reconnectAttempt=0,this.initiateConnection())}close(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this.abortController.abort()}initiateConnection(){this.abortController=new AbortController,this._readyState=x.CONNECTING,this._fetch(this.url,{...this.requestOptions,body:this.body(),headers:this.buildRequestHeaders(),signal:this.abortController.signal,cache:`no-store`}).then(e=>this.handleFetchResponse(e)).catch(e=>{if(e.name===`AbortError`||this.abortController.signal.aborted){this.close();return}this._onError(e),this.scheduleReconnect({error:e})})}async handleFetchResponse(e){let{body:t,status:n}=e;if(n===204){this.disconnected();return}if(n>=400){this.scheduleReconnect({status:n});return}if(!t)throw new te(`The server response did not have a body`);this._readyState=x.OPEN,this._onConnect(),this.reconnectAttempt=0;let r=new re({onEvent:e=>{typeof e.id==`string`&&(this.lastEventId=e.id),this._onMessage(e)},onComment:e=>this._onComment(e),onRetry:e=>this.serverReconnectionTime=e});await this.readResponseStream(t,r),this.scheduleReconnect({status:n,error:new ee(`The server response stream was closed`)})}async readResponseStream(e,t){let n=e.getReader(),r=new TextDecoder,i=!1;for(;!i;){let e=await n.read();e.value&&t.parse(r.decode(e.value,{stream:!0})),i=e.done}t.finish()}disconnected(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this._onDisconnect()}buildRequestHeaders(){let e=this.lastEventId?{"Last-Event-ID":this.lastEventId}:void 0;return{...this.headers,...e}}scheduleReconnect(e){if(this.abortController.signal.aborted)return;clearTimeout(this.reconnectTimeout),this.reconnectAttempt+=1;let t={attempt:this.reconnectAttempt,status:e.status,error:e.error,serverReconnectionTime:this.serverReconnectionTime};if(!this._shouldReconnect(t)){this.disconnected();return}this._readyState=x.CONNECTING;let n=this._calculateReconnectDelay(t);(!Number.isFinite(n)||n<1||n>1e3*60*60)&&(this._onError(new b(`The calculated reconnect delay is out of range: ${n}. Defaulting to ${this.serverReconnectionTime}`)),n=this.serverReconnectionTime),this.reconnectTimeout=setTimeout(()=>this.initiateConnection(),n)}resolveCallback(e,t,n){if(e==null)return t;if(typeof e!=`function`)throw new ne(`${n} must be a function`);return e}};const ae=e=>new ie(e),oe=async(e,t,n,r)=>{let i=new AbortController,a=setTimeout(()=>{r.debug(`[fetchWithTimeout] Reached timeout, aborting request`),i.abort()},e);try{let e=await fetch(typeof t==`string`||t instanceof Request?t:t.toString(),{...n,signal:i.signal});return clearTimeout(a),e}catch(e){throw r.warn(`[fetchWithTimeout] Fetch error: `,e),clearTimeout(a),e}},se=9e4;var ce=class{constructor(e){this.options=e,this.eventEmitter=new r,this.options=e,this.logger=e.logger,this.url=new URL(`server/sse/v1`,e.baseUrl),this.heartbeatUrl=new URL(`server/heartbeat/v1`,e.baseUrl)}async connect(e){this.eventSource&&this.close();let t=new Promise((e,t)=>{this.eventSource=ae({url:this.url,method:`POST`,headers:{"Content-Type":`application/json`},body:()=>this.buildRequestBody(),onMessage:({data:e})=>{this.dispatchMessage(e)},onConnect:()=>{this.logger.debug(`[StreamingTransport] Connected`),e(this)},shouldReconnect:e=>{let n=!this.isStatusFatal(e.status);if(!n){let n=this.prepareFatalError(e.status,e.error);this.eventEmitter.emit(`connectionError`,n),t(n)}return n},calculateReconnectDelay:e=>{let t=2**Math.min(e.attempt,9)*1e3,n=`[StreamingTransport] Scheduling reconnect attempt #${e.attempt} in ${t}ms.`;return e.attempt<=5?this.logger.info(n):this.logger.warn(n),t},onDisconnect:()=>{this.logger.debug(`[StreamingTransport] Disconnected`)}}),this.eventSource.connect()});return this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),se),Promise.race([t,new Promise(t=>{setTimeout(()=>t(this),e)})])}get sessionId(){return this._sessionId}sendHeartbeat(){!this.isConnected||!this._sessionId||oe(se,this.heartbeatUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})},this.logger).then(e=>{e.ok||this.logger.debug(`[StreamingTransport] Heartbeat failed with status: ${e.status}`)}).catch(e=>{this.logger.debug(`[StreamingTransport] Heartbeat failed: `,e)})}buildRequestBody(){return this._sessionId=a(),JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})}dispatchMessage(e){try{let t=JSON.parse(e);this.eventEmitter.emit(`configBundleReceived`,t)}catch(e){this.logger.error(`[StreamingTransport] Error parsing and dispatching config data update: `,e)}}prepareFatalError(e,t){let n=e??0;return new v(`${`Connection failed with status: ${e??`unknown`}.`}${t?` Error: ${t}.`:``} This is an unrecoverable error, will not attempt to reconnect.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}get isConnected(){return this.eventSource?.readyState==`open`}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}close(){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0,this.eventSource?.close()}dispose(){this.close(),this.clear()}},le=class{constructor(){this.fatalError=!1,this.pollingIntervalSeconds=60}clearPollingInterval(){clearInterval(this.pollingInterval)}schedulePollingInterval(e){clearInterval(this.pollingInterval),!(this.pollingIntervalSeconds<=0)&&(this.pollingInterval=setInterval(e,this.pollingIntervalSeconds*1e3))}async handleNonOkResponse(e){if(!e.ok)throw this.isStatusFatal(e.status)?(this.fatalError=!0,this.close(),this.prepareFatalResponseStatusError(e.status,await e.text())):new v(`Connection failed with status: ${e.status}`,e.status)}handleFetchError(e){throw this.isFetchErrorFatal(e)?(this.fatalError=!0,this.close(),new v(`Connection failed with fatal error: ${e}. This is an unrecoverable error, retry attempts will be ignored.`)):e instanceof SyntaxError?new v(`Failed to parse the response from the server: ${e}`):new v(`Connection failed with error: ${e}.`)}prepareFatalResponseStatusError(e,t){let n=e??0;return new v(`${`Connection failed with status: ${e??`unknown`}`}${(t?.trim()?.length??0)>0?` (${t})`:``}. This is an unrecoverable error, retry attempts will be ignored.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}isFetchErrorFatal(e){return e?.name===`NotAllowedError`}get isConnected(){return this.pollingInterval!==void 0}close(){clearInterval(this.pollingInterval),this.pollingInterval=void 0}dispose(){this.close(),this.clear()}},ue=class extends le{constructor(e){super(),this.options=e,this.eventEmitter=new r,this._sessionId=a(),this.options=e,this.logger=e.logger,this.url=new URL(`server/polling/v1`,e.baseUrl),this.pollingIntervalSeconds=e.pollingInterval??300}async connect(e){this.clearPollingInterval();try{await this.fetchConfigs(e)}finally{this.fatalError||this.schedulePollingInterval(()=>{this.fetchConfigs(e).catch(e=>{this.logger.error(`[PollingTransport] Error during polling:`,e)})})}return this}get sessionId(){return this._sessionId}async fetchConfigs(e){if(this.fatalError){this.logger.warn(`[PollingTransport] There was a prior unrecoverable error. Ignoring attempt to reconnect.`);return}try{let t=await oe(e,this.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,lastUpdateTimestamp:this.lastUpdateTimestamp,sessionId:this._sessionId})},this.logger);if(await this.handleNonOkResponse(t),t.status===200){let e=JSON.parse(await t.text());this.lastUpdateTimestamp=e.timestamp,this.eventEmitter.emit(`configBundleReceived`,e)}}catch(e){try{this.handleFetchError(e)}catch(e){throw this.fatalError&&this.eventEmitter.emit(`connectionError`,e),e}}}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}},de=m({__addDisposableResource:()=>ze,__assign:()=>Ue,__asyncDelegator:()=>je,__asyncGenerator:()=>Ae,__asyncValues:()=>Me,__await:()=>ke,__awaiter:()=>xe,__classPrivateFieldGet:()=>Ie,__classPrivateFieldIn:()=>Re,__classPrivateFieldSet:()=>Le,__createBinding:()=>We,__decorate:()=>me,__disposeResources:()=>Be,__esDecorate:()=>ge,__exportStar:()=>Ce,__extends:()=>fe,__generator:()=>Se,__importDefault:()=>Fe,__importStar:()=>Pe,__makeTemplateObject:()=>Ne,__metadata:()=>be,__param:()=>he,__propKey:()=>ve,__read:()=>Te,__rest:()=>pe,__rewriteRelativeImportExtension:()=>Ve,__runInitializers:()=>_e,__setFunctionName:()=>ye,__spread:()=>Ee,__spreadArray:()=>Oe,__spreadArrays:()=>De,__values:()=>we,default:()=>Je});function fe(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);He(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function pe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function me(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function he(e,t){return function(n,r){t(n,r,e)}}function ge(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function _e(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function ve(e){return typeof e==`symbol`?e:`${e}`}function ye(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function be(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function xe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Se(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Ce(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&We(t,e,n)}function we(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Te(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Ee(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Te(arguments[t]));return e}function De(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function Oe(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function ke(e){return this instanceof ke?(this.v=e,this):new ke(e)}function Ae(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof ke?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function je(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:ke(e[r](t)),done:!1}:i?i(t):t}:i}}function Me(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof we==`function`?we(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Ne(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function Pe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=Ke(e),r=0;r<n.length;r++)n[r]!==`default`&&We(t,e,n[r]);return Ge(t,e),t}function Fe(e){return e&&e.__esModule?e:{default:e}}function Ie(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function Le(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function Re(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function ze(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function Be(e){function t(t){e.error=e.hasError?new qe(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function Ve(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var He,Ue,We,Ge,Ke,qe,Je,Ye=f((()=>{He=function(e,t){return He=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},He(e,t)},Ue=function(){return Ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ue.apply(this,arguments)},We=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Ge=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},Ke=function(e){return Ke=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},Ke(e)},qe=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},Je={__extends:fe,__assign:Ue,__rest:pe,__decorate:me,__param:he,__esDecorate:ge,__runInitializers:_e,__propKey:ve,__setFunctionName:ye,__metadata:be,__awaiter:xe,__generator:Se,__createBinding:We,__exportStar:Ce,__values:we,__read:Te,__spread:Ee,__spreadArrays:De,__spreadArray:Oe,__await:ke,__asyncGenerator:Ae,__asyncDelegator:je,__asyncValues:Me,__makeTemplateObject:Ne,__importStar:Pe,__importDefault:Fe,__classPrivateFieldGet:Ie,__classPrivateFieldSet:Le,__classPrivateFieldIn:Re,__addDisposableResource:ze,__disposeResources:Be,__rewriteRelativeImportExtension:Ve}})),Xe=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Ze=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isInteger=e.isRoot=e.toPath=void 0,e.unescapeComponent=a,e.escapeComponent=o,e.parseJsonPointer=s,e.formatJsonPointer=c,e.isChild=l,e.isPathEqual=u,e.parent=d,e.isValidIndex=f;let t=/~1/g,n=/~0/g,r=/~/g,i=/\//g;function a(e){return e.indexOf(`~`)===-1?e:e.replace(t,`/`).replace(n,`~`)}function o(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(r,`~0`).replace(i,`~1`)}function s(e){return e?e.slice(1).split(`/`).map(a):[]}function c(t){return(0,e.isRoot)(t)?``:`/`+t.map(e=>o(String(e))).join(`/`)}e.toPath=e=>typeof e==`string`?s(e):e;function l(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function u(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}e.isRoot=e=>!e.length;function d(e){if(e.length<1)throw Error(`NO_PARENT`);return e.slice(0,e.length-1)}function f(e){if(typeof e==`number`)return!0;let t=Number.parseInt(e,10);return String(t)===e&&t>=0}e.isInteger=e=>{let t=e.length,n=0,r;for(;n<t;){if(r=e.charCodeAt(n),r>=48&&r<=57){n++;continue}return!1}return!0}})),Qe=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validatePath=e.validateJsonPointer=void 0,e.validateJsonPointer=t=>{if(typeof t==`string`){if(t){if(t[0]!==`/`)throw Error(`POINTER_INVALID`);if(t.length>1024)throw Error(`POINTER_TOO_LONG`)}}else (0,e.validatePath)(t)};let{isArray:t}=Array;e.validatePath=e=>{if(!t(e))throw Error(`Invalid path.`);if(e.length>256)throw Error(`Path too long.`);for(let t of e)switch(typeof t){case`string`:case`number`:continue;default:throw Error(`Invalid path step.`)}}})),$e=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=n;let t=Object.prototype.hasOwnProperty;function n(e,n){return t.call(e,n)}})),et=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.get=void 0;let t=$e();e.get=(e,n)=>{let r=n.length,i;if(!r)return e;for(let a=0;a<r;a++)if(i=n[a],e instanceof Array){if(typeof i!=`number`){if(i===`-`)return;let e=~~i;if(``+e!==i)return;i=e}e=e[i]}else if(typeof e==`object`){if(!e||!(0,t.hasOwnProperty)(e,i))return;e=e[i]}else return;return e}})),tt=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isObjectReference=e.isArrayEnd=e.isArrayReference=e.find=void 0;let t=$e(),{isArray:n}=Array;e.find=(e,r)=>{let i=r.length;if(!i)return{val:e};let a,o;for(let s=0;s<i;s++)if(a=e,o=r[s],n(a)){let t=a.length;if(o===`-`)o=t;else if(typeof o==`string`){let e=~~o;if(``+e!==o||(o=e,o<0))throw Error(`INVALID_INDEX`)}e=a[o]}else if(typeof a==`object`&&a)e=(0,t.hasOwnProperty)(a,o)?a[o]:void 0;else throw Error(`NOT_FOUND`);return{val:e,obj:a,key:o}},e.isArrayReference=e=>n(e.obj)&&typeof e.key==`number`,e.isArrayEnd=e=>e.obj.length===e.key,e.isObjectReference=e=>typeof e.obj==`object`&&typeof e.key==`string`})),nt=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.findByPointer=void 0;let t=$e(),n=Ze(),{isArray:r}=Array;e.findByPointer=(e,i)=>{if(!e)return{val:i};let a,o,s=0,c=1;for(;s>-1;)if(s=e.indexOf(`/`,c),o=s>-1?e.substring(c,s):e.substring(c),c=s+1,a=i,r(a)){let e=a.length;if(o===`-`)o=e;else{let e=~~o;if(``+e!==o)throw Error(`INVALID_INDEX`);if(o=e,o<0)throw`INVALID_INDEX`}i=a[o]}else if(typeof a==`object`&&a)o=(0,n.unescapeComponent)(o),i=(0,t.hasOwnProperty)(a,o)?a[o]:void 0;else throw`NOT_FOUND`;return{val:i,obj:a,key:o}}})),rt=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(Ye(),_(de)).__exportStar(nt(),e)})),it=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(Ye(),_(de));t.__exportStar(Xe(),e),t.__exportStar(Ze(),e),t.__exportStar(Qe(),e),t.__exportStar(et(),e),t.__exportStar(tt(),e),t.__exportStar(rt(),e)}))();const at=(e,t,n)=>{let r=n[0];switch(t.toLowerCase()){case`=`:case`equals`:return r!==void 0&&e===r;case`!=`:case`does not equal`:return r!==void 0&&e!==r;case`is one of`:return n.includes(e);case`is not one of`:return!n.includes(e);case`starts with any of`:return n.some(t=>e.startsWith(t));case`does not start with any of`:return!n.some(t=>e.startsWith(t));case`ends with any of`:return n.some(t=>e.endsWith(t));case`does not end with any of`:return!n.some(t=>e.endsWith(t));default:return!1}},ot=(e,t,n)=>{let r=t.toLowerCase(),i=st(e);if(i===void 0)return r===`!=`||r===`does not equal`;let a=n[0];if(a===void 0)return!1;let o=st(a);if(o===void 0)return!1;switch(r){case`=`:case`equals`:return i===o;case`!=`:case`does not equal`:return i!==o;case`<`:return i<o;case`<=`:return i<=o;case`>`:return i>o;case`>=`:return i>=o;default:return!1}},st=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`||e.length===0||!ct(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0},ct=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0};var lt=class extends Error{},ut=class extends lt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},dt=class extends lt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},ft=class extends lt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},pt=class extends lt{},mt=class extends lt{constructor(e){super(`Invalid unit ${e}`)}},S=class extends lt{},C=class extends lt{constructor(){super(`Zone is an abstract class`)}};const w=`numeric`,T=`short`,E=`long`,ht={year:w,month:w,day:w},gt={year:w,month:T,day:w},_t={year:w,month:T,day:w,weekday:T},vt={year:w,month:E,day:w},yt={year:w,month:E,day:w,weekday:E},bt={hour:w,minute:w},xt={hour:w,minute:w,second:w},St={hour:w,minute:w,second:w,timeZoneName:T},Ct={hour:w,minute:w,second:w,timeZoneName:E},wt={hour:w,minute:w,hourCycle:`h23`},Tt={hour:w,minute:w,second:w,hourCycle:`h23`},Et={hour:w,minute:w,second:w,hourCycle:`h23`,timeZoneName:T},Dt={hour:w,minute:w,second:w,hourCycle:`h23`,timeZoneName:E},Ot={year:w,month:w,day:w,hour:w,minute:w},kt={year:w,month:w,day:w,hour:w,minute:w,second:w},At={year:w,month:T,day:w,hour:w,minute:w},jt={year:w,month:T,day:w,hour:w,minute:w,second:w},Mt={year:w,month:T,day:w,weekday:T,hour:w,minute:w},Nt={year:w,month:E,day:w,hour:w,minute:w,timeZoneName:T},Pt={year:w,month:E,day:w,hour:w,minute:w,second:w,timeZoneName:T},Ft={year:w,month:E,day:w,weekday:E,hour:w,minute:w,timeZoneName:E},It={year:w,month:E,day:w,weekday:E,hour:w,minute:w,second:w,timeZoneName:E};var Lt=class{get type(){throw new C}get name(){throw new C}get ianaName(){return this.name}get isUniversal(){throw new C}offsetName(e,t){throw new C}formatOffset(e,t){throw new C}offset(e){throw new C}equals(e){throw new C}get isValid(){throw new C}};let Rt=null;var zt=class e extends Lt{static get instance(){return Rt===null&&(Rt=new e),Rt}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return hr(e,t,n)}formatOffset(e,t){return yr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}};const Bt=new Map;function Vt(e){let t=Bt.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),Bt.set(e,t)),t}const Ht={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ut(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function Wt(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=Ht[t];t===`era`?r[a]=i:P(a)||(r[a]=parseInt(i,10))}return r}const Gt=new Map;var Kt=class e extends Lt{static create(t){let n=Gt.get(t);return n===void 0&&Gt.set(t,n=new e(t)),n}static resetCache(){Gt.clear(),Bt.clear()}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(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return hr(e,t,n,this.name)}formatOffset(e,t){return yr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=Vt(this.name),[r,i,a,o,s,c,l]=n.formatToParts?Wt(n,t):Ut(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=dr({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}};let qt={};function Jt(e,t={}){let n=JSON.stringify([e,t]),r=qt[n];return r||(r=new Intl.ListFormat(e,t),qt[n]=r),r}const Yt=new Map;function Xt(e,t={}){let n=JSON.stringify([e,t]),r=Yt.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),Yt.set(n,r)),r}const Zt=new Map;function Qt(e,t={}){let n=JSON.stringify([e,t]),r=Zt.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),Zt.set(n,r)),r}const $t=new Map;function en(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=$t.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),$t.set(i,a)),a}let tn=null;function nn(){return tn||(tn=new Intl.DateTimeFormat().resolvedOptions().locale,tn)}const rn=new Map;function an(e){let t=rn.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),rn.set(e,t)),t}const on=new Map;function sn(e){let t=on.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={..._n,...t}),on.set(e,t)}return t}function cn(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=Xt(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=Xt(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function ln(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function un(e){let t=[];for(let n=1;n<=12;n++){let r=J.utc(2009,n,1);t.push(e(r))}return t}function dn(e){let t=[];for(let n=1;n<=7;n++){let r=J.utc(2016,11,13+n);t.push(e(r))}return t}function fn(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function pn(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||an(e.locale).numberingSystem===`latn`}var mn=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=Qt(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return L(this.floor?Math.floor(e):sr(e,3),this.padTo)}},hn=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&Kt.create(n).valid?(r=n,this.dt=e):(r=`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,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Xt(t,i)}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(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},gn=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&Qn()&&(this.rtf=en(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Rr(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}};const _n={firstDay:1,minimalDays:4,weekend:[6,7]};var D=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||j.defaultLocale;return new e(o||(a?`en-US`:nn()),n||j.defaultNumberingSystem,r||j.defaultOutputCalendar,ir(i)||j.defaultWeekSettings,o)}static resetCache(){tn=null,Yt.clear(),Zt.clear(),$t.clear(),rn.clear(),on.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=cn(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=ln(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??(this.fastNumbersCached=pn(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,ir(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return fn(this,e,wr,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=un(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return fn(this,e,Or,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=dn(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return fn(this,void 0,()=>kr,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[J.utc(2016,11,13,9),J.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return fn(this,e,Nr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[J.utc(-40,1,1),J.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new mn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new hn(e,this.intl,t)}relFormatter(e={}){return new gn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Jt(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||an(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:$n()?sn(this.locale):_n}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}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};let vn=null;var O=class e extends Lt{static get utcInstance(){return vn===null&&(vn=new e(0)),vn}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(gr(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${yr(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${yr(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return yr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},yn=class extends Lt{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 k(e,t){if(P(e)||e===null)return t;if(e instanceof Lt)return e;if(Xn(e)){let n=e.toLowerCase();return n===`default`?t:n===`local`||n===`system`?zt.instance:n===`utc`||n===`gmt`?O.utcInstance:O.parseSpecifier(n)||Kt.create(e)}else if(F(e))return O.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new yn(e)}const bn={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},xn={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]},Sn=bn.hanidec.replace(/[\[|\]]/g,``).split(``);function Cn(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(bn.hanidec)!==-1)t+=Sn.indexOf(e[n]);else for(let e in xn){let[n,i]=xn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}const wn=new Map;function Tn(){wn.clear()}function A({numberingSystem:e},t=``){let n=e||`latn`,r=wn.get(n);r===void 0&&(r=new Map,wn.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${bn[n]}${t}`),r.set(t,i)),i}let En=()=>Date.now(),Dn=`system`,On=null,kn=null,An=null,jn=60,Mn,Nn=null;var j=class{static get now(){return En}static set now(e){En=e}static set defaultZone(e){Dn=e}static get defaultZone(){return k(Dn,zt.instance)}static get defaultLocale(){return On}static set defaultLocale(e){On=e}static get defaultNumberingSystem(){return kn}static set defaultNumberingSystem(e){kn=e}static get defaultOutputCalendar(){return An}static set defaultOutputCalendar(e){An=e}static get defaultWeekSettings(){return Nn}static set defaultWeekSettings(e){Nn=ir(e)}static get twoDigitCutoffYear(){return jn}static set twoDigitCutoffYear(e){jn=e%100}static get throwOnInvalid(){return Mn}static set throwOnInvalid(e){Mn=e}static resetCaches(){D.resetCache(),Kt.resetCache(),J.resetCache(),Tn()}},M=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};const Pn=[0,31,59,90,120,151,181,212,243,273,304,334],Fn=[0,31,60,91,121,152,182,213,244,274,305,335];function N(e,t){return new M(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function In(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Ln(e,t,n){return n+(cr(e)?Fn:Pn)[t-1]}function Rn(e,t){let n=cr(e)?Fn:Pn,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function zn(e,t){return(e-t+7)%7+1}function Bn(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=Ln(r,i,a),s=zn(In(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=pr(l,t,n)):c>pr(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...br(e)}}function Vn(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=zn(In(r,1,t),n),s=lr(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=lr(l)):c>s?(l=r+1,c-=lr(r)):l=r;let{month:u,day:d}=Rn(l,c);return{year:l,month:u,day:d,...br(e)}}function Hn(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:Ln(t,n,r),...br(e)}}function Un(e){let{year:t,ordinal:n}=e,{month:r,day:i}=Rn(t,n);return{year:t,month:r,day:i,...br(e)}}function Wn(e,t){if(!P(e.localWeekday)||!P(e.localWeekNumber)||!P(e.localWeekYear)){if(!P(e.weekday)||!P(e.weekNumber)||!P(e.weekYear))throw new pt(`Cannot mix locale-based week fields with ISO-based week fields`);return P(e.localWeekday)||(e.weekday=e.localWeekday),P(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),P(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Gn(e,t=4,n=1){let r=Yn(e.weekYear),i=I(e.weekNumber,1,pr(e.weekYear,t,n)),a=I(e.weekday,1,7);return r?i?a?!1:N(`weekday`,e.weekday):N(`week`,e.weekNumber):N(`weekYear`,e.weekYear)}function Kn(e){let t=Yn(e.year),n=I(e.ordinal,1,lr(e.year));return t?n?!1:N(`ordinal`,e.ordinal):N(`year`,e.year)}function qn(e){let t=Yn(e.year),n=I(e.month,1,12),r=I(e.day,1,ur(e.year,e.month));return t?n?r?!1:N(`day`,e.day):N(`month`,e.month):N(`year`,e.year)}function Jn(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=I(t,0,23)||t===24&&n===0&&r===0&&i===0,o=I(n,0,59),s=I(r,0,59),c=I(i,0,999);return a?o?s?c?!1:N(`millisecond`,i):N(`second`,r):N(`minute`,n):N(`hour`,t)}function P(e){return e===void 0}function F(e){return typeof e==`number`}function Yn(e){return typeof e==`number`&&e%1==0}function Xn(e){return typeof e==`string`}function Zn(e){return Object.prototype.toString.call(e)===`[object Date]`}function Qn(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function $n(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function er(e){return Array.isArray(e)?e:[e]}function tr(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function nr(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function rr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ir(e){if(e==null)return null;if(typeof e!=`object`)throw new S(`Week settings must be an object`);if(!I(e.firstDay,1,7)||!I(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!I(e,1,7)))throw new S(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function I(e,t,n){return Yn(e)&&e>=t&&e<=n}function ar(e,t){return e-t*Math.floor(e/t)}function L(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function R(e){if(!(P(e)||e===null||e===``))return parseInt(e,10)}function z(e){if(!(P(e)||e===null||e===``))return parseFloat(e)}function or(e){if(!(P(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function sr(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function cr(e){return e%4==0&&(e%100!=0||e%400==0)}function lr(e){return cr(e)?366:365}function ur(e,t){let n=ar(t-1,12)+1,r=e+(t-n)/12;return n===2?cr(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function dr(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function fr(e,t,n){return-zn(In(e,1,t),n)+t-1}function pr(e,t=4,n=1){let r=fr(e,t,n),i=fr(e+1,t,n);return(lr(e)-r+i)/7}function mr(e){return e>99?e:e>j.twoDigitCutoffYear?1900+e:2e3+e}function hr(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function gr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function _r(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new S(`Invalid unit value ${e}`);return t}function vr(e,t){let n={};for(let r in e)if(rr(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=_r(i)}return n}function yr(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${L(n,2)}:${L(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${L(n,2)}${L(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function br(e){return nr(e,[`hour`,`minute`,`second`,`millisecond`])}const xr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Sr=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Cr=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function wr(e){switch(e){case`narrow`:return[...Cr];case`short`:return[...Sr];case`long`:return[...xr];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}}const Tr=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],Er=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Dr=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Or(e){switch(e){case`narrow`:return[...Dr];case`short`:return[...Er];case`long`:return[...Tr];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}const kr=[`AM`,`PM`],Ar=[`Before Christ`,`Anno Domini`],jr=[`BC`,`AD`],Mr=[`B`,`A`];function Nr(e){switch(e){case`narrow`:return[...Mr];case`short`:return[...jr];case`long`:return[...Ar];default:return null}}function Pr(e){return kr[e.hour<12?0:1]}function Fr(e,t){return Or(t)[e.weekday-1]}function Ir(e,t){return wr(t)[e.month-1]}function Lr(e,t){return Nr(t)[e.year<0?0:1]}function Rr(e,t,n=`always`,r=!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.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function zr(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Br={D:ht,DD:gt,DDD:vt,DDDD:yt,t:bt,tt:xt,ttt:St,tttt:Ct,T:wt,TT:Tt,TTT:Et,TTTT:Dt,f:Ot,ff:At,fff:Nt,ffff:Ft,F:kt,FF:jt,FFF:Pt,FFFF:It};var B=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return Br[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return L(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?Pr(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?Ir(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?Fr(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?Lr(t,e):a({era:e},`era`);return zr(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return zr(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}};const Vr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Hr(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function Ur(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function Wr(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function Gr(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=R(t[n+i]);return[r,null,n+i]}}const Kr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,qr=`(?:${Kr.source}?(?:\\[(${Vr.source})\\])?)?`,Jr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Yr=RegExp(`${Jr.source}${qr}`),Xr=RegExp(`(?:[Tt]${Yr.source})?`),Zr=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Qr=/(\d{4})-?W(\d\d)(?:-?(\d))?/,$r=/(\d{4})-?(\d{3})/,ei=Gr(`weekYear`,`weekNumber`,`weekDay`),ti=Gr(`year`,`ordinal`),ni=/(\d{4})-(\d\d)-(\d\d)/,ri=RegExp(`${Jr.source} ?(?:${Kr.source}|(${Vr.source}))?`),ii=RegExp(`(?: ${ri.source})?`);function ai(e,t,n){let r=e[t];return P(r)?n:R(r)}function oi(e,t){return[{year:ai(e,t),month:ai(e,t+1,1),day:ai(e,t+2,1)},null,t+3]}function si(e,t){return[{hours:ai(e,t,0),minutes:ai(e,t+1,0),seconds:ai(e,t+2,0),milliseconds:or(e[t+3])},null,t+4]}function ci(e,t){let n=!e[t]&&!e[t+1],r=gr(e[t+1],e[t+2]);return[{},n?null:O.instance(r),t+3]}function li(e,t){return[{},e[t]?Kt.create(e[t]):null,t+1]}const ui=RegExp(`^T?${Jr.source}$`),di=/^-?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 fi(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(z(n)),months:f(z(r)),weeks:f(z(i)),days:f(z(a)),hours:f(z(o)),minutes:f(z(s)),seconds:f(z(c),c===`-0`),milliseconds:f(or(l),d)}]}const pi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function mi(e,t,n,r,i,a,o){let s={year:t.length===2?mr(R(t)):R(t),month:Sr.indexOf(n)+1,day:R(r),hour:R(i),minute:R(a)};return o&&(s.second=R(o)),e&&(s.weekday=e.length>3?Tr.indexOf(e)+1:Er.indexOf(e)+1),s}const hi=/^(?:(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 gi(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=mi(t,i,r,n,a,o,s),p;return p=c?pi[c]:l?0:gr(u,d),[f,new O(p)]}function _i(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}const vi=/^(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$/,yi=/^(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$/,bi=/^(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 xi(e){let[,t,n,r,i,a,o,s]=e;return[mi(t,i,r,n,a,o,s),O.utcInstance]}function Si(e){let[,t,n,r,i,a,o,s]=e;return[mi(t,s,n,r,i,a,o),O.utcInstance]}const Ci=Hr(Zr,Xr),wi=Hr(Qr,Xr),Ti=Hr($r,Xr),Ei=Hr(Yr),Di=Ur(oi,si,ci,li),Oi=Ur(ei,si,ci,li),ki=Ur(ti,si,ci,li),Ai=Ur(si,ci,li);function ji(e){return Wr(e,[Ci,Di],[wi,Oi],[Ti,ki],[Ei,Ai])}function Mi(e){return Wr(_i(e),[hi,gi])}function Ni(e){return Wr(e,[vi,xi],[yi,xi],[bi,Si])}function Pi(e){return Wr(e,[di,fi])}const Fi=Ur(si);function Ii(e){return Wr(e,[ui,Fi])}const Li=Hr(ni,ii),Ri=Hr(ri),zi=Ur(si,ci,li);function Bi(e){return Wr(e,[Li,Di],[Ri,zi])}const Vi=`Invalid Duration`,Hi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ui={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:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Hi},V=146097/400,Wi=146097/4800,Gi={years:{quarters:4,months:12,weeks:V/7,days:V,hours:V*24,minutes:V*24*60,seconds:V*24*60*60,milliseconds:V*24*60*60*1e3},quarters:{months:3,weeks:V/28,days:V/4,hours:V*24/4,minutes:V*24*60/4,seconds:V*24*60*60/4,milliseconds:V*24*60*60*1e3/4},months:{weeks:Wi/7,days:Wi,hours:Wi*24,minutes:Wi*24*60,seconds:Wi*24*60*60,milliseconds:Wi*24*60*60*1e3},...Hi},H=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],Ki=H.slice(0).reverse();function U(e,t,n=!1){return new W({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function qi(e,t){let n=t.milliseconds??0;for(let r of Ki.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Ji(e,t){let n=qi(e,t)<0?-1:1;H.reduceRight((r,i)=>{if(P(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),H.reduce((n,r)=>{if(P(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Yi(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var W=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?Gi:Ui;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||D.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new S(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:vr(t,e.normalizeUnit),loc:D.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(F(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new S(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=Pi(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=Ii(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the Duration is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new ft(r);return new e({invalid:r})}static normalizeUnit(e){let t={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(!t)throw new mt(e);return t}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,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?B.create(this.loc,n).formatDurationFromString(this,e):Vi}toHuman(e={}){if(!this.isValid)return Vi;let t=e.showZeros!==!1,n=H.map(n=>{let r=this.values[n];return P(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}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+=sr(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},J.fromMillis(t,{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?qi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of H)(rr(n.values,e)||rr(this.values,e))&&(r[e]=n.get(e)+this.get(e));return U(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=_r(e(this.values[n],n));return U(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...vr(t,e.normalizeUnit)};return U(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return U(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return Ji(this.matrix,e),U(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Yi(this.normalize().shiftToAll().toObject());return U(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of H)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;F(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else F(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return Ji(this.matrix,n),U(this,{values:n},!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 t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return U(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=Yi(this.values);return U(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 t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of H)if(!t(this.values[n],e.values[n]))return!1;return!0}};const Xi=`Invalid Interval`;function Zi(e,t){return!e||!e.isValid?Qi.invalid(`missing or invalid start`):!t||!t.isValid?Qi.invalid(`missing or invalid end`):t<e?Qi.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var Qi=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the Interval is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new dt(r);return new e({invalid:r})}static fromDateTimes(t,n){let r=Za(t),i=Za(n);return Zi(r,i)??new e({start:r,end:i})}static after(t,n){let r=W.fromDurationLike(n),i=Za(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=W.fromDurationLike(n),i=Za(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=J.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=J.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=W.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=W.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" 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 lastDateTime(){return this.isValid&&this.e?this.e.minus(1):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`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.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:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(Za).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=W.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}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(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Xi}[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=ht,t={}){return this.isValid?B.create(this.s.loc.clone(t),e).formatInterval(this):Xi}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Xi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Xi}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Xi}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Xi}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):W.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},$i=class{static hasDST(e=j.defaultZone){let t=J.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Kt.isValidZone(e)}static normalizeZone(e){return k(e,j.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||D.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||D.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||D.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||D.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return D.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return D.create(t,null,`gregory`).eras(e)}static features(){return{relative:Qn(),localeWeek:$n()}}};function ea(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(W.fromMillis(r).as(`days`))}function ta(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=ea(e,t);return(n-n%7)/7}],[`days`,ea]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function na(e,t,n,r){let[i,a,o,s]=ta(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=W.fromObject(a,r);return l.length>0?W.fromMillis(c,r).shiftTo(...l).plus(u):u}function G(e,t=e=>e){return{regex:e,deser:([e])=>t(Cn(e))}}const ra=`[ \xA0]`,ia=new RegExp(ra,`g`);function aa(e){return e.replace(/\./g,`\\.?`).replace(ia,ra)}function oa(e){return e.replace(/\./g,``).replace(ia,` `).toLowerCase()}function K(e,t){return e===null?null:{regex:RegExp(e.map(aa).join(`|`)),deser:([n])=>e.findIndex(e=>oa(n)===oa(e))+t}}function sa(e,t){return{regex:e,deser:([,e,t])=>gr(e,t),groups:t}}function ca(e){return{regex:e,deser:([e])=>e}}function la(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function ua(e,t){let n=A(t),r=A(t,`{2}`),i=A(t,`{3}`),a=A(t,`{4}`),o=A(t,`{6}`),s=A(t,`{1,2}`),c=A(t,`{1,3}`),l=A(t,`{1,6}`),u=A(t,`{1,9}`),d=A(t,`{2,4}`),f=A(t,`{4,6}`),p=e=>({regex:RegExp(la(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return K(t.eras(`short`),0);case`GG`:return K(t.eras(`long`),0);case`y`:return G(l);case`yy`:return G(d,mr);case`yyyy`:return G(a);case`yyyyy`:return G(f);case`yyyyyy`:return G(o);case`M`:return G(s);case`MM`:return G(r);case`MMM`:return K(t.months(`short`,!0),1);case`MMMM`:return K(t.months(`long`,!0),1);case`L`:return G(s);case`LL`:return G(r);case`LLL`:return K(t.months(`short`,!1),1);case`LLLL`:return K(t.months(`long`,!1),1);case`d`:return G(s);case`dd`:return G(r);case`o`:return G(c);case`ooo`:return G(i);case`HH`:return G(r);case`H`:return G(s);case`hh`:return G(r);case`h`:return G(s);case`mm`:return G(r);case`m`:return G(s);case`q`:return G(s);case`qq`:return G(r);case`s`:return G(s);case`ss`:return G(r);case`S`:return G(c);case`SSS`:return G(i);case`u`:return ca(u);case`uu`:return ca(s);case`uuu`:return G(n);case`a`:return K(t.meridiems(),0);case`kkkk`:return G(a);case`kk`:return G(d,mr);case`W`:return G(s);case`WW`:return G(r);case`E`:case`c`:return G(n);case`EEE`:return K(t.weekdays(`short`,!1),1);case`EEEE`:return K(t.weekdays(`long`,!1),1);case`ccc`:return K(t.weekdays(`short`,!0),1);case`cccc`:return K(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return sa(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return sa(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return ca(/[a-z_+-/]{1,256}?/i);case` `:return ca(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:`missing Intl.DateTimeFormat.formatToParts support`};return m.token=e,m}const da={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 fa(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=da[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function pa(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function ma(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(rr(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function ha(e){let t=e=>{switch(e){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}},n=null,r;return P(e.z)||(n=Kt.create(e.z)),P(e.Z)||(n||(n=new O(e.Z)),r=e.Z),P(e.q)||(e.M=(e.q-1)*3+1),P(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),P(e.u)||(e.S=or(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}let ga=null;function _a(){return ga||(ga=J.fromMillis(1555555555555)),ga}function va(e,t){if(e.literal)return e;let n=Ca(B.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function ya(e,t){return Array.prototype.concat(...e.map(e=>va(e,t)))}var ba=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=ya(B.parseFormat(t),e),this.units=this.tokens.map(t=>ua(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=pa(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=ma(e,this.regex,this.handlers),[r,i,a]=n?ha(n):[null,null,void 0];if(rr(n,`a`)&&rr(n,`H`))throw new pt(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function xa(e,t,n){return new ba(e,n).explainFromTokens(t)}function Sa(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=xa(e,t,n);return[r,i,a,o]}function Ca(e,t){if(!e)return null;let n=B.create(t,e).dtFormatter(_a()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>fa(t,e,i))}const wa=`Invalid DateTime`,Ta=864e13;function Ea(e){return new M(`unsupported zone`,`the zone "${e.name}" is not supported`)}function Da(e){return e.weekData===null&&(e.weekData=Bn(e.c)),e.weekData}function Oa(e){return e.localWeekData===null&&(e.localWeekData=Bn(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function q(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new J({...n,...t,old:n})}function ka(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Aa(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function ja(e,t,n){return ka(dr(e),t,n)}function Ma(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,ur(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=W.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=ka(dr(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function Na(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=J.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return J.invalid(new M(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function Pa(e,t,n=!0){return e.isValid?B.create(D.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Fa(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=L(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=L(e.c.month),n===`month`)return i;i+=`-`}else if(i+=L(e.c.month),n===`month`)return i;return i+=L(e.c.day),i}function Ia(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=L(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=L(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=L(e.c.second))}else{if(c+=L(e.c.minute),o===`minute`)break;s&&(c+=L(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=L(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=L(Math.trunc(-e.o/60)),c+=`:`,c+=L(Math.trunc(-e.o%60))):(c+=`+`,c+=L(Math.trunc(e.o/60)),c+=`:`,c+=L(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}const La={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Ra={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},za={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ba=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],Va=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],Ha=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function Ua(e){let t={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`}[e.toLowerCase()];if(!t)throw new mt(e);return t}function Wa(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return Ua(e)}}function Ga(e){if(Ya===void 0&&(Ya=j.now()),e.type!==`iana`)return e.offset(Ya);let t=e.name,n=Xa.get(t);return n===void 0&&(n=e.offset(Ya),Xa.set(t,n)),n}function Ka(e,t){let n=k(t.zone,j.defaultZone);if(!n.isValid)return J.invalid(Ea(n));let r=D.fromObject(t),i,a;if(P(e.year))i=j.now();else{for(let t of Ba)P(e[t])&&(e[t]=La[t]);let t=qn(e)||Jn(e);if(t)return J.invalid(t);let r=Ga(n);[i,a]=ja(e,r,n)}return new J({ts:i,zone:n,loc:r,o:a})}function qa(e,t,n){let r=P(n.round)?!0:n.round,i=P(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=sr(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function Ja(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}let Ya;const Xa=new Map;var J=class e{constructor(e){let t=e.zone||j.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new M(`invalid input`):null)||(t.isValid?null:Ea(t));this.ts=P(e.ts)?j.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=F(e.o)&&!e.old?e.o:t.offset(this.ts);r=Aa(this.ts,a),n=Number.isNaN(r.year)?new M(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||D.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=Ja(arguments),[n,r,i,a,o,s,c]=t;return Ka({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=Ja(arguments),[n,r,i,a,o,s,c]=t;return e.zone=O.utcInstance,Ka({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=Zn(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=k(n.zone,j.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:D.fromObject(n)}):e.invalid(Ea(i))}static fromMillis(t,n={}){if(!F(t))throw new S(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-Ta||t>Ta?e.invalid(`Timestamp out of range`):new e({ts:t,zone:k(n.zone,j.defaultZone),loc:D.fromObject(n)})}static fromSeconds(t,n={}){if(F(t))return new e({ts:t*1e3,zone:k(n.zone,j.defaultZone),loc:D.fromObject(n)});throw new S(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t=t||{};let r=k(n.zone,j.defaultZone);if(!r.isValid)return e.invalid(Ea(r));let i=D.fromObject(n),a=vr(t,Wa),{minDaysInFirstWeek:o,startOfWeek:s}=Wn(a,i),c=j.now(),l=P(n.specificOffset)?r.offset(c):n.specificOffset,u=!P(a.ordinal),d=!P(a.year),f=!P(a.month)||!P(a.day),p=d||f,m=a.weekYear||a.weekNumber;if((p||u)&&m)throw new pt(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(f&&u)throw new pt(`Can't mix ordinal dates with month/day`);let h=m||a.weekday&&!p,g,_,v=Aa(c,l);h?(g=Va,_=Ra,v=Bn(v,o,s)):u?(g=Ha,_=za,v=Hn(v)):(g=Ba,_=La);let y=!1;for(let e of g){let t=a[e];P(t)?y?a[e]=_[e]:a[e]=v[e]:y=!0}let ee=(h?Gn(a,o,s):u?Kn(a):qn(a))||Jn(a);if(ee)return e.invalid(ee);let[te,ne]=ja(h?Vn(a,o,s):u?Un(a):a,l,r),b=new e({ts:te,zone:r,o:ne,loc:i});return a.weekday&&p&&t.weekday!==b.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${a.weekday} and a date of ${b.toISO()}`):b.isValid?b:e.invalid(b.invalid)}static fromISO(e,t={}){let[n,r]=ji(e);return Na(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=Mi(e);return Na(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=Ni(e);return Na(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(P(t)||P(n))throw new S(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,s,c,l]=Sa(D.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return l?e.invalid(l):Na(o,s,r,`format ${n}`,t,c)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=Bi(e);return Na(n,r,t,`SQL`,e)}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the DateTime is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new ut(r);return new e({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Ca(e,D.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return ya(B.parseFormat(e),D.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){Ya=void 0,Xa.clear()}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?Da(this).weekYear:NaN}get weekNumber(){return this.isValid?Da(this).weekNumber:NaN}get weekday(){return this.isValid?Da(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Oa(this).weekday:NaN}get localWeekNumber(){return this.isValid?Oa(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Oa(this).weekYear:NaN}get ordinal(){return this.isValid?Hn(this.c).ordinal:NaN}get monthShort(){return this.isValid?$i.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?$i.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?$i.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?$i.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,t=6e4,n=dr(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=Aa(s,a),u=Aa(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[q(this,{ts:s}),q(this,{ts:c})]:[this]}get isInLeapYear(){return cr(this.year)}get daysInMonth(){return ur(this.year,this.month)}get daysInYear(){return this.isValid?lr(this.year):NaN}get weeksInWeekYear(){return this.isValid?pr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?pr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=B.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(O.instance(e),t)}toLocal(){return this.setZone(j.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=k(t,j.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=ja(r,n,t)}return q(this,{ts:e,zone:t})}else return e.invalid(Ea(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return q(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=vr(e,Wa),{minDaysInFirstWeek:n,startOfWeek:r}=Wn(t,this.loc),i=!P(t.weekYear)||!P(t.weekNumber)||!P(t.weekday),a=!P(t.ordinal),o=!P(t.year),s=!P(t.month)||!P(t.day),c=o||s,l=t.weekYear||t.weekNumber;if((c||a)&&l)throw new pt(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(s&&a)throw new pt(`Can't mix ordinal dates with month/day`);let u;i?u=Vn({...Bn(this.c,n,r),...t},n,r):P(t.ordinal)?(u={...this.toObject(),...t},P(t.day)&&(u.day=Math.min(ur(u.year,u.month),u.day))):u=Un({...Hn(this.c),...t});let[d,f]=ja(u,this.o,this.zone);return q(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=W.fromDurationLike(e);return q(this,Ma(this,t))}minus(e){if(!this.isValid)return this;let t=W.fromDurationLike(e).negate();return q(this,Ma(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=W.normalizeUnit(e);switch(r){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}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?B.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):wa}toLocaleString(e=ht,t={}){return this.isValid?B.create(this.loc.clone(t),e).formatDateTime(this):wa}toLocaleParts(e={}){return this.isValid?B.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=Ua(a);let o=e===`extended`,s=Fa(this,o,a);return Ba.indexOf(a)>=3&&(s+=`T`),s+=Ia(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?Fa(this,e===`extended`,Ua(t)):null}toISOWeekDate(){return Pa(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=Ua(o),(r&&Ba.indexOf(o)>=3?`T`:``)+Ia(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return Pa(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return Pa(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?Fa(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),Pa(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():wa}[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 t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return W.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=er(t).map(W.normalizeUnit),a=e.valueOf()>this.valueOf(),o=na(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?Qi.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),qa(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?qa(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new S(`min requires all arguments be DateTimes`);return tr(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new S(`max requires all arguments be DateTimes`);return tr(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return xa(D.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new ba(D.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(P(t)||P(n))throw new S(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=D.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new S(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:s,zone:c,specificOffset:l,invalidReason:u}=n.explainFromTokens(t);return u?e.invalid(u):Na(s,c,r,`format ${n.format}`,t,l)}static get DATE_SHORT(){return ht}static get DATE_MED(){return gt}static get DATE_MED_WITH_WEEKDAY(){return _t}static get DATE_FULL(){return vt}static get DATE_HUGE(){return yt}static get TIME_SIMPLE(){return bt}static get TIME_WITH_SECONDS(){return xt}static get TIME_WITH_SHORT_OFFSET(){return St}static get TIME_WITH_LONG_OFFSET(){return Ct}static get TIME_24_SIMPLE(){return wt}static get TIME_24_WITH_SECONDS(){return Tt}static get TIME_24_WITH_SHORT_OFFSET(){return Et}static get TIME_24_WITH_LONG_OFFSET(){return Dt}static get DATETIME_SHORT(){return Ot}static get DATETIME_SHORT_WITH_SECONDS(){return kt}static get DATETIME_MED(){return At}static get DATETIME_MED_WITH_SECONDS(){return jt}static get DATETIME_MED_WITH_WEEKDAY(){return Mt}static get DATETIME_FULL(){return Nt}static get DATETIME_FULL_WITH_SECONDS(){return Pt}static get DATETIME_HUGE(){return Ft}static get DATETIME_HUGE_WITH_SECONDS(){return It}};function Za(e){if(J.isDateTime(e))return e;if(e&&e.valueOf&&F(e.valueOf()))return J.fromJSDate(e);if(e&&typeof e==`object`)return J.fromObject(e);throw new S(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const Qa=(e,t,n)=>{let r=n[0];if(r===void 0)return!1;let i=$a(e),a=$a(r);if(i===void 0||a===void 0)return!1;switch(t){case`is after`:return i>a;case`is before`:return i<a;default:return!1}},$a=e=>{let t=J.fromISO(e,{zone:`utc`});return t.isValid?t.toMillis():void 0};var eo=p(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),to=p(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),no=p(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=eo(),a=to();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),ro=p(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),io=p(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Y=p(((e,t)=>{let n=to(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=eo(),{safeRe:a,t:o}=no(),s=ro(),{compareIdentifiers:c}=io();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),ao=p(((e,t)=>{let n=Y();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),oo=p(((e,t)=>{let n=ao();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),so=p(((e,t)=>{let n=ao();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),co=p(((e,t)=>{let n=Y();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),lo=p(((e,t)=>{let n=ao();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),uo=p(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).major})),fo=p(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).minor})),po=p(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).patch})),mo=p(((e,t)=>{let n=ao();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),X=p(((e,t)=>{let n=Y();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),ho=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(t,e,r)})),go=p(((e,t)=>{let n=X();t.exports=(e,t)=>n(e,t,!0)})),_o=p(((e,t)=>{let n=Y();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),vo=p(((e,t)=>{let n=_o();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),yo=p(((e,t)=>{let n=_o();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),bo=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)>0})),xo=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)<0})),So=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)===0})),Co=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)!==0})),wo=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)>=0})),To=p(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)<=0})),Eo=p(((e,t)=>{let n=So(),r=Co(),i=bo(),a=wo(),o=xo(),s=To();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Do=p(((e,t)=>{let n=Y(),r=ao(),{safeRe:i,t:a}=no();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t=t||{};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Oo=p(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Z=p(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,oe(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>ae(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(se(this.set[t],e,this.options))return!0;return!1}};let r=new(Oo()),i=ro(),a=ko(),o=to(),s=Y(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=no(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=eo(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=re(e,t),o(`xrange`,e),e=ie(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},re=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>x(e,t)).join(` `)),x=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},ie=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ae=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),oe=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),se=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),ko=p(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=ro(),{safeRe:i,t:a}=no(),o=Eo(),s=to(),c=Y(),l=Z()})),Ao=p(((e,t)=>{let n=Z();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),jo=p(((e,t)=>{let n=Z();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Mo=p(((e,t)=>{let n=Y(),r=Z();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),No=p(((e,t)=>{let n=Y(),r=Z();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Po=p(((e,t)=>{let n=Y(),r=Z(),i=bo();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Fo=p(((e,t)=>{let n=Z();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Io=p(((e,t)=>{let n=Y(),r=ko(),{ANY:i}=r,a=Z(),o=Ao(),s=bo(),c=xo(),l=To(),u=wo();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o=o||e,s=s||e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Lo=p(((e,t)=>{let n=Io();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ro=p(((e,t)=>{let n=Io();t.exports=(e,t,r)=>n(e,t,`<`,r)})),zo=p(((e,t)=>{let n=Z();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Bo=p(((e,t)=>{let n=Ao(),r=X();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),Vo=p(((e,t)=>{let n=Z(),r=ko(),{ANY:i}=r,a=Ao(),o=X(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i=i||t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Q=g(p(((e,t)=>{let n=no(),r=eo(),i=Y(),a=io();t.exports={parse:ao(),valid:oo(),clean:so(),inc:co(),diff:lo(),major:uo(),minor:fo(),patch:po(),prerelease:mo(),compare:X(),rcompare:ho(),compareLoose:go(),compareBuild:_o(),sort:vo(),rsort:yo(),gt:bo(),lt:xo(),eq:So(),neq:Co(),gte:wo(),lte:To(),cmp:Eo(),coerce:Do(),Comparator:ko(),Range:Z(),satisfies:Ao(),toComparators:jo(),maxSatisfying:Mo(),minSatisfying:No(),minVersion:Po(),validRange:Fo(),outside:Io(),gtr:Lo(),ltr:Ro(),intersects:zo(),simplifyRange:Bo(),subset:Vo(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);const Ho=(e,t,n)=>{let r=t.toLowerCase();if(e.trim().length===0)return r===`is not one of`;let i=Q.coerce(e),a=n.map(e=>Q.coerce(e)),o=a[0]??null;switch(r){case`=`:return Uo(i,o);case`<`:return Wo(i,o,Q.lt);case`<=`:return Wo(i,o,Q.lte);case`>`:return Wo(i,o,Q.gt);case`>=`:return Wo(i,o,Q.gte);case`is one of`:return a.some(e=>Uo(i,e));case`is not one of`:return!a.some(e=>Uo(i,e));default:return!1}},Uo=(e,t)=>e!==null&&t!==null&&Q.eq(e,t),Wo=(e,t,n)=>e!==null&&t!==null&&n(e,t),Go=Symbol(`absent`),Ko=Symbol(`unknown-attribute`),qo=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jo=e=>e===Go||e==null?``:qo(e)?Yo(e):``,Yo=e=>typeof e==`string`?e:String(e),Xo=e=>e===Go?void 0:e,Zo=e=>e===Ko?`unknown-attribute`:e===Go?`absent`:qo(e)?`scalar`:Array.isArray(e)?`array`:`object`,Qo=(e,t,n)=>{let r=t.toLowerCase();if(!Array.isArray(e))return r===`does not contain any of`;let i=e.filter(qo).map(Yo);switch(r){case`contains any of`:return i.some(e=>n.includes(e));case`does not contain any of`:return!i.some(e=>n.includes(e));default:return!1}};var $o=class{evaluate(e,t){return this.explain(e,t).matched}explain(e,t){let n=this.resolve(e,t),r=Zo(n),i=n===Go||n===Ko?void 0:n;return n===Ko?{matched:!1,resolvedValue:i,resolvedType:r}:{matched:this.compare(e,n),resolvedValue:i,resolvedType:r}}compare(e,t){let n=e.targetValues??[];switch(e.targetType){case`text`:return at(Jo(t),e.operator,n);case`number`:return ot(Xo(t),e.operator,n);case`datetime`:return Qa(Jo(t),e.operator,n);case`semver`:return Ho(Jo(t),e.operator,n);case`array`:return Qo(Xo(t),e.operator,n)}return!1}resolve(e,t){switch(e.attribute){case`identifier`:return es(t?.context?.id);case`name`:return es(t?.context?.name);case`appName`:return es(t?.metadata?.appName);case`appVersion`:return es(t?.metadata?.appVersion);case`traits`:return e.trait?es(this.findTraitValue(t?.context?.traits,e.trait)):Go;default:return Ko}}findTraitValue(e,t){try{return(0,it.findByPointer)(t,e).val}catch{return}}};const es=e=>e??Go;function ts(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n}function ns(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n^e^t}new DataView(new Uint8Array(8).buffer);var rs=new DataView(new Uint8Array(8).buffer);function is(e,t){return rs.setUint32(0,e.getUint32(t,!0),!0),rs.getBigUint64(0,!0)}function $(e,t){return e.getBigUint64(t,!0)}new DataView(new Uint8Array(8).buffer),new DataView(new Uint8Array(8).buffer);var as=new TextEncoder,os=2048,ss=os/3,cs=new Uint8Array(os);function ls(e){if(typeof e==`string`){if(e.length<=ss){let{written:t}=as.encodeInto(e,cs);return new DataView(cs.buffer,0,t)}let t=as.encode(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength):e}var us=`fast`;function ds(e){return e>=0n&&e<=18446744073709551615n}function fs(e,t){let n={seed:t,rapidMumBehaviour:us};if(e===void 0)return n;if(e.seed!==void 0){if(!ds(e.seed))throw Error(`seed must be a 64-bit unsigned bigint value: ${e.seed}`);n.seed=e.seed}return e.rapidMumBehaviour!==void 0&&(n.rapidMumBehaviour=e.rapidMumBehaviour),n}var ps=0n,ms=[3257665815644502181n,10067880064238660809n,5418857496715711651n,5573817676018592327n,11562461410679940143n,16646288086500911323n,10443028834174122124n,12297829382473034410n],hs=new Uint8Array(8),gs=new DataView(hs.buffer);function _s(e,t){let n=e.getUint8(0);return hs[6]=n>>3,hs[5]=n<<5,hs[0]=e.getUint8(t-1),gs.getBigUint64(0,!0)}function vs(e,t,n,r){let i=e*t,a=(BigInt.asUintN(64,i)^n[7])*(i>>64n^n[1]^r);return BigInt.asUintN(64,a)^a>>64n}function ys(e,t,n,r){let i=e*t,a=BigInt.asUintN(64,i)^n[7]^e,o=i>>64n^n[1]^r^t,s=a*o;return BigInt.asUintN(64,s)^s>>64n^a^o}var bs={fast:{rapid_mix:ts,rapidhash_epilogue:vs},protected:{rapid_mix:ns,rapidhash_epilogue:ys}};function xs(e,t,n,r,i){let a=e.byteLength,o=BigInt(e.byteLength);t^=r(t^n[2],n[1]);let s,c,l=a,u;if(a<=16)if(u=o,a>=4)if(t^=o,a>=8){let t=a-8;s=$(e,0),c=$(e,t)}else{let t=a-4;s=is(e,0),c=is(e,t)}else a>0?(s=_s(e,a),c=BigInt(e.getUint8(a>>1))):(s=0n,c=0n);else{let i=0;if(l>112){let a=t,o=t,s=t,c=t,u=t,d=t;do t=r($(e,i)^n[0],$(e,i+8)^t),a=r($(e,i+16)^n[1],$(e,i+24)^a),o=r($(e,i+32)^n[2],$(e,i+40)^o),s=r($(e,i+48)^n[3],$(e,i+56)^s),c=r($(e,i+64)^n[4],$(e,i+72)^c),u=r($(e,i+80)^n[5],$(e,i+88)^u),d=r($(e,i+96)^n[6],$(e,i+104)^d),i+=112,l-=112;while(l>112);t^=a,o^=s,c^=u,t^=d,o^=c,t^=o}u=BigInt(l),l>16&&(t=r($(e,i)^n[2],$(e,i+8)^t),l>32&&(t=r($(e,i+16)^n[2],$(e,i+24)^t),l>48&&(t=r($(e,i+32)^n[1],$(e,i+40)^t),l>64&&(t=r($(e,i+48)^n[1],$(e,i+56)^t),l>80&&(t=r($(e,i+64)^n[2],$(e,i+72)^t),l>96&&(t=r($(e,i+80)^n[1],$(e,i+88)^t))))))),s=$(e,i+l-16)^u,c=$(e,i+l-8)}return s^=n[1],c^=t,i(s,c,n,u)}function Ss(e,t){let{seed:n,rapidMumBehaviour:r}=fs(t,ps),{rapid_mix:i,rapidhash_epilogue:a}=bs[r];return xs(ls(e),n,ms,i,a)}const Cs=e=>{let t=`${e.contextIdentifier}-${e.configId}`;return Number(Ss(t,{seed:15426857351n})%1000n)/10};var ws=class{constructor(e){if(this.logger=e,this.conditionEvaluator=new $o,!e||!e.warn||!e.error||!e.info)throw TypeError(`The provided logger is not a valid 'ConfigDirectorLogger'`);this.logger=e}evaluate(e,t){return{id:e.id,key:e.key,type:e.type,value:this.explain(e,t).value}}explain(e,t){let n=[...e.target?.rules??[]].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1)),r=[],i;for(let a of n){if(i){r.push({ruleId:a.id,outcome:`not-evaluated`,conditions:[],bucket:void 0});continue}let n=this.explainRule(a,e,t);r.push(n.explanation),n.value!==void 0&&(i={ruleId:a.id,value:n.value})}return{value:i?.value??e.target?.defaultValue,servedBy:i?{kind:`rule`,ruleId:i.ruleId}:{kind:`default`},rules:r}}explainRule(e,t,n){let r={ruleId:e.id,outcome:`not-matched`,conditions:[],bucket:void 0};try{let i;return e.type==`percentage`?i=this.explainPercentage(e.percentages??[],t,n,r):e.type==`conditional`&&(i=this.explainConditionalRule(e,t,n,r)),i!==void 0&&(r.outcome=`matched`),{explanation:r,value:i}}catch(n){return this.logger.warn(`There was an error while evaluating a targeting rule '${e?.id}' for '${t?.key}'. The rule will be disregarded.`,{error:n,configKey:t?.key,ruleId:e?.id}),{explanation:{ruleId:e.id,outcome:`errored`,conditions:[],bucket:void 0},value:void 0}}}explainPercentage(e,t,n,r){let i=n?.context?.id??void 0,a=i===void 0?0:Cs({configId:t.id,contextIdentifier:i}),o=[],s=0,c;for(let t of e){let e=s+t.percentage;o.push({percentageId:t.id,from:s,to:e,value:t.value?.toString()}),c===void 0&&a<e&&(c=t),s=e}return r.bucket={identifier:i,defaultedToPredefinedBucket:i===void 0,assignedPercentage:a,shares:o,selectedPercentageId:c?.id},c?.value==null?void 0:c.value.toString()}explainConditionalRule(e,t,n,r){let i=!1;for(let t of e.conditions??[]){if(i){r.conditions.push({conditionId:t.id,outcome:`not-evaluated`});continue}let e=this.conditionEvaluator.explain(t,n);r.conditions.push({conditionId:t.id,outcome:e.matched?`matched`:`not-matched`,resolvedValue:e.resolvedValue,resolvedType:e.resolvedType}),i=!e.matched}if(!i){if(e.target==`value`)return e.value==null?void 0:e.value.toString();if(e.target==`percentage`)return this.explainPercentage(e.percentages??[],t,n,r)}}};const Ts=e=>{let t=typeof e;if(t===`object`)try{return e.constructor?.name??t}catch{return t}else if(t===`function`)try{let n=e.name;return n?`function: ${n}`:t}catch{return t}return t},Es=e=>e===`number`||e===`bigint`,Ds=new Set([`boolean`,`integer`,`float`]),Os=(e,t)=>{let n=e.value,r=Ts(t);if(n==null)return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`value-missing`};if(e.type===`json`)return Ps(n,t,r,e.valueId);if(typeof t==`string`)return Ds.has(e.type)?{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}:{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`};if(typeof t==`boolean`&&(e.type===`boolean`||e.type===`string`||e.type===`enum`)){let i=ks(n),a=typeof i==`boolean`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-boolean`}}if(Es(typeof t)&&e.type===`integer`){let i=As(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}if(Es(typeof t)&&(e.type===`float`||e.type===`enum`||e.type===`string`)){let i=js(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}},ks=e=>{if(!e)return;let t=e.toLowerCase();if(!(t!=`true`&&t!=`false`))return t===`true`},As=e=>{let t=Ms(e);return t==null?void 0:Math.trunc(t)},js=e=>Ms(e),Ms=e=>{if(!e||!Ns(e))return;let t=Number(e);if(!(isNaN(t)||!isFinite(t)))return t},Ns=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0},Ps=(e,t,n,r)=>{if(typeof t==`string`)return{parsedValue:e,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`};try{let i=JSON.parse(e);return Fs(i,t)?{parsedValue:i,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`}:{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`type-mismatch`}}catch{return{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`invalid-json`}}},Fs=(e,t)=>{if(e===null)return!1;let n=typeof t;return n===`bigint`?typeof e==`number`:typeof e===n},Is={off:-1,error:0,warn:1,info:2,debug:3},Ls=()=>{let e={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`};try{return new Intl.DateTimeFormat(void 0,{...e,fractionalSecondDigits:3})}catch{return new Intl.DateTimeFormat(void 0,e)}};var Rs=class{constructor(e,t){this.level=e,this.decorator=t,this.level=e,this.decorator=t,this.dateFormatter=Ls()}debug(e,...t){this.log(console.debug,`debug`,e,...t)}info(e,...t){this.log(console.info,`info`,e,...t)}warn(e,...t){this.log(console.warn,`warn`,e,...t)}error(e,...t){this.log(console.error,`error`,e,...t)}log(e,t,n,...r){Is[this.level]>=Is[t]&&e(`[${this.dateFormatter.format(new Date)}] ${this.decorator?.decorateMessage(n)}`,...r)}},zs=class{decorateMessage(e){return`[ConfigDirector:js-server-sdk] ${e}`}};const Bs=(e,t)=>new Rs(e??`warn`,t??new zs),Vs=(e,t)=>new URL(e,t?.toString()),Hs=async(e,t)=>e.valueId?{valueId:e.valueId}:e.value?e.value.length<=500&&e.type!=`json`?{value:e.value}:{valueId:await t(e.value)}:e,Us=e=>{if(e.type===`json`||e.type==null&&typeof e.value==`object`){if(e.valueId)return{valueId:e.valueId,type:`json`};try{return{value:JSON.stringify(e.value),type:`json`}}catch{return{value:e.value.toString(),type:`json`}}}let t=e.value?.toString();return t&&t.length<=500?{value:t}:e.valueId?{valueId:e.valueId}:{value:t}},Ws=e=>{let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]?.length??0)>0)return!1;return!0},Gs=e=>{if(!e)return!0;let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]??0)>0)return!1;return!0};var Ks=class{constructor(e){this.executeRequests=!0,this.sdkKey=e.sdkKey,this.sdkIdentity=e.sdkIdentity,this.logger=e.logger,this.metaContext=e.metaContext,this.url=new URL(`server/telemetry/v1`,e.baseUrl.toString())}async report({discreteEvents:e,aggregatedEvents:t,droppedEvents:n}){if(!this.executeRequests)return{success:!1,fatalError:!0};let r={serverSdkKey:this.sdkKey,metaContext:{sdkName:this.sdkIdentity.sdkName,sdkVersion:this.sdkIdentity.sdkVersion,appName:this.metaContext.appName,appVersion:this.metaContext.appVersion},discreteEvents:e,aggregatedEvents:t,droppedEvents:n};if(this.isReportEmpty(r))return{success:!0,fatalError:!1};let i=await this.sendReport(r);return i.fatalError&&(this.executeRequests=!1),i}isReportEmpty(e){return Ws(e.discreteEvents)&&Ws(e.aggregatedEvents)&&Gs(e.droppedEvents)}async sendReport(e){try{let t=await oe(5e3,this.url,{method:`POST`,body:JSON.stringify(e)},this.logger),n=this.isStatusFatal(t.status);return n&&this.logger.warn(`[EventReporter] Received a fatal status response (${t.status}) from the telemetry endpoint. No more telemetry data will be sent.`),{success:t.ok,fatalError:n}}catch(e){return this.logger.warn(`[EventReporter] Error attempting to send telemetry data: ${e}`,{error:e}),{success:!1,fatalError:!1}}}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}},qs=class{aggregate(e){if(e.events.length==0)return[];let t=new Map;for(let n of e.events){let e=JSON.stringify(n),r=t.get(e)?.count||0;t.set(e,{event:n,count:r+1})}return Array.from(t).map(([,t])=>({startTime:e.startTime,endTime:e.endTime,count:t.count,event:t.event}))}},Js=class{constructor(e){this._events=[],this._droppedEventCount=0,this.limit=e??1e3}get events(){return this._events}get reachedLimit(){return this._events.length>=this.limit}get droppedEventCount(){return this._droppedEventCount}push(...e){this.startTime||(this.startTime=new Date);let t=Math.max(0,e.length-this.limit),n=e.slice(t,e.length);if(this._droppedEventCount+=t,this._events.length+n.length>this.limit){let e=this._events.length+n.length-this.limit;this._events.splice(0,e),this._droppedEventCount+=e}return this._events.push(...n)}takeSnapshot(){let e=new Date,t=this.startTime??e,n=this._events.splice(0),r=this._droppedEventCount;return this.startTime=void 0,this._droppedEventCount=0,{startTime:t,endTime:e,events:n,droppedCount:r}}clear(){this._events=[],this.startTime=void 0,this._droppedEventCount=0}},Ys=class{constructor(e){this.aggregator=new qs,this.collectEvents=!0,this.logger=e.logger,this.evaluationEventQueue=new Js(e.evaluationQueueLimit??1e3),this.flushIntervalDelay=e.flushIntervalDelay??3e4;let t=e.initialFlushIntervalDelay??5e3;this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),t)}async flushAndScheduleNext(){if(!this.collectEvents)return;let e;try{e=await this.flush()}catch(t){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events: `,t),e={success:!1,fatalError:!1}}e.fatalError?(this.collectEvents=!1,this.close(),this.logger.warn(`[TelemetryEventCollector] Received a fatal error from telemetry collection. No longer collecting events.`)):this.collectEvents&&(this.cancelScheduledFlush(),this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.flushIntervalDelay))}cancelScheduledFlush(){clearTimeout(this.flushTimeout)}async close(){this.collectEvents=!1,clearTimeout(this.flushTimeout);try{await this.flush()}catch(e){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events during close: `,e)}this.evaluationEventQueue.clear()}dispose(){this.close()}},Xs=class extends Map{constructor(e,t){super(t),this._droppedCount=0,this.limit=e,this.enforceLimit()}set(e,t){return super.set(e,t),this.enforceLimit(),this}get droppedCount(){return this._droppedCount}clearAndReset(){this.clear(),this._droppedCount=0}enforceLimit(){for(;this.size>this.limit;){let e=this.keys().next().value;e!==void 0&&(this.delete(e),this._droppedCount+=1)}}},Zs=class{constructor(e){this.valueIdGenerator=e,this.valueIdGenerator=e}async process(e){let t=await Promise.all(e.events.map(async e=>({...e,defaultValue:await Hs(e.defaultValue,this.valueIdGenerator),evaluatedValue:await Hs(e.evaluatedValue,this.valueIdGenerator)})));return{...e,events:t}}},Qs=class extends Ys{constructor(e){super(e),this.reporter=new Ks(e),this.contexts=new Xs(e.contextLimit??1e3),this.evaluationEventSnapshotPreprocessor=new Zs(e.valueIdGenerator)}evaluatedConfig(e){if(!this.collectEvents)return;e.context?.id&&!e.context.anonymous&&this.contexts.set(e.context.id,e.context);let t={...e.evaluation,contextId:e.context?.anonymous?void 0:e.context?.id};this.evaluationEventQueue.push(this.sanitizeEvaluatedConfigEvent(t))}sanitizeEvaluatedConfigEvent(e){return{...e,defaultValue:Us({value:e.defaultValue,type:e.type}),evaluatedValue:Us({value:e.evaluatedValue,valueId:e.evaluatedValueId,type:e.type})}}snapshotContexts(){let e=Array.from(this.contexts.values()),t=this.contexts.droppedCount;return this.contexts.clearAndReset(),{contexts:e,droppedCount:t}}async flush(){if(!this.reporter)return{success:!1,fatalError:!1};let e=await this.evaluationEventSnapshotPreprocessor.process(this.evaluationEventQueue.takeSnapshot()),t=this.snapshotContexts();return await this.reporter?.report({context:this._context,discreteEvents:{capturedContexts:t.contexts},aggregatedEvents:{evaluatedConfig:this.aggregator.aggregate(e)},droppedEvents:{evaluatedConfig:e.droppedCount,capturedContexts:t.droppedCount}})}};const $s=(e,t)=>{let n=BigInt(0),r=BigInt(62),i=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``),a=BigInt(`0x`+i),o=``;for(;a>n;)o=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[Number(a%r)]+o,a/=r;return o.padStart(t,`0`)},ec=Math.ceil(128/Math.log2(62)),tc=async e=>$s(i(`sha256`).update(e?.toString()??``).digest().subarray(0,16),ec),nc=new URL(`https://server-sdk-api.configdirector.com`);var rc=class{constructor(e,t,r){this.handlersMap=new Map,this.eventEmitter=new n,this.ready=!1,this.logger=r?.logger??Bs(),this.timeout=r?.connection?.timeout??3e3,this.metaContext=r?.metadata??{},this.validateSdkKeyPresence(e),this.configEvaluator=new ws(this.logger);let i=this.parseUrl(r?.connection?.url)??nc;this.connectionMode=r?.connection?.mode??`streaming`;let a=this.getTransportConstructor(this.connectionMode),o=r?.telemetry?.eventQueueLimit??5e3;this.usageEventCollector=new Qs({sdkKey:e,sdkIdentity:t,metaContext:r?.metadata??{},logger:this.logger,baseUrl:i,flushIntervalDelay:r?.telemetry?.flushInterval??3e4,evaluationQueueLimit:Math.ceil(o*.7),contextLimit:Math.floor(o*.3),urlFactory:Vs,valueIdGenerator:tc}),this.transport=new a({serverSdkKey:e,baseUrl:i,metaContext:{...r?.metadata,sdkName:t.sdkName,sdkVersion:t.sdkVersion},logger:this.logger,pollingInterval:r?.connection?.pollingInterval}),this.transport.on(`configBundleReceived`,e=>{this.readyResolve?.();let t=Object.keys(e.configs);!this.configSet||e.kind==`full`?(this.configSet=e,this.eventEmitter.emit(`configsUpdated`,{keys:t}),this.updateWatchers(e.configs)):(this.configSet.configs={...this.configSet.configs,...e.configs},this.eventEmitter.emit(`configsUpdated`,{keys:t}),this.updateWatchers(e.configs)),this.logger.debug(`[ConfigDirectorClient] ConfigSet updated from server with ${t.length} key(s)`,{keys:t})}),this.transport.on(`connectionError`,e=>{this.logger.error(`[ConfigDirectorClient] The connection encountered an unrecoverable error and will not be retried. Configs will no longer receive updates.`,e),this.eventEmitter.emit(`connectionError`,{error:e})}),this.registerHandler(`clientReady`,r?.hooks?.clientReady),this.registerHandler(`configEvaluated`,r?.hooks?.configEvaluated),this.registerHandler(`configsUpdated`,r?.hooks?.configsUpdated),this.registerHandler(`connectionError`,r?.hooks?.connectionError)}registerHandler(e,t){if(!t)return;let n=Array.isArray(t)?t:[t];for(let t of n)typeof t==`function`&&this.on(e,t)}async initialize(){try{this.ready=!1,this.readyPromise=new Promise(e=>{this.readyResolve=e}).then(()=>{this.ready=!0,this.eventEmitter.emit(`clientReady`),this.logger.debug(`[ConfigDirectorClient] Received initial payload from the server, client is ready`)});let e=new Date().getTime();await this.transport.connect(this.timeout);let t=new Date().getTime()-e,n=this.timeout-t;if(n>0&&await Promise.race([this.readyPromise,new Promise(e=>{setTimeout(()=>e(),n)})]),!this.ready){let e=this.connectionMode===`streaming`?`The client will continue to retry since there were no fatal errors detected. Configs will return the default value until the connection succeeds.`:`Since the client was configured without streaming, configs may not update and always return the default value.`;this.logger.warn(`[ConfigDirectorClient] Timed out waiting for initialization after ${this.timeout}ms. ${e}`)}}catch(e){this.logger.error(`[ConfigDirectorClient] An error occurred during initialization: `,e)}}getTransportConstructor(e){switch(e){case`polling`:return ue;default:return ce}}updateWatchers(e){Object.values(e).forEach(e=>this.updateWatchersForConfig(e))}updateWatchersForConfig(e){this.handlersMap.get(e.key)?.forEach(t=>{let n=this.getValueFromConfigDefinition(e.key,e,t.defaultValue,t.context);t.handler(n)})}watch(e,t,n,r){this.validateDefaultValue(t);let i=this.handlersMap.get(e),a={handler:n,defaultValue:t,requestedType:typeof t,context:r};return i?i.push(a):this.handlersMap.set(e,[a]),()=>this.unwatch(e,n)}unwatch(e,t){let n=this.handlersMap.get(e);if(n)if(t){let e=n.findIndex(e=>e.handler==t);e>=0&&n?.splice(e,1)}else n.splice(0)}getValue(e,t,n){this.validateDefaultValue(t);let r=this.configSet?.configs[e];return this.getValueFromConfigDefinition(e,r,t,n)}getValueFromConfigDefinition(e,t,n,r){if(t){let i=this.configEvaluator.evaluate(t,{context:r,metadata:this.metaContext}),a=Os(i,n);return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,type:i.type,defaultValue:n,requestedType:a.requestedType,evaluatedValue:a.parsedValue,evaluatedValueId:a.parsedValueId,usedDefault:a.usedDefault,evaluationReason:a.reason}}),this.dispatchEvaluationEvent({key:e,value:a.parsedValue,valueId:a.parsedValueId??void 0,isDefaultValue:a.usedDefault,reason:a.reason,context:r}),this.logger.debug(`[ConfigDirectorClient] Evaluated '${e}' to '${a.parsedValue}'`),a.parsedValue}else{this.logger.debug(`[ConfigDirectorClient] No config state found for '${e}', returning default value '${n}'`);let t=this.isReady?`config-state-missing`:`client-not-ready`;return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,defaultValue:n,requestedType:Ts(n),evaluatedValue:n,usedDefault:!0,evaluationReason:t}}),this.dispatchEvaluationEvent({key:e,value:n,isDefaultValue:!0,reason:t,context:r}),n}}dispatchEvaluationEvent(e){setTimeout(()=>this.eventEmitter.emit(`configEvaluated`,{evaluation:e}),0)}parseUrl(e){if(e)try{return new URL(e)}catch(t){throw new y(`Invalid base URL '${e}'. Parsing failed: ${t}`)}}validateSdkKeyPresence(e){if(!e||e.trim().length==0)throw new y(`No server SDK key was provided, the client cannot be instantiated without a valid server SDK key`)}validateDefaultValue(e){if(e==null)throw new y(`Invalid default value. The default value for a config must be defined and non-null.`);if(typeof e==`function`)throw new y(`Invalid default value. The default value for a config cannot be a function.`)}get isReady(){return this.ready}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}removeAllObservers(){this.logger.debug(`[ConfigDirectorClient] removeAllObservers() has been called, removing all observers`),this.eventEmitter.removeAllListeners(),this.handlersMap.clear()}unwatchAll(){this.handlersMap.clear()}getAllConfigs(e){if(!this.configSet)return{};let t=Object.entries(this.configSet.configs),n=e?.configKeys?t.filter(([t])=>e.configKeys?.includes(t)):t;return Object.fromEntries(n.map(([t,n])=>[t,this.configEvaluator.evaluate(n,{context:e?.context,metadata:this.metaContext})]))}closeConnection(){this.logger.debug(`[ConfigDirectorClient] closeConnection() has been called, closing connection to server`),this.transport.close(),this.ready=!1}dispose(){this.removeAllObservers(),this.closeConnection(),this.usageEventCollector.close().catch(e=>{this.logger.warn(`[ConfigDirectorClient] Error flushing telemetry while disposing the client: `,e)})}},ic=class n{constructor(r,i){this.metadata={name:n.name},this.runsOn=`server`,this.events=new e,this.client=new rc(r,{sdkName:`js-openfeature-server-provider`,sdkVersion:`1.7.0`},i),this.readyHandler=()=>{this.events.emit(t.Ready)},this.client.on(`configsUpdated`,({keys:e})=>{this.events.emit(t.ConfigurationChanged,{flagsChanged:e})})}async initialize(){await this.client.initialize(),this.client.off(`clientReady`,this.readyHandler),this.client.on(`clientReady`,this.readyHandler)}resolveBooleanEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveStringEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveNumberEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveObjectEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}onClose(){return this.client.dispose(),Promise.resolve()}evaluate(e,t,n){return{value:this.client.getValue(e,t,this.mapContext(n))}}mapContext(e){if(!e)return;let t=(e.targetingKey??e.id)?.toString(),n=e.name?.toString(),r=e?.traits||{},i=typeof r==`object`&&Object.keys(r).length>0,a=e.anonymous;return{id:t,name:n,traits:i?r:void 0,anonymous:typeof a==`boolean`?a:void 0}}};export{ic as ConfigDirectorProvider};
5
+ `;break;case`id`:e.value.includes(`\0`)||(this.lastEventId=e.value);break;case`retry`:/^\d+$/.test(e.value)&&this.onRetry?.(Number.parseInt(e.value,10));break;default:break}}parseField(e){let t=e.indexOf(`:`);return t===-1?{field:e,value:``}:{field:e.slice(0,t),value:this.extractValue(e,t+1)}}extractValue(e,t){return e[t]===` `?e.slice(t+1):e.slice(t)}};let b=function(e){return e.OPEN=`open`,e.CLOSED=`closed`,e.CONNECTING=`connecting`,e}({});var x=class{constructor(e){this.DEFAULT_SHOULD_RECONNECT=()=>!0,this.DEFAULT_CALCULATE_RECONNECT_DELAY=()=>this.serverReconnectionTime,this.reconnectAttempt=0,this.abortController=new AbortController,this._readyState=b.CLOSED,this.serverReconnectionTime=2e3,this.url=e.url.toString(),this.lastEventId=e.lastEventId,this.headers={Accept:`text/event-stream`,...e.headers};let t=e.body;this.body=typeof t==`function`?t:()=>t,this.requestOptions={method:e.method??`GET`,mode:e.mode,credentials:e.credentials,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy},this._fetch=e.fetch??((e,t)=>fetch(e,t)),this._onError=this.resolveCallback(e.onError,()=>{},`onError`),this._onConnect=this.resolveCallback(e.onConnect,()=>{},`onConnect`),this._onDisconnect=this.resolveCallback(e.onDisconnect,()=>{},`onDisconnect`),this._onMessage=this.resolveCallback(e.onMessage,()=>{},`onMessage`),this._onComment=this.resolveCallback(e.onComment,()=>{},`onComment`),this._shouldReconnect=this.resolveCallback(e.shouldReconnect,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`),this._calculateReconnectDelay=this.resolveCallback(e.calculateReconnectDelay,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`calculateReconnectDelay`)}set onError(e){this._onError=this.resolveCallback(e,()=>{},`onError`)}set onMessage(e){this._onMessage=this.resolveCallback(e,()=>{},`onMessage`)}set onComment(e){this._onComment=this.resolveCallback(e,()=>{},`onComment`)}set onConnect(e){this._onConnect=this.resolveCallback(e,()=>{},`onConnect`)}set onDisconnect(e){this._onDisconnect=this.resolveCallback(e,()=>{},`onDisconnect`)}set shouldReconnect(e){this._shouldReconnect=this.resolveCallback(e,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`)}set calculateReconnectDelay(e){this._calculateReconnectDelay=this.resolveCallback(e,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`shouldReconnect`)}get readyState(){return this._readyState}connect(){this._readyState===b.CLOSED&&(this.reconnectAttempt=0,this.initiateConnection())}close(){clearTimeout(this.reconnectTimeout),this._readyState=b.CLOSED,this.abortController.abort()}initiateConnection(){this.abortController=new AbortController,this._readyState=b.CONNECTING,this._fetch(this.url,{...this.requestOptions,body:this.body(),headers:this.buildRequestHeaders(),signal:this.abortController.signal,cache:`no-store`}).then(e=>this.handleFetchResponse(e)).catch(e=>{if(e.name===`AbortError`||this.abortController.signal.aborted){this.close();return}this._onError(e),this.scheduleReconnect({error:e})})}async handleFetchResponse(e){let{body:t,status:n}=e;if(n===204){this.disconnected();return}if(n>=400){this.scheduleReconnect({status:n});return}if(!t)throw new v(`The server response did not have a body`);this._readyState=b.OPEN,this._onConnect(),this.reconnectAttempt=0;let r=new te({onEvent:e=>{typeof e.id==`string`&&(this.lastEventId=e.id),this._onMessage(e)},onComment:e=>this._onComment(e),onRetry:e=>this.serverReconnectionTime=e});await this.readResponseStream(t,r),this.scheduleReconnect({status:n,error:new _(`The server response stream was closed`)})}async readResponseStream(e,t){let n=e.getReader(),r=new TextDecoder,i=!1;for(;!i;){let e=await n.read();e.value&&t.parse(r.decode(e.value,{stream:!0})),i=e.done}t.finish()}disconnected(){clearTimeout(this.reconnectTimeout),this._readyState=b.CLOSED,this._onDisconnect()}buildRequestHeaders(){let e=this.lastEventId?{"Last-Event-ID":this.lastEventId}:void 0;return{...this.headers,...e}}scheduleReconnect(e){if(this.abortController.signal.aborted)return;clearTimeout(this.reconnectTimeout),this.reconnectAttempt+=1;let t={attempt:this.reconnectAttempt,status:e.status,error:e.error,serverReconnectionTime:this.serverReconnectionTime};if(!this._shouldReconnect(t)){this.disconnected();return}this._readyState=b.CONNECTING;let n=this._calculateReconnectDelay(t);(!Number.isFinite(n)||n<1||n>1e3*60*60)&&(this._onError(new ee(`The calculated reconnect delay is out of range: ${n}. Defaulting to ${this.serverReconnectionTime}`)),n=this.serverReconnectionTime),this.reconnectTimeout=setTimeout(()=>this.initiateConnection(),n)}resolveCallback(e,t,n){if(e==null)return t;if(typeof e!=`function`)throw new y(`${n} must be a function`);return e}};const ne=e=>new x(e),re=async(e,t,n,r)=>{let i=new AbortController,a=setTimeout(()=>{r.debug(`[fetchWithTimeout] Reached timeout, aborting request`),i.abort()},e);try{let e=await fetch(typeof t==`string`||t instanceof Request?t:t.toString(),{...n,signal:i.signal});return clearTimeout(a),e}catch(e){throw r.warn(`[fetchWithTimeout] Fetch error: `,e),clearTimeout(a),e}},ie=9e4;var ae=class{constructor(e){this.options=e,this.eventEmitter=new r,this.options=e,this.logger=e.logger,this.url=new URL(`server/sse/v1`,e.baseUrl),this.heartbeatUrl=new URL(`server/heartbeat/v1`,e.baseUrl)}async connect(e){this.eventSource&&this.close();let t=new Promise((e,t)=>{this.eventSource=ne({url:this.url,method:`POST`,headers:{"Content-Type":`application/json`},body:()=>this.buildRequestBody(),onMessage:({data:e})=>{this.dispatchMessage(e)},onConnect:()=>{this.logger.debug(`[StreamingTransport] Connected`),e(this)},shouldReconnect:e=>{let n=!this.isStatusFatal(e.status);if(!n){this.stopHeartbeat();let n=this.prepareFatalError(e.status,e.error);this.eventEmitter.emit(`connectionError`,n),t(n)}return n},calculateReconnectDelay:e=>{let t=2**Math.min(e.attempt,9)*1e3,n=`[StreamingTransport] Scheduling reconnect attempt #${e.attempt} in ${t}ms.`;return e.attempt<=5?this.logger.info(n):this.logger.warn(n),t},onDisconnect:()=>{this.logger.debug(`[StreamingTransport] Disconnected`)}}),this.eventSource.connect()});this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),ie);let n;try{return await Promise.race([t,new Promise(t=>{n=setTimeout(()=>t(this),e)})])}finally{clearTimeout(n)}}get sessionId(){return this._sessionId}sendHeartbeat(){!this.isConnected||!this._sessionId||re(ie,this.heartbeatUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})},this.logger).then(e=>{e.ok||this.logger.debug(`[StreamingTransport] Heartbeat failed with status: ${e.status}`)}).catch(e=>{this.logger.debug(`[StreamingTransport] Heartbeat failed: `,e)})}buildRequestBody(){return this._sessionId=a(),JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,sessionId:this._sessionId})}dispatchMessage(e){try{let t=JSON.parse(e);this.eventEmitter.emit(`configBundleReceived`,t)}catch(e){this.logger.error(`[StreamingTransport] Error parsing and dispatching config data update: `,e)}}prepareFatalError(e,t){let n=e??0;return new h(`${`Connection failed with status: ${e??`unknown`}.`}${t?` Error: ${t}.`:``} This is an unrecoverable error, will not attempt to reconnect.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}get isConnected(){return this.eventSource?.readyState==`open`}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}stopHeartbeat(){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0}close(){this.stopHeartbeat(),this.eventSource?.close()}dispose(){this.close(),this.clear()}},oe=class{constructor(){this.fatalError=!1}clearPollingInterval(){clearInterval(this.pollingInterval)}schedulePollingInterval(e){clearInterval(this.pollingInterval),!(this.pollingIntervalSeconds<=0)&&(this.pollingInterval=setInterval(e,this.pollingIntervalSeconds*1e3))}async handleNonOkResponse(e){if(!e.ok)throw this.isStatusFatal(e.status)?(this.fatalError=!0,this.close(),this.prepareFatalResponseStatusError(e.status,await e.text())):new h(`Connection failed with status: ${e.status}`,e.status)}handleFetchError(e){throw this.isFetchErrorFatal(e)?(this.fatalError=!0,this.close(),new h(`Connection failed with fatal error: ${e}. This is an unrecoverable error, retry attempts will be ignored.`)):e instanceof SyntaxError?new h(`Failed to parse the response from the server: ${e}`):new h(`Connection failed with error: ${e}.`)}prepareFatalResponseStatusError(e,t){let n=e??0;return new h(`${`Connection failed with status: ${e??`unknown`}`}${(t?.trim()?.length??0)>0?` (${t})`:``}. This is an unrecoverable error, retry attempts will be ignored.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}isFetchErrorFatal(e){return e?.name===`NotAllowedError`}get isConnected(){return this.pollingInterval!==void 0}close(){clearInterval(this.pollingInterval),this.pollingInterval=void 0}dispose(){this.close(),this.clear()}},se=class extends oe{constructor(e){super(),this.options=e,this.eventEmitter=new r,this._sessionId=a(),this.options=e,this.logger=e.logger,this.url=new URL(`server/polling/v1`,e.baseUrl),this.pollingIntervalSeconds=e.pollingInterval??300}async connect(e){this.clearPollingInterval();try{await this.fetchConfigs(e)}finally{this.fatalError||this.schedulePollingInterval(()=>{this.fetchConfigs(e).catch(e=>{this.logger.error(`[PollingTransport] Error during polling:`,e)})})}return this}get sessionId(){return this._sessionId}async fetchConfigs(e){if(this.fatalError){this.logger.warn(`[PollingTransport] There was a prior unrecoverable error. Ignoring attempt to reconnect.`);return}try{let t=await re(e,this.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,lastUpdateTimestamp:this.lastUpdateTimestamp,sessionId:this._sessionId})},this.logger);if(await this.handleNonOkResponse(t),t.status===200){let e=JSON.parse(await t.text());this.lastUpdateTimestamp=e.timestamp,this.eventEmitter.emit(`configBundleReceived`,e)}}catch(e){try{this.handleFetchError(e)}catch(e){throw this.fatalError&&this.eventEmitter.emit(`connectionError`,e),e}}}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}};const ce=/^(?:0|[1-9][0-9]*)$/,le=/~(?![01])/,ue=Object.prototype.propertyIsEnumerable,de=e=>{if(!le.test(e))return e.replace(/~1/g,`/`).replace(/~0/g,`~`)},fe=(e,t)=>{if(Array.isArray(e))return ce.test(t)&&ue.call(e,t)?e[Number(t)]:void 0;if(typeof e==`object`&&e)return ue.call(e,t)?e[t]:void 0},pe=(e,t)=>{if(e===``)return t;if(!e.startsWith(`/`))return;let n=t;for(let t of e.slice(1).split(`/`)){let e=de(t);if(e===void 0||(n=fe(n,e),n===void 0))return}return n},me=(e,t,n)=>{let r=n[0];switch(t.toLowerCase()){case`=`:case`equals`:return r!==void 0&&e===r;case`!=`:case`does not equal`:return r!==void 0&&e!==r;case`is one of`:return n.includes(e);case`is not one of`:return!n.includes(e);case`starts with any of`:return n.some(t=>e.startsWith(t));case`does not start with any of`:return!n.some(t=>e.startsWith(t));case`ends with any of`:return n.some(t=>e.endsWith(t));case`does not end with any of`:return!n.some(t=>e.endsWith(t));default:return!1}},he=(e,t,n)=>{let r=t.toLowerCase(),i=ge(e);if(i===void 0)return r===`!=`||r===`does not equal`;let a=n[0];if(a===void 0)return!1;let o=ge(a);if(o===void 0)return!1;switch(r){case`=`:case`equals`:return i===o;case`!=`:case`does not equal`:return i!==o;case`<`:return i<o;case`<=`:return i<=o;case`>`:return i>o;case`>=`:return i>=o;default:return!1}},ge=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`||e.length===0||!_e(e))return;let t=Number(e);return Number.isFinite(t)?t:void 0},_e=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0};var ve=class extends Error{},ye=class extends ve{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},be=class extends ve{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},xe=class extends ve{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Se=class extends ve{},Ce=class extends ve{constructor(e){super(`Invalid unit ${e}`)}},S=class extends ve{},C=class extends ve{constructor(){super(`Zone is an abstract class`)}};const w=`numeric`,T=`short`,E=`long`,we={year:w,month:w,day:w},Te={year:w,month:T,day:w},Ee={year:w,month:T,day:w,weekday:T},De={year:w,month:E,day:w},Oe={year:w,month:E,day:w,weekday:E},ke={hour:w,minute:w},Ae={hour:w,minute:w,second:w},je={hour:w,minute:w,second:w,timeZoneName:T},Me={hour:w,minute:w,second:w,timeZoneName:E},Ne={hour:w,minute:w,hourCycle:`h23`},Pe={hour:w,minute:w,second:w,hourCycle:`h23`},Fe={hour:w,minute:w,second:w,hourCycle:`h23`,timeZoneName:T},Ie={hour:w,minute:w,second:w,hourCycle:`h23`,timeZoneName:E},Le={year:w,month:w,day:w,hour:w,minute:w},Re={year:w,month:w,day:w,hour:w,minute:w,second:w},ze={year:w,month:T,day:w,hour:w,minute:w},Be={year:w,month:T,day:w,hour:w,minute:w,second:w},Ve={year:w,month:T,day:w,weekday:T,hour:w,minute:w},He={year:w,month:E,day:w,hour:w,minute:w,timeZoneName:T},Ue={year:w,month:E,day:w,hour:w,minute:w,second:w,timeZoneName:T},We={year:w,month:E,day:w,weekday:E,hour:w,minute:w,timeZoneName:E},Ge={year:w,month:E,day:w,weekday:E,hour:w,minute:w,second:w,timeZoneName:E};var Ke=class{get type(){throw new C}get name(){throw new C}get ianaName(){return this.name}get isUniversal(){throw new C}offsetName(e,t){throw new C}formatOffset(e,t){throw new C}offset(e){throw new C}equals(e){throw new C}get isValid(){throw new C}};let qe=null;var Je=class e extends Ke{static get instance(){return qe===null&&(qe=new e),qe}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return wn(e,t,n)}formatOffset(e,t){return On(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}};const Ye=new Map;function Xe(e){let t=Ye.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),Ye.set(e,t)),t}const Ze={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Qe(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function $e(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=Ze[t];t===`era`?r[a]=i:P(a)||(r[a]=parseInt(i,10))}return r}const et=new Map;var tt=class e extends Ke{static create(t){let n=et.get(t);return n===void 0&&et.set(t,n=new e(t)),n}static resetCache(){et.clear(),Ye.clear()}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(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return wn(e,t,n,this.name)}formatOffset(e,t){return On(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=Xe(this.name),[r,i,a,o,s,c,l]=n.formatToParts?$e(n,t):Qe(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=bn({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}};let nt={};function rt(e,t={}){let n=JSON.stringify([e,t]),r=nt[n];return r||(r=new Intl.ListFormat(e,t),nt[n]=r),r}const it=new Map;function at(e,t={}){let n=JSON.stringify([e,t]),r=it.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),it.set(n,r)),r}const ot=new Map;function st(e,t={}){let n=JSON.stringify([e,t]),r=ot.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),ot.set(n,r)),r}const ct=new Map;function lt(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=ct.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),ct.set(i,a)),a}let ut=null;function dt(){return ut||(ut=new Intl.DateTimeFormat().resolvedOptions().locale,ut)}const ft=new Map;function pt(e){let t=ft.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),ft.set(e,t)),t}const mt=new Map;function ht(e){let t=mt.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Tt,...t}),mt.set(e,t)}return t}function gt(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=at(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=at(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function _t(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function vt(e){let t=[];for(let n=1;n<=12;n++){let r=J.utc(2009,n,1);t.push(e(r))}return t}function yt(e){let t=[];for(let n=1;n<=7;n++){let r=J.utc(2016,11,13+n);t.push(e(r))}return t}function bt(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function xt(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||pt(e.locale).numberingSystem===`latn`}var St=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=st(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return L(this.floor?Math.floor(e):gn(e,3),this.padTo)}},Ct=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&tt.create(n).valid?(r=n,this.dt=e):(r=`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,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=at(t,i)}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(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},wt=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&sn()&&(this.rtf=lt(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):qn(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}};const Tt={firstDay:1,minimalDays:4,weekend:[6,7]};var D=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||j.defaultLocale;return new e(o||(a?`en-US`:dt()),n||j.defaultNumberingSystem,r||j.defaultOutputCalendar,pn(i)||j.defaultWeekSettings,o)}static resetCache(){ut=null,it.clear(),ot.clear(),ct.clear(),ft.clear(),mt.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=gt(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=_t(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??(this.fastNumbersCached=xt(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,pn(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return bt(this,e,Nn,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=vt(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return bt(this,e,Ln,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=yt(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return bt(this,void 0,()=>Rn,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[J.utc(2016,11,13,9),J.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return bt(this,e,Hn,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[J.utc(-40,1,1),J.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new St(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Ct(e,this.intl,t)}relFormatter(e={}){return new wt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return rt(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||pt(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:cn()?ht(this.locale):Tt}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}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};let Et=null;var O=class e extends Ke{static get utcInstance(){return Et===null&&(Et=new e(0)),Et}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Tn(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${On(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${On(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return On(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},Dt=class extends Ke{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 k(e,t){if(P(e)||e===null)return t;if(e instanceof Ke)return e;if(an(e)){let n=e.toLowerCase();return n===`default`?t:n===`local`||n===`system`?Je.instance:n===`utc`||n===`gmt`?O.utcInstance:O.parseSpecifier(n)||tt.create(e)}else if(F(e))return O.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new Dt(e)}const Ot={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},kt={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]},At=Ot.hanidec.replace(/[\[|\]]/g,``).split(``);function jt(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(Ot.hanidec)!==-1)t+=At.indexOf(e[n]);else for(let e in kt){let[n,i]=kt[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}const Mt=new Map;function Nt(){Mt.clear()}function A({numberingSystem:e},t=``){let n=e||`latn`,r=Mt.get(n);r===void 0&&(r=new Map,Mt.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${Ot[n]}${t}`),r.set(t,i)),i}let Pt=()=>Date.now(),Ft=`system`,It=null,Lt=null,Rt=null,zt=60,Bt,Vt=null;var j=class{static get now(){return Pt}static set now(e){Pt=e}static set defaultZone(e){Ft=e}static get defaultZone(){return k(Ft,Je.instance)}static get defaultLocale(){return It}static set defaultLocale(e){It=e}static get defaultNumberingSystem(){return Lt}static set defaultNumberingSystem(e){Lt=e}static get defaultOutputCalendar(){return Rt}static set defaultOutputCalendar(e){Rt=e}static get defaultWeekSettings(){return Vt}static set defaultWeekSettings(e){Vt=pn(e)}static get twoDigitCutoffYear(){return zt}static set twoDigitCutoffYear(e){zt=e%100}static get throwOnInvalid(){return Bt}static set throwOnInvalid(e){Bt=e}static resetCaches(){D.resetCache(),tt.resetCache(),J.resetCache(),Nt()}},M=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};const Ht=[0,31,59,90,120,151,181,212,243,273,304,334],Ut=[0,31,60,91,121,152,182,213,244,274,305,335];function N(e,t){return new M(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Wt(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Gt(e,t,n){return n+(_n(e)?Ut:Ht)[t-1]}function Kt(e,t){let n=_n(e)?Ut:Ht,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function qt(e,t){return(e-t+7)%7+1}function Jt(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=Gt(r,i,a),s=qt(Wt(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=Sn(l,t,n)):c>Sn(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...kn(e)}}function Yt(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=qt(Wt(r,1,t),n),s=vn(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=vn(l)):c>s?(l=r+1,c-=vn(r)):l=r;let{month:u,day:d}=Kt(l,c);return{year:l,month:u,day:d,...kn(e)}}function Xt(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:Gt(t,n,r),...kn(e)}}function Zt(e){let{year:t,ordinal:n}=e,{month:r,day:i}=Kt(t,n);return{year:t,month:r,day:i,...kn(e)}}function Qt(e,t){if(!P(e.localWeekday)||!P(e.localWeekNumber)||!P(e.localWeekYear)){if(!P(e.weekday)||!P(e.weekNumber)||!P(e.weekYear))throw new Se(`Cannot mix locale-based week fields with ISO-based week fields`);return P(e.localWeekday)||(e.weekday=e.localWeekday),P(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),P(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function $t(e,t=4,n=1){let r=rn(e.weekYear),i=I(e.weekNumber,1,Sn(e.weekYear,t,n)),a=I(e.weekday,1,7);return r?i?a?!1:N(`weekday`,e.weekday):N(`week`,e.weekNumber):N(`weekYear`,e.weekYear)}function en(e){let t=rn(e.year),n=I(e.ordinal,1,vn(e.year));return t?n?!1:N(`ordinal`,e.ordinal):N(`year`,e.year)}function tn(e){let t=rn(e.year),n=I(e.month,1,12),r=I(e.day,1,yn(e.year,e.month));return t?n?r?!1:N(`day`,e.day):N(`month`,e.month):N(`year`,e.year)}function nn(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=I(t,0,23)||t===24&&n===0&&r===0&&i===0,o=I(n,0,59),s=I(r,0,59),c=I(i,0,999);return a?o?s?c?!1:N(`millisecond`,i):N(`second`,r):N(`minute`,n):N(`hour`,t)}function P(e){return e===void 0}function F(e){return typeof e==`number`}function rn(e){return typeof e==`number`&&e%1==0}function an(e){return typeof e==`string`}function on(e){return Object.prototype.toString.call(e)===`[object Date]`}function sn(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function cn(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function ln(e){return Array.isArray(e)?e:[e]}function un(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function dn(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function fn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pn(e){if(e==null)return null;if(typeof e!=`object`)throw new S(`Week settings must be an object`);if(!I(e.firstDay,1,7)||!I(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!I(e,1,7)))throw new S(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function I(e,t,n){return rn(e)&&e>=t&&e<=n}function mn(e,t){return e-t*Math.floor(e/t)}function L(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function R(e){if(!(P(e)||e===null||e===``))return parseInt(e,10)}function z(e){if(!(P(e)||e===null||e===``))return parseFloat(e)}function hn(e){if(!(P(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function gn(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function _n(e){return e%4==0&&(e%100!=0||e%400==0)}function vn(e){return _n(e)?366:365}function yn(e,t){let n=mn(t-1,12)+1,r=e+(t-n)/12;return n===2?_n(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function bn(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function xn(e,t,n){return-qt(Wt(e,1,t),n)+t-1}function Sn(e,t=4,n=1){let r=xn(e,t,n),i=xn(e+1,t,n);return(vn(e)-r+i)/7}function Cn(e){return e>99?e:e>j.twoDigitCutoffYear?1900+e:2e3+e}function wn(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Tn(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function En(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new S(`Invalid unit value ${e}`);return t}function Dn(e,t){let n={};for(let r in e)if(fn(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=En(i)}return n}function On(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${L(n,2)}:${L(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${L(n,2)}${L(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function kn(e){return dn(e,[`hour`,`minute`,`second`,`millisecond`])}const An=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],jn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Mn=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function Nn(e){switch(e){case`narrow`:return[...Mn];case`short`:return[...jn];case`long`:return[...An];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}}const Pn=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],Fn=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],In=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Ln(e){switch(e){case`narrow`:return[...In];case`short`:return[...Fn];case`long`:return[...Pn];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}const Rn=[`AM`,`PM`],zn=[`Before Christ`,`Anno Domini`],Bn=[`BC`,`AD`],Vn=[`B`,`A`];function Hn(e){switch(e){case`narrow`:return[...Vn];case`short`:return[...Bn];case`long`:return[...zn];default:return null}}function Un(e){return Rn[e.hour<12?0:1]}function Wn(e,t){return Ln(t)[e.weekday-1]}function Gn(e,t){return Nn(t)[e.month-1]}function Kn(e,t){return Hn(t)[e.year<0?0:1]}function qn(e,t,n=`always`,r=!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.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function Jn(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Yn={D:we,DD:Te,DDD:De,DDDD:Oe,t:ke,tt:Ae,ttt:je,tttt:Me,T:Ne,TT:Pe,TTT:Fe,TTTT:Ie,f:Le,ff:ze,fff:He,ffff:We,F:Re,FF:Be,FFF:Ue,FFFF:Ge};var B=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return Yn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return L(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?Un(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?Gn(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?Wn(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?Kn(t,e):a({era:e},`era`);return Jn(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return Jn(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}};const Xn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Zn(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function Qn(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function $n(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function er(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=R(t[n+i]);return[r,null,n+i]}}const tr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,nr=`(?:${tr.source}?(?:\\[(${Xn.source})\\])?)?`,rr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ir=RegExp(`${rr.source}${nr}`),ar=RegExp(`(?:[Tt]${ir.source})?`),or=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,sr=/(\d{4})-?W(\d\d)(?:-?(\d))?/,cr=/(\d{4})-?(\d{3})/,lr=er(`weekYear`,`weekNumber`,`weekDay`),ur=er(`year`,`ordinal`),dr=/(\d{4})-(\d\d)-(\d\d)/,fr=RegExp(`${rr.source} ?(?:${tr.source}|(${Xn.source}))?`),pr=RegExp(`(?: ${fr.source})?`);function mr(e,t,n){let r=e[t];return P(r)?n:R(r)}function hr(e,t){return[{year:mr(e,t),month:mr(e,t+1,1),day:mr(e,t+2,1)},null,t+3]}function gr(e,t){return[{hours:mr(e,t,0),minutes:mr(e,t+1,0),seconds:mr(e,t+2,0),milliseconds:hn(e[t+3])},null,t+4]}function _r(e,t){let n=!e[t]&&!e[t+1],r=Tn(e[t+1],e[t+2]);return[{},n?null:O.instance(r),t+3]}function vr(e,t){return[{},e[t]?tt.create(e[t]):null,t+1]}const yr=RegExp(`^T?${rr.source}$`),br=/^-?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 xr(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(z(n)),months:f(z(r)),weeks:f(z(i)),days:f(z(a)),hours:f(z(o)),minutes:f(z(s)),seconds:f(z(c),c===`-0`),milliseconds:f(hn(l),d)}]}const Sr={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Cr(e,t,n,r,i,a,o){let s={year:t.length===2?Cn(R(t)):R(t),month:jn.indexOf(n)+1,day:R(r),hour:R(i),minute:R(a)};return o&&(s.second=R(o)),e&&(s.weekday=e.length>3?Pn.indexOf(e)+1:Fn.indexOf(e)+1),s}const wr=/^(?:(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 Tr(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=Cr(t,i,r,n,a,o,s),p;return p=c?Sr[c]:l?0:Tn(u,d),[f,new O(p)]}function Er(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}const Dr=/^(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$/,Or=/^(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$/,kr=/^(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 Ar(e){let[,t,n,r,i,a,o,s]=e;return[Cr(t,i,r,n,a,o,s),O.utcInstance]}function jr(e){let[,t,n,r,i,a,o,s]=e;return[Cr(t,s,n,r,i,a,o),O.utcInstance]}const Mr=Zn(or,ar),Nr=Zn(sr,ar),Pr=Zn(cr,ar),Fr=Zn(ir),Ir=Qn(hr,gr,_r,vr),Lr=Qn(lr,gr,_r,vr),Rr=Qn(ur,gr,_r,vr),zr=Qn(gr,_r,vr);function Br(e){return $n(e,[Mr,Ir],[Nr,Lr],[Pr,Rr],[Fr,zr])}function Vr(e){return $n(Er(e),[wr,Tr])}function Hr(e){return $n(e,[Dr,Ar],[Or,Ar],[kr,jr])}function Ur(e){return $n(e,[br,xr])}const Wr=Qn(gr);function Gr(e){return $n(e,[yr,Wr])}const Kr=Zn(dr,pr),qr=Zn(fr),Jr=Qn(gr,_r,vr);function Yr(e){return $n(e,[Kr,Ir],[qr,Jr])}const Xr=`Invalid Duration`,Zr={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Qr={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:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...Zr},V=146097/400,$r=146097/4800,ei={years:{quarters:4,months:12,weeks:V/7,days:V,hours:V*24,minutes:V*24*60,seconds:V*24*60*60,milliseconds:V*24*60*60*1e3},quarters:{months:3,weeks:V/28,days:V/4,hours:V*24/4,minutes:V*24*60/4,seconds:V*24*60*60/4,milliseconds:V*24*60*60*1e3/4},months:{weeks:$r/7,days:$r,hours:$r*24,minutes:$r*24*60,seconds:$r*24*60*60,milliseconds:$r*24*60*60*1e3},...Zr},H=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],ti=H.slice(0).reverse();function U(e,t,n=!1){return new W({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function ni(e,t){let n=t.milliseconds??0;for(let r of ti.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function ri(e,t){let n=ni(e,t)<0?-1:1;H.reduceRight((r,i)=>{if(P(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),H.reduce((n,r)=>{if(P(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function ii(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var W=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?ei:Qr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||D.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new S(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Dn(t,e.normalizeUnit),loc:D.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(F(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new S(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=Ur(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=Gr(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the Duration is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new xe(r);return new e({invalid:r})}static normalizeUnit(e){let t={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(!t)throw new Ce(e);return t}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,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?B.create(this.loc,n).formatDurationFromString(this,e):Xr}toHuman(e={}){if(!this.isValid)return Xr;let t=e.showZeros!==!1,n=H.map(n=>{let r=this.values[n];return P(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}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+=gn(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},J.fromMillis(t,{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?ni(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of H)(fn(n.values,e)||fn(this.values,e))&&(r[e]=n.get(e)+this.get(e));return U(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=En(e(this.values[n],n));return U(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Dn(t,e.normalizeUnit)};return U(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return U(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ri(this.matrix,e),U(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=ii(this.normalize().shiftToAll().toObject());return U(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of H)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;F(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else F(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return ri(this.matrix,n),U(this,{values:n},!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 t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return U(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=ii(this.values);return U(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 t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of H)if(!t(this.values[n],e.values[n]))return!1;return!0}};const ai=`Invalid Interval`;function oi(e,t){return!e||!e.isValid?si.invalid(`missing or invalid start`):!t||!t.isValid?si.invalid(`missing or invalid end`):t<e?si.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var si=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the Interval is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new be(r);return new e({invalid:r})}static fromDateTimes(t,n){let r=oa(t),i=oa(n);return oi(r,i)??new e({start:r,end:i})}static after(t,n){let r=W.fromDurationLike(n),i=oa(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=W.fromDurationLike(n),i=oa(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=J.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=J.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=W.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=W.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" 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 lastDateTime(){return this.isValid&&this.e?this.e.minus(1):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`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.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:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(oa).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=W.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}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(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ai}[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=we,t={}){return this.isValid?B.create(this.s.loc.clone(t),e).formatInterval(this):ai}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ai}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ai}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ai}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ai}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):W.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},ci=class{static hasDST(e=j.defaultZone){let t=J.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return tt.isValidZone(e)}static normalizeZone(e){return k(e,j.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||D.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||D.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||D.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||D.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||D.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return D.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return D.create(t,null,`gregory`).eras(e)}static features(){return{relative:sn(),localeWeek:cn()}}};function li(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(W.fromMillis(r).as(`days`))}function ui(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=li(e,t);return(n-n%7)/7}],[`days`,li]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function di(e,t,n,r){let[i,a,o,s]=ui(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=W.fromObject(a,r);return l.length>0?W.fromMillis(c,r).shiftTo(...l).plus(u):u}function G(e,t=e=>e){return{regex:e,deser:([e])=>t(jt(e))}}const fi=`[ \xA0]`,pi=new RegExp(fi,`g`);function mi(e){return e.replace(/\./g,`\\.?`).replace(pi,fi)}function hi(e){return e.replace(/\./g,``).replace(pi,` `).toLowerCase()}function K(e,t){return e===null?null:{regex:RegExp(e.map(mi).join(`|`)),deser:([n])=>e.findIndex(e=>hi(n)===hi(e))+t}}function gi(e,t){return{regex:e,deser:([,e,t])=>Tn(e,t),groups:t}}function _i(e){return{regex:e,deser:([e])=>e}}function vi(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function yi(e,t){let n=A(t),r=A(t,`{2}`),i=A(t,`{3}`),a=A(t,`{4}`),o=A(t,`{6}`),s=A(t,`{1,2}`),c=A(t,`{1,3}`),l=A(t,`{1,6}`),u=A(t,`{1,9}`),d=A(t,`{2,4}`),f=A(t,`{4,6}`),p=e=>({regex:RegExp(vi(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return K(t.eras(`short`),0);case`GG`:return K(t.eras(`long`),0);case`y`:return G(l);case`yy`:return G(d,Cn);case`yyyy`:return G(a);case`yyyyy`:return G(f);case`yyyyyy`:return G(o);case`M`:return G(s);case`MM`:return G(r);case`MMM`:return K(t.months(`short`,!0),1);case`MMMM`:return K(t.months(`long`,!0),1);case`L`:return G(s);case`LL`:return G(r);case`LLL`:return K(t.months(`short`,!1),1);case`LLLL`:return K(t.months(`long`,!1),1);case`d`:return G(s);case`dd`:return G(r);case`o`:return G(c);case`ooo`:return G(i);case`HH`:return G(r);case`H`:return G(s);case`hh`:return G(r);case`h`:return G(s);case`mm`:return G(r);case`m`:return G(s);case`q`:return G(s);case`qq`:return G(r);case`s`:return G(s);case`ss`:return G(r);case`S`:return G(c);case`SSS`:return G(i);case`u`:return _i(u);case`uu`:return _i(s);case`uuu`:return G(n);case`a`:return K(t.meridiems(),0);case`kkkk`:return G(a);case`kk`:return G(d,Cn);case`W`:return G(s);case`WW`:return G(r);case`E`:case`c`:return G(n);case`EEE`:return K(t.weekdays(`short`,!1),1);case`EEEE`:return K(t.weekdays(`long`,!1),1);case`ccc`:return K(t.weekdays(`short`,!0),1);case`cccc`:return K(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return gi(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return gi(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return _i(/[a-z_+-/]{1,256}?/i);case` `:return _i(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:`missing Intl.DateTimeFormat.formatToParts support`};return m.token=e,m}const bi={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 xi(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=bi[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function Si(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Ci(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(fn(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function wi(e){let t=e=>{switch(e){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}},n=null,r;return P(e.z)||(n=tt.create(e.z)),P(e.Z)||(n||(n=new O(e.Z)),r=e.Z),P(e.q)||(e.M=(e.q-1)*3+1),P(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),P(e.u)||(e.S=hn(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}let Ti=null;function Ei(){return Ti||(Ti=J.fromMillis(1555555555555)),Ti}function Di(e,t){if(e.literal)return e;let n=Mi(B.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function Oi(e,t){return Array.prototype.concat(...e.map(e=>Di(e,t)))}var ki=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Oi(B.parseFormat(t),e),this.units=this.tokens.map(t=>yi(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=Si(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Ci(e,this.regex,this.handlers),[r,i,a]=n?wi(n):[null,null,void 0];if(fn(n,`a`)&&fn(n,`H`))throw new Se(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Ai(e,t,n){return new ki(e,n).explainFromTokens(t)}function ji(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=Ai(e,t,n);return[r,i,a,o]}function Mi(e,t){if(!e)return null;let n=B.create(t,e).dtFormatter(Ei()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>xi(t,e,i))}const Ni=`Invalid DateTime`,Pi=864e13;function Fi(e){return new M(`unsupported zone`,`the zone "${e.name}" is not supported`)}function Ii(e){return e.weekData===null&&(e.weekData=Jt(e.c)),e.weekData}function Li(e){return e.localWeekData===null&&(e.localWeekData=Jt(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function q(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new J({...n,...t,old:n})}function Ri(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function zi(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Bi(e,t,n){return Ri(bn(e),t,n)}function Vi(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,yn(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=W.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=Ri(bn(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function Hi(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=J.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return J.invalid(new M(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function Ui(e,t,n=!0){return e.isValid?B.create(D.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Wi(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=L(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=L(e.c.month),n===`month`)return i;i+=`-`}else if(i+=L(e.c.month),n===`month`)return i;return i+=L(e.c.day),i}function Gi(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=L(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=L(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=L(e.c.second))}else{if(c+=L(e.c.minute),o===`minute`)break;s&&(c+=L(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=L(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=L(Math.trunc(-e.o/60)),c+=`:`,c+=L(Math.trunc(-e.o%60))):(c+=`+`,c+=L(Math.trunc(e.o/60)),c+=`:`,c+=L(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}const Ki={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},qi={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ji={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Yi=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],Xi=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],Zi=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function Qi(e){let t={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`}[e.toLowerCase()];if(!t)throw new Ce(e);return t}function $i(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return Qi(e)}}function ea(e){if(ia===void 0&&(ia=j.now()),e.type!==`iana`)return e.offset(ia);let t=e.name,n=aa.get(t);return n===void 0&&(n=e.offset(ia),aa.set(t,n)),n}function ta(e,t){let n=k(t.zone,j.defaultZone);if(!n.isValid)return J.invalid(Fi(n));let r=D.fromObject(t),i,a;if(P(e.year))i=j.now();else{for(let t of Yi)P(e[t])&&(e[t]=Ki[t]);let t=tn(e)||nn(e);if(t)return J.invalid(t);let r=ea(n);[i,a]=Bi(e,r,n)}return new J({ts:i,zone:n,loc:r,o:a})}function na(e,t,n){let r=P(n.round)?!0:n.round,i=P(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=gn(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function ra(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}let ia;const aa=new Map;var J=class e{constructor(e){let t=e.zone||j.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new M(`invalid input`):null)||(t.isValid?null:Fi(t));this.ts=P(e.ts)?j.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=F(e.o)&&!e.old?e.o:t.offset(this.ts);r=zi(this.ts,a),n=Number.isNaN(r.year)?new M(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||D.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=ra(arguments),[n,r,i,a,o,s,c]=t;return ta({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=ra(arguments),[n,r,i,a,o,s,c]=t;return e.zone=O.utcInstance,ta({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=on(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=k(n.zone,j.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:D.fromObject(n)}):e.invalid(Fi(i))}static fromMillis(t,n={}){if(!F(t))throw new S(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-Pi||t>Pi?e.invalid(`Timestamp out of range`):new e({ts:t,zone:k(n.zone,j.defaultZone),loc:D.fromObject(n)})}static fromSeconds(t,n={}){if(F(t))return new e({ts:t*1e3,zone:k(n.zone,j.defaultZone),loc:D.fromObject(n)});throw new S(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t=t||{};let r=k(n.zone,j.defaultZone);if(!r.isValid)return e.invalid(Fi(r));let i=D.fromObject(n),a=Dn(t,$i),{minDaysInFirstWeek:o,startOfWeek:s}=Qt(a,i),c=j.now(),l=P(n.specificOffset)?r.offset(c):n.specificOffset,u=!P(a.ordinal),d=!P(a.year),f=!P(a.month)||!P(a.day),p=d||f,m=a.weekYear||a.weekNumber;if((p||u)&&m)throw new Se(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(f&&u)throw new Se(`Can't mix ordinal dates with month/day`);let h=m||a.weekday&&!p,g,_,v=zi(c,l);h?(g=Xi,_=qi,v=Jt(v,o,s)):u?(g=Zi,_=Ji,v=Xt(v)):(g=Yi,_=Ki);let y=!1;for(let e of g){let t=a[e];P(t)?y?a[e]=_[e]:a[e]=v[e]:y=!0}let ee=(h?$t(a,o,s):u?en(a):tn(a))||nn(a);if(ee)return e.invalid(ee);let[te,b]=Bi(h?Yt(a,o,s):u?Zt(a):a,l,r),x=new e({ts:te,zone:r,o:b,loc:i});return a.weekday&&p&&t.weekday!==x.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${a.weekday} and a date of ${x.toISO()}`):x.isValid?x:e.invalid(x.invalid)}static fromISO(e,t={}){let[n,r]=Br(e);return Hi(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=Vr(e);return Hi(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=Hr(e);return Hi(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(P(t)||P(n))throw new S(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,s,c,l]=ji(D.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return l?e.invalid(l):Hi(o,s,r,`format ${n}`,t,c)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=Yr(e);return Hi(n,r,t,`SQL`,e)}static invalid(t,n=null){if(!t)throw new S(`need to specify a reason the DateTime is invalid`);let r=t instanceof M?t:new M(t,n);if(j.throwOnInvalid)throw new ye(r);return new e({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Mi(e,D.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return Oi(B.parseFormat(e),D.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){ia=void 0,aa.clear()}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?Ii(this).weekYear:NaN}get weekNumber(){return this.isValid?Ii(this).weekNumber:NaN}get weekday(){return this.isValid?Ii(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Li(this).weekday:NaN}get localWeekNumber(){return this.isValid?Li(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Li(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(this.c).ordinal:NaN}get monthShort(){return this.isValid?ci.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ci.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ci.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ci.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,t=6e4,n=bn(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=zi(s,a),u=zi(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[q(this,{ts:s}),q(this,{ts:c})]:[this]}get isInLeapYear(){return _n(this.year)}get daysInMonth(){return yn(this.year,this.month)}get daysInYear(){return this.isValid?vn(this.year):NaN}get weeksInWeekYear(){return this.isValid?Sn(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Sn(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=B.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(O.instance(e),t)}toLocal(){return this.setZone(j.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=k(t,j.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=Bi(r,n,t)}return q(this,{ts:e,zone:t})}else return e.invalid(Fi(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return q(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Dn(e,$i),{minDaysInFirstWeek:n,startOfWeek:r}=Qt(t,this.loc),i=!P(t.weekYear)||!P(t.weekNumber)||!P(t.weekday),a=!P(t.ordinal),o=!P(t.year),s=!P(t.month)||!P(t.day),c=o||s,l=t.weekYear||t.weekNumber;if((c||a)&&l)throw new Se(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(s&&a)throw new Se(`Can't mix ordinal dates with month/day`);let u;i?u=Yt({...Jt(this.c,n,r),...t},n,r):P(t.ordinal)?(u={...this.toObject(),...t},P(t.day)&&(u.day=Math.min(yn(u.year,u.month),u.day))):u=Zt({...Xt(this.c),...t});let[d,f]=Bi(u,this.o,this.zone);return q(this,{ts:d,o:f})}plus(e){if(!this.isValid)return this;let t=W.fromDurationLike(e);return q(this,Vi(this,t))}minus(e){if(!this.isValid)return this;let t=W.fromDurationLike(e).negate();return q(this,Vi(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=W.normalizeUnit(e);switch(r){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}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?B.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ni}toLocaleString(e=we,t={}){return this.isValid?B.create(this.loc.clone(t),e).formatDateTime(this):Ni}toLocaleParts(e={}){return this.isValid?B.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=Qi(a);let o=e===`extended`,s=Wi(this,o,a);return Yi.indexOf(a)>=3&&(s+=`T`),s+=Gi(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?Wi(this,e===`extended`,Qi(t)):null}toISOWeekDate(){return Ui(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=Qi(o),(r&&Yi.indexOf(o)>=3?`T`:``)+Gi(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return Ui(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return Ui(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?Wi(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),Ui(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ni}[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 t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return W.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=ln(t).map(W.normalizeUnit),a=e.valueOf()>this.valueOf(),o=di(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?si.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),na(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?na(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new S(`min requires all arguments be DateTimes`);return un(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new S(`max requires all arguments be DateTimes`);return un(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return Ai(D.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new ki(D.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(P(t)||P(n))throw new S(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=D.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new S(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:s,zone:c,specificOffset:l,invalidReason:u}=n.explainFromTokens(t);return u?e.invalid(u):Hi(s,c,r,`format ${n.format}`,t,l)}static get DATE_SHORT(){return we}static get DATE_MED(){return Te}static get DATE_MED_WITH_WEEKDAY(){return Ee}static get DATE_FULL(){return De}static get DATE_HUGE(){return Oe}static get TIME_SIMPLE(){return ke}static get TIME_WITH_SECONDS(){return Ae}static get TIME_WITH_SHORT_OFFSET(){return je}static get TIME_WITH_LONG_OFFSET(){return Me}static get TIME_24_SIMPLE(){return Ne}static get TIME_24_WITH_SECONDS(){return Pe}static get TIME_24_WITH_SHORT_OFFSET(){return Fe}static get TIME_24_WITH_LONG_OFFSET(){return Ie}static get DATETIME_SHORT(){return Le}static get DATETIME_SHORT_WITH_SECONDS(){return Re}static get DATETIME_MED(){return ze}static get DATETIME_MED_WITH_SECONDS(){return Be}static get DATETIME_MED_WITH_WEEKDAY(){return Ve}static get DATETIME_FULL(){return He}static get DATETIME_FULL_WITH_SECONDS(){return Ue}static get DATETIME_HUGE(){return We}static get DATETIME_HUGE_WITH_SECONDS(){return Ge}};function oa(e){if(J.isDateTime(e))return e;if(e&&e.valueOf&&F(e.valueOf()))return J.fromJSDate(e);if(e&&typeof e==`object`)return J.fromObject(e);throw new S(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const sa=(e,t,n)=>{let r=n[0];if(r===void 0)return!1;let i=ca(e),a=ca(r);if(i===void 0||a===void 0)return!1;switch(t){case`is after`:return i>a;case`is before`:return i<a;default:return!1}},ca=e=>{let t=J.fromISO(e,{zone:`utc`});return t.isValid?t.toMillis():void 0};var la=f(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),ua=f(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),da=f(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=la(),a=ua();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),fa=f(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),pa=f(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Y=f(((e,t)=>{let n=ua(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=la(),{safeRe:a,t:o}=da(),s=fa(),{compareIdentifiers:c}=pa();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),ma=f(((e,t)=>{let n=Y();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),ha=f(((e,t)=>{let n=ma();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),ga=f(((e,t)=>{let n=ma();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),_a=f(((e,t)=>{let n=Y();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),va=f(((e,t)=>{let n=ma();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),ya=f(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).major})),ba=f(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).minor})),xa=f(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).patch})),Sa=f(((e,t)=>{let n=ma();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),X=f(((e,t)=>{let n=Y();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ca=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(t,e,r)})),wa=f(((e,t)=>{let n=X();t.exports=(e,t)=>n(e,t,!0)})),Ta=f(((e,t)=>{let n=Y();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Ea=f(((e,t)=>{let n=Ta();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Da=f(((e,t)=>{let n=Ta();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Oa=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)>0})),ka=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)<0})),Aa=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)===0})),ja=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)!==0})),Ma=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)>=0})),Na=f(((e,t)=>{let n=X();t.exports=(e,t,r)=>n(e,t,r)<=0})),Pa=f(((e,t)=>{let n=Aa(),r=ja(),i=Oa(),a=Ma(),o=ka(),s=Na();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Fa=f(((e,t)=>{let n=Y(),r=ma(),{safeRe:i,t:a}=da();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t=t||{};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Ia=f(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Z=f(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,oe(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>ae(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(se(this.set[t],e,this.options))return!0;return!1}};let r=new(Ia()),i=fa(),a=La(),o=ua(),s=Y(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=da(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=la(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=b(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ne(e,t),o(`xrange`,e),e=ie(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ne=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>re(e,t)).join(` `)),re=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},ie=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ae=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),oe=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),se=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),La=f(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=fa(),{safeRe:i,t:a}=da(),o=Pa(),s=ua(),c=Y(),l=Z()})),Ra=f(((e,t)=>{let n=Z();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),za=f(((e,t)=>{let n=Z();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Ba=f(((e,t)=>{let n=Y(),r=Z();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Va=f(((e,t)=>{let n=Y(),r=Z();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Ha=f(((e,t)=>{let n=Y(),r=Z(),i=Oa();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Ua=f(((e,t)=>{let n=Z();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Wa=f(((e,t)=>{let n=Y(),r=La(),{ANY:i}=r,a=Z(),o=Ra(),s=Oa(),c=ka(),l=Na(),u=Ma();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o=o||e,s=s||e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Ga=f(((e,t)=>{let n=Wa();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ka=f(((e,t)=>{let n=Wa();t.exports=(e,t,r)=>n(e,t,`<`,r)})),qa=f(((e,t)=>{let n=Z();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Ja=f(((e,t)=>{let n=Ra(),r=X();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),Ya=f(((e,t)=>{let n=Z(),r=La(),{ANY:i}=r,a=Ra(),o=X(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i=i||t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Q=m(f(((e,t)=>{let n=da(),r=la(),i=Y(),a=pa();t.exports={parse:ma(),valid:ha(),clean:ga(),inc:_a(),diff:va(),major:ya(),minor:ba(),patch:xa(),prerelease:Sa(),compare:X(),rcompare:Ca(),compareLoose:wa(),compareBuild:Ta(),sort:Ea(),rsort:Da(),gt:Oa(),lt:ka(),eq:Aa(),neq:ja(),gte:Ma(),lte:Na(),cmp:Pa(),coerce:Fa(),Comparator:La(),Range:Z(),satisfies:Ra(),toComparators:za(),maxSatisfying:Ba(),minSatisfying:Va(),minVersion:Ha(),validRange:Ua(),outside:Wa(),gtr:Ga(),ltr:Ka(),intersects:qa(),simplifyRange:Ja(),subset:Ya(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);const Xa=(e,t,n)=>{let r=t.toLowerCase();if(e.trim().length===0)return r===`is not one of`;let i=Q.coerce(e),a=n.map(e=>Q.coerce(e)),o=a[0]??null;switch(r){case`=`:return Za(i,o);case`<`:return Qa(i,o,Q.lt);case`<=`:return Qa(i,o,Q.lte);case`>`:return Qa(i,o,Q.gt);case`>=`:return Qa(i,o,Q.gte);case`is one of`:return a.some(e=>Za(i,e));case`is not one of`:return!a.some(e=>Za(i,e));default:return!1}},Za=(e,t)=>e!==null&&t!==null&&Q.eq(e,t),Qa=(e,t,n)=>e!==null&&t!==null&&n(e,t),$a=Symbol(`absent`),eo=Symbol(`unknown-attribute`),to=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,no=e=>e===$a||e==null?``:to(e)?ro(e):``,ro=e=>typeof e==`string`?e:String(e),io=e=>e===$a?void 0:e,ao=e=>e===eo?`unknown-attribute`:e===$a?`absent`:to(e)?`scalar`:Array.isArray(e)?`array`:`object`,oo=(e,t,n)=>{let r=t.toLowerCase();if(!Array.isArray(e))return r===`does not contain any of`;let i=e.filter(to).map(ro);switch(r){case`contains any of`:return i.some(e=>n.includes(e));case`does not contain any of`:return!i.some(e=>n.includes(e));default:return!1}};var so=class{evaluate(e,t){return this.explain(e,t).matched}explain(e,t){let n=this.resolve(e,t),r=ao(n),i=n===$a||n===eo?void 0:n;return n===eo?{matched:!1,resolvedValue:i,resolvedType:r}:{matched:this.compare(e,n),resolvedValue:i,resolvedType:r}}compare(e,t){let n=e.targetValues??[];switch(e.targetType){case`text`:return me(no(t),e.operator,n);case`number`:return he(io(t),e.operator,n);case`datetime`:return sa(no(t),e.operator,n);case`semver`:return Xa(no(t),e.operator,n);case`array`:return oo(io(t),e.operator,n)}return!1}resolve(e,t){switch(e.attribute){case`identifier`:return co(t?.context?.id);case`name`:return co(t?.context?.name);case`appName`:return co(t?.metadata?.appName);case`appVersion`:return co(t?.metadata?.appVersion);case`traits`:return e.trait?co(pe(e.trait,t?.context?.traits)):$a;default:return eo}}};const co=e=>e??$a;var lo=class{constructor(e){this.conditionEvaluator=e}explain(e,t,n){let r=t?.[e.segmentId];if(r===void 0||!uo(r))return{matched:!1,segmentFound:!1,matchedGroupIndex:void 0};let i=this.matchingGroupIndex(r,n),a=i!==void 0;return{matched:this.operatorHolds(e,a),segmentFound:!0,matchedGroupIndex:i}}operatorHolds(e,t){switch(e.operator.toLowerCase()){case`in`:return t;case`not in`:return!t;default:return!1}}matchingGroupIndex(e,t){let n=(e.groups??[]).findIndex(e=>(e??[]).every(e=>this.conditionEvaluator.evaluate(e,t)));return n===-1?void 0:n}};const uo=e=>(e.groups??[]).every(e=>(e??[]).every(e=>e.kind===void 0||e.kind===`attribute`));function fo(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n}function po(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n^e^t}new DataView(new Uint8Array(8).buffer);var mo=new DataView(new Uint8Array(8).buffer);function ho(e,t){return mo.setUint32(0,e.getUint32(t,!0),!0),mo.getBigUint64(0,!0)}function $(e,t){return e.getBigUint64(t,!0)}new DataView(new Uint8Array(8).buffer),new DataView(new Uint8Array(8).buffer);var go=new TextEncoder,_o=2048,vo=_o/3,yo=new Uint8Array(_o);function bo(e){if(typeof e==`string`){if(e.length<=vo){let{written:t}=go.encodeInto(e,yo);return new DataView(yo.buffer,0,t)}let t=go.encode(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength):e}var xo=`fast`;function So(e){return e>=0n&&e<=18446744073709551615n}function Co(e,t){let n={seed:t,rapidMumBehaviour:xo};if(e===void 0)return n;if(e.seed!==void 0){if(!So(e.seed))throw Error(`seed must be a 64-bit unsigned bigint value: ${e.seed}`);n.seed=e.seed}return e.rapidMumBehaviour!==void 0&&(n.rapidMumBehaviour=e.rapidMumBehaviour),n}var wo=0n,To=[3257665815644502181n,10067880064238660809n,5418857496715711651n,5573817676018592327n,11562461410679940143n,16646288086500911323n,10443028834174122124n,12297829382473034410n],Eo=new Uint8Array(8),Do=new DataView(Eo.buffer);function Oo(e,t){let n=e.getUint8(0);return Eo[6]=n>>3,Eo[5]=n<<5,Eo[0]=e.getUint8(t-1),Do.getBigUint64(0,!0)}function ko(e,t,n,r){let i=e*t,a=(BigInt.asUintN(64,i)^n[7])*(i>>64n^n[1]^r);return BigInt.asUintN(64,a)^a>>64n}function Ao(e,t,n,r){let i=e*t,a=BigInt.asUintN(64,i)^n[7]^e,o=i>>64n^n[1]^r^t,s=a*o;return BigInt.asUintN(64,s)^s>>64n^a^o}var jo={fast:{rapid_mix:fo,rapidhash_epilogue:ko},protected:{rapid_mix:po,rapidhash_epilogue:Ao}};function Mo(e,t,n,r,i){let a=e.byteLength,o=BigInt(e.byteLength);t^=r(t^n[2],n[1]);let s,c,l=a,u;if(a<=16)if(u=o,a>=4)if(t^=o,a>=8){let t=a-8;s=$(e,0),c=$(e,t)}else{let t=a-4;s=ho(e,0),c=ho(e,t)}else a>0?(s=Oo(e,a),c=BigInt(e.getUint8(a>>1))):(s=0n,c=0n);else{let i=0;if(l>112){let a=t,o=t,s=t,c=t,u=t,d=t;do t=r($(e,i)^n[0],$(e,i+8)^t),a=r($(e,i+16)^n[1],$(e,i+24)^a),o=r($(e,i+32)^n[2],$(e,i+40)^o),s=r($(e,i+48)^n[3],$(e,i+56)^s),c=r($(e,i+64)^n[4],$(e,i+72)^c),u=r($(e,i+80)^n[5],$(e,i+88)^u),d=r($(e,i+96)^n[6],$(e,i+104)^d),i+=112,l-=112;while(l>112);t^=a,o^=s,c^=u,t^=d,o^=c,t^=o}u=BigInt(l),l>16&&(t=r($(e,i)^n[2],$(e,i+8)^t),l>32&&(t=r($(e,i+16)^n[2],$(e,i+24)^t),l>48&&(t=r($(e,i+32)^n[1],$(e,i+40)^t),l>64&&(t=r($(e,i+48)^n[1],$(e,i+56)^t),l>80&&(t=r($(e,i+64)^n[2],$(e,i+72)^t),l>96&&(t=r($(e,i+80)^n[1],$(e,i+88)^t))))))),s=$(e,i+l-16)^u,c=$(e,i+l-8)}return s^=n[1],c^=t,i(s,c,n,u)}function No(e,t){let{seed:n,rapidMumBehaviour:r}=Co(t,wo),{rapid_mix:i,rapidhash_epilogue:a}=jo[r];return Mo(bo(e),n,To,i,a)}const Po=e=>{let t=`${e.contextIdentifier}-${e.configId}`;return Number(No(t,{seed:15426857351n})%1000n)/10};var Fo=class{constructor(e){if(this.logger=e,this.conditionEvaluator=new so,this.segmentEvaluator=new lo(this.conditionEvaluator),!e||!e.warn||!e.error||!e.info)throw TypeError(`The provided logger is not a valid 'ConfigDirectorLogger'`);this.logger=e}evaluate(e,t,n){return{id:e.id,key:e.key,type:e.type,value:this.explain(e,t,n).value}}explain(e,t,n){let r=[...e.target?.rules??[]].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1)),i=[],a;for(let o of r){if(a){i.push({ruleId:o.id,outcome:`not-evaluated`,conditions:[],bucket:void 0});continue}let r=this.explainRule(o,e,t,n);i.push(r.explanation),r.value!==void 0&&(a={ruleId:o.id,value:r.value})}return{value:a?.value??e.target?.defaultValue,servedBy:a?{kind:`rule`,ruleId:a.ruleId}:{kind:`default`},rules:i}}explainRule(e,t,n,r){let i={ruleId:e.id,outcome:`not-matched`,conditions:[],bucket:void 0};try{let a;return e.type==`percentage`?a=this.explainPercentage(e.percentages??[],t,n,i):e.type==`conditional`&&(a=this.explainConditionalRule(e,t,n,r,i)),a!==void 0&&(i.outcome=`matched`),{explanation:i,value:a}}catch(n){return this.logger.warn(`There was an error while evaluating a targeting rule '${e?.id}' for '${t?.key}'. The rule will be disregarded.`,{error:n,configKey:t?.key,ruleId:e?.id}),{explanation:{ruleId:e.id,outcome:`errored`,conditions:[],bucket:void 0},value:void 0}}}explainPercentage(e,t,n,r){let i=n?.context?.id??void 0,a=i===void 0?0:Po({configId:t.id,contextIdentifier:i}),o=[],s=0,c;for(let t of e){let e=s+t.percentage;o.push({percentageId:t.id,from:s,to:e,value:t.value?.toString()}),c===void 0&&a<e&&(c=t),s=e}return r.bucket={identifier:i,defaultedToPredefinedBucket:i===void 0,assignedPercentage:a,shares:o,selectedPercentageId:c?.id},c?.value==null?void 0:c.value.toString()}explainConditionalRule(e,t,n,r,i){let a=!1;for(let t of e.conditions??[]){if(a){i.conditions.push({conditionId:t.id,outcome:`not-evaluated`});continue}let e=this.explainCondition(t,n,r);i.conditions.push(e),a=e.outcome!==`matched`}if(!a){if(e.target==`value`)return e.value==null?void 0:e.value.toString();if(e.target==`percentage`)return this.explainPercentage(e.percentages??[],t,n,i)}}explainCondition(e,t,n){if(e.kind===`segment`){let r=this.segmentEvaluator.explain(e,n,t);return{conditionId:e.id,kind:`segment`,outcome:r.matched?`matched`:`not-matched`,segmentId:e.segmentId,segmentFound:r.segmentFound,matchedGroupIndex:r.matchedGroupIndex}}let r=this.conditionEvaluator.explain(e,t);return{conditionId:e.id,kind:`attribute`,outcome:r.matched?`matched`:`not-matched`,resolvedValue:r.resolvedValue,resolvedType:r.resolvedType}}};const Io=e=>{let t=typeof e;if(t===`object`)try{return e.constructor?.name??t}catch{return t}else if(t===`function`)try{let n=e.name;return n?`function: ${n}`:t}catch{return t}return t},Lo=e=>e===`number`||e===`bigint`,Ro=new Set([`boolean`,`integer`,`float`]),zo=(e,t)=>{let n=e.value,r=Io(t);if(n==null||n===``)return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`value-missing`};if(e.type===`json`)return Go(n,t,r,e.valueId);if(typeof t==`string`)return Ro.has(e.type)?{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}:{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`};if(typeof t==`boolean`&&(e.type===`boolean`||e.type===`string`||e.type===`enum`)){let i=Bo(n),a=typeof i==`boolean`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-boolean`}}if(Lo(typeof t)&&e.type===`integer`){let i=Vo(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}if(Lo(typeof t)&&(e.type===`float`||e.type===`enum`||e.type===`string`)){let i=Ho(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`type-mismatch`}},Bo=e=>{if(!e)return;let t=e.toLowerCase();if(!(t!=`true`&&t!=`false`))return t===`true`},Vo=e=>{let t=Uo(e);return t==null?void 0:Math.trunc(t)},Ho=e=>Uo(e),Uo=e=>{if(!e||!Wo(e))return;let t=Number(e);if(!(isNaN(t)||!isFinite(t)))return t},Wo=e=>{for(let t of e)if(!(t>=`0`&&t<=`9`)&&!`+-.eE`.includes(t))return!1;return!0},Go=(e,t,n,r)=>{if(typeof t==`string`)return{parsedValue:e,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`};try{let i=JSON.parse(e);return Ko(i,t)?{parsedValue:i,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`}:{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`type-mismatch`}}catch{return{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`invalid-json`}}},Ko=(e,t)=>{if(e===null)return!1;let n=typeof t;return n===`bigint`?typeof e==`number`:typeof e===n},qo={off:-1,error:0,warn:1,info:2,debug:3},Jo=()=>{let e={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`};try{return new Intl.DateTimeFormat(void 0,{...e,fractionalSecondDigits:3})}catch{return new Intl.DateTimeFormat(void 0,e)}};var Yo=class{constructor(e,t){this.level=e,this.decorator=t,this.level=e,this.decorator=t,this.dateFormatter=Jo()}debug(e,...t){this.log(console.debug,`debug`,e,...t)}info(e,...t){this.log(console.info,`info`,e,...t)}warn(e,...t){this.log(console.warn,`warn`,e,...t)}error(e,...t){this.log(console.error,`error`,e,...t)}log(e,t,n,...r){qo[this.level]>=qo[t]&&e(`[${this.dateFormatter.format(new Date)}] ${this.decorator?.decorateMessage(n)}`,...r)}},Xo=class{decorateMessage(e){return`[ConfigDirector:js-server-sdk] ${e}`}};const Zo=(e,t)=>new Yo(e??`warn`,t??new Xo),Qo=(e,t)=>new URL(e,t?.toString()),$o=(e,t)=>e===void 0?{seconds:t.defaultSeconds,warning:void 0}:e>=t.minimumSeconds?{seconds:e,warning:void 0}:{seconds:t.minimumSeconds,warning:`pollingInterval of ${e} seconds is below the minimum of ${t.minimumSeconds} seconds. Using ${t.minimumSeconds} seconds.`},es=async(e,t)=>e.valueId?{valueId:e.valueId}:e.value?e.value.length<=500&&e.type!=`json`?{value:e.value}:{valueId:await t(e.value)}:e,ts=e=>{if(e.type===`json`||e.type==null&&typeof e.value==`object`){if(e.valueId)return{valueId:e.valueId,type:`json`};try{return{value:JSON.stringify(e.value),type:`json`}}catch{return{value:e.value.toString(),type:`json`}}}let t=e.value?.toString();return t&&t.length<=500?{value:t}:e.valueId?{valueId:e.valueId}:{value:t}},ns=e=>{let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]?.length??0)>0)return!1;return!0},rs=e=>{if(!e)return!0;let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]??0)>0)return!1;return!0};var is=class{constructor(e){this.executeRequests=!0,this.sdkKey=e.sdkKey,this.sdkIdentity=e.sdkIdentity,this.logger=e.logger,this.metaContext=e.metaContext,this.url=new URL(`server/telemetry/v1`,e.baseUrl.toString())}async report({discreteEvents:e,aggregatedEvents:t,droppedEvents:n}){if(!this.executeRequests)return{success:!1,fatalError:!0};let r={serverSdkKey:this.sdkKey,metaContext:{sdkName:this.sdkIdentity.sdkName,sdkVersion:this.sdkIdentity.sdkVersion,appName:this.metaContext.appName,appVersion:this.metaContext.appVersion},discreteEvents:e,aggregatedEvents:t,droppedEvents:n};if(this.isReportEmpty(r))return{success:!0,fatalError:!1};let i=await this.sendReport(r);return i.fatalError&&(this.executeRequests=!1),i}isReportEmpty(e){return ns(e.discreteEvents)&&ns(e.aggregatedEvents)&&rs(e.droppedEvents)}async sendReport(e){try{let t=await re(5e3,this.url,{method:`POST`,body:JSON.stringify(e)},this.logger),n=this.isStatusFatal(t.status);return n&&this.logger.warn(`[EventReporter] Received a fatal status response (${t.status}) from the telemetry endpoint. No more telemetry data will be sent.`),{success:t.ok,fatalError:n}}catch(e){return this.logger.warn(`[EventReporter] Error attempting to send telemetry data: ${e}`,{error:e}),{success:!1,fatalError:!1}}}isStatusFatal(e){return!!e&&e>=400&&e<500&&e!=429}},as=class{aggregate(e){if(e.events.length==0)return[];let t=new Map;for(let n of e.events){let e=JSON.stringify(n),r=t.get(e)?.count||0;t.set(e,{event:n,count:r+1})}return Array.from(t).map(([,t])=>({startTime:e.startTime,endTime:e.endTime,count:t.count,event:t.event}))}},os=class{constructor(e){this._events=[],this._droppedEventCount=0,this.limit=e??1e3}get events(){return this._events}get reachedLimit(){return this._events.length>=this.limit}get droppedEventCount(){return this._droppedEventCount}push(...e){this.startTime||(this.startTime=new Date);let t=Math.max(0,e.length-this.limit),n=e.slice(t,e.length);if(this._droppedEventCount+=t,this._events.length+n.length>this.limit){let e=this._events.length+n.length-this.limit;this._events.splice(0,e),this._droppedEventCount+=e}return this._events.push(...n)}takeSnapshot(){let e=new Date,t=this.startTime??e,n=this._events.splice(0),r=this._droppedEventCount;return this.startTime=void 0,this._droppedEventCount=0,{startTime:t,endTime:e,events:n,droppedCount:r}}clear(){this._events=[],this.startTime=void 0,this._droppedEventCount=0}},ss=class{constructor(e){this.aggregator=new as,this.collectEvents=!0,this.started=!1,this.logger=e.logger,this.evaluationEventQueue=new os(e.evaluationQueueLimit??1e3),this.flushIntervalDelay=e.flushIntervalDelay??3e4,this.initialFlushIntervalDelay=e.initialFlushIntervalDelay??5e3}start(){this.started||!this.collectEvents||(this.started=!0,this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.initialFlushIntervalDelay))}async flushAndScheduleNext(){if(!this.collectEvents)return;let e;try{e=await this.flush()}catch(t){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events: `,t),e={success:!1,fatalError:!1}}e.fatalError?(this.collectEvents=!1,this.close(),this.logger.warn(`[TelemetryEventCollector] Received a fatal error from telemetry collection. No longer collecting events.`)):this.collectEvents&&(this.cancelScheduledFlush(),this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.flushIntervalDelay))}cancelScheduledFlush(){clearTimeout(this.flushTimeout)}async close(){this.collectEvents=!1,clearTimeout(this.flushTimeout);try{await this.flush()}catch(e){this.logger.warn(`[TelemetryEventCollector] Error flushing telemetry events during close: `,e)}this.evaluationEventQueue.clear()}dispose(){this.close()}},cs=class extends Map{constructor(e,t){super(t),this._droppedCount=0,this.limit=e,this.enforceLimit()}set(e,t){return super.set(e,t),this.enforceLimit(),this}get droppedCount(){return this._droppedCount}clearAndReset(){this.clear(),this._droppedCount=0}enforceLimit(){for(;this.size>this.limit;){let e=this.keys().next().value;e!==void 0&&(this.delete(e),this._droppedCount+=1)}}},ls=class{constructor(e){this.valueIdGenerator=e,this.valueIdGenerator=e}async process(e){let t=await Promise.all(e.events.map(async e=>({...e,defaultValue:await es(e.defaultValue,this.valueIdGenerator),evaluatedValue:await es(e.evaluatedValue,this.valueIdGenerator)})));return{...e,events:t}}},us=class extends ss{constructor(e){super(e),this.reporter=new is(e),this.contexts=new cs(e.contextLimit??1e3),this.evaluationEventSnapshotPreprocessor=new ls(e.valueIdGenerator)}evaluatedConfig(e){if(!this.collectEvents)return;e.context?.id&&!e.context.anonymous&&this.contexts.set(e.context.id,e.context);let t={...e.evaluation,contextId:e.context?.anonymous?void 0:e.context?.id};this.evaluationEventQueue.push(this.sanitizeEvaluatedConfigEvent(t))}sanitizeEvaluatedConfigEvent(e){return{...e,defaultValue:ts({value:e.defaultValue,type:e.type}),evaluatedValue:ts({value:e.evaluatedValue,valueId:e.evaluatedValueId,type:e.type})}}snapshotContexts(){let e=Array.from(this.contexts.values()),t=this.contexts.droppedCount;return this.contexts.clearAndReset(),{contexts:e,droppedCount:t}}async flush(){if(!this.reporter)return{success:!1,fatalError:!1};let e=await this.evaluationEventSnapshotPreprocessor.process(this.evaluationEventQueue.takeSnapshot()),t=this.snapshotContexts();return await this.reporter?.report({context:this._context,discreteEvents:{capturedContexts:t.contexts},aggregatedEvents:{evaluatedConfig:this.aggregator.aggregate(e)},droppedEvents:{evaluatedConfig:e.droppedCount,capturedContexts:t.droppedCount}})}};const ds=(e,t)=>{let n=BigInt(0),r=BigInt(62),i=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``),a=BigInt(`0x`+i),o=``;for(;a>n;)o=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[Number(a%r)]+o,a/=r;return o.padStart(t,`0`)},fs=Math.ceil(128/Math.log2(62)),ps=async e=>ds(i(`sha256`).update(e?.toString()??``).digest().subarray(0,16),fs),ms=new URL(`https://server-sdk-api.configdirector.com`);var hs=class{constructor(e,t,r,i){this.handlersMap=new Map,this.eventEmitter=new n,this.ready=!1,this.logger=r?.logger??Zo(),this.timeout=r?.connection?.timeout??3e3,this.metaContext=r?.metadata??{},this.validateSdkKeyPresence(e),this.configEvaluator=new Fo(this.logger);let a=this.parseUrl(r?.connection?.url)??ms;this.connectionMode=r?.connection?.mode??`streaming`,this.usageEventCollector=i?.telemetry??this.buildTelemetryCollector(e,t,a,r),this.transport=i?.transport??this.buildTransport(e,t,a,r),this.transport.on(`configBundleReceived`,e=>{this.readyResolve?.(!1);let t=this.findKeysRemovedBy(e);!this.configSet||e.kind==`full`?this.configSet=e:(this.configSet.configs={...this.configSet.configs,...e.configs},this.configSet.segments={...this.configSet.segments,...e.segments});let n=Object.keys(e.configs);this.eventEmitter.emit(`configsUpdated`,{keys:n,removedKeys:t}),this.updateWatchers([...n,...t]),this.logger.debug(`[ConfigDirectorClient] ConfigSet updated from server with ${n.length} key(s) and ${t.length} removed key(s)`,{keys:n,removedKeys:t})}),this.transport.on(`connectionError`,e=>{this.logger.error(`[ConfigDirectorClient] The connection encountered an unrecoverable error and will not be retried. Configs will no longer receive updates.`,e),this.eventEmitter.emit(`connectionError`,{error:e})}),this.registerHandler(`clientReady`,r?.hooks?.clientReady),this.registerHandler(`configEvaluated`,r?.hooks?.configEvaluated),this.registerHandler(`configsUpdated`,r?.hooks?.configsUpdated),this.registerHandler(`connectionError`,r?.hooks?.connectionError)}registerHandler(e,t){if(!t)return;let n=Array.isArray(t)?t:[t];for(let t of n)typeof t==`function`&&this.on(e,t)}async initialize(){try{this.ready=!1,this.readyPromise=new Promise(e=>{this.readyResolve=e}).then(e=>{e||(this.ready=!0,this.eventEmitter.emit(`clientReady`),this.logger.debug(`[ConfigDirectorClient] Received initial payload from the server, client is ready`))}),this.usageEventCollector.start();let e=new Date().getTime();await this.transport.connect(this.timeout);let t=new Date().getTime()-e,n=this.timeout-t;if(n>0&&(await Promise.race([this.readyPromise,new Promise(e=>{this.readyTimer=setTimeout(()=>e(),n)})]),this.clearReadyTimer()),!this.ready){let e=this.connectionMode===`streaming`?`The client will continue to retry since there were no fatal errors detected. Configs will return the default value until the connection succeeds.`:`Since the client was configured without streaming, configs may not update and always return the default value.`;this.logger.warn(`[ConfigDirectorClient] Timed out waiting for initialization after ${this.timeout}ms. ${e}`)}}catch(e){this.logger.error(`[ConfigDirectorClient] An error occurred during initialization: `,e)}}resolvePollingIntervalForMode(e){if(this.connectionMode!==`polling`)return;let t=$o(e,{defaultSeconds:300,minimumSeconds:60});return t.warning&&this.logger.warn(`[ConfigDirectorClient] ${t.warning}`),t.seconds}buildTelemetryCollector(e,t,n,r){let i=r?.telemetry?.eventQueueLimit??5e3;return new us({sdkKey:e,sdkIdentity:t,metaContext:r?.metadata??{},logger:this.logger,baseUrl:n,flushIntervalDelay:r?.telemetry?.flushInterval??3e4,evaluationQueueLimit:Math.ceil(i*.7),contextLimit:Math.floor(i*.3),urlFactory:Qo,valueIdGenerator:ps})}buildTransport(e,t,n,r){return new(this.getTransportConstructor(this.connectionMode))({serverSdkKey:e,baseUrl:n,metaContext:{...r?.metadata,sdkName:t.sdkName,sdkVersion:t.sdkVersion},logger:this.logger,pollingInterval:this.resolvePollingIntervalForMode(r?.connection?.pollingInterval)})}getTransportConstructor(e){switch(e){case`polling`:return se;default:return ae}}findKeysRemovedBy(e){return!this.configSet||e.kind!=`full`?[]:Object.keys(this.configSet.configs).filter(t=>!Object.prototype.hasOwnProperty.call(e.configs,t))}updateWatchers(e){e.forEach(e=>this.updateWatchersForConfig(e))}updateWatchersForConfig(e){let t=this.configSet?.configs[e];this.handlersMap.get(e)?.forEach(n=>{let r=this.getValueFromConfigDefinition(e,t,n.defaultValue,n.context);n.handler(r)})}watch(e,t,n,r){this.validateDefaultValue(t);let i=this.handlersMap.get(e),a={handler:n,defaultValue:t,requestedType:typeof t,context:r};return i?i.push(a):this.handlersMap.set(e,[a]),()=>this.unwatch(e,n)}unwatch(e,t){let n=this.handlersMap.get(e);if(n)if(t){let e=n.findIndex(e=>e.handler==t);e>=0&&n?.splice(e,1)}else n.splice(0)}getValue(e,t,n){this.validateDefaultValue(t);let r=this.configSet?.configs[e];return this.getValueFromConfigDefinition(e,r,t,n)}getValueFromConfigDefinition(e,t,n,r){if(t){let i=this.configEvaluator.evaluate(t,{context:r,metadata:this.metaContext},this.configSet?.segments),a=zo(i,n);return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,type:i.type,defaultValue:n,requestedType:a.requestedType,evaluatedValue:a.parsedValue,evaluatedValueId:a.parsedValueId,usedDefault:a.usedDefault,evaluationReason:a.reason}}),this.dispatchEvaluationEvent({key:e,value:a.parsedValue,valueId:a.parsedValueId??void 0,isDefaultValue:a.usedDefault,reason:a.reason,context:r}),this.logger.debug(`[ConfigDirectorClient] Evaluated '${e}' to '${a.parsedValue}'`),a.parsedValue}else{this.logger.debug(`[ConfigDirectorClient] No config state found for '${e}', returning default value '${n}'`);let t=this.isReady?`config-state-missing`:`client-not-ready`;return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,defaultValue:n,requestedType:Io(n),evaluatedValue:n,usedDefault:!0,evaluationReason:t}}),this.dispatchEvaluationEvent({key:e,value:n,isDefaultValue:!0,reason:t,context:r}),n}}dispatchEvaluationEvent(e){setTimeout(()=>this.eventEmitter.emit(`configEvaluated`,{evaluation:e}),0)}parseUrl(e){if(e)try{return new URL(e)}catch(t){throw new g(`Invalid base URL '${e}'. Parsing failed: ${t}`)}}validateSdkKeyPresence(e){if(!e||e.trim().length==0)throw new g(`No server SDK key was provided, the client cannot be instantiated without a valid server SDK key`)}validateDefaultValue(e){if(e==null)throw new g(`Invalid default value. The default value for a config must be defined and non-null.`);if(typeof e==`function`)throw new g(`Invalid default value. The default value for a config cannot be a function.`)}get isReady(){return this.ready}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}removeAllObservers(){this.logger.debug(`[ConfigDirectorClient] removeAllObservers() has been called, removing all observers`),this.eventEmitter.removeAllListeners(),this.handlersMap.clear()}unwatchAll(){this.handlersMap.clear()}getAllConfigs(e){if(!this.configSet)return{};let t=Object.entries(this.configSet.configs),n=e?.configKeys?t.filter(([t])=>e.configKeys?.includes(t)):t;return Object.fromEntries(n.map(([t,n])=>[t,this.configEvaluator.evaluate(n,{context:e?.context,metadata:this.metaContext},this.configSet?.segments)]))}closeConnection(){this.logger.debug(`[ConfigDirectorClient] closeConnection() has been called, closing connection to server`),this.transport.close(),this.ready=!1}clearReadyTimer(){clearTimeout(this.readyTimer),this.readyTimer=void 0}dispose(){this.removeAllObservers(),this.closeConnection(),this.readyResolve?.(!0),this.clearReadyTimer(),this.usageEventCollector.close().catch(e=>{this.logger.warn(`[ConfigDirectorClient] Error flushing telemetry while disposing the client: `,e)})}},gs=class n{constructor(r,i){this.metadata={name:n.name},this.runsOn=`server`,this.events=new e,this.client=new hs(r,{sdkName:`js-openfeature-server-provider`,sdkVersion:`1.9.0`},i),this.readyHandler=()=>{this.events.emit(t.Ready)},this.client.on(`configsUpdated`,({keys:e,removedKeys:n})=>{this.events.emit(t.ConfigurationChanged,{flagsChanged:[...e,...n]})})}async initialize(){await this.client.initialize(),this.client.off(`clientReady`,this.readyHandler),this.client.on(`clientReady`,this.readyHandler)}resolveBooleanEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveStringEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveNumberEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveObjectEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}onClose(){return this.client.dispose(),Promise.resolve()}evaluate(e,t,n){return{value:this.client.getValue(e,t,this.mapContext(n))}}mapContext(e){if(!e)return;let t=(e.targetingKey??e.id)?.toString(),n=e.name?.toString(),r=e?.traits||{},i=typeof r==`object`&&Object.keys(r).length>0,a=e.anonymous;return{id:t,name:n,traits:i?r:void 0,anonymous:typeof a==`boolean`?a:void 0}}};export{gs as ConfigDirectorProvider};
6
6
  //# sourceMappingURL=configdirector-openfeature-server-provider.mjs.map