@ember-nexus/app-core 0.0.3 → 0.0.5

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/browser/index.js +1 -1
  3. package/dist/browser/index.js.map +1 -1
  4. package/dist/esm/BrowserEvent/GetServiceResolverEvent.js +1 -1
  5. package/dist/esm/BrowserEvent/GetServiceResolverEvent.js.map +1 -1
  6. package/dist/esm/Cache/Cache.js +0 -1
  7. package/dist/esm/Cache/Cache.js.map +1 -1
  8. package/dist/esm/Cache/ElementCache.js +1 -1
  9. package/dist/esm/Cache/ElementCache.js.map +1 -1
  10. package/dist/esm/Cache/ElementChildrenCache.js +1 -1
  11. package/dist/esm/Cache/ElementChildrenCache.js.map +1 -1
  12. package/dist/esm/Cache/ElementParentsCache.js +1 -1
  13. package/dist/esm/Cache/ElementParentsCache.js.map +1 -1
  14. package/dist/esm/Cache/ElementRelatedCache.js +1 -1
  15. package/dist/esm/Cache/ElementRelatedCache.js.map +1 -1
  16. package/dist/esm/Cache/IndexCache.js +1 -1
  17. package/dist/esm/Cache/IndexCache.js.map +1 -1
  18. package/dist/esm/Endpoint/Element/DeleteElementEndpoint.js +1 -3
  19. package/dist/esm/Endpoint/Element/DeleteElementEndpoint.js.map +1 -1
  20. package/dist/esm/Endpoint/Element/GetElementChildrenEndpoint.js +1 -4
  21. package/dist/esm/Endpoint/Element/GetElementChildrenEndpoint.js.map +1 -1
  22. package/dist/esm/Endpoint/Element/GetElementEndpoint.js +1 -4
  23. package/dist/esm/Endpoint/Element/GetElementEndpoint.js.map +1 -1
  24. package/dist/esm/Endpoint/Element/GetElementParentsEndpoint.js +1 -4
  25. package/dist/esm/Endpoint/Element/GetElementParentsEndpoint.js.map +1 -1
  26. package/dist/esm/Endpoint/Element/GetElementRelatedEndpoint.js +1 -4
  27. package/dist/esm/Endpoint/Element/GetElementRelatedEndpoint.js.map +1 -1
  28. package/dist/esm/Endpoint/Element/GetIndexEndpoint.js +1 -4
  29. package/dist/esm/Endpoint/Element/GetIndexEndpoint.js.map +1 -1
  30. package/dist/esm/Endpoint/Element/PatchElementEndpoint.js +1 -3
  31. package/dist/esm/Endpoint/Element/PatchElementEndpoint.js.map +1 -1
  32. package/dist/esm/Endpoint/Element/PostElementEndpoint.js +1 -3
  33. package/dist/esm/Endpoint/Element/PostElementEndpoint.js.map +1 -1
  34. package/dist/esm/Endpoint/Element/PostIndexEndpoint.js +1 -3
  35. package/dist/esm/Endpoint/Element/PostIndexEndpoint.js.map +1 -1
  36. package/dist/esm/Endpoint/Element/PutElementEndpoint.js +1 -3
  37. package/dist/esm/Endpoint/Element/PutElementEndpoint.js.map +1 -1
  38. package/dist/esm/Endpoint/User/DeleteTokenEndpoint.js +1 -3
  39. package/dist/esm/Endpoint/User/DeleteTokenEndpoint.js.map +1 -1
  40. package/dist/esm/Endpoint/User/GetMeEndpoint.js +1 -4
  41. package/dist/esm/Endpoint/User/GetMeEndpoint.js.map +1 -1
  42. package/dist/esm/Endpoint/User/GetTokenEndpoint.js +1 -4
  43. package/dist/esm/Endpoint/User/GetTokenEndpoint.js.map +1 -1
  44. package/dist/esm/Endpoint/User/PostChangePasswordEndpoint.js +1 -3
  45. package/dist/esm/Endpoint/User/PostChangePasswordEndpoint.js.map +1 -1
  46. package/dist/esm/Endpoint/User/PostRegisterEndpoint.js +1 -3
  47. package/dist/esm/Endpoint/User/PostRegisterEndpoint.js.map +1 -1
  48. package/dist/esm/Endpoint/User/PostTokenEndpoint.js +1 -4
  49. package/dist/esm/Endpoint/User/PostTokenEndpoint.js.map +1 -1
  50. package/dist/esm/Error/ResponseError.js +4 -4
  51. package/dist/esm/Error/ResponseError.js.map +1 -1
  52. package/dist/esm/Event/NormalizedValueToRawValueEvent.js +2 -3
  53. package/dist/esm/Event/NormalizedValueToRawValueEvent.js.map +1 -1
  54. package/dist/esm/Event/RawValueToNormalizedValueEvent.js +2 -3
  55. package/dist/esm/Event/RawValueToNormalizedValueEvent.js.map +1 -1
  56. package/dist/esm/EventListener/DateTimeNormalizedValueToRawValueEventListener.js +2 -2
  57. package/dist/esm/EventListener/DateTimeNormalizedValueToRawValueEventListener.js.map +1 -1
  58. package/dist/esm/EventListener/DateTimeRawValueToNormalizedValueEventListener.js +3 -3
  59. package/dist/esm/EventListener/DateTimeRawValueToNormalizedValueEventListener.js.map +1 -1
  60. package/dist/esm/EventListener/GenericNormalizedValueToRawValueEventListener.js +2 -2
  61. package/dist/esm/EventListener/GenericNormalizedValueToRawValueEventListener.js.map +1 -1
  62. package/dist/esm/EventListener/GenericRawValueToNormalizedValueEventListener.js +2 -2
  63. package/dist/esm/EventListener/GenericRawValueToNormalizedValueEventListener.js.map +1 -1
  64. package/dist/esm/Init.js +4 -4
  65. package/dist/esm/Init.js.map +1 -1
  66. package/dist/esm/Service/ApiConfiguration.js +1 -7
  67. package/dist/esm/Service/ApiConfiguration.js.map +1 -1
  68. package/dist/esm/Service/ApiWrapper.js +1 -22
  69. package/dist/esm/Service/ApiWrapper.js.map +1 -1
  70. package/dist/esm/Service/CollectionParser.js +1 -2
  71. package/dist/esm/Service/CollectionParser.js.map +1 -1
  72. package/dist/esm/Service/ElementParser.js +1 -2
  73. package/dist/esm/Service/ElementParser.js.map +1 -1
  74. package/dist/esm/Service/EventDispatcher.js +2 -4
  75. package/dist/esm/Service/EventDispatcher.js.map +1 -1
  76. package/dist/esm/Service/FetchHelper.js +1 -3
  77. package/dist/esm/Service/FetchHelper.js.map +1 -1
  78. package/dist/esm/Service/Logger.js +0 -1
  79. package/dist/esm/Service/Logger.js.map +1 -1
  80. package/dist/esm/Service/ServiceResolver.js +3 -2
  81. package/dist/esm/Service/ServiceResolver.js.map +1 -1
  82. package/dist/esm/Service/TokenParser.js +1 -1
  83. package/dist/esm/Service/TokenParser.js.map +1 -1
  84. package/dist/esm/Type/Definition/Event.js +1 -2
  85. package/dist/esm/Type/Definition/Event.js.map +1 -1
  86. package/dist/esm/Type/Definition/PriorityRegistry.js +3 -1
  87. package/dist/esm/Type/Definition/PriorityRegistry.js.map +1 -1
  88. package/dist/esm/Type/Definition/Registry.js +3 -1
  89. package/dist/esm/Type/Definition/Registry.js.map +1 -1
  90. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BrowserEventIdentifier:()=>p,EventIdentifier:()=>g,HttpRequestMethod:()=>y,LogLevel:()=>v,RequestProblemCategory:()=>E,ServiceIdentifier:()=>w});var r={};e.r(r),e.d(r,{customEventDefaultInit:()=>T});var n={};e.r(n),e.d(n,{GetServiceResolverEvent:()=>GetServiceResolverEvent});var i={};e.r(i),e.d(i,{exportPlaceholder:()=>b});var s={};e.r(s),e.d(s,{EmberNexusError:()=>EmberNexusError,LogicError:()=>LogicError,NetworkError:()=>NetworkError,ParseError:()=>ParseError,Response401UnauthorizedError:()=>Response401UnauthorizedError,Response403ForbiddenError:()=>Response403ForbiddenError,Response404NotFoundError:()=>Response404NotFoundError,Response429TooManyRequestsError:()=>Response429TooManyRequestsError,ResponseError:()=>ResponseError,ValidationError:()=>ValidationError});var o={};e.r(o),e.d(o,{Cache:()=>Cache,ElementCache:()=>ElementCache,ElementChildrenCache:()=>ElementChildrenCache,ElementParentsCache:()=>ElementParentsCache,ElementRelatedCache:()=>ElementRelatedCache,IndexCache:()=>IndexCache});var a={};e.r(a),e.d(a,{DeleteElementEndpoint:()=>DeleteElementEndpoint,GetElementChildrenEndpoint:()=>GetElementChildrenEndpoint,GetElementEndpoint:()=>GetElementEndpoint,GetElementParentsEndpoint:()=>GetElementParentsEndpoint,GetElementRelatedEndpoint:()=>GetElementRelatedEndpoint,GetIndexEndpoint:()=>GetIndexEndpoint,PatchElementEndpoint:()=>PatchElementEndpoint,PostElementEndpoint:()=>PostElementEndpoint,PostIndexEndpoint:()=>PostIndexEndpoint,PutElementEndpoint:()=>PutElementEndpoint});var l={};e.r(l),e.d(l,{DeleteTokenEndpoint:()=>DeleteTokenEndpoint,GetMeEndpoint:()=>GetMeEndpoint,GetTokenEndpoint:()=>GetTokenEndpoint,PostChangePasswordEndpoint:()=>PostChangePasswordEndpoint,PostRegisterEndpoint:()=>PostRegisterEndpoint,PostTokenEndpoint:()=>PostTokenEndpoint});var c={};e.r(c),e.d(c,{Element:()=>a,User:()=>l});var u={};e.r(u);var h={};e.r(h),e.d(h,{Event:()=>Event,PriorityRegistry:()=>PriorityRegistry,Registry:()=>Registry,Response:()=>u,createUniqueUserIdentifierFromString:()=>createUniqueUserIdentifierFromString,eventIdentifierRegex:()=>L,eventListenerTargetRegex:()=>C,getEventListenerTargetsFromEventIdentifier:()=>getEventListenerTargetsFromEventIdentifier,serviceIdentifierRegex:()=>I,tokenRegex:()=>P,uuidv4Regex:()=>N,validateEventIdentifierFromString:()=>validateEventIdentifierFromString,validateEventListenerTargetFromString:()=>validateEventListenerTargetFromString,validateServiceIdentifierFromString:()=>validateServiceIdentifierFromString,validateTokenFromString:()=>validateTokenFromString,validateUuidFromString:()=>validateUuidFromString});var d={};e.r(d),e.d(d,{NormalizedValueToRawValueEvent:()=>NormalizedValueToRawValueEvent,RawValueToNormalizedValueEvent:()=>RawValueToNormalizedValueEvent});var m={};e.r(m),e.d(m,{ApiConfiguration:()=>ApiConfiguration,ApiWrapper:()=>ApiWrapper,CollectionParser:()=>CollectionParser,ElementParser:()=>ElementParser,EventDispatcher:()=>EventDispatcher,FetchHelper:()=>FetchHelper,Logger:()=>Logger,ServiceResolver:()=>ServiceResolver,TokenParser:()=>TokenParser_TokenParser});var f={};e.r(f),e.d(f,{DateTimeNormalizedValueToRawValueEventListener:()=>DateTimeNormalizedValueToRawValueEventListener,DateTimeRawValueToNormalizedValueEventListener:()=>DateTimeRawValueToNormalizedValueEventListener,GenericNormalizedValueToRawValueEventListener:()=>GenericNormalizedValueToRawValueEventListener,GenericRawValueToNormalizedValueEventListener:()=>GenericRawValueToNormalizedValueEventListener,initEventListener:()=>initEventListener});var p,g,y,v,E,w,S={};e.r(S),e.d(S,{Definition:()=>h,Enum:()=>t,Partial:()=>r}),function(e){e.GetServiceResolver="ember-nexus.app-core.get-service-resolver"}(p||(p={})),function(e){e.NormalizedValueToRawValueEvent="ember-nexus.app-core.event.normalized-value-to-raw-value",e.RawValueToNormalizedValueEvent="ember-nexus.app-core.event.raw-value-to-normalized-value"}(g||(g={})),function(e){e.GET="GET",e.POST="POST",e.PATCH="PATCH",e.PUT="PUT",e.DELETE="DELETE",e.HEAD="HEAD",e.COPY="COPY",e.LOCK="LOCK",e.UNLOCK="UNLOCK",e.MKCOL="MKCOL",e.MOVE="MOVE",e.PROPFIND="PROPFIND",e.PROPPATCH="PROPPATCH"}(y||(y={})),function(e){e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(v||(v={})),function(e){e.ClientSide="client",e.ServerSide="server",e.Logic="Logic"}(E||(E={})),function(e){e.emberNexusWebSDK="ember-nexus.web-sdk",e.logger="global.logger",e.action="global.action-registry",e.setting="global.setting-registry",e.icon="global.icon-registry",e.serviceFetchHelper="ember-nexus.app-core.service.fetch-helper-service",e.serviceApiConfiguration="ember-nexus.app-core.service.api-configuration-service",e.serviceElementParser="ember-nexus.app-core.service.element-parser-service",e.serviceCollectionParser="ember-nexus.app-core.service.collection-parser-service",e.serviceTokenParser="ember-nexus.app-core.service.token-parser-service",e.serviceApiWrapper="ember-nexus.app-core.service.api-wrapper",e.serviceEventDispatcher="ember-nexus.app-core.service.event-dispatcher",e.endpointElementDeleteElementEndpoint="ember-nexus.app-core.endpoint.element.delete-element-endpoint",e.endpointElementGetElementEndpoint="ember-nexus.app-core.endpoint.element.get-element-endpoint",e.endpointElementGetElementChildrenEndpoint="ember-nexus.app-core.endpoint.element.get-element-children-endpoint",e.endpointElementGetElementParentsEndpoint="ember-nexus.app-core.endpoint.element.get-element-parents-endpoint",e.endpointElementGetElementRelatedEndpoint="ember-nexus.app-core.endpoint.element.get-element-related-endpoint",e.endpointElementGetIndexEndpoint="ember-nexus.app-core.endpoint.element.get-index-endpoint",e.endpointElementPatchElementEndpoint="ember-nexus.app-core.endpoint.element.patch-element-endpoint",e.endpointElementPostElementEndpoint="ember-nexus.app-core.endpoint.element.post-element-endpoint",e.endpointElementPostIndexEndpoint="ember-nexus.app-core.endpoint.element.post-index-endpoint",e.endpointElementPutElementEndpoint="ember-nexus.app-core.endpoint.element.put-element-endpoint",e.endpointUserDeleteTokenEndpoint="ember-nexus.app-core.endpoint.user.delete-token-endpoint",e.endpointUserGetMeEndpoint="ember-nexus.app-core.endpoint.user.get-me-endpoint",e.endpointUserGetTokenEndpoint="ember-nexus.app-core.endpoint.user.get-token-endpoint",e.endpointUserPostChangePasswordEndpoint="ember-nexus.app-core.endpoint.user.post-change-password-endpoint",e.endpointUserPostRegisterEndpoint="ember-nexus.app-core.endpoint.user.post-register-endpoint",e.endpointUserPostTokenEndpoint="ember-nexus.app-core.endpoint.user.post-token-endpoint",e.cacheElement="ember-nexus.app-core.cache.element-cache",e.cacheElementChildren="ember-nexus.app-core.cache.element-children-cache",e.cacheElementParents="ember-nexus.app-core.cache.element-parents-cache",e.cacheElementRelated="ember-nexus.app-core.cache.element-related-cache",e.cacheIndex="ember-nexus.app-core.cache.index-cache"}(w||(w={}));const T={bubbles:!0,composed:!0,cancelable:!0};class GetServiceResolverEvent extends CustomEvent{static type=p.GetServiceResolver;constructor(){super(GetServiceResolverEvent.type,{...T,detail:{serviceResolver:null}})}getServiceResolver(){return this.detail.serviceResolver}setServiceResolver(e){this.detail.serviceResolver=e}}const b=!1;class EmberNexusError extends Error{constructor(e){super(e)}}class LogicError extends EmberNexusError{constructor(e){super(e),this.name="LogicError"}}class NetworkError extends EmberNexusError{constructor(e,t){super(e),this.name="NetworkError",this.cause=t}}class ParseError extends EmberNexusError{constructor(e){super(e),this.name="ParseError"}}class ResponseError extends EmberNexusError{_type=null;_title=null;_detail=null;_status=null;constructor(e){super(e)}getType(){return this._type}setType(e){return this._type=e,this}getTitle(){return this._title}setTitle(e){return this._title=e,this}getDetail(){return this._detail}setDetail(e){return this._detail=e,this}getStatus(){return this._status}setStatus(e){return this._status=e,this}}class Response401UnauthorizedError extends ResponseError{constructor(e){super(e),this.name="Response401UnauthorizedError",this.setStatus(401)}}class Response403ForbiddenError extends ResponseError{constructor(e){super(e),this.name="Response403ForbiddenError",this.setStatus(403)}}class Response404NotFoundError extends ResponseError{constructor(e){super(e),this.name="Response404NotFoundError",this.setStatus(404)}}class Response429TooManyRequestsError extends ResponseError{constructor(e){super(e),this.name="Response429TooManyRequestsError",this.setStatus(429)}}class ValidationError extends EmberNexusError{constructor(e){super(e),this.name="ValidationError"}}class Cache{cache;has(e){return this.cache.has(e)}get(e){return this.cache.get(e)}set(e,t){return this.cache.set(e,t),this}delete(e){return this.cache.delete(e),this}setFromDataEtag(e,t,r){const n=this.cache.get(e);n&&void 0===r&&(r=n.etag);const i={data:t,etag:r};return this.cache.set(e,i),this}setFromParsedResponse(e,t){const r=t.response.headers.get("ETag");if(null===r)throw new LogicError("Expected parsedResponse to contain ETag header.");const n={data:t.data,etag:r};return this.cache.set(e,n),this}refresh(e){return this}}const O="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,k=new Set,F="object"==typeof process&&process?process:{},emitWarning=(e,t,r,n)=>{"function"==typeof F.emitWarning?F.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let x=globalThis.AbortController,D=globalThis.AbortSignal;if(void 0===x){D=class AbortSignal{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},x=class AbortController{constructor(){warnACPolyfill()}signal=new D;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==F.env?.LRU_CACHE_IGNORE_AC_WARNING;const warnACPolyfill=()=>{e&&(e=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",warnACPolyfill))}}Symbol("type");const isPosInt=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),getUintArray=e=>isPosInt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(e){super(e),this.fill(0)}}class Stack{heap;length;static#e=!1;static create(e){const t=getUintArray(e);if(!t)return[];Stack.#e=!0;const r=new Stack(e,t);return Stack.#e=!1,r}constructor(e,t){if(!Stack.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class LRUCache{#t;#r;#n;#i;#s;#o;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#c;#u;#h;#d;#m;#f;#p;#g;#y;#v;#E;#w;#S;#T;#b;#O;#k;static unsafeExposeInternals(e){return{starts:e.#w,ttls:e.#S,sizes:e.#E,keyMap:e.#u,keyList:e.#h,valList:e.#d,next:e.#m,prev:e.#f,get head(){return e.#p},get tail(){return e.#g},free:e.#y,isBackgroundFetch:t=>e.#F(t),backgroundFetch:(t,r,n,i)=>e.#x(t,r,n,i),moveToTail:t=>e.#D(t),indexes:t=>e.#L(t),rindexes:t=>e.#C(t),isStale:t=>e.#I(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#c}get size(){return this.#l}get fetchMethod(){return this.#o}get memoMethod(){return this.#a}get dispose(){return this.#n}get onInsert(){return this.#i}get disposeAfter(){return this.#s}constructor(e){const{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:a,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:m=0,maxEntrySize:f=0,sizeCalculation:p,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:S,ignoreFetchAbort:T}=e;if(0!==t&&!isPosInt(t))throw new TypeError("max option must be a nonnegative integer");const b=t?getUintArray(t):Array;if(!b)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=m,this.maxEntrySize=f||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=g,this.#b=!!g,this.#u=new Map,this.#h=new Array(t).fill(void 0),this.#d=new Array(t).fill(void 0),this.#m=new b(t),this.#f=new b(t),this.#p=0,this.#g=0,this.#y=Stack.create(t),this.#l=0,this.#c=0,"function"==typeof l&&(this.#n=l),"function"==typeof c&&(this.#i=c),"function"==typeof u?(this.#s=u,this.#v=[]):(this.#s=void 0,this.#v=void 0),this.#T=!!this.#n,this.#k=!!this.#i,this.#O=!!this.#s,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!T,0!==this.maxEntrySize){if(0!==this.#r&&!isPosInt(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=isPosInt(n)||0===n?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#N()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";if((e=>!k.has(e))(e)){k.add(e);emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,LRUCache)}}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#N(){const e=new ZeroArray(this.#t),t=new ZeroArray(this.#t);this.#S=e,this.#w=t,this.#R=(r,n,i=O.now())=>{if(t[r]=0!==n?i:0,e[r]=n,0!==n&&this.ttlAutopurge){const e=setTimeout(()=>{this.#I(r)&&this.#A(this.#h[r],"expire")},n+1);e.unref&&e.unref()}},this.#z=r=>{t[r]=0!==e[r]?O.now():0},this.#M=(n,i)=>{if(e[i]){const s=e[i],o=t[i];if(!s||!o)return;n.ttl=s,n.start=o,n.now=r||getNow();const a=n.now-o;n.remainingTTL=s-a}};let r=0;const getNow=()=>{const e=O.now();if(this.ttlResolution>0){r=e;const t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{const i=this.#u.get(n);if(void 0===i)return 0;const s=e[i],o=t[i];if(!s||!o)return 1/0;return s-((r||getNow())-o)},this.#I=n=>{const i=t[n],s=e[n];return!!s&&!!i&&(r||getNow())-i>s}}#z=()=>{};#M=()=>{};#R=()=>{};#I=()=>!1;#P(){const e=new ZeroArray(this.#t);this.#c=0,this.#E=e,this.#V=t=>{this.#c-=e[t],e[t]=0},this.#U=(e,t,r,n)=>{if(this.#F(t))return 0;if(!isPosInt(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!isPosInt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#_=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#c>r;)this.#H(!0)}this.#c+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#c)}}#V=e=>{};#_=(e,t,r)=>{};#U=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#g;this.#W(t)&&(!e&&this.#I(t)||(yield t),t!==this.#p);)t=this.#f[t]}*#C({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#p;this.#W(t)&&(!e&&this.#I(t)||(yield t),t!==this.#g);)t=this.#m[t]}#W(e){return void 0!==e&&this.#u.get(this.#h[e])===e}*entries(){for(const e of this.#L())void 0===this.#d[e]||void 0===this.#h[e]||this.#F(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*rentries(){for(const e of this.#C())void 0===this.#d[e]||void 0===this.#h[e]||this.#F(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*keys(){for(const e of this.#L()){const t=this.#h[e];void 0===t||this.#F(this.#d[e])||(yield t)}}*rkeys(){for(const e of this.#C()){const t=this.#h[e];void 0===t||this.#F(this.#d[e])||(yield t)}}*values(){for(const e of this.#L()){void 0===this.#d[e]||this.#F(this.#d[e])||(yield this.#d[e])}}*rvalues(){for(const e of this.#C()){void 0===this.#d[e]||this.#F(this.#d[e])||(yield this.#d[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#L()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;if(void 0!==i&&e(i,this.#h[r],this))return this.get(this.#h[r],t)}}forEach(e,t=this){for(const r of this.#L()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#h[r],this)}}rforEach(e,t=this){for(const r of this.#C()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#h[r],this)}}purgeStale(){let e=!1;for(const t of this.#C({allowStale:!0}))this.#I(t)&&(this.#A(this.#h[t],"expire"),e=!0);return e}info(e){const t=this.#u.get(e);if(void 0===t)return;const r=this.#d[t],n=this.#F(r)?r.__staleWhileFetching:r;if(void 0===n)return;const i={value:n};if(this.#S&&this.#w){const e=this.#S[t],r=this.#w[t];if(e&&r){const t=e-(O.now()-r);i.ttl=t,i.start=Date.now()}}return this.#E&&(i.size=this.#E[t]),i}dump(){const e=[];for(const t of this.#L({allowStale:!0})){const r=this.#h[t],n=this.#d[t],i=this.#F(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;const s={value:i};if(this.#S&&this.#w){s.ttl=this.#S[t];const e=O.now()-this.#w[t];s.start=Math.floor(Date.now()-e)}this.#E&&(s.size=this.#E[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=O.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:l=this.noUpdateTTL}=r;const c=this.#U(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let u=0===this.#l?void 0:this.#u.get(e);if(void 0===u)u=0===this.#l?this.#g:0!==this.#y.length?this.#y.pop():this.#l===this.#t?this.#H(!1):this.#l,this.#h[u]=e,this.#d[u]=t,this.#u.set(e,u),this.#m[this.#g]=u,this.#f[u]=this.#g,this.#g=u,this.#l++,this.#_(u,c,a),a&&(a.set="add"),l=!1,this.#k&&this.#i?.(t,e,"add");else{this.#D(u);const r=this.#d[u];if(t!==r){if(this.#b&&this.#F(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||s||(this.#T&&this.#n?.(t,e,"set"),this.#O&&this.#v?.push([t,e,"set"]))}else s||(this.#T&&this.#n?.(r,e,"set"),this.#O&&this.#v?.push([r,e,"set"]));if(this.#V(u),this.#_(u,c,a),this.#d[u]=t,a){a.set="replace";const e=r&&this.#F(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#k&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#S||this.#N(),this.#S&&(l||this.#R(u,n,i),a&&this.#M(a,u)),!s&&this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}return this}pop(){try{for(;this.#l;){const e=this.#d[this.#p];if(this.#H(!0),this.#F(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}}}#H(e){const t=this.#p,r=this.#h[t],n=this.#d[t];return this.#b&&this.#F(n)?n.__abortController.abort(new Error("evicted")):(this.#T||this.#O)&&(this.#T&&this.#n?.(n,r,"evict"),this.#O&&this.#v?.push([n,r,"evict"])),this.#V(t),e&&(this.#h[t]=void 0,this.#d[t]=void 0,this.#y.push(t)),1===this.#l?(this.#p=this.#g=0,this.#y.length=0):this.#p=this.#m[t],this.#u.delete(r),this.#l--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=this.#u.get(e);if(void 0!==i){const e=this.#d[i];if(this.#F(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#I(i))return r&&this.#z(i),n&&(n.has="hit",this.#M(n,i)),!0;n&&(n.has="stale",this.#M(n,i))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#u.get(e);if(void 0===n||!r&&this.#I(n))return;const i=this.#d[n];return this.#F(i)?i.__staleWhileFetching:i}#x(e,t,r,n){const i=void 0===t?void 0:this.#d[t];if(this.#F(i))return i;const s=new x,{signal:o}=r;o?.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const a={signal:s.signal,options:r,context:n},cb=(n,i=!1)=>{const{aborted:o}=s.signal,c=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,c&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!c&&!i)return fetchFail(s.signal.reason);const u=l;return this.#d[t]===l&&(void 0===n?u.__staleWhileFetching?this.#d[t]=u.__staleWhileFetching:this.#A(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,a.options))),n},fetchFail=n=>{const{aborted:i}=s.signal,o=i&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,u=l;if(this.#d[t]===l){!c||void 0===u.__staleWhileFetching?this.#A(e,"fetch"):o||(this.#d[t]=u.__staleWhileFetching)}if(a)return r.status&&void 0!==u.__staleWhileFetching&&(r.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw n};r.status&&(r.status.fetchDispatched=!0);const l=new Promise((t,n)=>{const o=this.#o?.(e,i,a);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),s.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>cb(e,!0)))})}).then(cb,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),fetchFail(e))),c=Object.assign(l,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,c,{...a.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=c,c}#F(e){if(!this.#b)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof x}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:f,forceRefresh:p=!1,status:g,signal:y}=t;if(!this.#b)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:g});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:g,signal:y};let E=this.#u.get(e);if(void 0===E){g&&(g.fetch="miss");const t=this.#x(e,E,v,f);return t.__returned=t}{const t=this.#d[E];if(this.#F(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#I(E);if(!p&&!i)return g&&(g.fetch="hit"),this.#D(E),n&&this.#z(E),g&&this.#M(g,E),t;const s=this.#x(e,E,v,f),o=void 0!==s.__staleWhileFetching&&r;return g&&(g.fetch=i?"stale":"refresh",o&&i&&(g.returnedStale=!0)),o?s.__staleWhileFetching:s.__returned=s}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#a;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:i,...s}=t,o=this.get(e,s);if(!i&&void 0!==o)return o;const a=r(e,o,{options:s,context:n});return this.set(e,a,s),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}=t,o=this.#u.get(e);if(void 0!==o){const t=this.#d[o],a=this.#F(t);return s&&this.#M(s,o),this.#I(o)?(s&&(s.get="stale"),a?(s&&r&&void 0!==t.__staleWhileFetching&&(s.returnedStale=!0),r?t.__staleWhileFetching:void 0):(i||this.#A(e,"expire"),s&&r&&(s.returnedStale=!0),r?t:void 0)):(s&&(s.get="hit"),a?t.__staleWhileFetching:(this.#D(o),n&&this.#z(o),t))}s&&(s.get="miss")}#j(e,t){this.#f[t]=e,this.#m[e]=t}#D(e){e!==this.#g&&(e===this.#p?this.#p=this.#m[e]:this.#j(this.#f[e],this.#m[e]),this.#j(this.#g,e),this.#g=e)}delete(e){return this.#A(e,"delete")}#A(e,t){let r=!1;if(0!==this.#l){const n=this.#u.get(e);if(void 0!==n)if(r=!0,1===this.#l)this.#Z(t);else{this.#V(n);const r=this.#d[n];if(this.#F(r)?r.__abortController.abort(new Error("deleted")):(this.#T||this.#O)&&(this.#T&&this.#n?.(r,e,t),this.#O&&this.#v?.push([r,e,t])),this.#u.delete(e),this.#h[n]=void 0,this.#d[n]=void 0,n===this.#g)this.#g=this.#f[n];else if(n===this.#p)this.#p=this.#m[n];else{const e=this.#f[n];this.#m[e]=this.#m[n];const t=this.#m[n];this.#f[t]=this.#f[n]}this.#l--,this.#y.push(n)}}if(this.#O&&this.#v?.length){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}return r}clear(){return this.#Z("delete")}#Z(e){for(const t of this.#C({allowStale:!0})){const r=this.#d[t];if(this.#F(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#h[t];this.#T&&this.#n?.(r,n,e),this.#O&&this.#v?.push([r,n,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#h.fill(void 0),this.#S&&this.#w&&(this.#S.fill(0),this.#w.fill(0)),this.#E&&this.#E.fill(0),this.#p=0,this.#g=0,this.#y.length=0,this.#c=0,this.#l=0,this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}}}class ElementCache extends Cache{static identifier=w.cacheElement;constructor(){super(),this.cache=new LRUCache({max:500})}static constructFromServiceResolver(){return new ElementCache}static createCacheKey(e){return`${e}`}setFromCollection(e){for(let t=0;t<e.nodes.length;t++)this.setFromDataEtag(ElementCache.createCacheKey(e.nodes[t].id),e.nodes[t]);for(let t=0;t<e.relations.length;t++)this.setFromDataEtag(ElementCache.createCacheKey(e.relations[t].id),e.relations[t]);return this}}class ElementChildrenCache extends Cache{static identifier=w.cacheElementChildren;constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementChildrenCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class ElementParentsCache extends Cache{static identifier=w.cacheElementParents;constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementParentsCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class ElementRelatedCache extends Cache{static identifier=w.cacheElementRelated;constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementRelatedCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class IndexCache extends Cache{static identifier=w.cacheIndex;constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new IndexCache}static createCacheKey(e,t){return`${e}-${t}`}}class DeleteElementEndpoint{logger;fetchHelper;static identifier=w.endpointElementDeleteElementEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new DeleteElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async deleteElement(e){try{const t=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP DELETE request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(r),{response:r}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementChildrenEndpoint{logger;fetchHelper;collectionParser;static identifier=w.endpointElementGetElementChildrenEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementChildrenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementChildren(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/children?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementEndpoint{logger;fetchHelper;elementParser;static identifier=w.endpointElementGetElementEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP GET request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultGetOptions(t)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===n.status)return{response:n};const i=await this.fetchHelper.parseJsonResponse(n);return{data:await this.elementParser.deserializeElement(i),response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementParentsEndpoint{logger;fetchHelper;collectionParser;static identifier=w.endpointElementGetElementParentsEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementParentsEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementParents(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/parents?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementRelatedEndpoint{logger;fetchHelper;collectionParser;static identifier=w.endpointElementGetElementRelatedEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementRelatedEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementRelated(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/related?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetIndexEndpoint{logger;fetchHelper;collectionParser;static identifier=w.endpointElementGetIndexEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetIndexEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getIndex(e=1,t=25,r){try{if(e<1)throw new ValidationError("Page number must be at least 1.");if(t<1)throw new ValidationError("Page size must be at least 1.");const n=this.fetchHelper.buildUrl(`/?page=${e}&pageSize=${t}`);this.logger.debug(`Executing HTTP GET request against URL: ${n}`);const i=await fetch(n,this.fetchHelper.getDefaultGetOptions(r)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const s=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(s),response:i}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PatchElementEndpoint{logger;fetchHelper;static identifier=w.endpointElementPatchElementEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PatchElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async patchElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PATCH request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPatchOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostElementEndpoint{logger;fetchHelper;static identifier=w.endpointElementPostElementEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP POST request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPostOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(n),response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostIndexEndpoint{logger;fetchHelper;static identifier=w.endpointElementPostIndexEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostIndexEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postIndex(e){try{const t=this.fetchHelper.buildUrl("/");this.logger.debug(`Executing HTTP POST request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultPostOptions(JSON.stringify(e))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(r),response:r}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PutElementEndpoint{logger;fetchHelper;static identifier=w.endpointElementPutElementEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PutElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async putElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PUT request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPutOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class DeleteTokenEndpoint{logger;fetchHelper;static identifier=w.endpointUserDeleteTokenEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new DeleteTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async deleteToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP DELETE request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(t),{response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetMeEndpoint{logger;fetchHelper;elementParser;static identifier=w.endpointUserGetMeEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetMeEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getMe(){try{const e=this.fetchHelper.buildUrl("/me");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("User"!==n.type)throw new LogicError("Expected node to be of type 'User'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetTokenEndpoint{logger;fetchHelper;elementParser;static identifier=w.endpointUserGetTokenEndpoint;constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("Token"!==n.type)throw new LogicError("Expected node to be of type 'Token'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostChangePasswordEndpoint{logger;fetchHelper;static identifier=w.endpointUserPostChangePasswordEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostChangePasswordEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postChangePassword(e,t,r){try{const n=this.fetchHelper.buildUrl("/change-password");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"ActionChangePassword",currentPassword:t,newPassword:r,uniqueUserIdentifier:e},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(s),{response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostRegisterEndpoint{logger;fetchHelper;static identifier=w.endpointUserPostRegisterEndpoint;constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostRegisterEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postRegister(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/register");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"User",uniqueUserIdentifier:e,password:t,data:r},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(s),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostTokenEndpoint{logger;tokenParser;fetchHelper;static identifier=w.endpointUserPostTokenEndpoint;constructor(e,t,r){this.logger=e,this.tokenParser=t,this.fetchHelper=r}static constructFromServiceResolver(e){return new PostTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceTokenParser),e.getServiceOrFail(w.serviceFetchHelper))}async postToken(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"Token",uniqueUserIdentifier:e,password:t,data:r},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),o=await this.fetchHelper.parseJsonResponse(s);return{data:this.tokenParser.rawTokenToToken(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class Event{identifier;stopped=!1;constructor(e){this.identifier=e}getIdentifier(){return this.identifier}isPropagationStopped(){return this.stopped}stopPropagation(){return this.stopped=!0,this}}const L=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;function validateEventIdentifierFromString(e){if(!L.test(e))throw new ParseError("Passed variable is not a valid event identifier.");return e}const C=/^(?:([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*|\*|([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*(\.\*))$/;function validateEventListenerTargetFromString(e){if(!C.test(e))throw new ParseError("Passed variable is not a valid event listener target.");return e}function getEventListenerTargetsFromEventIdentifier(e){const t=e.split("."),r=[];r.push(validateEventListenerTargetFromString(e));for(let e=t.length-1;e>0;e--)r.push(validateEventListenerTargetFromString(t.slice(0,e).join(".")+".*"));return r.push(validateEventListenerTargetFromString("*")),r}class PriorityRegistry{entries=new Map;clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){if(!this.hasEntry(e))return null;const t=this.entries.get(e);return t[t.length-1].entry}hasEntry(e){return this.entries.has(e)}setEntry(e,t,r){let n;void 0===r&&(r=0),this.entries.has(e)?n=this.entries.get(e):(n=[],this.entries.set(e,n));let i=0,s=n.length-1,o=-1;for(;i<=s;){const e=Math.floor((i+s)/2);n[e].priority>=r?(o=e,s=e-1):i=e+1}const a=-1===o?i:o;return n.splice(a,0,{priority:r,entry:t}),this}getAllEntriesForKey(e){return this.entries.has(e)?this.entries.get(e).map(e=>e.entry):null}}class Registry{entries=new Map;clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){return this.hasEntry(e)?this.entries.get(e):null}hasEntry(e){return this.entries.has(e)}setEntry(e,t){return this.entries.set(e,t),this}}const I=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;function validateServiceIdentifierFromString(e){if(!I.test(e))throw new ParseError("Passed variable is not a valid service identifier.");return e}const P=/^secret-token:.+$/;function validateTokenFromString(e){if(!P.test(e))throw new Error("Passed variable is not a valid token.");return e}function createUniqueUserIdentifierFromString(e){return e}const N=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function validateUuidFromString(e){if(!N.test(e))throw new ParseError("Passed variable is not a valid UUID v4.");return e}class NormalizedValueToRawValueEvent extends Event{normalizedValue;static identifier=g.NormalizedValueToRawValueEvent;rawValue=null;constructor(e){super(NormalizedValueToRawValueEvent.identifier),this.normalizedValue=e}getNormalizedValue(){return this.normalizedValue}getRawValue(){return this.rawValue}setRawValue(e){return this.isPropagationStopped()||(this.rawValue=e),this}}class RawValueToNormalizedValueEvent extends Event{rawValue;static identifier=g.RawValueToNormalizedValueEvent;normalizedValue=null;constructor(e){super(RawValueToNormalizedValueEvent.identifier),this.rawValue=e}getRawValue(){return this.rawValue}getNormalizedValue(){return this.normalizedValue}setNormalizedValue(e){return this.isPropagationStopped()||(this.normalizedValue=e),this}}class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(e){super(`Invalid unit ${e}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const R="numeric",A="short",z="long",M={year:R,month:R,day:R},V={year:R,month:A,day:R},U={year:R,month:A,day:R,weekday:A},_={year:R,month:z,day:R},H={year:R,month:z,day:R,weekday:z},W={hour:R,minute:R},j={hour:R,minute:R,second:R},Z={hour:R,minute:R,second:R,timeZoneName:A},$={hour:R,minute:R,second:R,timeZoneName:z},G={hour:R,minute:R,hourCycle:"h23"},q={hour:R,minute:R,second:R,hourCycle:"h23"},B={hour:R,minute:R,second:R,hourCycle:"h23",timeZoneName:A},J={hour:R,minute:R,second:R,hourCycle:"h23",timeZoneName:z},Y={year:R,month:R,day:R,hour:R,minute:R},K={year:R,month:R,day:R,hour:R,minute:R,second:R},Q={year:R,month:A,day:R,hour:R,minute:R},X={year:R,month:A,day:R,hour:R,minute:R,second:R},ee={year:R,month:A,day:R,weekday:A,hour:R,minute:R},te={year:R,month:z,day:R,hour:R,minute:R,timeZoneName:A},re={year:R,month:z,day:R,hour:R,minute:R,second:R,timeZoneName:A},ne={year:R,month:z,day:R,weekday:z,hour:R,minute:R,timeZoneName:z},ie={year:R,month:z,day:R,weekday:z,hour:R,minute:R,second:R,timeZoneName:z};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(e,t){throw new ZoneIsAbstractError}formatOffset(e,t){throw new ZoneIsAbstractError}offset(e){throw new ZoneIsAbstractError}equals(e){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let se=null;class SystemZone extends Zone{static get instance(){return null===se&&(se=new SystemZone),se}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const oe=new Map;const ae={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};const le=new Map;class IANAZone extends Zone{static create(e){let t=le.get(e);return void 0===t&&le.set(e,t=new IANAZone(e)),t}static resetCache(){le.clear(),oe.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(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=IANAZone.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r,this.name)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=function makeDTF(e){let t=oe.get(e);return void 0===t&&(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"}),oe.set(e,t)),t}(this.name);let[n,i,s,o,a,l,c]=r.formatToParts?function partsOffset(e,t){const r=e.formatToParts(t),n=[];for(let e=0;e<r.length;e++){const{type:t,value:i}=r[e],s=ae[t];"era"===t?n[s]=i:isUndefined(s)||(n[s]=parseInt(i,10))}return n}(r,t):function hackyOffset(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,s,o,a,l,c,u]=n;return[o,i,s,a,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const h=u%1e3;return u-=h>=0?h:1e3+h,(objToLocalTS({year:n,month:i,day:s,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let ce={};const ue=new Map;function getCachedDTF(e,t={}){const r=JSON.stringify([e,t]);let n=ue.get(r);return void 0===n&&(n=new Intl.DateTimeFormat(e,t),ue.set(r,n)),n}const he=new Map;const de=new Map;let me=null;const fe=new Map;function getCachedIntResolvedOptions(e){let t=fe.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),fe.set(e,t)),t}const pe=new Map;function listStuff(e,t,r,n){const i=e.listingMode();return"error"===i?null:"en"===i?r(t):n(t)}class PolyNumberFormatter{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:i,...s}=r;if(!t||Object.keys(s).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function getCachedINF(e,t={}){const r=JSON.stringify([e,t]);let n=he.get(r);return void 0===n&&(n=new Intl.NumberFormat(e,t),he.set(r,n)),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return padStart(this.floor?Math.floor(e):roundTo(e,3),this.padTo)}}class PolyDateFormatter{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&IANAZone.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=getCachedDTF(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(e,t,r){this.opts={style:"long",...r},!t&&hasRelative()&&(this.rtf=function getCachedRTF(e,t={}){const{base:r,...n}=t,i=JSON.stringify([e,n]);let s=de.get(i);return void 0===s&&(s=new Intl.RelativeTimeFormat(e,t),de.set(i,s)),s}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function formatRelativeTime(e,t,r="always",n=!1){const 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."]},s=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&s){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${i[e][0]}`;case-1:return r?"yesterday":`last ${i[e][0]}`;case 0:return r?"today":`this ${i[e][0]}`}}const o=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=i[e],u=n?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return o?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const ge={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(e){return Locale.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,i=!1){const s=e||Settings.defaultLocale,o=s||(i?"en-US":function systemLocale(){return me||(me=(new Intl.DateTimeFormat).resolvedOptions().locale,me)}()),a=t||Settings.defaultNumberingSystem,l=r||Settings.defaultOutputCalendar,c=validateWeekSettings(n)||Settings.defaultWeekSettings;return new Locale(o,a,l,c,s)}static resetCache(){me=null,ue.clear(),he.clear(),de.clear(),fe.clear(),pe.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Locale.create(e,t,r,n)}constructor(e,t,r,n,i){const[s,o,a]=function parseLocaleString(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,n;try{t=getCachedDTF(e).resolvedOptions(),n=e}catch(i){const s=e.substring(0,r);t=getCachedDTF(s).resolvedOptions(),n=s}const{numberingSystem:i,calendar:s}=t;return[n,i,s]}}(e);this.locale=s,this.numberingSystem=t||o||null,this.outputCalendar=r||a||null,this.weekSettings=n,this.intl=function intlConfigString(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(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 null==this.fastNumbersCached&&(this.fastNumbersCached=function supportsFastNumbers(e){return(!e.numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===getCachedIntResolvedOptions(e.locale).numberingSystem)}(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Locale.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,validateWeekSettings(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return listStuff(this,e,months,()=>{const r=t?{month:e,day:"numeric"}:{month:e},n=t?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=function mapMonths(e){const t=[];for(let r=1;r<=12;r++){const n=DateTime.utc(2009,r,1);t.push(e(n))}return t}(e=>this.extract(e,r,"month"))),this.monthsCache[n][e]})}weekdays(e,t=!1){return listStuff(this,e,weekdays,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function mapWeekdays(e){const t=[];for(let r=1;r<=7;r++){const n=DateTime.utc(2016,11,13+r);t.push(e(n))}return t}(e=>this.extract(e,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return listStuff(this,void 0,()=>Me,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return listStuff(this,e,eras,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===r);return n?n.value:null}numberFormatter(e={}){return new PolyNumberFormatter(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new PolyDateFormatter(e,this.intl,t)}relFormatter(e={}){return new PolyRelFormatter(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function getCachedLF(e,t={}){const r=JSON.stringify([e,t]);let n=ce[r];return n||(n=new Intl.ListFormat(e,t),ce[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?function getCachedWeekInfo(e){let t=pe.get(e);if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...ge,...t}),pe.set(e,t)}return t}(this.locale):ge}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 ye=null;class FixedOffsetZone extends Zone{static get utcInstance(){return null===ye&&(ye=new FixedOffsetZone(0)),ye}static instance(e){return 0===e?FixedOffsetZone.utcInstance:new FixedOffsetZone(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new FixedOffsetZone(signedOffset(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return formatOffset(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{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 normalizeZone(e,t){if(isUndefined(e)||null===e)return t;if(e instanceof Zone)return e;if(function isString(e){return"string"==typeof e}(e)){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?SystemZone.instance:"utc"===r||"gmt"===r?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(r)||IANAZone.create(e)}return isNumber(e)?FixedOffsetZone.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new InvalidZone(e)}const ve={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ee={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]},we=ve.hanidec.replace(/[\[|\]]/g,"").split("");const Se=new Map;function digitRegex({numberingSystem:e},t=""){const r=e||"latn";let n=Se.get(r);void 0===n&&(n=new Map,Se.set(r,n));let i=n.get(t);return void 0===i&&(i=new RegExp(`${ve[r]}${t}`),n.set(t,i)),i}let Te,now=()=>Date.now(),be="system",Oe=null,ke=null,Fe=null,xe=60,De=null;class Settings{static get now(){return now}static set now(e){now=e}static set defaultZone(e){be=e}static get defaultZone(){return normalizeZone(be,SystemZone.instance)}static get defaultLocale(){return Oe}static set defaultLocale(e){Oe=e}static get defaultNumberingSystem(){return ke}static set defaultNumberingSystem(e){ke=e}static get defaultOutputCalendar(){return Fe}static set defaultOutputCalendar(e){Fe=e}static get defaultWeekSettings(){return De}static set defaultWeekSettings(e){De=validateWeekSettings(e)}static get twoDigitCutoffYear(){return xe}static set twoDigitCutoffYear(e){xe=e%100}static get throwOnInvalid(){return Te}static set throwOnInvalid(e){Te=e}static resetCaches(){Locale.resetCache(),IANAZone.resetCache(),DateTime.resetCache(),function resetDigitRegexCache(){Se.clear()}()}}class Invalid{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Le=[0,31,59,90,120,151,181,212,243,273,304,334],Ce=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(e,t){return new Invalid("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function dayOfWeek(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return 0===i?7:i}function computeOrdinal(e,t,r){return r+(isLeapYear(e)?Ce:Le)[t-1]}function uncomputeOrdinal(e,t){const r=isLeapYear(e)?Ce:Le,n=r.findIndex(e=>e<t);return{month:n+1,day:t-r[n]}}function isoWeekdayToLocal(e,t){return(e-t+7)%7+1}function gregorianToWeek(e,t=4,r=1){const{year:n,month:i,day:s}=e,o=computeOrdinal(n,i,s),a=isoWeekdayToLocal(dayOfWeek(n,i,s),r);let l,c=Math.floor((o-a+14-t)/7);return c<1?(l=n-1,c=weeksInWeekYear(l,t,r)):c>weeksInWeekYear(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...timeObject(e)}}function weekToGregorian(e,t=4,r=1){const{weekYear:n,weekNumber:i,weekday:s}=e,o=isoWeekdayToLocal(dayOfWeek(n,1,t),r),a=daysInYear(n);let l,c=7*i+s-o-7+t;c<1?(l=n-1,c+=daysInYear(l)):c>a?(l=n+1,c-=daysInYear(n)):l=n;const{month:u,day:h}=uncomputeOrdinal(l,c);return{year:l,month:u,day:h,...timeObject(e)}}function gregorianToOrdinal(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:computeOrdinal(t,r,n),...timeObject(e)}}function ordinalToGregorian(e){const{year:t,ordinal:r}=e,{month:n,day:i}=uncomputeOrdinal(t,r);return{year:t,month:n,day:i,...timeObject(e)}}function usesLocalWeekValues(e,t){if(!isUndefined(e.localWeekday)||!isUndefined(e.localWeekNumber)||!isUndefined(e.localWeekYear)){if(!isUndefined(e.weekday)||!isUndefined(e.weekNumber)||!isUndefined(e.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined(e.localWeekday)||(e.weekday=e.localWeekday),isUndefined(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),isUndefined(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidGregorianData(e){const t=isInteger(e.year),r=integerBetween(e.month,1,12),n=integerBetween(e.day,1,daysInMonth(e.year,e.month));return t?r?!n&&unitOutOfRange("day",e.day):unitOutOfRange("month",e.month):unitOutOfRange("year",e.year)}function hasInvalidTimeData(e){const{hour:t,minute:r,second:n,millisecond:i}=e,s=integerBetween(t,0,23)||24===t&&0===r&&0===n&&0===i,o=integerBetween(r,0,59),a=integerBetween(n,0,59),l=integerBetween(i,0,999);return s?o?a?!l&&unitOutOfRange("millisecond",i):unitOutOfRange("second",n):unitOutOfRange("minute",r):unitOutOfRange("hour",t)}function isUndefined(e){return void 0===e}function isNumber(e){return"number"==typeof e}function isInteger(e){return"number"==typeof e&&e%1==0}function hasRelative(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function hasLocaleWeekInfo(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function bestBy(e,t,r){if(0!==e.length)return e.reduce((e,n)=>{const i=[t(n),n];return e&&r(e[0],i[0])===e[0]?e:i},null)[1]}function util_hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function validateWeekSettings(e){if(null==e)return null;if("object"!=typeof e)throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(e.firstDay,1,7)||!integerBetween(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!integerBetween(e,1,7)))throw new InvalidArgumentError("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function integerBetween(e,t,r){return isInteger(e)&&e>=t&&e<=r}function padStart(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function parseInteger(e){return isUndefined(e)||null===e||""===e?void 0:parseInt(e,10)}function parseFloating(e){return isUndefined(e)||null===e||""===e?void 0:parseFloat(e)}function parseMillis(e){if(!isUndefined(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function roundTo(e,t,r=!1){const n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function daysInYear(e){return isLeapYear(e)?366:365}function daysInMonth(e,t){const r=function floorMod(e,t){return e-t*Math.floor(e/t)}(t-1,12)+1;return 2===r?isLeapYear(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function objToLocalTS(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 firstWeekOffset(e,t,r){return-isoWeekdayToLocal(dayOfWeek(e,1,t),r)+t-1}function weeksInWeekYear(e,t=4,r=1){const n=firstWeekOffset(e,t,r),i=firstWeekOffset(e+1,t,r);return(daysInYear(e)-n+i)/7}function untruncateYear(e){return e>99?e:e>Settings.twoDigitCutoffYear?1900+e:2e3+e}function parseZoneInfo(e,t,r,n=null){const i=new Date(e),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);const o={timeZoneName:t,...s},a=new Intl.DateTimeFormat(r,o).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function signedOffset(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function asNumber(e){const t=Number(e);if("boolean"==typeof e||""===e||Number.isNaN(t))throw new InvalidArgumentError(`Invalid unit value ${e}`);return t}function normalizeObject(e,t){const r={};for(const n in e)if(util_hasOwnProperty(e,n)){const i=e[n];if(null==i)continue;r[t(n)]=asNumber(i)}return r}function formatOffset(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${padStart(r,2)}:${padStart(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${padStart(r,2)}${padStart(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function timeObject(e){return function util_pick(e,t){return t.reduce((t,r)=>(t[r]=e[r],t),{})}(e,["hour","minute","second","millisecond"])}const Ie=["January","February","March","April","May","June","July","August","September","October","November","December"],Pe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ne=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(e){switch(e){case"narrow":return[...Ne];case"short":return[...Pe];case"long":return[...Ie];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 Re=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ae=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ze=["M","T","W","T","F","S","S"];function weekdays(e){switch(e){case"narrow":return[...ze];case"short":return[...Ae];case"long":return[...Re];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Me=["AM","PM"],Ve=["Before Christ","Anno Domini"],Ue=["BC","AD"],_e=["B","A"];function eras(e){switch(e){case"narrow":return[..._e];case"short":return[...Ue];case"long":return[...Ve];default:return null}}function stringifyTokens(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const He={D:M,DD:V,DDD:_,DDDD:H,t:W,tt:j,ttt:Z,tttt:$,T:G,TT:q,TTT:B,TTTT:J,f:Y,ff:Q,fff:te,ffff:ne,F:K,FF:X,FFF:re,FFFF:ie};class Formatter{static create(e,t={}){return new Formatter(e,t)}static parseFormat(e){let t=null,r="",n=!1;const i=[];for(let s=0;s<e.length;s++){const o=e.charAt(s);"'"===o?(r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return He[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return 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){if(this.opts.forceSimple)return padStart(e,t);const r={...this.opts};return t>0&&(r.padTo=t),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,string=(t,r)=>this.loc.extract(e,t,r),formatOffset=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",meridiem=()=>r?function meridiemForDateTime(e){return Me[e.hour<12?0:1]}(e):string({hour:"numeric",hourCycle:"h12"},"dayperiod"),month=(t,n)=>r?function monthForDateTime(e,t){return months(t)[e.month-1]}(e,t):string(n?{month:t}:{month:t,day:"numeric"},"month"),weekday=(t,n)=>r?function weekdayForDateTime(e,t){return weekdays(t)[e.weekday-1]}(e,t):string(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),maybeMacro=t=>{const r=Formatter.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},era=t=>r?function eraForDateTime(e,t){return eras(t)[e.year<0?0:1]}(e,t):string({era:t},"era");return stringifyTokens(Formatter.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return formatOffset({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return formatOffset({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return formatOffset({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return meridiem();case"d":return n?string({day:"numeric"},"day"):this.num(e.day);case"dd":return n?string({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return weekday("short",!0);case"cccc":return weekday("long",!0);case"ccccc":return weekday("narrow",!0);case"EEE":return weekday("short",!1);case"EEEE":return weekday("long",!1);case"EEEEE":return weekday("narrow",!1);case"L":return n?string({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?string({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return month("short",!0);case"LLLL":return month("long",!0);case"LLLLL":return month("narrow",!0);case"M":return n?string({month:"numeric"},"month"):this.num(e.month);case"MM":return n?string({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return month("short",!1);case"MMMM":return month("long",!1);case"MMMMM":return month("narrow",!1);case"y":return n?string({year:"numeric"},"year"):this.num(e.year);case"yy":return n?string({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?string({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?string({year:"numeric"},"year"):this.num(e.year,6);case"G":return era("short");case"GG":return era("long");case"GGGGG":return era("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return maybeMacro(t)}})}formatDurationFromString(e,t){const tokenToField=e=>{switch(e[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=Formatter.parseFormat(t),n=r.reduce((e,{literal:t,val:r})=>t?e:e.concat(r),[]);return stringifyTokens(r,(e=>t=>{const r=tokenToField(t);return r?this.num(e.get(r),t.length):t})(e.shiftTo(...n.map(tokenToField).filter(e=>e))))}}const We=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function combineExtractors(...e){return t=>e.reduce(([e,r,n],i)=>{const[s,o,a]=i(t,n);return[{...e,...s},o||r,a]},[{},null,1]).slice(0,2)}function parse(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function simpleParse(...e){return(t,r)=>{const n={};let i;for(i=0;i<e.length;i++)n[e[i]]=parseInteger(t[r+i]);return[n,null,r+i]}}const je=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Ze=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,$e=RegExp(`${Ze.source}${`(?:${je.source}?(?:\\[(${We.source})\\])?)?`}`),Ge=RegExp(`(?:T${$e.source})?`),qe=simpleParse("weekYear","weekNumber","weekDay"),Be=simpleParse("year","ordinal"),Je=RegExp(`${Ze.source} ?(?:${je.source}|(${We.source}))?`),Ye=RegExp(`(?: ${Je.source})?`);function regexParser_int(e,t,r){const n=e[t];return isUndefined(n)?r:parseInteger(n)}function extractISOTime(e,t){return[{hours:regexParser_int(e,t,0),minutes:regexParser_int(e,t+1,0),seconds:regexParser_int(e,t+2,0),milliseconds:parseMillis(e[t+3])},null,t+4]}function extractISOOffset(e,t){const r=!e[t]&&!e[t+1],n=signedOffset(e[t+1],e[t+2]);return[{},r?null:FixedOffsetZone.instance(n),t+3]}function extractIANAZone(e,t){return[{},e[t]?IANAZone.create(e[t]):null,t+1]}const Ke=RegExp(`^T?${Ze.source}$`),Qe=/^-?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 extractISODuration(e){const[t,r,n,i,s,o,a,l,c]=e,u="-"===t[0],h=l&&"-"===l[0],maybeNegate=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:maybeNegate(parseFloating(r)),months:maybeNegate(parseFloating(n)),weeks:maybeNegate(parseFloating(i)),days:maybeNegate(parseFloating(s)),hours:maybeNegate(parseFloating(o)),minutes:maybeNegate(parseFloating(a)),seconds:maybeNegate(parseFloating(l),"-0"===l),milliseconds:maybeNegate(parseMillis(c),h)}]}const Xe={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(e,t,r,n,i,s,o){const a={year:2===t.length?untruncateYear(parseInteger(t)):parseInteger(t),month:Pe.indexOf(r)+1,day:parseInteger(n),hour:parseInteger(i),minute:parseInteger(s)};return o&&(a.second=parseInteger(o)),e&&(a.weekday=e.length>3?Re.indexOf(e)+1:Ae.indexOf(e)+1),a}const et=/^(?:(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 extractRFC2822(e){const[,t,r,n,i,s,o,a,l,c,u,h]=e,d=fromStrings(t,i,n,r,s,o,a);let m;return m=l?Xe[l]:c?0:signedOffset(u,h),[d,new FixedOffsetZone(m)]}const tt=/^(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$/,rt=/^(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$/,nt=/^(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 extractRFC1123Or850(e){const[,t,r,n,i,s,o,a]=e;return[fromStrings(t,i,n,r,s,o,a),FixedOffsetZone.utcInstance]}function extractASCII(e){const[,t,r,n,i,s,o,a]=e;return[fromStrings(t,a,r,n,i,s,o),FixedOffsetZone.utcInstance]}const it=combineRegexes(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ge),st=combineRegexes(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ge),ot=combineRegexes(/(\d{4})-?(\d{3})/,Ge),at=combineRegexes($e),lt=combineExtractors(function extractISOYmd(e,t){return[{year:regexParser_int(e,t),month:regexParser_int(e,t+1,1),day:regexParser_int(e,t+2,1)},null,t+3]},extractISOTime,extractISOOffset,extractIANAZone),ct=combineExtractors(qe,extractISOTime,extractISOOffset,extractIANAZone),ut=combineExtractors(Be,extractISOTime,extractISOOffset,extractIANAZone),ht=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const dt=combineExtractors(extractISOTime);const mt=combineRegexes(/(\d{4})-(\d\d)-(\d\d)/,Ye),ft=combineRegexes(Je),pt=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const gt="Invalid Duration",yt={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},vt={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...yt},Et=365.2425,wt=30.436875,St={years:{quarters:4,months:12,weeks:52.1775,days:Et,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:wt,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...yt},Tt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],bt=Tt.slice(0).reverse();function clone(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new Duration(n)}function durationToMillis(e,t){let r=t.milliseconds??0;for(const n of bt.slice(1))t[n]&&(r+=t[n]*e[n].milliseconds);return r}function normalizeValues(e,t){const r=durationToMillis(e,t)<0?-1:1;Tt.reduceRight((n,i)=>{if(isUndefined(t[i]))return n;if(n){const s=t[n]*r,o=e[i][n],a=Math.floor(s/o);t[i]+=a*r,t[n]-=a*o*r}return i},null),Tt.reduce((r,n)=>{if(isUndefined(t[n]))return r;if(r){const i=t[r]%1;t[r]-=i,t[n]+=i*e[r][n]}return n},null)}class Duration{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?St:vt;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Locale.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return Duration.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Duration({values:normalizeObject(e,Duration.normalizeUnit),loc:Locale.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(isNumber(e))return Duration.fromMillis(e);if(Duration.isDuration(e))return e;if("object"==typeof e)return Duration.fromObject(e);throw new InvalidArgumentError(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=function parseISODuration(e){return parse(e,[Qe,extractISODuration])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=function parseISOTimeOnly(e){return parse(e,[Ke,dt])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDurationError(r);return new Duration({invalid:r})}static normalizeUnit(e){const 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():e];if(!t)throw new InvalidUnitError(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={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?Formatter.create(this.loc,r).formatDurationFromString(this,e):gt}toHuman(e={}){if(!this.isValid)return gt;const t=Tt.map(t=>{const r=this.values[t];return isUndefined(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:t.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return DateTime.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?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e),r={};for(const e of Tt)(util_hasOwnProperty(t.values,e)||util_hasOwnProperty(this.values,e))&&(r[e]=t.get(e)+this.get(e));return clone(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=asNumber(e(this.values[r],r));return clone(this,{values:t},!0)}get(e){return this[Duration.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return clone(this,{values:{...this.values,...normalizeObject(e,Duration.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return normalizeValues(this.matrix,e),clone(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return clone(this,{values:function removeZeroes(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>Duration.normalizeUnit(e));const t={},r={},n=this.toObject();let i;for(const s of Tt)if(e.indexOf(s)>=0){i=s;let e=0;for(const t in r)e+=this.matrix[t][s]*r[t],r[t]=0;isNumber(n[s])&&(e+=n[s]);const o=Math.trunc(e);t[s]=o,r[s]=(1e3*e-1e3*o)/1e3}else isNumber(n[s])&&(r[s]=n[s]);for(const e in r)0!==r[e]&&(t[i]+=e===i?r[e]:r[e]/this.matrix[i][e]);return normalizeValues(this.matrix,t),clone(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return clone(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 null===this.invalid}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)return!1;if(!this.loc.equals(e.loc))return!1;function eq(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const t of Tt)if(!eq(this.values[t],e.values[t]))return!1;return!0}}const Ot="Invalid Interval";class Interval{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidIntervalError(r);return new Interval({invalid:r})}static fromDateTimes(e,t){const r=friendlyDateTime(e),n=friendlyDateTime(t),i=function validateStartEnd(e,t){return e&&e.isValid?t&&t.isValid?t<e?Interval.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:Interval.invalid("missing or invalid end"):Interval.invalid("missing or invalid start")}(r,n);return null==i?new Interval({start:r,end:n}):i}static after(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n,n.plus(r))}static before(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,s,o;try{e=DateTime.fromISO(r,t),i=e.isValid}catch(n){i=!1}try{s=DateTime.fromISO(n,t),o=s.isValid}catch(n){o=!1}if(i&&o)return Interval.fromDateTimes(e,s);if(i){const r=Duration.fromISO(n,t);if(r.isValid)return Interval.after(e,r)}else if(o){const e=Duration.fromISO(r,t);if(e.isValid)return Interval.before(s,e)}}return Interval.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}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;const r=this.start.startOf(e,t);let n;return n=t?.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?Interval.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(friendlyDateTime).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[];let{s:n}=this,i=0;for(;n<this.e;){const e=t[i]||this.e,s=+e>+this.e?this.e:e;r.push(Interval.fromDateTimes(n,s)),n=s,i+=1}return r}splitBy(e){const t=Duration.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,i=1;const s=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));r=+e>+this.e?this.e:e,s.push(Interval.fromDateTimes(n,r)),n=r,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:Interval.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return Interval.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),s=Array.prototype.concat(...i).sort((e,t)=>e.time-t.time);for(const e of s)r+="s"===e.type?1:-1,1===r?t=e.time:(t&&+t!==+e.time&&n.push(Interval.fromDateTimes(t,e.time)),t=null);return Interval.merge(n)}difference(...e){return Interval.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Ot}[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=M,t={}){return this.isValid?Formatter.create(this.s.loc.clone(t),e).formatInterval(this):Ot}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ot}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ot}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ot}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ot}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Duration.invalid(this.invalidReason)}mapEndpoints(e){return Interval.fromDateTimes(e(this.s),e(this.e))}}class Info{static hasDST(e=Settings.defaultZone){const t=DateTime.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return IANAZone.isValidZone(e)}static normalizeZone(e){return normalizeZone(e,Settings.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Locale.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Locale.create(t,null,"gregory").eras(e)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(e,t){const utcDayStart=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=utcDayStart(t)-utcDayStart(e);return Math.floor(Duration.fromMillis(r).as("days"))}function diff(e,t,r,n){let[i,s,o,a]=function highOrderDiffs(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=dayDiff(e,t);return(r-r%7)/7}],["days",dayDiff]],i={},s=e;let o,a;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,i[l]=c(e,t),a=s.plus(i),a>t?(i[l]--,(e=s.plus(i))>t&&(a=e,i[l]--,e=s.plus(i))):e=a);return[e,i,a,o]}(e,t,r);const l=t-i,c=r.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(o<t&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));const u=Duration.fromObject(s,n);return c.length>0?Duration.fromMillis(l,n).shiftTo(...c).plus(u):u}function intUnit(e,t=e=>e){return{regex:e,deser:([e])=>t(function parseDigits(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(ve.hanidec))t+=we.indexOf(e[r]);else for(const e in Ee){const[r,i]=Ee[e];n>=r&&n<=i&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const kt=`[ ${String.fromCharCode(160)}]`,Ft=new RegExp(kt,"g");function fixListRegex(e){return e.replace(/\./g,"\\.?").replace(Ft,kt)}function stripInsensitivities(e){return e.replace(/\./g,"").replace(Ft," ").toLowerCase()}function oneOf(e,t){return null===e?null:{regex:RegExp(e.map(fixListRegex).join("|")),deser:([r])=>e.findIndex(e=>stripInsensitivities(r)===stripInsensitivities(e))+t}}function offset(e,t){return{regex:e,deser:([,e,t])=>signedOffset(e,t),groups:t}}function simple(e){return{regex:e,deser:([e])=>e}}const xt={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"}};let Dt=null;function expandMacroTokens(e,t){return Array.prototype.concat(...e.map(e=>function maybeExpandMacroToken(e,t){if(e.literal)return e;const r=formatOptsToTokens(Formatter.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t)))}class TokenParser{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=expandMacroTokens(Formatter.parseFormat(t),e),this.units=this.tokens.map(t=>function unitForToken(e,t){const r=digitRegex(t),n=digitRegex(t,"{2}"),i=digitRegex(t,"{3}"),s=digitRegex(t,"{4}"),o=digitRegex(t,"{6}"),a=digitRegex(t,"{1,2}"),l=digitRegex(t,"{1,3}"),c=digitRegex(t,"{1,6}"),u=digitRegex(t,"{1,9}"),h=digitRegex(t,"{2,4}"),d=digitRegex(t,"{4,6}"),literal=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return literal(m);switch(m.val){case"G":return oneOf(t.eras("short"),0);case"GG":return oneOf(t.eras("long"),0);case"y":return intUnit(c);case"yy":case"kk":return intUnit(h,untruncateYear);case"yyyy":case"kkkk":return intUnit(s);case"yyyyy":return intUnit(d);case"yyyyyy":return intUnit(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return intUnit(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return intUnit(n);case"MMM":return oneOf(t.months("short",!0),1);case"MMMM":return oneOf(t.months("long",!0),1);case"LLL":return oneOf(t.months("short",!1),1);case"LLLL":return oneOf(t.months("long",!1),1);case"o":case"S":return intUnit(l);case"ooo":case"SSS":return intUnit(i);case"u":return simple(u);case"uu":return simple(a);case"uuu":case"E":case"c":return intUnit(r);case"a":return oneOf(t.meridiems(),0);case"EEE":return oneOf(t.weekdays("short",!1),1);case"EEEE":return oneOf(t.weekdays("long",!1),1);case"ccc":return oneOf(t.weekdays("short",!0),1);case"cccc":return oneOf(t.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return literal(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function buildRegex(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"")}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,r]=function match(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const i in r)if(util_hasOwnProperty(r,i)){const s=r[i],o=s.groups?s.groups+1:1;!s.literal&&s.token&&(e[s.token.val[0]]=s.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(e,this.regex,this.handlers),[n,i,s]=r?function dateTimeFromMatches(e){let t,r=null;return isUndefined(e.z)||(r=IANAZone.create(e.z)),isUndefined(e.Z)||(r||(r=new FixedOffsetZone(e.Z)),t=e.Z),isUndefined(e.q)||(e.M=3*(e.q-1)+1),isUndefined(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),isUndefined(e.u)||(e.S=parseMillis(e.u)),[Object.keys(e).reduce((t,r)=>{const n=(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}})(r);return n&&(t[n]=e[r]),t},{}),r,t]}(r):[null,null,void 0];if(util_hasOwnProperty(r,"a")&&util_hasOwnProperty(r,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:n,zone:i,specificOffset:s}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function explainFromTokens(e,t,r){return new TokenParser(e,r).explainFromTokens(t)}function formatOptsToTokens(e,t){if(!e)return null;const r=Formatter.create(t,e).dtFormatter(function getDummyDateTime(){return Dt||(Dt=DateTime.fromMillis(1555555555555)),Dt}()),n=r.formatToParts(),i=r.resolvedOptions();return n.map(t=>function tokenForPart(e,t,r){const{type:n,value:i}=e;if("literal"===n){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const s=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let a=xt[o];if("object"==typeof a&&(a=a[s]),a)return{literal:!1,val:a}}(t,e,i))}const Lt="Invalid DateTime",Ct=864e13;function unsupportedZone(e){return new Invalid("unsupported zone",`the zone "${e.name}" is not supported`)}function possiblyCachedWeekData(e){return null===e.weekData&&(e.weekData=gregorianToWeek(e.c)),e.weekData}function possiblyCachedLocalWeekData(e){return null===e.localWeekData&&(e.localWeekData=gregorianToWeek(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function datetime_clone(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new DateTime({...r,...t,old:r})}function fixOffset(e,t,r){let n=e-60*t*1e3;const i=r.offset(n);if(t===i)return[n,t];n-=60*(i-t)*1e3;const s=r.offset(n);return i===s?[n,i]:[e-60*Math.min(i,s)*1e3,Math.max(i,s)]}function tsToObj(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function objToTS(e,t,r){return fixOffset(objToLocalTS(e),t,r)}function adjustTime(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),s={...e.c,year:n,month:i,day:Math.min(e.c.day,daysInMonth(n,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=Duration.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"),a=objToLocalTS(s);let[l,c]=fixOffset(a,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function parseDataToDateTime(e,t,r,n,i,s){const{setZone:o,zone:a}=r;if(e&&0!==Object.keys(e).length||t){const n=t||a,i=DateTime.fromObject(e,{...r,zone:n,specificOffset:s});return o?i:i.setZone(a)}return DateTime.invalid(new Invalid("unparsable",`the input "${i}" can't be parsed as ${n}`))}function toTechFormat(e,t,r=!0){return e.isValid?Formatter.create(Locale.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function toISODate(e,t){const r=e.c.year>9999||e.c.year<0;let n="";return r&&e.c.year>=0&&(n+="+"),n+=padStart(e.c.year,r?6:4),t?(n+="-",n+=padStart(e.c.month),n+="-",n+=padStart(e.c.day)):(n+=padStart(e.c.month),n+=padStart(e.c.day)),n}function toISOTime(e,t,r,n,i,s){let o=padStart(e.c.hour);return t?(o+=":",o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=":")):o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=padStart(e.c.second),0===e.c.millisecond&&n||(o+=".",o+=padStart(e.c.millisecond,3))),i&&(e.isOffsetFixed&&0===e.offset&&!s?o+="Z":e.o<0?(o+="-",o+=padStart(Math.trunc(-e.o/60)),o+=":",o+=padStart(Math.trunc(-e.o%60))):(o+="+",o+=padStart(Math.trunc(e.o/60)),o+=":",o+=padStart(Math.trunc(e.o%60)))),s&&(o+="["+e.zone.ianaName+"]"),o}const It={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Pt={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Nt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Rt=["year","month","day","hour","minute","second","millisecond"],At=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],zt=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnitWithLocalWeeks(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function normalizeUnit(e){const 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 InvalidUnitError(e);return t}(e)}}function quickDT(e,t){const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t);let i,s;if(isUndefined(e.year))i=Settings.now();else{for(const t of Rt)isUndefined(e[t])&&(e[t]=It[t]);const t=hasInvalidGregorianData(e)||hasInvalidTimeData(e);if(t)return DateTime.invalid(t);const n=function guessOffsetForZone(e){if(void 0===Mt&&(Mt=Settings.now()),"iana"!==e.type)return e.offset(Mt);const t=e.name;let r=Vt.get(t);return void 0===r&&(r=e.offset(Mt),Vt.set(t,r)),r}(r);[i,s]=objToTS(e,n,r)}return new DateTime({ts:i,zone:r,loc:n,o:s})}function diffRelative(e,t,r){const n=!!isUndefined(r.round)||r.round,format=(e,i)=>{e=roundTo(e,n||r.calendary?0:2,!0);return t.loc.clone(r).relFormatter(r).format(e,i)},differ=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return format(differ(r.unit),r.unit);for(const e of r.units){const t=differ(e);if(Math.abs(t)>=1)return format(t,e)}return format(e>t?-0:0,r.units[r.units.length-1])}function lastOpts(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}let Mt;const Vt=new Map;class DateTime{constructor(e){const t=e.zone||Settings.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new Invalid("invalid input"):null)||(t.isValid?null:unsupportedZone(t));this.ts=isUndefined(e.ts)?Settings.now():e.ts;let n=null,i=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const s=isNumber(e.o)&&!e.old?e.o:t.offset(this.ts);n=tsToObj(this.ts,s),r=Number.isNaN(n.year)?new Invalid("invalid input"):null,n=r?null:n,i=r?null:s}}this._zone=t,this.loc=e.loc||Locale.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[e,t]=lastOpts(arguments),[r,n,i,s,o,a,l]=t;return quickDT({year:r,month:n,day:i,hour:s,minute:o,second:a,millisecond:l},e)}static utc(){const[e,t]=lastOpts(arguments),[r,n,i,s,o,a,l]=t;return e.zone=FixedOffsetZone.utcInstance,quickDT({year:r,month:n,day:i,hour:s,minute:o,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const r=function isDate(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(r))return DateTime.invalid("invalid input");const n=normalizeZone(t.zone,Settings.defaultZone);return n.isValid?new DateTime({ts:r,zone:n,loc:Locale.fromObject(t)}):DateTime.invalid(unsupportedZone(n))}static fromMillis(e,t={}){if(isNumber(e))return e<-Ct||e>Ct?DateTime.invalid("Timestamp out of range"):new DateTime({ts:e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(isNumber(e))return new DateTime({ts:1e3*e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t),i=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:s,startOfWeek:o}=usesLocalWeekValues(i,n),a=Settings.now(),l=isUndefined(t.specificOffset)?r.offset(a):t.specificOffset,c=!isUndefined(i.ordinal),u=!isUndefined(i.year),h=!isUndefined(i.month)||!isUndefined(i.day),d=u||h,m=i.weekYear||i.weekNumber;if((d||c)&&m)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!d;let p,g,y=tsToObj(a,l);f?(p=At,g=Pt,y=gregorianToWeek(y,s,o)):c?(p=zt,g=Nt,y=gregorianToOrdinal(y)):(p=Rt,g=It);let v=!1;for(const e of p){isUndefined(i[e])?i[e]=v?g[e]:y[e]:v=!0}const E=f?function hasInvalidWeekData(e,t=4,r=1){const n=isInteger(e.weekYear),i=integerBetween(e.weekNumber,1,weeksInWeekYear(e.weekYear,t,r)),s=integerBetween(e.weekday,1,7);return n?i?!s&&unitOutOfRange("weekday",e.weekday):unitOutOfRange("week",e.weekNumber):unitOutOfRange("weekYear",e.weekYear)}(i,s,o):c?function hasInvalidOrdinalData(e){const t=isInteger(e.year),r=integerBetween(e.ordinal,1,daysInYear(e.year));return t?!r&&unitOutOfRange("ordinal",e.ordinal):unitOutOfRange("year",e.year)}(i):hasInvalidGregorianData(i),w=E||hasInvalidTimeData(i);if(w)return DateTime.invalid(w);const S=f?weekToGregorian(i,s,o):c?ordinalToGregorian(i):i,[T,b]=objToTS(S,l,r),O=new DateTime({ts:T,zone:r,o:b,loc:n});return i.weekday&&d&&e.weekday!==O.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${O.toISO()}`):O.isValid?O:DateTime.invalid(O.invalid)}static fromISO(e,t={}){const[r,n]=function parseISODate(e){return parse(e,[it,lt],[st,ct],[ot,ut],[at,ht])}(e);return parseDataToDateTime(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=function parseRFC2822Date(e){return parse(function preprocessRFC2822(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[et,extractRFC2822])}(e);return parseDataToDateTime(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=function parseHTTPDate(e){return parse(e,[tt,extractRFC1123Or850],[rt,extractRFC1123Or850],[nt,extractASCII])}(e);return parseDataToDateTime(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=r,s=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,a,l,c]=function parseFromTokens(e,t,r){const{result:n,zone:i,specificOffset:s,invalidReason:o}=explainFromTokens(e,t,r);return[n,i,s,o]}(s,e,t);return c?DateTime.invalid(c):parseDataToDateTime(o,a,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return DateTime.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=function parseSQL(e){return parse(e,[mt,lt],[ft,pt])}(e);return parseDataToDateTime(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(r);return new DateTime({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=formatOptsToTokens(e,Locale.fromObject(t));return r?r.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return expandMacroTokens(Formatter.parseFormat(e),Locale.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Mt=void 0,Vt.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}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?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.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&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=objToLocalTS(this.c),n=this.zone.offset(r-e),i=this.zone.offset(r+e),s=this.zone.offset(r-n*t),o=this.zone.offset(r-i*t);if(s===o)return[this];const a=r-s*t,l=r-o*t,c=tsToObj(a,s),u=tsToObj(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[datetime_clone(this,{ts:a}),datetime_clone(this,{ts:l})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=Formatter.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(FixedOffsetZone.instance(e),t)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=normalizeZone(e,Settings.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=objToTS(r,t,e)}return datetime_clone(this,{ts:n,zone:e})}return DateTime.invalid(unsupportedZone(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return datetime_clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:r,startOfWeek:n}=usesLocalWeekValues(t,this.loc),i=!isUndefined(t.weekYear)||!isUndefined(t.weekNumber)||!isUndefined(t.weekday),s=!isUndefined(t.ordinal),o=!isUndefined(t.year),a=!isUndefined(t.month)||!isUndefined(t.day),l=o||a,c=t.weekYear||t.weekNumber;if((l||s)&&c)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&s)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let u;i?u=weekToGregorian({...gregorianToWeek(this.c,r,n),...t},r,n):isUndefined(t.ordinal)?(u={...this.toObject(),...t},isUndefined(t.day)&&(u.day=Math.min(daysInMonth(u.year,u.month),u.day))):u=ordinalToGregorian({...gregorianToOrdinal(this.c),...t});const[h,d]=objToTS(u,this.o,this.zone);return datetime_clone(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;return datetime_clone(this,adjustTime(this,Duration.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return datetime_clone(this,adjustTime(this,Duration.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=Duration.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Lt}toLocaleString(e=M,t={}){return this.isValid?Formatter.create(this.loc.clone(t),e).formatDateTime(this):Lt}toLocaleParts(e={}){return this.isValid?Formatter.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const s="extended"===e;let o=toISODate(this,s);return o+="T",o+=toISOTime(this,s,t,r,n,i),o}toISODate({format:e="extended"}={}){return this.isValid?toISODate(this,"extended"===e):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:i=!1,format:s="extended"}={}){if(!this.isValid)return null;return(n?"T":"")+toISOTime(this,"extended"===s,t,e,r,i)}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),toTechFormat(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Lt}[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{};const 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",r={}){if(!this.isValid||!e.isValid)return Duration.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=function maybeArray(e){return Array.isArray(e)?e:[e]}(t).map(Duration.normalizeUnit),s=e.valueOf()>this.valueOf(),o=diff(s?this:e,s?e:this,i,n);return s?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(DateTime.now(),e,t)}until(e){return this.isValid?Interval.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=n&&n<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||DateTime.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),diffRelative(t,this.plus(r),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?diffRelative(e.base||DateTime.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:i=null}=r;return explainFromTokens(Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return DateTime.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:n=null}=t,i=Locale.fromOpts({locale:r,numberingSystem:n,defaultToEN:!0});return new TokenParser(i,e)}static fromFormatParser(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=r,s=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!s.equals(t.locale))throw new InvalidArgumentError(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${t.locale}`);const{result:o,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?DateTime.invalid(c):parseDataToDateTime(o,a,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return M}static get DATE_MED(){return V}static get DATE_MED_WITH_WEEKDAY(){return U}static get DATE_FULL(){return _}static get DATE_HUGE(){return H}static get TIME_SIMPLE(){return W}static get TIME_WITH_SECONDS(){return j}static get TIME_WITH_SHORT_OFFSET(){return Z}static get TIME_WITH_LONG_OFFSET(){return $}static get TIME_24_SIMPLE(){return G}static get TIME_24_WITH_SECONDS(){return q}static get TIME_24_WITH_SHORT_OFFSET(){return B}static get TIME_24_WITH_LONG_OFFSET(){return J}static get DATETIME_SHORT(){return Y}static get DATETIME_SHORT_WITH_SECONDS(){return K}static get DATETIME_MED(){return Q}static get DATETIME_MED_WITH_SECONDS(){return X}static get DATETIME_MED_WITH_WEEKDAY(){return ee}static get DATETIME_FULL(){return te}static get DATETIME_FULL_WITH_SECONDS(){return re}static get DATETIME_HUGE(){return ne}static get DATETIME_HUGE_WITH_SECONDS(){return ie}}function friendlyDateTime(e){if(DateTime.isDateTime(e))return e;if(e&&e.valueOf&&isNumber(e.valueOf()))return DateTime.fromJSDate(e);if(e&&"object"==typeof e)return DateTime.fromObject(e);throw new InvalidArgumentError(`Unknown datetime argument: ${e}, of type ${typeof e}`)}class DateTimeNormalizedValueToRawValueEventListener{static eventListenerTarget=g.NormalizedValueToRawValueEvent;static priority=50;constructor(){}static constructFromServiceResolver(){return new DateTimeNormalizedValueToRawValueEventListener}onEvent(e){if(e.getIdentifier()!==DateTimeNormalizedValueToRawValueEventListener.eventListenerTarget)return;const t=e.getNormalizedValue();if(!(t instanceof Date))return;const r=DateTime.fromJSDate(t).toFormat("yyyy-MM-dd'T'HH:mm:ssZZ");e.setRawValue(r),e.stopPropagation()}}class DateTimeRawValueToNormalizedValueEventListener{static eventListenerTarget=g.RawValueToNormalizedValueEvent;static priority=50;static dateRegex=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$/;constructor(){}static constructFromServiceResolver(){return new DateTimeRawValueToNormalizedValueEventListener}onEvent(e){if(e.getIdentifier()!==DateTimeRawValueToNormalizedValueEventListener.eventListenerTarget)return;const t=e.getRawValue();if("string"!=typeof t)return;if(!DateTimeRawValueToNormalizedValueEventListener.dateRegex.test(t))return;const r=new Date(t);e.setNormalizedValue(r),e.stopPropagation()}}class GenericNormalizedValueToRawValueEventListener{static eventListenerTarget=g.NormalizedValueToRawValueEvent;static priority=0;constructor(){}static constructFromServiceResolver(){return new GenericNormalizedValueToRawValueEventListener}onEvent(e){if(e.getIdentifier()!==GenericNormalizedValueToRawValueEventListener.eventListenerTarget)return;const t=e.getNormalizedValue();(Array.isArray(t)||"number"==typeof t||"boolean"==typeof t||"string"==typeof t||t instanceof String||null===t)&&(e.setRawValue(t),e.stopPropagation())}}class GenericRawValueToNormalizedValueEventListener{static eventListenerTarget=g.RawValueToNormalizedValueEvent;static priority=0;constructor(){}static constructFromServiceResolver(){return new GenericRawValueToNormalizedValueEventListener}onEvent(e){if(e.getIdentifier()!==GenericRawValueToNormalizedValueEventListener.eventListenerTarget)return;const t=e.getRawValue();(Array.isArray(t)||"number"==typeof t||"boolean"==typeof t||"string"==typeof t||null===t)&&(e.setNormalizedValue(t),e.stopPropagation())}}class ApiConfiguration{logger;static identifier=w.serviceApiConfiguration;token;apiHost;elementCacheMaxEntries;collectionCacheMaxEntries;collectionPageSize;constructor(e){this.logger=e,this.token=null,this.apiHost="",this.elementCacheMaxEntries=100,this.collectionCacheMaxEntries=50,this.collectionPageSize=25}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger);return new ApiConfiguration(t)}hasToken(){return null!==this.token}getToken(){return this.token}setToken(e){return this.token=e,this}getApiHost(){return this.apiHost}setApiHost(e){return e.endsWith("/")&&(this.logger.warn("Removed trailing slash from API host configuration due to internal requirement. Please check if trailing slash can be directly removed."),e=e.replace(/\/+$/,"")),this.apiHost=e,this}getElementCacheMaxEntries(){return this.elementCacheMaxEntries}setElementCacheMaxEntries(e){return this.elementCacheMaxEntries=e,this}getCollectionCacheMaxEntries(){return this.collectionCacheMaxEntries}setCollectionCacheMaxEntries(e){return this.collectionCacheMaxEntries=e,this}getCollectionPageSize(){return this.collectionPageSize}setCollectionPageSize(e){return this.collectionPageSize=e,this}}class ApiWrapper{getElementEndpoint;getElementChildrenEndpoint;getElementParentsEndpoint;getElementRelatedEndpoint;getIndexEndpoint;postIndexEndpoint;postElementEndpoint;putElementEndpoint;patchElementEndpoint;deleteElementEndpoint;postRegisterEndpoint;postChangePasswordEndpoint;getMeEndpoint;postTokenEndpoint;getTokenEndpoint;deleteTokenEndpoint;elementCache;elementChildrenCache;elementParentsCache;elementRelatedCache;indexCache;static identifier=w.serviceApiWrapper;constructor(e,t,r,n,i,s,o,a,l,c,u,h,d,m,f,p,g,y,v,E,w){this.getElementEndpoint=e,this.getElementChildrenEndpoint=t,this.getElementParentsEndpoint=r,this.getElementRelatedEndpoint=n,this.getIndexEndpoint=i,this.postIndexEndpoint=s,this.postElementEndpoint=o,this.putElementEndpoint=a,this.patchElementEndpoint=l,this.deleteElementEndpoint=c,this.postRegisterEndpoint=u,this.postChangePasswordEndpoint=h,this.getMeEndpoint=d,this.postTokenEndpoint=m,this.getTokenEndpoint=f,this.deleteTokenEndpoint=p,this.elementCache=g,this.elementChildrenCache=y,this.elementParentsCache=v,this.elementRelatedCache=E,this.indexCache=w}static constructFromServiceResolver(e){return new ApiWrapper(e.getServiceOrFail(w.endpointElementGetElementEndpoint),e.getServiceOrFail(w.endpointElementGetElementChildrenEndpoint),e.getServiceOrFail(w.endpointElementGetElementParentsEndpoint),e.getServiceOrFail(w.endpointElementGetElementRelatedEndpoint),e.getServiceOrFail(w.endpointElementGetIndexEndpoint),e.getServiceOrFail(w.endpointElementPostIndexEndpoint),e.getServiceOrFail(w.endpointElementPostElementEndpoint),e.getServiceOrFail(w.endpointElementPutElementEndpoint),e.getServiceOrFail(w.endpointElementPatchElementEndpoint),e.getServiceOrFail(w.endpointElementDeleteElementEndpoint),e.getServiceOrFail(w.endpointUserPostRegisterEndpoint),e.getServiceOrFail(w.endpointUserPostChangePasswordEndpoint),e.getServiceOrFail(w.endpointUserGetMeEndpoint),e.getServiceOrFail(w.endpointUserPostTokenEndpoint),e.getServiceOrFail(w.endpointUserGetTokenEndpoint),e.getServiceOrFail(w.endpointUserDeleteTokenEndpoint),e.getServiceOrFail(w.cacheElement),e.getServiceOrFail(w.cacheElementChildren),e.getServiceOrFail(w.cacheElementParents),e.getServiceOrFail(w.cacheElementRelated),e.getServiceOrFail(w.cacheIndex))}async getElement(e,{forceLoad:t=!1}={}){const r=ElementCache.createCacheKey(e),n=this.elementCache.get(r);if(n&&!t)return n.data;if(n){const t=await this.getElementEndpoint.getElement(e,n.etag);return"data"in t?(this.elementCache.setFromParsedResponse(r,t),t.data):(this.elementCache.refresh(r),n.data)}const i=await this.getElementEndpoint.getElement(e);return this.elementCache.setFromParsedResponse(r,i),i.data}async getElementChildren(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementChildrenCache.createCacheKey(e,t,r),s=this.elementChildrenCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementChildrenEndpoint.getElementChildren(e,t,r,s.etag);return"data"in n?(this.elementChildrenCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementChildrenCache.refresh(i),s.data)}const o=await this.getElementChildrenEndpoint.getElementChildren(e,t,r);return this.elementChildrenCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getElementParents(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementParentsCache.createCacheKey(e,t,r),s=this.elementParentsCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementParentsEndpoint.getElementParents(e,t,r,s.etag);return"data"in n?(this.elementParentsCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementParentsCache.refresh(i),s.data)}const o=await this.getElementParentsEndpoint.getElementParents(e,t,r);return this.elementParentsCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getElementRelated(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementRelatedCache.createCacheKey(e,t,r),s=this.elementRelatedCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementRelatedEndpoint.getElementRelated(e,t,r,s.etag);return"data"in n?(this.elementRelatedCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementRelatedCache.refresh(i),s.data)}const o=await this.getElementRelatedEndpoint.getElementRelated(e,t,r);return this.elementRelatedCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getIndex({page:e=1,pageSize:t=25,forceLoad:r=!1}={}){const n=IndexCache.createCacheKey(e,t),i=this.indexCache.get(n);if(i&&!r)return i.data;if(i){const r=await this.getIndexEndpoint.getIndex(e,t,i.etag);return"data"in r?(this.indexCache.setFromParsedResponse(n,r),this.elementCache.setFromCollection(r.data),r.data):(this.indexCache.refresh(n),i.data)}const s=await this.getIndexEndpoint.getIndex(e,t);return this.indexCache.setFromParsedResponse(n,s),this.elementCache.setFromCollection(s.data),s.data}async postIndex(e){return(await this.postIndexEndpoint.postIndex(e)).data}async postElement(e,t){return(await this.postElementEndpoint.postElement(e,t)).data}async putElement(e,t){await this.putElementEndpoint.putElement(e,t),this.elementCache.delete(ElementCache.createCacheKey(e))}async patchElement(e,t){await this.patchElementEndpoint.patchElement(e,t),this.elementCache.delete(ElementCache.createCacheKey(e))}async deleteElement(e){await this.deleteElementEndpoint.deleteElement(e),this.elementCache.delete(ElementCache.createCacheKey(e))}async postRegister(e,t,r={}){return(await this.postRegisterEndpoint.postRegister(e,t,r)).data}async postChangePassword(e,t,r){await this.postChangePasswordEndpoint.postChangePassword(e,t,r)}async getMe(){const e=(await this.getMeEndpoint.getMe()).data;return this.elementCache.setFromDataEtag(ElementCache.createCacheKey(e.id),e),e}async postToken(e,t,r={}){return(await this.postTokenEndpoint.postToken(e,t,r)).data}async getToken(){const e=(await this.getTokenEndpoint.getToken()).data;return this.elementCache.setFromDataEtag(ElementCache.createCacheKey(e.id),e),e}async deleteToken(){await this.deleteTokenEndpoint.deleteToken()}}class CollectionParser{elementParser;static identifier=w.serviceCollectionParser;constructor(e){this.elementParser=e}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.serviceElementParser);return new CollectionParser(t)}async deserializeCollection(e){if(!("id"in e))throw new Error("Raw collection must contain property 'id' in order to be parsed to a collection.");const t=String(e.id);if(!("totalNodes"in e))throw new Error("Raw collection must contain property 'totalNodes' in order to be parsed to a collection.");const r=Number(e.totalNodes);if(!("links"in e))throw new Error("Raw collection must contain property 'links' in order to be parsed to a collection.");if("object"!=typeof e.links||null===e.links)throw new Error("Links property in raw collection must be of type object.");const n=e.links;if(!("first"in n))throw new Error("Raw collection must contain property 'links.first' in order to be parsed to a collection.");const i=String(n.first);if(!("previous"in n))throw new Error("Raw collection must contain property 'links.previous' in order to be parsed to a collection.");const s=null===n.previous?null:String(n.previous);if(!("next"in n))throw new Error("Raw collection must contain property 'links.next' in order to be parsed to a collection.");const o=null===n.next?null:String(n.next);if(!("last"in n))throw new Error("Raw collection must contain property 'links.last' in order to be parsed to a collection.");const a=String(n.last);if(!("nodes"in e))throw new Error("Raw collection must contain property 'nodes' in order to be parsed to a collection.");if(!Array.isArray(e.nodes))throw new Error("Nodes property in raw collection must be of type array.");const l=[];for(const t of e.nodes)l.push(await this.elementParser.deserializeElement(t));if(!("relations"in e))throw new Error("Raw collection must contain property 'relations' in order to be parsed to a collection.");if(!Array.isArray(e.relations))throw new Error("Relations property in raw collection must be of type array.");const c=[];for(const t of e.relations)c.push(await this.elementParser.deserializeElement(t));return{id:t,totalNodes:r,links:{first:i,previous:s,next:o,last:a},nodes:l,relations:c}}}class ElementParser{eventDispatcher;static identifier=w.serviceElementParser;constructor(e){this.eventDispatcher=e}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.serviceEventDispatcher);return new ElementParser(t)}async deserializeElement(e){if(!("id"in e))throw new Error("Raw element must contain property 'id' in order to be parsed to a node or relation.");const t=validateUuidFromString(String(e.id));if(!("type"in e))throw new Error("Raw element must contain property 'type' in order to be parsed to a node or relation.");const r=String(e.type);if(!("data"in e))throw new Error("Raw element must contain property 'data' in order to be parsed to a node or relation.");const n=e.data;for(const e in n){const t=new RawValueToNormalizedValueEvent(n[e]);if(await this.eventDispatcher.dispatchEvent(t),!t.isPropagationStopped())throw new Error(`Unable to deserialize property "${e}".`);n[e]=t.getNormalizedValue()}if("start"in e&&"end"in e){return{id:t,start:validateUuidFromString(String(e.start)),end:validateUuidFromString(String(e.end)),type:r,data:n}}return{id:t,type:r,data:n}}}class EventDispatcher{logger;static identifier=w.serviceEventDispatcher;eventListenerTargets;isSilent=!0;constructor(e){this.logger=e,this.eventListenerTargets=new Map}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger);return new EventDispatcher(t)}setSilent(e){return this.isSilent=e,this}async dispatchEvent(e){if(this.isSilent||this.logger.debug(`Dispatching event of identifier ${e.getIdentifier()}.`,{event:e}),e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation because it is already stopped.",{event:e}));const t=getEventListenerTargetsFromEventIdentifier(e.getIdentifier());for(let r=0;r<t.length;++r){const n=t[r],i=this.eventListenerTargets.get(n);if(void 0!==i){this.isSilent||this.logger.debug(`Iterating over resolved event listeners of identifier ${n}`,{event:e});for(let t=i.length-1;t>=0;t--){try{await Promise.resolve(i[t].eventListener.onEvent(e))}catch(t){this.logger.error("Event handler threw exception, dispatcher continues with next event listener.",{event:e,error:t})}if(e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation as it got stopped.",{event:e}))}}}this.isSilent||this.logger.debug("Event got handled by all event listeners.",{event:e})}addListener(e,t,r){let n;void 0===r&&(r=0),n=this.eventListenerTargets.has(e)?this.eventListenerTargets.get(e):[];let i=0,s=n.length-1,o=-1;for(;i<=s;){const e=Math.floor((i+s)/2);n[e].priority>=r?(o=e,s=e-1):i=e+1}const a=-1===o?i:o;return n.splice(a,0,{priority:r,eventListener:t}),this.eventListenerTargets.set(e,n),this}removeListener(e,t){const r=this.eventListenerTargets.get(e);if(!r)return this;for(let e=0;e<r.length;++e)if(r[e].eventListener===t){r.splice(e,1);break}return 0===r.length&&this.eventListenerTargets.delete(e),this}getListeners(e){const t=this.eventListenerTargets.get(e);return t?t.map(e=>e.eventListener):[]}hasListeners(e){return this.eventListenerTargets.has(e)}}class FetchHelper{logger;apiConfiguration;static identifier=w.serviceFetchHelper;constructor(e,t){this.logger=e,this.apiConfiguration=t}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger),r=e.getServiceOrFail(w.serviceApiConfiguration);return new FetchHelper(t,r)}rethrowErrorAsNetworkError(e){if(e instanceof EmberNexusError)throw e;throw new NetworkError("Network error occurred during fetch.",e)}logAndThrowError(e){const t=e instanceof Error?e:new Error(String(e));throw this.logger.error(t.message,t),t}async parseJsonResponse(e){const t=e.headers.get("Content-Type");if(!t)return Promise.reject(new ParseError("Response does not contain a Content-Type header."));if(!t.includes("application/json")&&!t.includes("application/problem+json"))return Promise.reject(new ParseError(`Unexpected Content-Type: "${t}". Expected JSON-compatible format.`));const r=await e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)});if(!e.ok)throw this.createResponseErrorFromBadResponse(e,r);return r}async parseEmptyResponse(e){if(e.ok&&204===e.status)return;const t=e.headers.get("Content-Type");if(null===t)throw new ParseError("Response does not contain content type header.");if(!t.includes("application/problem+json"))throw new ParseError("Unable to parse response as content type is not 'application/problem+json'.");const r=await e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)});throw this.createResponseErrorFromBadResponse(e,r)}parseLocationResponse(e){if(e.ok&&(201===e.status||204===e.status)&&e.headers.has("Location")){const t=e.headers.get("Location").split("/").at(-1);return Promise.resolve(validateUuidFromString(t))}const t=e.headers.get("Content-Type");return null===t?Promise.reject(new ParseError("Response does not contain content type header.")):t.includes("application/problem+json")?e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)}).then(t=>{throw this.createResponseErrorFromBadResponse(e,t)}):Promise.reject(new ParseError("Unable to parse response as content type is not 'application/problem+json'."))}createResponseErrorFromBadResponse(e,t){let r=null;return 401===e.status&&(r=new Response401UnauthorizedError("Server returned 401 unauthorized.")),403===e.status&&(r=new Response403ForbiddenError("Server returned 403 forbidden.")),404===e.status&&(r=new Response404NotFoundError("Server returned 404 not found.")),429===e.status&&(r=new Response429TooManyRequestsError("Server returned 429 too many requests.")),null===r&&(r=new ResponseError("Generic response error.")),"type"in t&&r.setType(String(t.type)),"title"in t&&r.setTitle(String(t.title)),"detail"in t&&r.setDetail(String(t.detail)),"status"in t&&null===r.getStatus()&&r.setStatus(Number(t.status)),r}addAuthorizationHeader(e){this.apiConfiguration.hasToken()&&(e.Authorization=`Bearer ${this.apiConfiguration.getToken()}`)}addAcceptJsonAndProblemJsonHeader(e){e.Accept="application/json, application/problem+json"}addIfNoneMatchHeader(e,t){e["If-None-Match"]=t}addContentTypeJsonHeader(e){e["Content-Type"]="application/json"}getDefaultGetOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),void 0!==e&&this.addIfNoneMatchHeader(t,e),{method:y.GET,headers:t,redirect:"follow",referrerPolicy:"no-referrer",cache:"no-store"}}getDefaultDeleteOptions(){const e={};return this.addAuthorizationHeader(e),this.addAcceptJsonAndProblemJsonHeader(e),{method:y.DELETE,headers:e,redirect:"follow",referrerPolicy:"no-referrer"}}getDefaultPostOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.POST,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPatchOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.PATCH,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPutOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.PUT,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}buildUrl(e){return`${this.apiConfiguration.getApiHost()}${e}`}runWrappedFetch(e,t){return e=`${this.apiConfiguration.getApiHost()}${e}`,this.logger.debug(`Executing HTTP ${t?.method??"-"} request against url ${e} .`),fetch(e,t)}}class Logger{logger;constructor(e){this.logger=e}debug(...e){return this.logger.debug(e)}error(...e){return this.logger.error(e)}info(...e){return this.logger.info(e)}warn(...e){return this.logger.warn(e)}}class ServiceResolver{services=new Map;constructor(){}hasService(e){return this.services.has(String(e))}getService(e){return this.hasService(String(e))?this.services.get(String(e)):null}getServiceOrFail(e){if(!this.hasService(String(e)))throw new Error(`Requested service with identifier ${String(e)} could not be resolved.`);return this.services.get(String(e))}setService(e,t){return this.services.set(String(e),t),this}deleteService(e){return this.services.delete(String(e)),this}getServiceIdentifiers(){return[...this.services.keys()]}getServices(){return[...this.services.values()]}clearServices(){return this.services.clear(),this}}class TokenParser_TokenParser{static identifier=w.serviceTokenParser;constructor(){}static constructFromServiceResolver(){return new TokenParser_TokenParser}rawTokenToToken(e){if(!("type"in e))throw new Error("Raw token must contain property 'type' in order to be parsed to a token.");if("_TokenResponse"!==String(e.type))throw new Error("Type must be '_TokenResponse' in order to be parsed to a token.");if(!("token"in e))throw new Error("Raw token must contain property 'token' in order to be parsed to a token.");return validateTokenFromString(String(e.token))}}function initEventListener(e){const t=e.getServiceOrFail(EventDispatcher.identifier),r=[DateTimeNormalizedValueToRawValueEventListener,DateTimeRawValueToNormalizedValueEventListener,GenericNormalizedValueToRawValueEventListener,GenericRawValueToNormalizedValueEventListener];for(let e=0;e<r.length;e++)t.addListener(r[e].eventListenerTarget,r[e].constructFromServiceResolver(),r[e].priority)}const Ut={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function formatTemplate(e,t,r,n=!1){const i=String(t),ansiColorWrap=(e,t)=>`[${t[0]}m${e}[${t[1]}m`,styleWrap=(e,t)=>null!=t&&"string"==typeof t?ansiColorWrap(e,Ut[t]):null!=t&&Array.isArray(t)?t.reduce((e,t)=>styleWrap(e,t),e):null!=t&&null!=t[e.trim()]?styleWrap(e,t[e.trim()]):null!=t&&null!=t["*"]?styleWrap(e,t["*"]):e;return i.replace(/{{(.+?)}}/g,(t,i)=>{const s=null!=r[i]?String(r[i]):n?"":t;return e.stylePrettyLogs?styleWrap(s,e?.prettyLogStyles?.[i]??null)+ansiColorWrap("",Ut.reset):s})}function formatNumberAddZeros(e,t=2,r=0){return null!=e&&isNaN(e)?"":(e=null!=e?e+r:e,2===t?null==e?"--":e<10?"0"+e:e.toString():null==e?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function jsonStringifyRecursive(e){const t=new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return"bigint"==typeof r?`${r}`:r})}function inspect(e,t){const r={seen:[],stylize:stylizeNoColor};return null!=t&&_extend(r,t),util_inspect_polyfil_isUndefined(r.showHidden)&&(r.showHidden=!1),util_inspect_polyfil_isUndefined(r.depth)&&(r.depth=2),util_inspect_polyfil_isUndefined(r.colors)&&(r.colors=!0),util_inspect_polyfil_isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,e,r.depth)}function util_inspect_polyfil_isUndefined(e){return void 0===e}function stylizeNoColor(e){return e}function stylizeWithColor(e,t){const r=inspect.styles[t];return null!=r&&null!=inspect?.colors?.[r]?.[0]&&null!=inspect?.colors?.[r]?.[1]?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function isFunction(e){return"function"==typeof e}function util_inspect_polyfil_isString(e){return"string"==typeof e}function isNull(e){return null===e}function hasOwn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function util_inspect_polyfil_isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function objectToString(e){return Object.prototype.toString.call(e)}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatValue(e,t,r=0){if(e.customInspect&&null!=t&&isFunction(t)&&t?.inspect!==inspect&&(!t?.constructor||t?.constructor.prototype!==t)){if("function"!=typeof t.inspect&&null!=t.toString)return t.toString();let n=t?.inspect(r,e);return util_inspect_polyfil_isString(n)||(n=formatValue(e,n,r)),n}const n=formatPrimitive(e,t);if(n)return n;let i=Object.keys(t);const s=function arrayToHash(e){const t={};return e.forEach(e=>{t[e]=!0}),t}(i);try{e.showHidden&&Object.getOwnPropertyNames&&(i=Object.getOwnPropertyNames(t))}catch(e){}if(isError(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return formatError(t);if(0===i.length){if(!isFunction(e.stylize))return t;if(isFunction(t)){const r=t.name?": "+t.name:"";return e.stylize("[Function"+r+"]","special")}if(isRegExp(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(util_inspect_polyfil_isDate(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(isError(t))return formatError(t)}let o,a="",l=!1,c=["{\n","\n}"];if(Array.isArray(t)&&(l=!0,c=["[\n","\n]"]),isFunction(t)){a=" [Function"+(t.name?": "+t.name:"")+"]"}return isRegExp(t)&&(a=" "+RegExp.prototype.toString.call(t)),util_inspect_polyfil_isDate(t)&&(a=" "+Date.prototype.toUTCString.call(t)),isError(t)&&(a=" "+formatError(t)),0!==i.length||l&&0!=t.length?r<0?isRegExp(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),o=l?function formatArray(e,t,r,n,i){const s=[];for(let i=0,o=t.length;i<o;++i)hasOwn(t,String(i))?s.push(formatProperty(e,t,r,n,String(i),!0)):s.push("");return i.forEach(i=>{i.match(/^\d+$/)||s.push(formatProperty(e,t,r,n,i,!0))}),s}(e,t,r,s,i):i.map(n=>formatProperty(e,t,r,s,n,l)),e.seen.pop(),function reduceToSingleString(e,t,r){return r[0]+(""===t?"":t+"\n")+" "+e.join(",\n ")+" "+r[1]}(o,a,c)):c[0]+a+c[1]}function formatProperty(e,t,r,n,i,s){let o,a,l={value:void 0};try{l.value=t[i]}catch(e){}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,i)||l)}catch(e){}if(l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),hasOwn(n,i)||(o="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=isNull(r)?formatValue(e,l.value,void 0):formatValue(e,l.value,r-1),a.indexOf("\n")>-1&&(a=s?a.split("\n").map(e=>" "+e).join("\n").substr(2):"\n"+a.split("\n").map(e=>" "+e).join("\n"))):a=e.stylize("[Circular]","special")),util_inspect_polyfil_isUndefined(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function formatPrimitive(e,t){if(util_inspect_polyfil_isUndefined(t))return e.stylize("undefined","undefined");if(util_inspect_polyfil_isString(t)){const r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(r,"string")}return function util_inspect_polyfil_isNumber(e){return"number"==typeof e}(t)?e.stylize(""+t,"number"):function isBoolean(e){return"boolean"==typeof e}(t)?e.stylize(""+t,"boolean"):isNull(t)?e.stylize("null","null"):void 0}function _extend(e,t){const r={...e};if(!t||!isObject(t))return e;const n={...t},i=Object.keys(t);let s=i.length;for(;s--;)r[i[s]]=n[i[s]];return r}inspect.colors=Ut,inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};const _t={getCallerStackFrame,getErrorTrace,getMeta:function getMeta(e,t,r,n,i,s){return Object.assign({},Ht,{name:i,parentNames:s,date:new Date,logLevelId:e,logLevelName:t,path:n?void 0:getCallerStackFrame(r)})},transportJSON:function transportJSON(e){console.log(jsonStringifyRecursive(e))},transportFormatted:function transportFormatted(e,t,r,n){const i=(r.length>0&&t.length>0?"\n":"")+r.join("\n");n.prettyInspectOptions.colors=n.stylePrettyLogs,console.log(e+function formatWithOptions(e,...t){const r={seen:[],stylize:stylizeNoColor};null!=e&&_extend(r,e);const n=t[0];let i=0,s="",o="";if("string"==typeof n){if(1===t.length)return n;let a,l=0;for(let o=0;o<n.length-1;o++)if(37===n.charCodeAt(o)){const c=n.charCodeAt(++o);if(i+1!==t.length){switch(c){case 115:{const n=t[++i];a="number"==typeof n||"bigint"==typeof n?formatPrimitive(r,n):"object"!=typeof n||null===n?String(n):inspect(n,{...e,compact:3,colors:!1,depth:0});break}case 106:a=jsonStringifyRecursive(t[++i]);break;case 100:{const e=t[++i];a="bigint"==typeof e?formatPrimitive(r,e):"symbol"==typeof e?"NaN":formatPrimitive(r,e);break}case 79:a=inspect(t[++i],e);break;case 111:a=inspect(t[++i],{...e,showHidden:!0,showProxy:!0,depth:4});break;case 105:{const e=t[++i];a="bigint"==typeof e?formatPrimitive(r,e):"symbol"==typeof e?"NaN":formatPrimitive(r,parseInt(a));break}case 102:{const e=t[++i];a="symbol"==typeof e?"NaN":formatPrimitive(r,parseInt(e));break}case 99:i+=1,a="";break;case 37:s+=n.slice(l,o),l=o+1;continue;default:continue}l!==o-1&&(s+=n.slice(l,o-1)),s+=a,l=o+1}else 37===c&&(s+=n.slice(l,o),l=o+1)}0!==l&&(i++,o=" ",l<n.length&&(s+=n.slice(l)))}for(;i<t.length;){const r=t[i];s+=o,s+="string"!=typeof r?inspect(r,e):r,o=" ",i++}return s}(n.prettyInspectOptions,...t)+i)},isBuffer:function isBuffer(e){return!1},isError:browser_isError,prettyFormatLogObj:function prettyFormatLogObj(e,t){return e.reduce((e,r)=>(browser_isError(r)?e.errors.push(prettyFormatErrorObj(r,t)):e.args.push(r),e),{args:[],errors:[]})},prettyFormatErrorObj},Ht={runtime:[typeof window,typeof document].includes("undefined")?"Generic":"Browser",browser:globalThis?.navigator?.userAgent},Wt=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/;function getCallerStackFrame(e,t=Error()){return stackLineToStackFrame(t?.stack?.split("\n")?.filter(e=>!e.includes("Error: "))?.[e])}function getErrorTrace(e){return(e?.stack?.split("\n")??[])?.filter(e=>!e.includes("Error: "))?.reduce((e,t)=>(e.push(stackLineToStackFrame(t)),e),[])}function stackLineToStackFrame(e){const t=globalThis?.location?.origin,r={fullFilePath:void 0,fileName:void 0,fileNameWithLine:void 0,fileColumn:void 0,fileLine:void 0,filePath:void 0,filePathWithLine:void 0,method:void 0};if(null!=e){const n=e.match(Wt);if(n){r.filePath=n[1].replace(/\?.*$/,""),r.fullFilePath=`${t}${r.filePath}`;const e=r.filePath.split("/");r.fileName=e[e.length-1],r.fileLine=n[2],r.fileColumn=n[3],r.filePathWithLine=`${r.filePath}:${r.fileLine}`,r.fileNameWithLine=`${r.fileName}:${r.fileLine}`}}return r}function browser_isError(e){return e instanceof Error}function prettyFormatErrorObj(e,t){const r=getErrorTrace(e).map(e=>formatTemplate(t,t.prettyErrorStackTemplate,{...e},!0)),n={errorName:` ${e.name} `,errorMessage:Object.getOwnPropertyNames(e).reduce((t,r)=>("stack"!==r&&t.push(e[r]),t),[]).join(", "),errorStack:r.join("\n")};return formatTemplate(t,t.prettyErrorTemplate,n)}class BaseLogger{constructor(e,t,r=4){this.logObj=t,this.stackDepthLevel=r,this.runtime=_t,this.settings={type:e?.type??"pretty",name:e?.name,parentNames:e?.parentNames,minLevel:e?.minLevel??0,argumentsArrayName:e?.argumentsArrayName,hideLogPositionForProduction:e?.hideLogPositionForProduction??!1,prettyLogTemplate:e?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{filePathWithLine}}{{nameWithDelimiterPrefix}}\t",prettyErrorTemplate:e?.prettyErrorTemplate??"\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}",prettyErrorStackTemplate:e?.prettyErrorStackTemplate??" • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}",prettyErrorParentNamesSeparator:e?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:e?.prettyErrorLoggerNameDelimiter??"\t",stylePrettyLogs:e?.stylePrettyLogs??!0,prettyLogTimeZone:e?.prettyLogTimeZone??"UTC",prettyLogStyles:e?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:e?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:e?.metaProperty??"_meta",maskPlaceholder:e?.maskPlaceholder??"[***]",maskValuesOfKeys:e?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:e?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:e?.maskValuesRegEx,prefix:[...e?.prefix??[]],attachedTransports:[...e?.attachedTransports??[]],overwrite:{mask:e?.overwrite?.mask,toLogObj:e?.overwrite?.toLogObj,addMeta:e?.overwrite?.addMeta,addPlaceholders:e?.overwrite?.addPlaceholders,formatMeta:e?.overwrite?.formatMeta,formatLogObj:e?.overwrite?.formatLogObj,transportFormatted:e?.overwrite?.transportFormatted,transportJSON:e?.overwrite?.transportJSON}}}log(e,t,...r){if(e<this.settings.minLevel)return;const n=[...this.settings.prefix,...r],i=null!=this.settings.overwrite?.mask?this.settings.overwrite?.mask(n):null!=this.settings.maskValuesOfKeys&&this.settings.maskValuesOfKeys.length>0?this._mask(n):n,s=null!=this.logObj?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,o=null!=this.settings.overwrite?.toLogObj?this.settings.overwrite?.toLogObj(i,s):this._toLogObj(i,s),a=null!=this.settings.overwrite?.addMeta?this.settings.overwrite?.addMeta(o,e,t):this._addMetaToLogObj(o,e,t);let l,c;return null!=this.settings.overwrite?.formatMeta&&(l=this.settings.overwrite?.formatMeta(a?.[this.settings.metaProperty])),null!=this.settings.overwrite?.formatLogObj&&(c=this.settings.overwrite?.formatLogObj(i,this.settings)),"pretty"===this.settings.type&&(l=l??this._prettyFormatLogObjMeta(a?.[this.settings.metaProperty]),c=c??this.runtime.prettyFormatLogObj(i,this.settings)),null!=l&&null!=c?null!=this.settings.overwrite?.transportFormatted?this.settings.overwrite?.transportFormatted(l,c.args,c.errors,this.settings):this.runtime.transportFormatted(l,c.args,c.errors,this.settings):null!=this.settings.overwrite?.transportJSON?this.settings.overwrite?.transportJSON(a):"hidden"!==this.settings.type&&this.runtime.transportJSON(a),null!=this.settings.attachedTransports&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(e=>{e(a)}),a}attachTransport(e){this.settings.attachedTransports.push(e)}getSubLogger(e,t){const r={...this.settings,...e,parentNames:null!=this.settings?.parentNames&&null!=this.settings?.name?[...this.settings.parentNames,this.settings.name]:null!=this.settings?.name?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...e?.prefix??[]]};return new this.constructor(r,t??this.logObj,this.stackDepthLevel)}_mask(e){const t=!0!==this.settings.maskValuesOfKeysCaseInsensitive?this.settings.maskValuesOfKeys:this.settings.maskValuesOfKeys.map(e=>e.toLowerCase());return e?.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t))}_recursiveCloneAndMaskValuesOfKeys(e,t,r=[]){if(r.includes(e))return{...e};if("object"==typeof e&&null!==e&&r.push(e),this.runtime.isError(e)||this.runtime.isBuffer(e))return e;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Array.isArray(e))return e.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t,r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof URL)return function urlToObject(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([e,t])=>({key:e,value:t})),hash:e.hash,origin:e.origin}}(e);if(null!==e&&"object"==typeof e){const n=this.runtime.isError(e)?this._cloneError(e):Object.create(Object.getPrototypeOf(e));return Object.getOwnPropertyNames(e).reduce((n,i)=>(n[i]=t.includes(!0!==this.settings?.maskValuesOfKeysCaseInsensitive?i:i.toLowerCase())?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(e[i],t,r)}catch(e){return null}})(),n),n)}if("string"==typeof e){let t=e;for(const e of this.settings?.maskValuesRegEx||[])t=t.replace(e,this.settings?.maskPlaceholder||"");return t}return e}_recursiveCloneAndExecuteFunctions(e,t=[]){return this.isObjectOrArray(e)&&t.includes(e)?this.shallowCopy(e):(this.isObjectOrArray(e)&&t.push(e),Array.isArray(e)?e.map(e=>this._recursiveCloneAndExecuteFunctions(e,t)):e instanceof Date?new Date(e.getTime()):this.isObject(e)?Object.getOwnPropertyNames(e).reduce((r,n)=>{const i=Object.getOwnPropertyDescriptor(e,n);if(i){Object.defineProperty(r,n,i);const s=e[n];r[n]="function"==typeof s?s():this._recursiveCloneAndExecuteFunctions(s,t)}return r},Object.create(Object.getPrototypeOf(e))):e)}isObjectOrArray(e){return"object"==typeof e&&null!==e}isObject(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}shallowCopy(e){return Array.isArray(e)?[...e]:{...e}}_toLogObj(e,t={}){return e=e?.map(e=>this.runtime.isError(e)?this._toErrorObject(e):e),t=null==this.settings.argumentsArrayName?1!==e.length||Array.isArray(e[0])||!0===this.runtime.isBuffer(e[0])||e[0]instanceof Date?{...t,...e}:"object"==typeof e[0]&&null!=e[0]?{...e[0],...t}:{0:e[0],...t}:{...t,[this.settings.argumentsArrayName]:e}}_cloneError(e){const t=new e.constructor;return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t}_toErrorObject(e){return{nativeError:e,name:e.name??"Error",message:e.message,stack:this.runtime.getErrorTrace(e)}}_addMetaToLogObj(e,t,r){return{...e,[this.settings.metaProperty]:this.runtime.getMeta(t,r,this.stackDepthLevel,this.settings.hideLogPositionForProduction,this.settings.name,this.settings.parentNames)}}_prettyFormatLogObjMeta(e){if(null==e)return"";let t=this.settings.prettyLogTemplate;const r={};t.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?t=t.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):"UTC"===this.settings.prettyLogTimeZone?(r.yyyy=e?.date?.getUTCFullYear()??"----",r.mm=formatNumberAddZeros(e?.date?.getUTCMonth(),2,1),r.dd=formatNumberAddZeros(e?.date?.getUTCDate(),2),r.hh=formatNumberAddZeros(e?.date?.getUTCHours(),2),r.MM=formatNumberAddZeros(e?.date?.getUTCMinutes(),2),r.ss=formatNumberAddZeros(e?.date?.getUTCSeconds(),2),r.ms=formatNumberAddZeros(e?.date?.getUTCMilliseconds(),3)):(r.yyyy=e?.date?.getFullYear()??"----",r.mm=formatNumberAddZeros(e?.date?.getMonth(),2,1),r.dd=formatNumberAddZeros(e?.date?.getDate(),2),r.hh=formatNumberAddZeros(e?.date?.getHours(),2),r.MM=formatNumberAddZeros(e?.date?.getMinutes(),2),r.ss=formatNumberAddZeros(e?.date?.getSeconds(),2),r.ms=formatNumberAddZeros(e?.date?.getMilliseconds(),3));const n="UTC"===this.settings.prettyLogTimeZone?e?.date:new Date(e?.date?.getTime()-6e4*e?.date?.getTimezoneOffset());r.rawIsoStr=n?.toISOString(),r.dateIsoStr=n?.toISOString().replace("T"," ").replace("Z",""),r.logLevelName=e?.logLevelName,r.fileNameWithLine=e?.path?.fileNameWithLine??"",r.filePathWithLine=e?.path?.filePathWithLine??"",r.fullFilePath=e?.path?.fullFilePath??"";let i=this.settings.parentNames?.join(this.settings.prettyErrorParentNamesSeparator);return i=null!=i&&null!=e?.name?i+this.settings.prettyErrorParentNamesSeparator:void 0,r.name=null!=e?.name||null!=i?(i??"")+e?.name??"":"",r.nameWithDelimiterPrefix=r.name.length>0?this.settings.prettyErrorLoggerNameDelimiter+r.name:"",r.nameWithDelimiterSuffix=r.name.length>0?r.name+this.settings.prettyErrorLoggerNameDelimiter:"",null!=this.settings.overwrite?.addPlaceholders&&this.settings.overwrite?.addPlaceholders(e,r),formatTemplate(this.settings,t,r)}}class esm_Logger extends BaseLogger{constructor(e,t){const r="undefined"!=typeof window&&"undefined"!=typeof document,n=!!r&&(void 0!==window.chrome&&void 0!==window.CSS&&window.CSS.supports("color","green")),i=!!r&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);(e=e||{}).stylePrettyLogs=!(e.stylePrettyLogs&&r&&!n)&&e.stylePrettyLogs,super(e,t,i?4:5)}log(e,t,...r){return super.log(e,t,...r)}silly(...e){return super.log(0,"SILLY",...e)}trace(...e){return super.log(1,"TRACE",...e)}debug(...e){return super.log(2,"DEBUG",...e)}info(...e){return super.log(3,"INFO",...e)}warn(...e){return super.log(4,"WARN",...e)}error(...e){return super.log(5,"ERROR",...e)}fatal(...e){return super.log(6,"FATAL",...e)}getSubLogger(e,t){return super.getSubLogger(e,t)}}function init(e){const t=new ServiceResolver;e.addEventListener(p.GetServiceResolver,e=>{e.setServiceResolver(t),e.stopPropagation()}),t.setService(w.action,new PriorityRegistry),t.setService(w.setting,new Registry),t.setService(w.icon,new Registry);const r=new esm_Logger({name:"app-core",type:"pretty"});t.setService(w.logger,r);const n=[EventDispatcher,ElementParser,CollectionParser,TokenParser_TokenParser,ApiConfiguration,FetchHelper,DeleteElementEndpoint,GetElementEndpoint,GetElementChildrenEndpoint,GetElementParentsEndpoint,GetElementRelatedEndpoint,GetIndexEndpoint,PatchElementEndpoint,PostElementEndpoint,PostIndexEndpoint,PutElementEndpoint,DeleteTokenEndpoint,GetMeEndpoint,GetTokenEndpoint,PostChangePasswordEndpoint,PostRegisterEndpoint,PostTokenEndpoint,ElementCache,ElementChildrenCache,ElementParentsCache,ElementRelatedCache,IndexCache,EventDispatcher,ApiWrapper];for(let e=0;e<n.length;e++)t.setService(n[e].identifier,n[e].constructFromServiceResolver(t));return initEventListener(t),t}export{n as BrowserEvent,i as BrowserEventListener,o as Cache,c as Endpoint,s as Error,d as Event,f as EventListener,m as Service,S as Type,init};
1
+ var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BrowserEventIdentifier:()=>p,EventIdentifier:()=>g,HttpRequestMethod:()=>y,LogLevel:()=>v,RequestProblemCategory:()=>E,ServiceIdentifier:()=>w});var r={};e.r(r),e.d(r,{customEventDefaultInit:()=>T});var n={};e.r(n),e.d(n,{GetServiceResolverEvent:()=>GetServiceResolverEvent});var i={};e.r(i),e.d(i,{exportPlaceholder:()=>b});var s={};e.r(s),e.d(s,{EmberNexusError:()=>EmberNexusError,LogicError:()=>LogicError,NetworkError:()=>NetworkError,ParseError:()=>ParseError,Response401UnauthorizedError:()=>Response401UnauthorizedError,Response403ForbiddenError:()=>Response403ForbiddenError,Response404NotFoundError:()=>Response404NotFoundError,Response429TooManyRequestsError:()=>Response429TooManyRequestsError,ResponseError:()=>ResponseError,ValidationError:()=>ValidationError});var o={};e.r(o),e.d(o,{Cache:()=>Cache,ElementCache:()=>ElementCache,ElementChildrenCache:()=>ElementChildrenCache,ElementParentsCache:()=>ElementParentsCache,ElementRelatedCache:()=>ElementRelatedCache,IndexCache:()=>IndexCache});var a={};e.r(a),e.d(a,{DeleteElementEndpoint:()=>DeleteElementEndpoint,GetElementChildrenEndpoint:()=>GetElementChildrenEndpoint,GetElementEndpoint:()=>GetElementEndpoint,GetElementParentsEndpoint:()=>GetElementParentsEndpoint,GetElementRelatedEndpoint:()=>GetElementRelatedEndpoint,GetIndexEndpoint:()=>GetIndexEndpoint,PatchElementEndpoint:()=>PatchElementEndpoint,PostElementEndpoint:()=>PostElementEndpoint,PostIndexEndpoint:()=>PostIndexEndpoint,PutElementEndpoint:()=>PutElementEndpoint});var l={};e.r(l),e.d(l,{DeleteTokenEndpoint:()=>DeleteTokenEndpoint,GetMeEndpoint:()=>GetMeEndpoint,GetTokenEndpoint:()=>GetTokenEndpoint,PostChangePasswordEndpoint:()=>PostChangePasswordEndpoint,PostRegisterEndpoint:()=>PostRegisterEndpoint,PostTokenEndpoint:()=>PostTokenEndpoint});var c={};e.r(c),e.d(c,{Element:()=>a,User:()=>l});var u={};e.r(u);var h={};e.r(h),e.d(h,{Event:()=>Event,PriorityRegistry:()=>PriorityRegistry,Registry:()=>Registry,Response:()=>u,createUniqueUserIdentifierFromString:()=>createUniqueUserIdentifierFromString,eventIdentifierRegex:()=>L,eventListenerTargetRegex:()=>C,getEventListenerTargetsFromEventIdentifier:()=>getEventListenerTargetsFromEventIdentifier,serviceIdentifierRegex:()=>I,tokenRegex:()=>N,uuidv4Regex:()=>R,validateEventIdentifierFromString:()=>validateEventIdentifierFromString,validateEventListenerTargetFromString:()=>validateEventListenerTargetFromString,validateServiceIdentifierFromString:()=>validateServiceIdentifierFromString,validateTokenFromString:()=>validateTokenFromString,validateUuidFromString:()=>validateUuidFromString});var d={};e.r(d),e.d(d,{NormalizedValueToRawValueEvent:()=>NormalizedValueToRawValueEvent,RawValueToNormalizedValueEvent:()=>RawValueToNormalizedValueEvent});var m={};e.r(m),e.d(m,{ApiConfiguration:()=>ApiConfiguration,ApiWrapper:()=>ApiWrapper,CollectionParser:()=>CollectionParser,ElementParser:()=>ElementParser,EventDispatcher:()=>EventDispatcher,FetchHelper:()=>FetchHelper,Logger:()=>Logger,ServiceResolver:()=>ServiceResolver,TokenParser:()=>TokenParser_TokenParser});var f={};e.r(f),e.d(f,{DateTimeNormalizedValueToRawValueEventListener:()=>DateTimeNormalizedValueToRawValueEventListener,DateTimeRawValueToNormalizedValueEventListener:()=>DateTimeRawValueToNormalizedValueEventListener,GenericNormalizedValueToRawValueEventListener:()=>GenericNormalizedValueToRawValueEventListener,GenericRawValueToNormalizedValueEventListener:()=>GenericRawValueToNormalizedValueEventListener,initEventListener:()=>initEventListener});var p,g,y,v,E,w,S={};e.r(S),e.d(S,{Definition:()=>h,Enum:()=>t,Partial:()=>r}),function(e){e.GetServiceResolver="ember-nexus.app-core.get-service-resolver"}(p||(p={})),function(e){e.NormalizedValueToRawValueEvent="ember-nexus.app-core.event.normalized-value-to-raw-value",e.RawValueToNormalizedValueEvent="ember-nexus.app-core.event.raw-value-to-normalized-value"}(g||(g={})),function(e){e.GET="GET",e.POST="POST",e.PATCH="PATCH",e.PUT="PUT",e.DELETE="DELETE",e.HEAD="HEAD",e.COPY="COPY",e.LOCK="LOCK",e.UNLOCK="UNLOCK",e.MKCOL="MKCOL",e.MOVE="MOVE",e.PROPFIND="PROPFIND",e.PROPPATCH="PROPPATCH"}(y||(y={})),function(e){e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"}(v||(v={})),function(e){e.ClientSide="client",e.ServerSide="server",e.Logic="Logic"}(E||(E={})),function(e){e.emberNexusWebSDK="ember-nexus.web-sdk",e.logger="global.logger",e.action="global.action-registry",e.setting="global.setting-registry",e.icon="global.icon-registry",e.serviceFetchHelper="ember-nexus.app-core.service.fetch-helper-service",e.serviceApiConfiguration="ember-nexus.app-core.service.api-configuration-service",e.serviceElementParser="ember-nexus.app-core.service.element-parser-service",e.serviceCollectionParser="ember-nexus.app-core.service.collection-parser-service",e.serviceTokenParser="ember-nexus.app-core.service.token-parser-service",e.serviceApiWrapper="ember-nexus.app-core.service.api-wrapper",e.serviceEventDispatcher="ember-nexus.app-core.service.event-dispatcher",e.endpointElementDeleteElementEndpoint="ember-nexus.app-core.endpoint.element.delete-element-endpoint",e.endpointElementGetElementEndpoint="ember-nexus.app-core.endpoint.element.get-element-endpoint",e.endpointElementGetElementChildrenEndpoint="ember-nexus.app-core.endpoint.element.get-element-children-endpoint",e.endpointElementGetElementParentsEndpoint="ember-nexus.app-core.endpoint.element.get-element-parents-endpoint",e.endpointElementGetElementRelatedEndpoint="ember-nexus.app-core.endpoint.element.get-element-related-endpoint",e.endpointElementGetIndexEndpoint="ember-nexus.app-core.endpoint.element.get-index-endpoint",e.endpointElementPatchElementEndpoint="ember-nexus.app-core.endpoint.element.patch-element-endpoint",e.endpointElementPostElementEndpoint="ember-nexus.app-core.endpoint.element.post-element-endpoint",e.endpointElementPostIndexEndpoint="ember-nexus.app-core.endpoint.element.post-index-endpoint",e.endpointElementPutElementEndpoint="ember-nexus.app-core.endpoint.element.put-element-endpoint",e.endpointUserDeleteTokenEndpoint="ember-nexus.app-core.endpoint.user.delete-token-endpoint",e.endpointUserGetMeEndpoint="ember-nexus.app-core.endpoint.user.get-me-endpoint",e.endpointUserGetTokenEndpoint="ember-nexus.app-core.endpoint.user.get-token-endpoint",e.endpointUserPostChangePasswordEndpoint="ember-nexus.app-core.endpoint.user.post-change-password-endpoint",e.endpointUserPostRegisterEndpoint="ember-nexus.app-core.endpoint.user.post-register-endpoint",e.endpointUserPostTokenEndpoint="ember-nexus.app-core.endpoint.user.post-token-endpoint",e.cacheElement="ember-nexus.app-core.cache.element-cache",e.cacheElementChildren="ember-nexus.app-core.cache.element-children-cache",e.cacheElementParents="ember-nexus.app-core.cache.element-parents-cache",e.cacheElementRelated="ember-nexus.app-core.cache.element-related-cache",e.cacheIndex="ember-nexus.app-core.cache.index-cache"}(w||(w={}));const T={bubbles:!0,composed:!0,cancelable:!0};class GetServiceResolverEvent extends CustomEvent{static{this.type=p.GetServiceResolver}constructor(){super(GetServiceResolverEvent.type,{...T,detail:{serviceResolver:null}})}getServiceResolver(){return this.detail.serviceResolver}setServiceResolver(e){this.detail.serviceResolver=e}}const b=!1;class EmberNexusError extends Error{constructor(e){super(e)}}class LogicError extends EmberNexusError{constructor(e){super(e),this.name="LogicError"}}class NetworkError extends EmberNexusError{constructor(e,t){super(e),this.name="NetworkError",this.cause=t}}class ParseError extends EmberNexusError{constructor(e){super(e),this.name="ParseError"}}class ResponseError extends EmberNexusError{constructor(e){super(e),this._type=null,this._title=null,this._detail=null,this._status=null}getType(){return this._type}setType(e){return this._type=e,this}getTitle(){return this._title}setTitle(e){return this._title=e,this}getDetail(){return this._detail}setDetail(e){return this._detail=e,this}getStatus(){return this._status}setStatus(e){return this._status=e,this}}class Response401UnauthorizedError extends ResponseError{constructor(e){super(e),this.name="Response401UnauthorizedError",this.setStatus(401)}}class Response403ForbiddenError extends ResponseError{constructor(e){super(e),this.name="Response403ForbiddenError",this.setStatus(403)}}class Response404NotFoundError extends ResponseError{constructor(e){super(e),this.name="Response404NotFoundError",this.setStatus(404)}}class Response429TooManyRequestsError extends ResponseError{constructor(e){super(e),this.name="Response429TooManyRequestsError",this.setStatus(429)}}class ValidationError extends EmberNexusError{constructor(e){super(e),this.name="ValidationError"}}class Cache{has(e){return this.cache.has(e)}get(e){return this.cache.get(e)}set(e,t){return this.cache.set(e,t),this}delete(e){return this.cache.delete(e),this}setFromDataEtag(e,t,r){const n=this.cache.get(e);n&&void 0===r&&(r=n.etag);const i={data:t,etag:r};return this.cache.set(e,i),this}setFromParsedResponse(e,t){const r=t.response.headers.get("ETag");if(null===r)throw new LogicError("Expected parsedResponse to contain ETag header.");const n={data:t.data,etag:r};return this.cache.set(e,n),this}refresh(e){return this}}const O="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,k=new Set,F="object"==typeof process&&process?process:{},emitWarning=(e,t,r,n)=>{"function"==typeof F.emitWarning?F.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let x=globalThis.AbortController,D=globalThis.AbortSignal;if(void 0===x){D=class AbortSignal{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},x=class AbortController{constructor(){warnACPolyfill()}signal=new D;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==F.env?.LRU_CACHE_IGNORE_AC_WARNING;const warnACPolyfill=()=>{e&&(e=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",warnACPolyfill))}}Symbol("type");const isPosInt=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),getUintArray=e=>isPosInt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(e){super(e),this.fill(0)}}class Stack{heap;length;static#e=!1;static create(e){const t=getUintArray(e);if(!t)return[];Stack.#e=!0;const r=new Stack(e,t);return Stack.#e=!1,r}constructor(e,t){if(!Stack.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class LRUCache{#t;#r;#n;#i;#s;#o;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#c;#u;#h;#d;#m;#f;#p;#g;#y;#v;#E;#w;#S;#T;#b;#O;#k;static unsafeExposeInternals(e){return{starts:e.#w,ttls:e.#S,sizes:e.#E,keyMap:e.#u,keyList:e.#h,valList:e.#d,next:e.#m,prev:e.#f,get head(){return e.#p},get tail(){return e.#g},free:e.#y,isBackgroundFetch:t=>e.#F(t),backgroundFetch:(t,r,n,i)=>e.#x(t,r,n,i),moveToTail:t=>e.#D(t),indexes:t=>e.#L(t),rindexes:t=>e.#C(t),isStale:t=>e.#I(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#c}get size(){return this.#l}get fetchMethod(){return this.#o}get memoMethod(){return this.#a}get dispose(){return this.#n}get onInsert(){return this.#i}get disposeAfter(){return this.#s}constructor(e){const{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:i,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:a,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:d,maxSize:m=0,maxEntrySize:f=0,sizeCalculation:p,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:S,ignoreFetchAbort:T}=e;if(0!==t&&!isPosInt(t))throw new TypeError("max option must be a nonnegative integer");const b=t?getUintArray(t):Array;if(!b)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=m,this.maxEntrySize=f||this.#r,this.sizeCalculation=p,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=g,this.#b=!!g,this.#u=new Map,this.#h=new Array(t).fill(void 0),this.#d=new Array(t).fill(void 0),this.#m=new b(t),this.#f=new b(t),this.#p=0,this.#g=0,this.#y=Stack.create(t),this.#l=0,this.#c=0,"function"==typeof l&&(this.#n=l),"function"==typeof c&&(this.#i=c),"function"==typeof u?(this.#s=u,this.#v=[]):(this.#s=void 0,this.#v=void 0),this.#T=!!this.#n,this.#k=!!this.#i,this.#O=!!this.#s,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!T,0!==this.maxEntrySize){if(0!==this.#r&&!isPosInt(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#N()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=isPosInt(n)||0===n?n:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";if((e=>!k.has(e))(e)){k.add(e);emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,LRUCache)}}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#R(){const e=new ZeroArray(this.#t),t=new ZeroArray(this.#t);this.#S=e,this.#w=t,this.#P=(r,n,i=O.now())=>{if(t[r]=0!==n?i:0,e[r]=n,0!==n&&this.ttlAutopurge){const e=setTimeout(()=>{this.#I(r)&&this.#A(this.#h[r],"expire")},n+1);e.unref&&e.unref()}},this.#z=r=>{t[r]=0!==e[r]?O.now():0},this.#M=(n,i)=>{if(e[i]){const s=e[i],o=t[i];if(!s||!o)return;n.ttl=s,n.start=o,n.now=r||getNow();const a=n.now-o;n.remainingTTL=s-a}};let r=0;const getNow=()=>{const e=O.now();if(this.ttlResolution>0){r=e;const t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{const i=this.#u.get(n);if(void 0===i)return 0;const s=e[i],o=t[i];if(!s||!o)return 1/0;return s-((r||getNow())-o)},this.#I=n=>{const i=t[n],s=e[n];return!!s&&!!i&&(r||getNow())-i>s}}#z=()=>{};#M=()=>{};#P=()=>{};#I=()=>!1;#N(){const e=new ZeroArray(this.#t);this.#c=0,this.#E=e,this.#V=t=>{this.#c-=e[t],e[t]=0},this.#U=(e,t,r,n)=>{if(this.#F(t))return 0;if(!isPosInt(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!isPosInt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#_=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#c>r;)this.#H(!0)}this.#c+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#c)}}#V=e=>{};#_=(e,t,r)=>{};#U=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#g;this.#W(t)&&(!e&&this.#I(t)||(yield t),t!==this.#p);)t=this.#f[t]}*#C({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#p;this.#W(t)&&(!e&&this.#I(t)||(yield t),t!==this.#g);)t=this.#m[t]}#W(e){return void 0!==e&&this.#u.get(this.#h[e])===e}*entries(){for(const e of this.#L())void 0===this.#d[e]||void 0===this.#h[e]||this.#F(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*rentries(){for(const e of this.#C())void 0===this.#d[e]||void 0===this.#h[e]||this.#F(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*keys(){for(const e of this.#L()){const t=this.#h[e];void 0===t||this.#F(this.#d[e])||(yield t)}}*rkeys(){for(const e of this.#C()){const t=this.#h[e];void 0===t||this.#F(this.#d[e])||(yield t)}}*values(){for(const e of this.#L()){void 0===this.#d[e]||this.#F(this.#d[e])||(yield this.#d[e])}}*rvalues(){for(const e of this.#C()){void 0===this.#d[e]||this.#F(this.#d[e])||(yield this.#d[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#L()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;if(void 0!==i&&e(i,this.#h[r],this))return this.get(this.#h[r],t)}}forEach(e,t=this){for(const r of this.#L()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#h[r],this)}}rforEach(e,t=this){for(const r of this.#C()){const n=this.#d[r],i=this.#F(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#h[r],this)}}purgeStale(){let e=!1;for(const t of this.#C({allowStale:!0}))this.#I(t)&&(this.#A(this.#h[t],"expire"),e=!0);return e}info(e){const t=this.#u.get(e);if(void 0===t)return;const r=this.#d[t],n=this.#F(r)?r.__staleWhileFetching:r;if(void 0===n)return;const i={value:n};if(this.#S&&this.#w){const e=this.#S[t],r=this.#w[t];if(e&&r){const t=e-(O.now()-r);i.ttl=t,i.start=Date.now()}}return this.#E&&(i.size=this.#E[t]),i}dump(){const e=[];for(const t of this.#L({allowStale:!0})){const r=this.#h[t],n=this.#d[t],i=this.#F(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;const s={value:i};if(this.#S&&this.#w){s.ttl=this.#S[t];const e=O.now()-this.#w[t];s.start=Math.floor(Date.now()-e)}this.#E&&(s.size=this.#E[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=O.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=r;let{noUpdateTTL:l=this.noUpdateTTL}=r;const c=this.#U(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let u=0===this.#l?void 0:this.#u.get(e);if(void 0===u)u=0===this.#l?this.#g:0!==this.#y.length?this.#y.pop():this.#l===this.#t?this.#H(!1):this.#l,this.#h[u]=e,this.#d[u]=t,this.#u.set(e,u),this.#m[this.#g]=u,this.#f[u]=this.#g,this.#g=u,this.#l++,this.#_(u,c,a),a&&(a.set="add"),l=!1,this.#k&&this.#i?.(t,e,"add");else{this.#D(u);const r=this.#d[u];if(t!==r){if(this.#b&&this.#F(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||s||(this.#T&&this.#n?.(t,e,"set"),this.#O&&this.#v?.push([t,e,"set"]))}else s||(this.#T&&this.#n?.(r,e,"set"),this.#O&&this.#v?.push([r,e,"set"]));if(this.#V(u),this.#_(u,c,a),this.#d[u]=t,a){a.set="replace";const e=r&&this.#F(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#k&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#S||this.#R(),this.#S&&(l||this.#P(u,n,i),a&&this.#M(a,u)),!s&&this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}return this}pop(){try{for(;this.#l;){const e=this.#d[this.#p];if(this.#H(!0),this.#F(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}}}#H(e){const t=this.#p,r=this.#h[t],n=this.#d[t];return this.#b&&this.#F(n)?n.__abortController.abort(new Error("evicted")):(this.#T||this.#O)&&(this.#T&&this.#n?.(n,r,"evict"),this.#O&&this.#v?.push([n,r,"evict"])),this.#V(t),e&&(this.#h[t]=void 0,this.#d[t]=void 0,this.#y.push(t)),1===this.#l?(this.#p=this.#g=0,this.#y.length=0):this.#p=this.#m[t],this.#u.delete(r),this.#l--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=this.#u.get(e);if(void 0!==i){const e=this.#d[i];if(this.#F(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#I(i))return r&&this.#z(i),n&&(n.has="hit",this.#M(n,i)),!0;n&&(n.has="stale",this.#M(n,i))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#u.get(e);if(void 0===n||!r&&this.#I(n))return;const i=this.#d[n];return this.#F(i)?i.__staleWhileFetching:i}#x(e,t,r,n){const i=void 0===t?void 0:this.#d[t];if(this.#F(i))return i;const s=new x,{signal:o}=r;o?.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const a={signal:s.signal,options:r,context:n},cb=(n,i=!1)=>{const{aborted:o}=s.signal,c=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,c&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!c&&!i)return fetchFail(s.signal.reason);const u=l;return this.#d[t]===l&&(void 0===n?u.__staleWhileFetching?this.#d[t]=u.__staleWhileFetching:this.#A(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,a.options))),n},fetchFail=n=>{const{aborted:i}=s.signal,o=i&&r.allowStaleOnFetchAbort,a=o||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,u=l;if(this.#d[t]===l){!c||void 0===u.__staleWhileFetching?this.#A(e,"fetch"):o||(this.#d[t]=u.__staleWhileFetching)}if(a)return r.status&&void 0!==u.__staleWhileFetching&&(r.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw n};r.status&&(r.status.fetchDispatched=!0);const l=new Promise((t,n)=>{const o=this.#o?.(e,i,a);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),s.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>cb(e,!0)))})}).then(cb,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),fetchFail(e))),c=Object.assign(l,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,c,{...a.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=c,c}#F(e){if(!this.#b)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof x}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:f,forceRefresh:p=!1,status:g,signal:y}=t;if(!this.#b)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:g});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:s,noDisposeOnSet:o,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:g,signal:y};let E=this.#u.get(e);if(void 0===E){g&&(g.fetch="miss");const t=this.#x(e,E,v,f);return t.__returned=t}{const t=this.#d[E];if(this.#F(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#I(E);if(!p&&!i)return g&&(g.fetch="hit"),this.#D(E),n&&this.#z(E),g&&this.#M(g,E),t;const s=this.#x(e,E,v,f),o=void 0!==s.__staleWhileFetching&&r;return g&&(g.fetch=i?"stale":"refresh",o&&i&&(g.returnedStale=!0)),o?s.__staleWhileFetching:s.__returned=s}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#a;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:i,...s}=t,o=this.get(e,s);if(!i&&void 0!==o)return o;const a=r(e,o,{options:s,context:n});return this.set(e,a,s),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:s}=t,o=this.#u.get(e);if(void 0!==o){const t=this.#d[o],a=this.#F(t);return s&&this.#M(s,o),this.#I(o)?(s&&(s.get="stale"),a?(s&&r&&void 0!==t.__staleWhileFetching&&(s.returnedStale=!0),r?t.__staleWhileFetching:void 0):(i||this.#A(e,"expire"),s&&r&&(s.returnedStale=!0),r?t:void 0)):(s&&(s.get="hit"),a?t.__staleWhileFetching:(this.#D(o),n&&this.#z(o),t))}s&&(s.get="miss")}#j(e,t){this.#f[t]=e,this.#m[e]=t}#D(e){e!==this.#g&&(e===this.#p?this.#p=this.#m[e]:this.#j(this.#f[e],this.#m[e]),this.#j(this.#g,e),this.#g=e)}delete(e){return this.#A(e,"delete")}#A(e,t){let r=!1;if(0!==this.#l){const n=this.#u.get(e);if(void 0!==n)if(r=!0,1===this.#l)this.#Z(t);else{this.#V(n);const r=this.#d[n];if(this.#F(r)?r.__abortController.abort(new Error("deleted")):(this.#T||this.#O)&&(this.#T&&this.#n?.(r,e,t),this.#O&&this.#v?.push([r,e,t])),this.#u.delete(e),this.#h[n]=void 0,this.#d[n]=void 0,n===this.#g)this.#g=this.#f[n];else if(n===this.#p)this.#p=this.#m[n];else{const e=this.#f[n];this.#m[e]=this.#m[n];const t=this.#m[n];this.#f[t]=this.#f[n]}this.#l--,this.#y.push(n)}}if(this.#O&&this.#v?.length){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}return r}clear(){return this.#Z("delete")}#Z(e){for(const t of this.#C({allowStale:!0})){const r=this.#d[t];if(this.#F(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#h[t];this.#T&&this.#n?.(r,n,e),this.#O&&this.#v?.push([r,n,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#h.fill(void 0),this.#S&&this.#w&&(this.#S.fill(0),this.#w.fill(0)),this.#E&&this.#E.fill(0),this.#p=0,this.#g=0,this.#y.length=0,this.#c=0,this.#l=0,this.#O&&this.#v){const e=this.#v;let t;for(;t=e?.shift();)this.#s?.(...t)}}}class ElementCache extends Cache{static{this.identifier=w.cacheElement}constructor(){super(),this.cache=new LRUCache({max:500})}static constructFromServiceResolver(){return new ElementCache}static createCacheKey(e){return`${e}`}setFromCollection(e){for(let t=0;t<e.nodes.length;t++)this.setFromDataEtag(ElementCache.createCacheKey(e.nodes[t].id),e.nodes[t]);for(let t=0;t<e.relations.length;t++)this.setFromDataEtag(ElementCache.createCacheKey(e.relations[t].id),e.relations[t]);return this}}class ElementChildrenCache extends Cache{static{this.identifier=w.cacheElementChildren}constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementChildrenCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class ElementParentsCache extends Cache{static{this.identifier=w.cacheElementParents}constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementParentsCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class ElementRelatedCache extends Cache{static{this.identifier=w.cacheElementRelated}constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new ElementRelatedCache}static createCacheKey(e,t,r){return`${e}-${t}-${r}`}}class IndexCache extends Cache{static{this.identifier=w.cacheIndex}constructor(){super(),this.cache=new LRUCache({max:50})}static constructFromServiceResolver(){return new IndexCache}static createCacheKey(e,t){return`${e}-${t}`}}class DeleteElementEndpoint{static{this.identifier=w.endpointElementDeleteElementEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new DeleteElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async deleteElement(e){try{const t=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP DELETE request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(r),{response:r}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementChildrenEndpoint{static{this.identifier=w.endpointElementGetElementChildrenEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementChildrenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementChildren(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/children?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementEndpoint{static{this.identifier=w.endpointElementGetElementEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP GET request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultGetOptions(t)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===n.status)return{response:n};const i=await this.fetchHelper.parseJsonResponse(n);return{data:await this.elementParser.deserializeElement(i),response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementParentsEndpoint{static{this.identifier=w.endpointElementGetElementParentsEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementParentsEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementParents(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/parents?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetElementRelatedEndpoint{static{this.identifier=w.endpointElementGetElementRelatedEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetElementRelatedEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getElementRelated(e,t=1,r=25,n){try{if(t<1)throw new ValidationError("Page number must be at least 1.");if(r<1)throw new ValidationError("Page size must be at least 1.");const i=this.fetchHelper.buildUrl(`/${e}/related?page=${t}&pageSize=${r}`);this.logger.debug(`Executing HTTP GET request against URL: ${i}`);const s=await fetch(i,this.fetchHelper.getDefaultGetOptions(n)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===s.status)return{response:s};const o=await this.fetchHelper.parseJsonResponse(s);return{data:await this.collectionParser.deserializeCollection(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetIndexEndpoint{static{this.identifier=w.endpointElementGetIndexEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.collectionParser=r}static constructFromServiceResolver(e){return new GetIndexEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceCollectionParser))}async getIndex(e=1,t=25,r){try{if(e<1)throw new ValidationError("Page number must be at least 1.");if(t<1)throw new ValidationError("Page size must be at least 1.");const n=this.fetchHelper.buildUrl(`/?page=${e}&pageSize=${t}`);this.logger.debug(`Executing HTTP GET request against URL: ${n}`);const i=await fetch(n,this.fetchHelper.getDefaultGetOptions(r)).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));if(304===i.status)return{response:i};const s=await this.fetchHelper.parseJsonResponse(i);return{data:await this.collectionParser.deserializeCollection(s),response:i}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PatchElementEndpoint{static{this.identifier=w.endpointElementPatchElementEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PatchElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async patchElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PATCH request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPatchOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostElementEndpoint{static{this.identifier=w.endpointElementPostElementEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP POST request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPostOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(n),response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostIndexEndpoint{static{this.identifier=w.endpointElementPostIndexEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostIndexEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postIndex(e){try{const t=this.fetchHelper.buildUrl("/");this.logger.debug(`Executing HTTP POST request against URL: ${t}`);const r=await fetch(t,this.fetchHelper.getDefaultPostOptions(JSON.stringify(e))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(r),response:r}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PutElementEndpoint{static{this.identifier=w.endpointElementPutElementEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PutElementEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async putElement(e,t){try{const r=this.fetchHelper.buildUrl(`/${e}`);this.logger.debug(`Executing HTTP PUT request against URL: ${r}`);const n=await fetch(r,this.fetchHelper.getDefaultPutOptions(JSON.stringify(t))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(n),{response:n}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class DeleteTokenEndpoint{static{this.identifier=w.endpointUserDeleteTokenEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new DeleteTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async deleteToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP DELETE request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultDeleteOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(t),{response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetMeEndpoint{static{this.identifier=w.endpointUserGetMeEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetMeEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getMe(){try{const e=this.fetchHelper.buildUrl("/me");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("User"!==n.type)throw new LogicError("Expected node to be of type 'User'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class GetTokenEndpoint{static{this.identifier=w.endpointUserGetTokenEndpoint}constructor(e,t,r){this.logger=e,this.fetchHelper=t,this.elementParser=r}static constructFromServiceResolver(e){return new GetTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper),e.getServiceOrFail(w.serviceElementParser))}async getToken(){try{const e=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP GET request against URL: ${e}`);const t=await fetch(e,this.fetchHelper.getDefaultGetOptions()).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),r=await this.fetchHelper.parseJsonResponse(t),n=await this.elementParser.deserializeElement(r);if("Token"!==n.type)throw new LogicError("Expected node to be of type 'Token'.");return{data:n,response:t}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostChangePasswordEndpoint{static{this.identifier=w.endpointUserPostChangePasswordEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostChangePasswordEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postChangePassword(e,t,r){try{const n=this.fetchHelper.buildUrl("/change-password");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"ActionChangePassword",currentPassword:t,newPassword:r,uniqueUserIdentifier:e},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return await this.fetchHelper.parseEmptyResponse(s),{response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostRegisterEndpoint{static{this.identifier=w.endpointUserPostRegisterEndpoint}constructor(e,t){this.logger=e,this.fetchHelper=t}static constructFromServiceResolver(e){return new PostRegisterEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceFetchHelper))}async postRegister(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/register");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"User",uniqueUserIdentifier:e,password:t,data:r},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e));return{data:await this.fetchHelper.parseLocationResponse(s),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class PostTokenEndpoint{static{this.identifier=w.endpointUserPostTokenEndpoint}constructor(e,t,r){this.logger=e,this.tokenParser=t,this.fetchHelper=r}static constructFromServiceResolver(e){return new PostTokenEndpoint(e.getServiceOrFail(w.logger),e.getServiceOrFail(w.serviceTokenParser),e.getServiceOrFail(w.serviceFetchHelper))}async postToken(e,t,r={}){try{const n=this.fetchHelper.buildUrl("/token");this.logger.debug(`Executing HTTP POST request against URL: ${n}`);const i={type:"Token",uniqueUserIdentifier:e,password:t,data:r},s=await fetch(n,this.fetchHelper.getDefaultPostOptions(JSON.stringify(i))).catch(e=>this.fetchHelper.rethrowErrorAsNetworkError(e)),o=await this.fetchHelper.parseJsonResponse(s);return{data:this.tokenParser.rawTokenToToken(o),response:s}}catch(e){this.fetchHelper.logAndThrowError(e)}}}class Event{constructor(e){this.stopped=!1,this.identifier=e}getIdentifier(){return this.identifier}isPropagationStopped(){return this.stopped}stopPropagation(){return this.stopped=!0,this}}const L=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;function validateEventIdentifierFromString(e){if(!L.test(e))throw new ParseError("Passed variable is not a valid event identifier.");return e}const C=/^(?:([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*|\*|([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*(\.\*))$/;function validateEventListenerTargetFromString(e){if(!C.test(e))throw new ParseError("Passed variable is not a valid event listener target.");return e}function getEventListenerTargetsFromEventIdentifier(e){const t=e.split("."),r=[];r.push(validateEventListenerTargetFromString(e));for(let e=t.length-1;e>0;e--)r.push(validateEventListenerTargetFromString(t.slice(0,e).join(".")+".*"));return r.push(validateEventListenerTargetFromString("*")),r}class PriorityRegistry{constructor(){this.entries=new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){if(!this.hasEntry(e))return null;const t=this.entries.get(e);return t[t.length-1].entry}hasEntry(e){return this.entries.has(e)}setEntry(e,t,r){let n;void 0===r&&(r=0),this.entries.has(e)?n=this.entries.get(e):(n=[],this.entries.set(e,n));let i=0,s=n.length-1,o=-1;for(;i<=s;){const e=Math.floor((i+s)/2);n[e].priority>=r?(o=e,s=e-1):i=e+1}const a=-1===o?i:o;return n.splice(a,0,{priority:r,entry:t}),this}getAllEntriesForKey(e){return this.entries.has(e)?this.entries.get(e).map(e=>e.entry):null}}class Registry{constructor(){this.entries=new Map}clearEntries(){return this.entries.clear(),this}deleteEntry(e){return this.entries.delete(e),this}getEntry(e){return this.hasEntry(e)?this.entries.get(e):null}hasEntry(e){return this.entries.has(e)}setEntry(e,t){return this.entries.set(e,t),this}}const I=/^([a-z][a-z0-9-]*)(\.([a-z][a-z0-9-]*))*$/;function validateServiceIdentifierFromString(e){if(!I.test(e))throw new ParseError("Passed variable is not a valid service identifier.");return e}const N=/^secret-token:.+$/;function validateTokenFromString(e){if(!N.test(e))throw new Error("Passed variable is not a valid token.");return e}function createUniqueUserIdentifierFromString(e){return e}const R=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function validateUuidFromString(e){if(!R.test(e))throw new ParseError("Passed variable is not a valid UUID v4.");return e}class NormalizedValueToRawValueEvent extends Event{static{this.identifier=g.NormalizedValueToRawValueEvent}constructor(e){super(NormalizedValueToRawValueEvent.identifier),this.normalizedValue=e,this.rawValue=null}getNormalizedValue(){return this.normalizedValue}getRawValue(){return this.rawValue}setRawValue(e){return this.isPropagationStopped()||(this.rawValue=e),this}}class RawValueToNormalizedValueEvent extends Event{static{this.identifier=g.RawValueToNormalizedValueEvent}constructor(e){super(RawValueToNormalizedValueEvent.identifier),this.rawValue=e,this.normalizedValue=null}getRawValue(){return this.rawValue}getNormalizedValue(){return this.normalizedValue}setNormalizedValue(e){return this.isPropagationStopped()||(this.normalizedValue=e),this}}class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(e){super(`Invalid unit ${e}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const P="numeric",A="short",z="long",M={year:P,month:P,day:P},V={year:P,month:A,day:P},U={year:P,month:A,day:P,weekday:A},_={year:P,month:z,day:P},H={year:P,month:z,day:P,weekday:z},W={hour:P,minute:P},j={hour:P,minute:P,second:P},Z={hour:P,minute:P,second:P,timeZoneName:A},$={hour:P,minute:P,second:P,timeZoneName:z},G={hour:P,minute:P,hourCycle:"h23"},q={hour:P,minute:P,second:P,hourCycle:"h23"},B={hour:P,minute:P,second:P,hourCycle:"h23",timeZoneName:A},J={hour:P,minute:P,second:P,hourCycle:"h23",timeZoneName:z},Y={year:P,month:P,day:P,hour:P,minute:P},K={year:P,month:P,day:P,hour:P,minute:P,second:P},Q={year:P,month:A,day:P,hour:P,minute:P},X={year:P,month:A,day:P,hour:P,minute:P,second:P},ee={year:P,month:A,day:P,weekday:A,hour:P,minute:P},te={year:P,month:z,day:P,hour:P,minute:P,timeZoneName:A},re={year:P,month:z,day:P,hour:P,minute:P,second:P,timeZoneName:A},ne={year:P,month:z,day:P,weekday:z,hour:P,minute:P,timeZoneName:z},ie={year:P,month:z,day:P,weekday:z,hour:P,minute:P,second:P,timeZoneName:z};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(e,t){throw new ZoneIsAbstractError}formatOffset(e,t){throw new ZoneIsAbstractError}offset(e){throw new ZoneIsAbstractError}equals(e){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let se=null;class SystemZone extends Zone{static get instance(){return null===se&&(se=new SystemZone),se}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const oe=new Map;const ae={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};const le=new Map;class IANAZone extends Zone{static create(e){let t=le.get(e);return void 0===t&&le.set(e,t=new IANAZone(e)),t}static resetCache(){le.clear(),oe.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(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=IANAZone.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r,this.name)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=function makeDTF(e){let t=oe.get(e);return void 0===t&&(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"}),oe.set(e,t)),t}(this.name);let[n,i,s,o,a,l,c]=r.formatToParts?function partsOffset(e,t){const r=e.formatToParts(t),n=[];for(let e=0;e<r.length;e++){const{type:t,value:i}=r[e],s=ae[t];"era"===t?n[s]=i:isUndefined(s)||(n[s]=parseInt(i,10))}return n}(r,t):function hackyOffset(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,s,o,a,l,c,u]=n;return[o,i,s,a,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const h=u%1e3;return u-=h>=0?h:1e3+h,(objToLocalTS({year:n,month:i,day:s,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let ce={};const ue=new Map;function getCachedDTF(e,t={}){const r=JSON.stringify([e,t]);let n=ue.get(r);return void 0===n&&(n=new Intl.DateTimeFormat(e,t),ue.set(r,n)),n}const he=new Map;const de=new Map;let me=null;const fe=new Map;function getCachedIntResolvedOptions(e){let t=fe.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),fe.set(e,t)),t}const pe=new Map;function listStuff(e,t,r,n){const i=e.listingMode();return"error"===i?null:"en"===i?r(t):n(t)}class PolyNumberFormatter{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:i,...s}=r;if(!t||Object.keys(s).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function getCachedINF(e,t={}){const r=JSON.stringify([e,t]);let n=he.get(r);return void 0===n&&(n=new Intl.NumberFormat(e,t),he.set(r,n)),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return padStart(this.floor?Math.floor(e):roundTo(e,3),this.padTo)}}class PolyDateFormatter{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&IANAZone.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=getCachedDTF(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(e,t,r){this.opts={style:"long",...r},!t&&hasRelative()&&(this.rtf=function getCachedRTF(e,t={}){const{base:r,...n}=t,i=JSON.stringify([e,n]);let s=de.get(i);return void 0===s&&(s=new Intl.RelativeTimeFormat(e,t),de.set(i,s)),s}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function formatRelativeTime(e,t,r="always",n=!1){const 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."]},s=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&s){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${i[e][0]}`;case-1:return r?"yesterday":`last ${i[e][0]}`;case 0:return r?"today":`this ${i[e][0]}`}}const o=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=i[e],u=n?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return o?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const ge={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(e){return Locale.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,i=!1){const s=e||Settings.defaultLocale,o=s||(i?"en-US":function systemLocale(){return me||(me=(new Intl.DateTimeFormat).resolvedOptions().locale,me)}()),a=t||Settings.defaultNumberingSystem,l=r||Settings.defaultOutputCalendar,c=validateWeekSettings(n)||Settings.defaultWeekSettings;return new Locale(o,a,l,c,s)}static resetCache(){me=null,ue.clear(),he.clear(),de.clear(),fe.clear(),pe.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Locale.create(e,t,r,n)}constructor(e,t,r,n,i){const[s,o,a]=function parseLocaleString(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,n;try{t=getCachedDTF(e).resolvedOptions(),n=e}catch(i){const s=e.substring(0,r);t=getCachedDTF(s).resolvedOptions(),n=s}const{numberingSystem:i,calendar:s}=t;return[n,i,s]}}(e);this.locale=s,this.numberingSystem=t||o||null,this.outputCalendar=r||a||null,this.weekSettings=n,this.intl=function intlConfigString(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(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 null==this.fastNumbersCached&&(this.fastNumbersCached=function supportsFastNumbers(e){return(!e.numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===getCachedIntResolvedOptions(e.locale).numberingSystem)}(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Locale.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,validateWeekSettings(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return listStuff(this,e,months,()=>{const r=t?{month:e,day:"numeric"}:{month:e},n=t?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=function mapMonths(e){const t=[];for(let r=1;r<=12;r++){const n=DateTime.utc(2009,r,1);t.push(e(n))}return t}(e=>this.extract(e,r,"month"))),this.monthsCache[n][e]})}weekdays(e,t=!1){return listStuff(this,e,weekdays,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function mapWeekdays(e){const t=[];for(let r=1;r<=7;r++){const n=DateTime.utc(2016,11,13+r);t.push(e(n))}return t}(e=>this.extract(e,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return listStuff(this,void 0,()=>Me,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return listStuff(this,e,eras,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===r);return n?n.value:null}numberFormatter(e={}){return new PolyNumberFormatter(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new PolyDateFormatter(e,this.intl,t)}relFormatter(e={}){return new PolyRelFormatter(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function getCachedLF(e,t={}){const r=JSON.stringify([e,t]);let n=ce[r];return n||(n=new Intl.ListFormat(e,t),ce[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?function getCachedWeekInfo(e){let t=pe.get(e);if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...ge,...t}),pe.set(e,t)}return t}(this.locale):ge}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 ye=null;class FixedOffsetZone extends Zone{static get utcInstance(){return null===ye&&(ye=new FixedOffsetZone(0)),ye}static instance(e){return 0===e?FixedOffsetZone.utcInstance:new FixedOffsetZone(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new FixedOffsetZone(signedOffset(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return formatOffset(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{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 normalizeZone(e,t){if(isUndefined(e)||null===e)return t;if(e instanceof Zone)return e;if(function isString(e){return"string"==typeof e}(e)){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?SystemZone.instance:"utc"===r||"gmt"===r?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(r)||IANAZone.create(e)}return isNumber(e)?FixedOffsetZone.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new InvalidZone(e)}const ve={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ee={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]},we=ve.hanidec.replace(/[\[|\]]/g,"").split("");const Se=new Map;function digitRegex({numberingSystem:e},t=""){const r=e||"latn";let n=Se.get(r);void 0===n&&(n=new Map,Se.set(r,n));let i=n.get(t);return void 0===i&&(i=new RegExp(`${ve[r]}${t}`),n.set(t,i)),i}let Te,now=()=>Date.now(),be="system",Oe=null,ke=null,Fe=null,xe=60,De=null;class Settings{static get now(){return now}static set now(e){now=e}static set defaultZone(e){be=e}static get defaultZone(){return normalizeZone(be,SystemZone.instance)}static get defaultLocale(){return Oe}static set defaultLocale(e){Oe=e}static get defaultNumberingSystem(){return ke}static set defaultNumberingSystem(e){ke=e}static get defaultOutputCalendar(){return Fe}static set defaultOutputCalendar(e){Fe=e}static get defaultWeekSettings(){return De}static set defaultWeekSettings(e){De=validateWeekSettings(e)}static get twoDigitCutoffYear(){return xe}static set twoDigitCutoffYear(e){xe=e%100}static get throwOnInvalid(){return Te}static set throwOnInvalid(e){Te=e}static resetCaches(){Locale.resetCache(),IANAZone.resetCache(),DateTime.resetCache(),function resetDigitRegexCache(){Se.clear()}()}}class Invalid{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Le=[0,31,59,90,120,151,181,212,243,273,304,334],Ce=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(e,t){return new Invalid("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function dayOfWeek(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return 0===i?7:i}function computeOrdinal(e,t,r){return r+(isLeapYear(e)?Ce:Le)[t-1]}function uncomputeOrdinal(e,t){const r=isLeapYear(e)?Ce:Le,n=r.findIndex(e=>e<t);return{month:n+1,day:t-r[n]}}function isoWeekdayToLocal(e,t){return(e-t+7)%7+1}function gregorianToWeek(e,t=4,r=1){const{year:n,month:i,day:s}=e,o=computeOrdinal(n,i,s),a=isoWeekdayToLocal(dayOfWeek(n,i,s),r);let l,c=Math.floor((o-a+14-t)/7);return c<1?(l=n-1,c=weeksInWeekYear(l,t,r)):c>weeksInWeekYear(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:a,...timeObject(e)}}function weekToGregorian(e,t=4,r=1){const{weekYear:n,weekNumber:i,weekday:s}=e,o=isoWeekdayToLocal(dayOfWeek(n,1,t),r),a=daysInYear(n);let l,c=7*i+s-o-7+t;c<1?(l=n-1,c+=daysInYear(l)):c>a?(l=n+1,c-=daysInYear(n)):l=n;const{month:u,day:h}=uncomputeOrdinal(l,c);return{year:l,month:u,day:h,...timeObject(e)}}function gregorianToOrdinal(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:computeOrdinal(t,r,n),...timeObject(e)}}function ordinalToGregorian(e){const{year:t,ordinal:r}=e,{month:n,day:i}=uncomputeOrdinal(t,r);return{year:t,month:n,day:i,...timeObject(e)}}function usesLocalWeekValues(e,t){if(!isUndefined(e.localWeekday)||!isUndefined(e.localWeekNumber)||!isUndefined(e.localWeekYear)){if(!isUndefined(e.weekday)||!isUndefined(e.weekNumber)||!isUndefined(e.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined(e.localWeekday)||(e.weekday=e.localWeekday),isUndefined(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),isUndefined(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidGregorianData(e){const t=isInteger(e.year),r=integerBetween(e.month,1,12),n=integerBetween(e.day,1,daysInMonth(e.year,e.month));return t?r?!n&&unitOutOfRange("day",e.day):unitOutOfRange("month",e.month):unitOutOfRange("year",e.year)}function hasInvalidTimeData(e){const{hour:t,minute:r,second:n,millisecond:i}=e,s=integerBetween(t,0,23)||24===t&&0===r&&0===n&&0===i,o=integerBetween(r,0,59),a=integerBetween(n,0,59),l=integerBetween(i,0,999);return s?o?a?!l&&unitOutOfRange("millisecond",i):unitOutOfRange("second",n):unitOutOfRange("minute",r):unitOutOfRange("hour",t)}function isUndefined(e){return void 0===e}function isNumber(e){return"number"==typeof e}function isInteger(e){return"number"==typeof e&&e%1==0}function hasRelative(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function hasLocaleWeekInfo(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function bestBy(e,t,r){if(0!==e.length)return e.reduce((e,n)=>{const i=[t(n),n];return e&&r(e[0],i[0])===e[0]?e:i},null)[1]}function util_hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function validateWeekSettings(e){if(null==e)return null;if("object"!=typeof e)throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(e.firstDay,1,7)||!integerBetween(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!integerBetween(e,1,7)))throw new InvalidArgumentError("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function integerBetween(e,t,r){return isInteger(e)&&e>=t&&e<=r}function padStart(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function parseInteger(e){return isUndefined(e)||null===e||""===e?void 0:parseInt(e,10)}function parseFloating(e){return isUndefined(e)||null===e||""===e?void 0:parseFloat(e)}function parseMillis(e){if(!isUndefined(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function roundTo(e,t,r=!1){const n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function daysInYear(e){return isLeapYear(e)?366:365}function daysInMonth(e,t){const r=function floorMod(e,t){return e-t*Math.floor(e/t)}(t-1,12)+1;return 2===r?isLeapYear(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function objToLocalTS(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 firstWeekOffset(e,t,r){return-isoWeekdayToLocal(dayOfWeek(e,1,t),r)+t-1}function weeksInWeekYear(e,t=4,r=1){const n=firstWeekOffset(e,t,r),i=firstWeekOffset(e+1,t,r);return(daysInYear(e)-n+i)/7}function untruncateYear(e){return e>99?e:e>Settings.twoDigitCutoffYear?1900+e:2e3+e}function parseZoneInfo(e,t,r,n=null){const i=new Date(e),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);const o={timeZoneName:t,...s},a=new Intl.DateTimeFormat(r,o).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function signedOffset(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function asNumber(e){const t=Number(e);if("boolean"==typeof e||""===e||Number.isNaN(t))throw new InvalidArgumentError(`Invalid unit value ${e}`);return t}function normalizeObject(e,t){const r={};for(const n in e)if(util_hasOwnProperty(e,n)){const i=e[n];if(null==i)continue;r[t(n)]=asNumber(i)}return r}function formatOffset(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${padStart(r,2)}:${padStart(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${padStart(r,2)}${padStart(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function timeObject(e){return function util_pick(e,t){return t.reduce((t,r)=>(t[r]=e[r],t),{})}(e,["hour","minute","second","millisecond"])}const Ie=["January","February","March","April","May","June","July","August","September","October","November","December"],Ne=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Re=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(e){switch(e){case"narrow":return[...Re];case"short":return[...Ne];case"long":return[...Ie];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 Pe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ae=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ze=["M","T","W","T","F","S","S"];function weekdays(e){switch(e){case"narrow":return[...ze];case"short":return[...Ae];case"long":return[...Pe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Me=["AM","PM"],Ve=["Before Christ","Anno Domini"],Ue=["BC","AD"],_e=["B","A"];function eras(e){switch(e){case"narrow":return[..._e];case"short":return[...Ue];case"long":return[...Ve];default:return null}}function stringifyTokens(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const He={D:M,DD:V,DDD:_,DDDD:H,t:W,tt:j,ttt:Z,tttt:$,T:G,TT:q,TTT:B,TTTT:J,f:Y,ff:Q,fff:te,ffff:ne,F:K,FF:X,FFF:re,FFFF:ie};class Formatter{static create(e,t={}){return new Formatter(e,t)}static parseFormat(e){let t=null,r="",n=!1;const i=[];for(let s=0;s<e.length;s++){const o=e.charAt(s);"'"===o?(r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return He[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return 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){if(this.opts.forceSimple)return padStart(e,t);const r={...this.opts};return t>0&&(r.padTo=t),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,string=(t,r)=>this.loc.extract(e,t,r),formatOffset=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",meridiem=()=>r?function meridiemForDateTime(e){return Me[e.hour<12?0:1]}(e):string({hour:"numeric",hourCycle:"h12"},"dayperiod"),month=(t,n)=>r?function monthForDateTime(e,t){return months(t)[e.month-1]}(e,t):string(n?{month:t}:{month:t,day:"numeric"},"month"),weekday=(t,n)=>r?function weekdayForDateTime(e,t){return weekdays(t)[e.weekday-1]}(e,t):string(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),maybeMacro=t=>{const r=Formatter.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},era=t=>r?function eraForDateTime(e,t){return eras(t)[e.year<0?0:1]}(e,t):string({era:t},"era");return stringifyTokens(Formatter.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return formatOffset({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return formatOffset({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return formatOffset({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return meridiem();case"d":return n?string({day:"numeric"},"day"):this.num(e.day);case"dd":return n?string({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return weekday("short",!0);case"cccc":return weekday("long",!0);case"ccccc":return weekday("narrow",!0);case"EEE":return weekday("short",!1);case"EEEE":return weekday("long",!1);case"EEEEE":return weekday("narrow",!1);case"L":return n?string({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?string({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return month("short",!0);case"LLLL":return month("long",!0);case"LLLLL":return month("narrow",!0);case"M":return n?string({month:"numeric"},"month"):this.num(e.month);case"MM":return n?string({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return month("short",!1);case"MMMM":return month("long",!1);case"MMMMM":return month("narrow",!1);case"y":return n?string({year:"numeric"},"year"):this.num(e.year);case"yy":return n?string({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?string({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?string({year:"numeric"},"year"):this.num(e.year,6);case"G":return era("short");case"GG":return era("long");case"GGGGG":return era("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return maybeMacro(t)}})}formatDurationFromString(e,t){const tokenToField=e=>{switch(e[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=Formatter.parseFormat(t),n=r.reduce((e,{literal:t,val:r})=>t?e:e.concat(r),[]);return stringifyTokens(r,(e=>t=>{const r=tokenToField(t);return r?this.num(e.get(r),t.length):t})(e.shiftTo(...n.map(tokenToField).filter(e=>e))))}}const We=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function combineExtractors(...e){return t=>e.reduce(([e,r,n],i)=>{const[s,o,a]=i(t,n);return[{...e,...s},o||r,a]},[{},null,1]).slice(0,2)}function parse(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function simpleParse(...e){return(t,r)=>{const n={};let i;for(i=0;i<e.length;i++)n[e[i]]=parseInteger(t[r+i]);return[n,null,r+i]}}const je=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Ze=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,$e=RegExp(`${Ze.source}${`(?:${je.source}?(?:\\[(${We.source})\\])?)?`}`),Ge=RegExp(`(?:T${$e.source})?`),qe=simpleParse("weekYear","weekNumber","weekDay"),Be=simpleParse("year","ordinal"),Je=RegExp(`${Ze.source} ?(?:${je.source}|(${We.source}))?`),Ye=RegExp(`(?: ${Je.source})?`);function regexParser_int(e,t,r){const n=e[t];return isUndefined(n)?r:parseInteger(n)}function extractISOTime(e,t){return[{hours:regexParser_int(e,t,0),minutes:regexParser_int(e,t+1,0),seconds:regexParser_int(e,t+2,0),milliseconds:parseMillis(e[t+3])},null,t+4]}function extractISOOffset(e,t){const r=!e[t]&&!e[t+1],n=signedOffset(e[t+1],e[t+2]);return[{},r?null:FixedOffsetZone.instance(n),t+3]}function extractIANAZone(e,t){return[{},e[t]?IANAZone.create(e[t]):null,t+1]}const Ke=RegExp(`^T?${Ze.source}$`),Qe=/^-?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 extractISODuration(e){const[t,r,n,i,s,o,a,l,c]=e,u="-"===t[0],h=l&&"-"===l[0],maybeNegate=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:maybeNegate(parseFloating(r)),months:maybeNegate(parseFloating(n)),weeks:maybeNegate(parseFloating(i)),days:maybeNegate(parseFloating(s)),hours:maybeNegate(parseFloating(o)),minutes:maybeNegate(parseFloating(a)),seconds:maybeNegate(parseFloating(l),"-0"===l),milliseconds:maybeNegate(parseMillis(c),h)}]}const Xe={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(e,t,r,n,i,s,o){const a={year:2===t.length?untruncateYear(parseInteger(t)):parseInteger(t),month:Ne.indexOf(r)+1,day:parseInteger(n),hour:parseInteger(i),minute:parseInteger(s)};return o&&(a.second=parseInteger(o)),e&&(a.weekday=e.length>3?Pe.indexOf(e)+1:Ae.indexOf(e)+1),a}const et=/^(?:(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 extractRFC2822(e){const[,t,r,n,i,s,o,a,l,c,u,h]=e,d=fromStrings(t,i,n,r,s,o,a);let m;return m=l?Xe[l]:c?0:signedOffset(u,h),[d,new FixedOffsetZone(m)]}const tt=/^(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$/,rt=/^(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$/,nt=/^(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 extractRFC1123Or850(e){const[,t,r,n,i,s,o,a]=e;return[fromStrings(t,i,n,r,s,o,a),FixedOffsetZone.utcInstance]}function extractASCII(e){const[,t,r,n,i,s,o,a]=e;return[fromStrings(t,a,r,n,i,s,o),FixedOffsetZone.utcInstance]}const it=combineRegexes(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ge),st=combineRegexes(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ge),ot=combineRegexes(/(\d{4})-?(\d{3})/,Ge),at=combineRegexes($e),lt=combineExtractors(function extractISOYmd(e,t){return[{year:regexParser_int(e,t),month:regexParser_int(e,t+1,1),day:regexParser_int(e,t+2,1)},null,t+3]},extractISOTime,extractISOOffset,extractIANAZone),ct=combineExtractors(qe,extractISOTime,extractISOOffset,extractIANAZone),ut=combineExtractors(Be,extractISOTime,extractISOOffset,extractIANAZone),ht=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const dt=combineExtractors(extractISOTime);const mt=combineRegexes(/(\d{4})-(\d\d)-(\d\d)/,Ye),ft=combineRegexes(Je),pt=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const gt="Invalid Duration",yt={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},vt={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...yt},Et=365.2425,wt=30.436875,St={years:{quarters:4,months:12,weeks:52.1775,days:Et,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:wt,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...yt},Tt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],bt=Tt.slice(0).reverse();function clone(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new Duration(n)}function durationToMillis(e,t){let r=t.milliseconds??0;for(const n of bt.slice(1))t[n]&&(r+=t[n]*e[n].milliseconds);return r}function normalizeValues(e,t){const r=durationToMillis(e,t)<0?-1:1;Tt.reduceRight((n,i)=>{if(isUndefined(t[i]))return n;if(n){const s=t[n]*r,o=e[i][n],a=Math.floor(s/o);t[i]+=a*r,t[n]-=a*o*r}return i},null),Tt.reduce((r,n)=>{if(isUndefined(t[n]))return r;if(r){const i=t[r]%1;t[r]-=i,t[n]+=i*e[r][n]}return n},null)}class Duration{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?St:vt;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Locale.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return Duration.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Duration({values:normalizeObject(e,Duration.normalizeUnit),loc:Locale.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(isNumber(e))return Duration.fromMillis(e);if(Duration.isDuration(e))return e;if("object"==typeof e)return Duration.fromObject(e);throw new InvalidArgumentError(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=function parseISODuration(e){return parse(e,[Qe,extractISODuration])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=function parseISOTimeOnly(e){return parse(e,[Ke,dt])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDurationError(r);return new Duration({invalid:r})}static normalizeUnit(e){const 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():e];if(!t)throw new InvalidUnitError(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={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?Formatter.create(this.loc,r).formatDurationFromString(this,e):gt}toHuman(e={}){if(!this.isValid)return gt;const t=Tt.map(t=>{const r=this.values[t];return isUndefined(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:t.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return DateTime.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?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e),r={};for(const e of Tt)(util_hasOwnProperty(t.values,e)||util_hasOwnProperty(this.values,e))&&(r[e]=t.get(e)+this.get(e));return clone(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=asNumber(e(this.values[r],r));return clone(this,{values:t},!0)}get(e){return this[Duration.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return clone(this,{values:{...this.values,...normalizeObject(e,Duration.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return normalizeValues(this.matrix,e),clone(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return clone(this,{values:function removeZeroes(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>Duration.normalizeUnit(e));const t={},r={},n=this.toObject();let i;for(const s of Tt)if(e.indexOf(s)>=0){i=s;let e=0;for(const t in r)e+=this.matrix[t][s]*r[t],r[t]=0;isNumber(n[s])&&(e+=n[s]);const o=Math.trunc(e);t[s]=o,r[s]=(1e3*e-1e3*o)/1e3}else isNumber(n[s])&&(r[s]=n[s]);for(const e in r)0!==r[e]&&(t[i]+=e===i?r[e]:r[e]/this.matrix[i][e]);return normalizeValues(this.matrix,t),clone(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return clone(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 null===this.invalid}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)return!1;if(!this.loc.equals(e.loc))return!1;function eq(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const t of Tt)if(!eq(this.values[t],e.values[t]))return!1;return!0}}const Ot="Invalid Interval";class Interval{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidIntervalError(r);return new Interval({invalid:r})}static fromDateTimes(e,t){const r=friendlyDateTime(e),n=friendlyDateTime(t),i=function validateStartEnd(e,t){return e&&e.isValid?t&&t.isValid?t<e?Interval.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:Interval.invalid("missing or invalid end"):Interval.invalid("missing or invalid start")}(r,n);return null==i?new Interval({start:r,end:n}):i}static after(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n,n.plus(r))}static before(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,s,o;try{e=DateTime.fromISO(r,t),i=e.isValid}catch(n){i=!1}try{s=DateTime.fromISO(n,t),o=s.isValid}catch(n){o=!1}if(i&&o)return Interval.fromDateTimes(e,s);if(i){const r=Duration.fromISO(n,t);if(r.isValid)return Interval.after(e,r)}else if(o){const e=Duration.fromISO(r,t);if(e.isValid)return Interval.before(s,e)}}return Interval.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}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;const r=this.start.startOf(e,t);let n;return n=t?.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?Interval.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(friendlyDateTime).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[];let{s:n}=this,i=0;for(;n<this.e;){const e=t[i]||this.e,s=+e>+this.e?this.e:e;r.push(Interval.fromDateTimes(n,s)),n=s,i+=1}return r}splitBy(e){const t=Duration.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,i=1;const s=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));r=+e>+this.e?this.e:e,s.push(Interval.fromDateTimes(n,r)),n=r,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:Interval.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return Interval.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),s=Array.prototype.concat(...i).sort((e,t)=>e.time-t.time);for(const e of s)r+="s"===e.type?1:-1,1===r?t=e.time:(t&&+t!==+e.time&&n.push(Interval.fromDateTimes(t,e.time)),t=null);return Interval.merge(n)}difference(...e){return Interval.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Ot}[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=M,t={}){return this.isValid?Formatter.create(this.s.loc.clone(t),e).formatInterval(this):Ot}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ot}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ot}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ot}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ot}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Duration.invalid(this.invalidReason)}mapEndpoints(e){return Interval.fromDateTimes(e(this.s),e(this.e))}}class Info{static hasDST(e=Settings.defaultZone){const t=DateTime.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return IANAZone.isValidZone(e)}static normalizeZone(e){return normalizeZone(e,Settings.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Locale.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Locale.create(t,null,"gregory").eras(e)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(e,t){const utcDayStart=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=utcDayStart(t)-utcDayStart(e);return Math.floor(Duration.fromMillis(r).as("days"))}function diff(e,t,r,n){let[i,s,o,a]=function highOrderDiffs(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=dayDiff(e,t);return(r-r%7)/7}],["days",dayDiff]],i={},s=e;let o,a;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,i[l]=c(e,t),a=s.plus(i),a>t?(i[l]--,(e=s.plus(i))>t&&(a=e,i[l]--,e=s.plus(i))):e=a);return[e,i,a,o]}(e,t,r);const l=t-i,c=r.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(o<t&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));const u=Duration.fromObject(s,n);return c.length>0?Duration.fromMillis(l,n).shiftTo(...c).plus(u):u}function intUnit(e,t=e=>e){return{regex:e,deser:([e])=>t(function parseDigits(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(ve.hanidec))t+=we.indexOf(e[r]);else for(const e in Ee){const[r,i]=Ee[e];n>=r&&n<=i&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const kt=`[ ${String.fromCharCode(160)}]`,Ft=new RegExp(kt,"g");function fixListRegex(e){return e.replace(/\./g,"\\.?").replace(Ft,kt)}function stripInsensitivities(e){return e.replace(/\./g,"").replace(Ft," ").toLowerCase()}function oneOf(e,t){return null===e?null:{regex:RegExp(e.map(fixListRegex).join("|")),deser:([r])=>e.findIndex(e=>stripInsensitivities(r)===stripInsensitivities(e))+t}}function offset(e,t){return{regex:e,deser:([,e,t])=>signedOffset(e,t),groups:t}}function simple(e){return{regex:e,deser:([e])=>e}}const xt={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"}};let Dt=null;function expandMacroTokens(e,t){return Array.prototype.concat(...e.map(e=>function maybeExpandMacroToken(e,t){if(e.literal)return e;const r=formatOptsToTokens(Formatter.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t)))}class TokenParser{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=expandMacroTokens(Formatter.parseFormat(t),e),this.units=this.tokens.map(t=>function unitForToken(e,t){const r=digitRegex(t),n=digitRegex(t,"{2}"),i=digitRegex(t,"{3}"),s=digitRegex(t,"{4}"),o=digitRegex(t,"{6}"),a=digitRegex(t,"{1,2}"),l=digitRegex(t,"{1,3}"),c=digitRegex(t,"{1,6}"),u=digitRegex(t,"{1,9}"),h=digitRegex(t,"{2,4}"),d=digitRegex(t,"{4,6}"),literal=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},m=(m=>{if(e.literal)return literal(m);switch(m.val){case"G":return oneOf(t.eras("short"),0);case"GG":return oneOf(t.eras("long"),0);case"y":return intUnit(c);case"yy":case"kk":return intUnit(h,untruncateYear);case"yyyy":case"kkkk":return intUnit(s);case"yyyyy":return intUnit(d);case"yyyyyy":return intUnit(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return intUnit(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return intUnit(n);case"MMM":return oneOf(t.months("short",!0),1);case"MMMM":return oneOf(t.months("long",!0),1);case"LLL":return oneOf(t.months("short",!1),1);case"LLLL":return oneOf(t.months("long",!1),1);case"o":case"S":return intUnit(l);case"ooo":case"SSS":return intUnit(i);case"u":return simple(u);case"uu":return simple(a);case"uuu":case"E":case"c":return intUnit(r);case"a":return oneOf(t.meridiems(),0);case"EEE":return oneOf(t.weekdays("short",!1),1);case"EEEE":return oneOf(t.weekdays("long",!1),1);case"ccc":return oneOf(t.weekdays("short",!0),1);case"cccc":return oneOf(t.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return literal(m)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=e,m}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function buildRegex(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"")}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,r]=function match(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const i in r)if(util_hasOwnProperty(r,i)){const s=r[i],o=s.groups?s.groups+1:1;!s.literal&&s.token&&(e[s.token.val[0]]=s.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(e,this.regex,this.handlers),[n,i,s]=r?function dateTimeFromMatches(e){let t,r=null;return isUndefined(e.z)||(r=IANAZone.create(e.z)),isUndefined(e.Z)||(r||(r=new FixedOffsetZone(e.Z)),t=e.Z),isUndefined(e.q)||(e.M=3*(e.q-1)+1),isUndefined(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),isUndefined(e.u)||(e.S=parseMillis(e.u)),[Object.keys(e).reduce((t,r)=>{const n=(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}})(r);return n&&(t[n]=e[r]),t},{}),r,t]}(r):[null,null,void 0];if(util_hasOwnProperty(r,"a")&&util_hasOwnProperty(r,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:n,zone:i,specificOffset:s}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function explainFromTokens(e,t,r){return new TokenParser(e,r).explainFromTokens(t)}function formatOptsToTokens(e,t){if(!e)return null;const r=Formatter.create(t,e).dtFormatter(function getDummyDateTime(){return Dt||(Dt=DateTime.fromMillis(1555555555555)),Dt}()),n=r.formatToParts(),i=r.resolvedOptions();return n.map(t=>function tokenForPart(e,t,r){const{type:n,value:i}=e;if("literal"===n){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const s=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let a=xt[o];if("object"==typeof a&&(a=a[s]),a)return{literal:!1,val:a}}(t,e,i))}const Lt="Invalid DateTime",Ct=864e13;function unsupportedZone(e){return new Invalid("unsupported zone",`the zone "${e.name}" is not supported`)}function possiblyCachedWeekData(e){return null===e.weekData&&(e.weekData=gregorianToWeek(e.c)),e.weekData}function possiblyCachedLocalWeekData(e){return null===e.localWeekData&&(e.localWeekData=gregorianToWeek(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function datetime_clone(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new DateTime({...r,...t,old:r})}function fixOffset(e,t,r){let n=e-60*t*1e3;const i=r.offset(n);if(t===i)return[n,t];n-=60*(i-t)*1e3;const s=r.offset(n);return i===s?[n,i]:[e-60*Math.min(i,s)*1e3,Math.max(i,s)]}function tsToObj(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function objToTS(e,t,r){return fixOffset(objToLocalTS(e),t,r)}function adjustTime(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),s={...e.c,year:n,month:i,day:Math.min(e.c.day,daysInMonth(n,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=Duration.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"),a=objToLocalTS(s);let[l,c]=fixOffset(a,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function parseDataToDateTime(e,t,r,n,i,s){const{setZone:o,zone:a}=r;if(e&&0!==Object.keys(e).length||t){const n=t||a,i=DateTime.fromObject(e,{...r,zone:n,specificOffset:s});return o?i:i.setZone(a)}return DateTime.invalid(new Invalid("unparsable",`the input "${i}" can't be parsed as ${n}`))}function toTechFormat(e,t,r=!0){return e.isValid?Formatter.create(Locale.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function toISODate(e,t){const r=e.c.year>9999||e.c.year<0;let n="";return r&&e.c.year>=0&&(n+="+"),n+=padStart(e.c.year,r?6:4),t?(n+="-",n+=padStart(e.c.month),n+="-",n+=padStart(e.c.day)):(n+=padStart(e.c.month),n+=padStart(e.c.day)),n}function toISOTime(e,t,r,n,i,s){let o=padStart(e.c.hour);return t?(o+=":",o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=":")):o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=padStart(e.c.second),0===e.c.millisecond&&n||(o+=".",o+=padStart(e.c.millisecond,3))),i&&(e.isOffsetFixed&&0===e.offset&&!s?o+="Z":e.o<0?(o+="-",o+=padStart(Math.trunc(-e.o/60)),o+=":",o+=padStart(Math.trunc(-e.o%60))):(o+="+",o+=padStart(Math.trunc(e.o/60)),o+=":",o+=padStart(Math.trunc(e.o%60)))),s&&(o+="["+e.zone.ianaName+"]"),o}const It={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Nt={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Rt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Pt=["year","month","day","hour","minute","second","millisecond"],At=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],zt=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnitWithLocalWeeks(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function normalizeUnit(e){const 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 InvalidUnitError(e);return t}(e)}}function quickDT(e,t){const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t);let i,s;if(isUndefined(e.year))i=Settings.now();else{for(const t of Pt)isUndefined(e[t])&&(e[t]=It[t]);const t=hasInvalidGregorianData(e)||hasInvalidTimeData(e);if(t)return DateTime.invalid(t);const n=function guessOffsetForZone(e){if(void 0===Mt&&(Mt=Settings.now()),"iana"!==e.type)return e.offset(Mt);const t=e.name;let r=Vt.get(t);return void 0===r&&(r=e.offset(Mt),Vt.set(t,r)),r}(r);[i,s]=objToTS(e,n,r)}return new DateTime({ts:i,zone:r,loc:n,o:s})}function diffRelative(e,t,r){const n=!!isUndefined(r.round)||r.round,format=(e,i)=>{e=roundTo(e,n||r.calendary?0:2,!0);return t.loc.clone(r).relFormatter(r).format(e,i)},differ=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return format(differ(r.unit),r.unit);for(const e of r.units){const t=differ(e);if(Math.abs(t)>=1)return format(t,e)}return format(e>t?-0:0,r.units[r.units.length-1])}function lastOpts(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}let Mt;const Vt=new Map;class DateTime{constructor(e){const t=e.zone||Settings.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new Invalid("invalid input"):null)||(t.isValid?null:unsupportedZone(t));this.ts=isUndefined(e.ts)?Settings.now():e.ts;let n=null,i=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const s=isNumber(e.o)&&!e.old?e.o:t.offset(this.ts);n=tsToObj(this.ts,s),r=Number.isNaN(n.year)?new Invalid("invalid input"):null,n=r?null:n,i=r?null:s}}this._zone=t,this.loc=e.loc||Locale.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[e,t]=lastOpts(arguments),[r,n,i,s,o,a,l]=t;return quickDT({year:r,month:n,day:i,hour:s,minute:o,second:a,millisecond:l},e)}static utc(){const[e,t]=lastOpts(arguments),[r,n,i,s,o,a,l]=t;return e.zone=FixedOffsetZone.utcInstance,quickDT({year:r,month:n,day:i,hour:s,minute:o,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const r=function isDate(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(r))return DateTime.invalid("invalid input");const n=normalizeZone(t.zone,Settings.defaultZone);return n.isValid?new DateTime({ts:r,zone:n,loc:Locale.fromObject(t)}):DateTime.invalid(unsupportedZone(n))}static fromMillis(e,t={}){if(isNumber(e))return e<-Ct||e>Ct?DateTime.invalid("Timestamp out of range"):new DateTime({ts:e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(isNumber(e))return new DateTime({ts:1e3*e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t),i=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:s,startOfWeek:o}=usesLocalWeekValues(i,n),a=Settings.now(),l=isUndefined(t.specificOffset)?r.offset(a):t.specificOffset,c=!isUndefined(i.ordinal),u=!isUndefined(i.year),h=!isUndefined(i.month)||!isUndefined(i.day),d=u||h,m=i.weekYear||i.weekNumber;if((d||c)&&m)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&c)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!d;let p,g,y=tsToObj(a,l);f?(p=At,g=Nt,y=gregorianToWeek(y,s,o)):c?(p=zt,g=Rt,y=gregorianToOrdinal(y)):(p=Pt,g=It);let v=!1;for(const e of p){isUndefined(i[e])?i[e]=v?g[e]:y[e]:v=!0}const E=f?function hasInvalidWeekData(e,t=4,r=1){const n=isInteger(e.weekYear),i=integerBetween(e.weekNumber,1,weeksInWeekYear(e.weekYear,t,r)),s=integerBetween(e.weekday,1,7);return n?i?!s&&unitOutOfRange("weekday",e.weekday):unitOutOfRange("week",e.weekNumber):unitOutOfRange("weekYear",e.weekYear)}(i,s,o):c?function hasInvalidOrdinalData(e){const t=isInteger(e.year),r=integerBetween(e.ordinal,1,daysInYear(e.year));return t?!r&&unitOutOfRange("ordinal",e.ordinal):unitOutOfRange("year",e.year)}(i):hasInvalidGregorianData(i),w=E||hasInvalidTimeData(i);if(w)return DateTime.invalid(w);const S=f?weekToGregorian(i,s,o):c?ordinalToGregorian(i):i,[T,b]=objToTS(S,l,r),O=new DateTime({ts:T,zone:r,o:b,loc:n});return i.weekday&&d&&e.weekday!==O.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${O.toISO()}`):O.isValid?O:DateTime.invalid(O.invalid)}static fromISO(e,t={}){const[r,n]=function parseISODate(e){return parse(e,[it,lt],[st,ct],[ot,ut],[at,ht])}(e);return parseDataToDateTime(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=function parseRFC2822Date(e){return parse(function preprocessRFC2822(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[et,extractRFC2822])}(e);return parseDataToDateTime(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=function parseHTTPDate(e){return parse(e,[tt,extractRFC1123Or850],[rt,extractRFC1123Or850],[nt,extractASCII])}(e);return parseDataToDateTime(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=r,s=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,a,l,c]=function parseFromTokens(e,t,r){const{result:n,zone:i,specificOffset:s,invalidReason:o}=explainFromTokens(e,t,r);return[n,i,s,o]}(s,e,t);return c?DateTime.invalid(c):parseDataToDateTime(o,a,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return DateTime.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=function parseSQL(e){return parse(e,[mt,lt],[ft,pt])}(e);return parseDataToDateTime(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(r);return new DateTime({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=formatOptsToTokens(e,Locale.fromObject(t));return r?r.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return expandMacroTokens(Formatter.parseFormat(e),Locale.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Mt=void 0,Vt.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}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?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.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&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=objToLocalTS(this.c),n=this.zone.offset(r-e),i=this.zone.offset(r+e),s=this.zone.offset(r-n*t),o=this.zone.offset(r-i*t);if(s===o)return[this];const a=r-s*t,l=r-o*t,c=tsToObj(a,s),u=tsToObj(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[datetime_clone(this,{ts:a}),datetime_clone(this,{ts:l})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=Formatter.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(FixedOffsetZone.instance(e),t)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=normalizeZone(e,Settings.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=objToTS(r,t,e)}return datetime_clone(this,{ts:n,zone:e})}return DateTime.invalid(unsupportedZone(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return datetime_clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:r,startOfWeek:n}=usesLocalWeekValues(t,this.loc),i=!isUndefined(t.weekYear)||!isUndefined(t.weekNumber)||!isUndefined(t.weekday),s=!isUndefined(t.ordinal),o=!isUndefined(t.year),a=!isUndefined(t.month)||!isUndefined(t.day),l=o||a,c=t.weekYear||t.weekNumber;if((l||s)&&c)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&s)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let u;i?u=weekToGregorian({...gregorianToWeek(this.c,r,n),...t},r,n):isUndefined(t.ordinal)?(u={...this.toObject(),...t},isUndefined(t.day)&&(u.day=Math.min(daysInMonth(u.year,u.month),u.day))):u=ordinalToGregorian({...gregorianToOrdinal(this.c),...t});const[h,d]=objToTS(u,this.o,this.zone);return datetime_clone(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;return datetime_clone(this,adjustTime(this,Duration.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return datetime_clone(this,adjustTime(this,Duration.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=Duration.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Lt}toLocaleString(e=M,t={}){return this.isValid?Formatter.create(this.loc.clone(t),e).formatDateTime(this):Lt}toLocaleParts(e={}){return this.isValid?Formatter.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const s="extended"===e;let o=toISODate(this,s);return o+="T",o+=toISOTime(this,s,t,r,n,i),o}toISODate({format:e="extended"}={}){return this.isValid?toISODate(this,"extended"===e):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:i=!1,format:s="extended"}={}){if(!this.isValid)return null;return(n?"T":"")+toISOTime(this,"extended"===s,t,e,r,i)}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),toTechFormat(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Lt}[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{};const 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",r={}){if(!this.isValid||!e.isValid)return Duration.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=function maybeArray(e){return Array.isArray(e)?e:[e]}(t).map(Duration.normalizeUnit),s=e.valueOf()>this.valueOf(),o=diff(s?this:e,s?e:this,i,n);return s?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(DateTime.now(),e,t)}until(e){return this.isValid?Interval.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=n&&n<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||DateTime.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),diffRelative(t,this.plus(r),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?diffRelative(e.base||DateTime.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:i=null}=r;return explainFromTokens(Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return DateTime.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:n=null}=t,i=Locale.fromOpts({locale:r,numberingSystem:n,defaultToEN:!0});return new TokenParser(i,e)}static fromFormatParser(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=r,s=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!s.equals(t.locale))throw new InvalidArgumentError(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${t.locale}`);const{result:o,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?DateTime.invalid(c):parseDataToDateTime(o,a,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return M}static get DATE_MED(){return V}static get DATE_MED_WITH_WEEKDAY(){return U}static get DATE_FULL(){return _}static get DATE_HUGE(){return H}static get TIME_SIMPLE(){return W}static get TIME_WITH_SECONDS(){return j}static get TIME_WITH_SHORT_OFFSET(){return Z}static get TIME_WITH_LONG_OFFSET(){return $}static get TIME_24_SIMPLE(){return G}static get TIME_24_WITH_SECONDS(){return q}static get TIME_24_WITH_SHORT_OFFSET(){return B}static get TIME_24_WITH_LONG_OFFSET(){return J}static get DATETIME_SHORT(){return Y}static get DATETIME_SHORT_WITH_SECONDS(){return K}static get DATETIME_MED(){return Q}static get DATETIME_MED_WITH_SECONDS(){return X}static get DATETIME_MED_WITH_WEEKDAY(){return ee}static get DATETIME_FULL(){return te}static get DATETIME_FULL_WITH_SECONDS(){return re}static get DATETIME_HUGE(){return ne}static get DATETIME_HUGE_WITH_SECONDS(){return ie}}function friendlyDateTime(e){if(DateTime.isDateTime(e))return e;if(e&&e.valueOf&&isNumber(e.valueOf()))return DateTime.fromJSDate(e);if(e&&"object"==typeof e)return DateTime.fromObject(e);throw new InvalidArgumentError(`Unknown datetime argument: ${e}, of type ${typeof e}`)}class DateTimeNormalizedValueToRawValueEventListener{static{this.eventListenerTarget=g.NormalizedValueToRawValueEvent}static{this.priority=50}constructor(){}static constructFromServiceResolver(){return new DateTimeNormalizedValueToRawValueEventListener}onEvent(e){if(e.getIdentifier()!==DateTimeNormalizedValueToRawValueEventListener.eventListenerTarget)return;const t=e.getNormalizedValue();if(!(t instanceof Date))return;const r=DateTime.fromJSDate(t).toFormat("yyyy-MM-dd'T'HH:mm:ssZZ");e.setRawValue(r),e.stopPropagation()}}class DateTimeRawValueToNormalizedValueEventListener{static{this.eventListenerTarget=g.RawValueToNormalizedValueEvent}static{this.priority=50}static{this.dateRegex=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$/}constructor(){}static constructFromServiceResolver(){return new DateTimeRawValueToNormalizedValueEventListener}onEvent(e){if(e.getIdentifier()!==DateTimeRawValueToNormalizedValueEventListener.eventListenerTarget)return;const t=e.getRawValue();if("string"!=typeof t)return;if(!DateTimeRawValueToNormalizedValueEventListener.dateRegex.test(t))return;const r=new Date(t);e.setNormalizedValue(r),e.stopPropagation()}}class GenericNormalizedValueToRawValueEventListener{static{this.eventListenerTarget=g.NormalizedValueToRawValueEvent}static{this.priority=0}constructor(){}static constructFromServiceResolver(){return new GenericNormalizedValueToRawValueEventListener}onEvent(e){if(e.getIdentifier()!==GenericNormalizedValueToRawValueEventListener.eventListenerTarget)return;const t=e.getNormalizedValue();(Array.isArray(t)||"number"==typeof t||"boolean"==typeof t||"string"==typeof t||t instanceof String||null===t)&&(e.setRawValue(t),e.stopPropagation())}}class GenericRawValueToNormalizedValueEventListener{static{this.eventListenerTarget=g.RawValueToNormalizedValueEvent}static{this.priority=0}constructor(){}static constructFromServiceResolver(){return new GenericRawValueToNormalizedValueEventListener}onEvent(e){if(e.getIdentifier()!==GenericRawValueToNormalizedValueEventListener.eventListenerTarget)return;const t=e.getRawValue();(Array.isArray(t)||"number"==typeof t||"boolean"==typeof t||"string"==typeof t||null===t)&&(e.setNormalizedValue(t),e.stopPropagation())}}class ApiConfiguration{static{this.identifier=w.serviceApiConfiguration}constructor(e){this.logger=e,this.token=null,this.apiHost="",this.elementCacheMaxEntries=100,this.collectionCacheMaxEntries=50,this.collectionPageSize=25}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger);return new ApiConfiguration(t)}hasToken(){return null!==this.token}getToken(){return this.token}setToken(e){return this.token=e,this}getApiHost(){return this.apiHost}setApiHost(e){return e.endsWith("/")&&(this.logger.warn("Removed trailing slash from API host configuration due to internal requirement. Please check if trailing slash can be directly removed."),e=e.replace(/\/+$/,"")),this.apiHost=e,this}getElementCacheMaxEntries(){return this.elementCacheMaxEntries}setElementCacheMaxEntries(e){return this.elementCacheMaxEntries=e,this}getCollectionCacheMaxEntries(){return this.collectionCacheMaxEntries}setCollectionCacheMaxEntries(e){return this.collectionCacheMaxEntries=e,this}getCollectionPageSize(){return this.collectionPageSize}setCollectionPageSize(e){return this.collectionPageSize=e,this}}class ApiWrapper{static{this.identifier=w.serviceApiWrapper}constructor(e,t,r,n,i,s,o,a,l,c,u,h,d,m,f,p,g,y,v,E,w){this.getElementEndpoint=e,this.getElementChildrenEndpoint=t,this.getElementParentsEndpoint=r,this.getElementRelatedEndpoint=n,this.getIndexEndpoint=i,this.postIndexEndpoint=s,this.postElementEndpoint=o,this.putElementEndpoint=a,this.patchElementEndpoint=l,this.deleteElementEndpoint=c,this.postRegisterEndpoint=u,this.postChangePasswordEndpoint=h,this.getMeEndpoint=d,this.postTokenEndpoint=m,this.getTokenEndpoint=f,this.deleteTokenEndpoint=p,this.elementCache=g,this.elementChildrenCache=y,this.elementParentsCache=v,this.elementRelatedCache=E,this.indexCache=w}static constructFromServiceResolver(e){return new ApiWrapper(e.getServiceOrFail(w.endpointElementGetElementEndpoint),e.getServiceOrFail(w.endpointElementGetElementChildrenEndpoint),e.getServiceOrFail(w.endpointElementGetElementParentsEndpoint),e.getServiceOrFail(w.endpointElementGetElementRelatedEndpoint),e.getServiceOrFail(w.endpointElementGetIndexEndpoint),e.getServiceOrFail(w.endpointElementPostIndexEndpoint),e.getServiceOrFail(w.endpointElementPostElementEndpoint),e.getServiceOrFail(w.endpointElementPutElementEndpoint),e.getServiceOrFail(w.endpointElementPatchElementEndpoint),e.getServiceOrFail(w.endpointElementDeleteElementEndpoint),e.getServiceOrFail(w.endpointUserPostRegisterEndpoint),e.getServiceOrFail(w.endpointUserPostChangePasswordEndpoint),e.getServiceOrFail(w.endpointUserGetMeEndpoint),e.getServiceOrFail(w.endpointUserPostTokenEndpoint),e.getServiceOrFail(w.endpointUserGetTokenEndpoint),e.getServiceOrFail(w.endpointUserDeleteTokenEndpoint),e.getServiceOrFail(w.cacheElement),e.getServiceOrFail(w.cacheElementChildren),e.getServiceOrFail(w.cacheElementParents),e.getServiceOrFail(w.cacheElementRelated),e.getServiceOrFail(w.cacheIndex))}async getElement(e,{forceLoad:t=!1}={}){const r=ElementCache.createCacheKey(e),n=this.elementCache.get(r);if(n&&!t)return n.data;if(n){const t=await this.getElementEndpoint.getElement(e,n.etag);return"data"in t?(this.elementCache.setFromParsedResponse(r,t),t.data):(this.elementCache.refresh(r),n.data)}const i=await this.getElementEndpoint.getElement(e);return this.elementCache.setFromParsedResponse(r,i),i.data}async getElementChildren(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementChildrenCache.createCacheKey(e,t,r),s=this.elementChildrenCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementChildrenEndpoint.getElementChildren(e,t,r,s.etag);return"data"in n?(this.elementChildrenCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementChildrenCache.refresh(i),s.data)}const o=await this.getElementChildrenEndpoint.getElementChildren(e,t,r);return this.elementChildrenCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getElementParents(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementParentsCache.createCacheKey(e,t,r),s=this.elementParentsCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementParentsEndpoint.getElementParents(e,t,r,s.etag);return"data"in n?(this.elementParentsCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementParentsCache.refresh(i),s.data)}const o=await this.getElementParentsEndpoint.getElementParents(e,t,r);return this.elementParentsCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getElementRelated(e,{page:t=1,pageSize:r=25,forceLoad:n=!1}={}){const i=ElementRelatedCache.createCacheKey(e,t,r),s=this.elementRelatedCache.get(i);if(s&&!n)return s.data;if(s){const n=await this.getElementRelatedEndpoint.getElementRelated(e,t,r,s.etag);return"data"in n?(this.elementRelatedCache.setFromParsedResponse(i,n),this.elementCache.setFromCollection(n.data),n.data):(this.elementRelatedCache.refresh(i),s.data)}const o=await this.getElementRelatedEndpoint.getElementRelated(e,t,r);return this.elementRelatedCache.setFromParsedResponse(i,o),this.elementCache.setFromCollection(o.data),o.data}async getIndex({page:e=1,pageSize:t=25,forceLoad:r=!1}={}){const n=IndexCache.createCacheKey(e,t),i=this.indexCache.get(n);if(i&&!r)return i.data;if(i){const r=await this.getIndexEndpoint.getIndex(e,t,i.etag);return"data"in r?(this.indexCache.setFromParsedResponse(n,r),this.elementCache.setFromCollection(r.data),r.data):(this.indexCache.refresh(n),i.data)}const s=await this.getIndexEndpoint.getIndex(e,t);return this.indexCache.setFromParsedResponse(n,s),this.elementCache.setFromCollection(s.data),s.data}async postIndex(e){return(await this.postIndexEndpoint.postIndex(e)).data}async postElement(e,t){return(await this.postElementEndpoint.postElement(e,t)).data}async putElement(e,t){await this.putElementEndpoint.putElement(e,t),this.elementCache.delete(ElementCache.createCacheKey(e))}async patchElement(e,t){await this.patchElementEndpoint.patchElement(e,t),this.elementCache.delete(ElementCache.createCacheKey(e))}async deleteElement(e){await this.deleteElementEndpoint.deleteElement(e),this.elementCache.delete(ElementCache.createCacheKey(e))}async postRegister(e,t,r={}){return(await this.postRegisterEndpoint.postRegister(e,t,r)).data}async postChangePassword(e,t,r){await this.postChangePasswordEndpoint.postChangePassword(e,t,r)}async getMe(){const e=(await this.getMeEndpoint.getMe()).data;return this.elementCache.setFromDataEtag(ElementCache.createCacheKey(e.id),e),e}async postToken(e,t,r={}){return(await this.postTokenEndpoint.postToken(e,t,r)).data}async getToken(){const e=(await this.getTokenEndpoint.getToken()).data;return this.elementCache.setFromDataEtag(ElementCache.createCacheKey(e.id),e),e}async deleteToken(){await this.deleteTokenEndpoint.deleteToken()}}class CollectionParser{static{this.identifier=w.serviceCollectionParser}constructor(e){this.elementParser=e}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.serviceElementParser);return new CollectionParser(t)}async deserializeCollection(e){if(!("id"in e))throw new Error("Raw collection must contain property 'id' in order to be parsed to a collection.");const t=String(e.id);if(!("totalNodes"in e))throw new Error("Raw collection must contain property 'totalNodes' in order to be parsed to a collection.");const r=Number(e.totalNodes);if(!("links"in e))throw new Error("Raw collection must contain property 'links' in order to be parsed to a collection.");if("object"!=typeof e.links||null===e.links)throw new Error("Links property in raw collection must be of type object.");const n=e.links;if(!("first"in n))throw new Error("Raw collection must contain property 'links.first' in order to be parsed to a collection.");const i=String(n.first);if(!("previous"in n))throw new Error("Raw collection must contain property 'links.previous' in order to be parsed to a collection.");const s=null===n.previous?null:String(n.previous);if(!("next"in n))throw new Error("Raw collection must contain property 'links.next' in order to be parsed to a collection.");const o=null===n.next?null:String(n.next);if(!("last"in n))throw new Error("Raw collection must contain property 'links.last' in order to be parsed to a collection.");const a=String(n.last);if(!("nodes"in e))throw new Error("Raw collection must contain property 'nodes' in order to be parsed to a collection.");if(!Array.isArray(e.nodes))throw new Error("Nodes property in raw collection must be of type array.");const l=[];for(const t of e.nodes)l.push(await this.elementParser.deserializeElement(t));if(!("relations"in e))throw new Error("Raw collection must contain property 'relations' in order to be parsed to a collection.");if(!Array.isArray(e.relations))throw new Error("Relations property in raw collection must be of type array.");const c=[];for(const t of e.relations)c.push(await this.elementParser.deserializeElement(t));return{id:t,totalNodes:r,links:{first:i,previous:s,next:o,last:a},nodes:l,relations:c}}}class ElementParser{static{this.identifier=w.serviceElementParser}constructor(e){this.eventDispatcher=e}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.serviceEventDispatcher);return new ElementParser(t)}async deserializeElement(e){if(!("id"in e))throw new Error("Raw element must contain property 'id' in order to be parsed to a node or relation.");const t=validateUuidFromString(String(e.id));if(!("type"in e))throw new Error("Raw element must contain property 'type' in order to be parsed to a node or relation.");const r=String(e.type);if(!("data"in e))throw new Error("Raw element must contain property 'data' in order to be parsed to a node or relation.");const n=e.data;for(const e in n){const t=new RawValueToNormalizedValueEvent(n[e]);if(await this.eventDispatcher.dispatchEvent(t),!t.isPropagationStopped())throw new Error(`Unable to deserialize property "${e}".`);n[e]=t.getNormalizedValue()}if("start"in e&&"end"in e){return{id:t,start:validateUuidFromString(String(e.start)),end:validateUuidFromString(String(e.end)),type:r,data:n}}return{id:t,type:r,data:n}}}class EventDispatcher{static{this.identifier=w.serviceEventDispatcher}constructor(e){this.logger=e,this.isSilent=!0,this.eventListenerTargets=new Map}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger);return new EventDispatcher(t)}setSilent(e){return this.isSilent=e,this}async dispatchEvent(e){if(this.isSilent||this.logger.debug(`Dispatching event of identifier ${e.getIdentifier()}.`,{event:e}),e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation because it is already stopped.",{event:e}));const t=getEventListenerTargetsFromEventIdentifier(e.getIdentifier());for(let r=0;r<t.length;++r){const n=t[r],i=this.eventListenerTargets.get(n);if(void 0!==i){this.isSilent||this.logger.debug(`Iterating over resolved event listeners of identifier ${n}`,{event:e});for(let t=i.length-1;t>=0;t--){try{await Promise.resolve(i[t].eventListener.onEvent(e))}catch(t){this.logger.error("Event handler threw exception, dispatcher continues with next event listener.",{event:e,error:t})}if(e.isPropagationStopped())return void(this.isSilent||this.logger.debug("Stopped event propagation as it got stopped.",{event:e}))}}}this.isSilent||this.logger.debug("Event got handled by all event listeners.",{event:e})}addListener(e,t,r){let n;void 0===r&&(r=0),n=this.eventListenerTargets.has(e)?this.eventListenerTargets.get(e):[];let i=0,s=n.length-1,o=-1;for(;i<=s;){const e=Math.floor((i+s)/2);n[e].priority>=r?(o=e,s=e-1):i=e+1}const a=-1===o?i:o;return n.splice(a,0,{priority:r,eventListener:t}),this.eventListenerTargets.set(e,n),this}removeListener(e,t){const r=this.eventListenerTargets.get(e);if(!r)return this;for(let e=0;e<r.length;++e)if(r[e].eventListener===t){r.splice(e,1);break}return 0===r.length&&this.eventListenerTargets.delete(e),this}getListeners(e){const t=this.eventListenerTargets.get(e);return t?t.map(e=>e.eventListener):[]}hasListeners(e){return this.eventListenerTargets.has(e)}}class FetchHelper{static{this.identifier=w.serviceFetchHelper}constructor(e,t){this.logger=e,this.apiConfiguration=t}static constructFromServiceResolver(e){const t=e.getServiceOrFail(w.logger),r=e.getServiceOrFail(w.serviceApiConfiguration);return new FetchHelper(t,r)}rethrowErrorAsNetworkError(e){if(e instanceof EmberNexusError)throw e;throw new NetworkError("Network error occurred during fetch.",e)}logAndThrowError(e){const t=e instanceof Error?e:new Error(String(e));throw this.logger.error(t.message,t),t}async parseJsonResponse(e){const t=e.headers.get("Content-Type");if(!t)return Promise.reject(new ParseError("Response does not contain a Content-Type header."));if(!t.includes("application/json")&&!t.includes("application/problem+json"))return Promise.reject(new ParseError(`Unexpected Content-Type: "${t}". Expected JSON-compatible format.`));const r=await e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)});if(!e.ok)throw this.createResponseErrorFromBadResponse(e,r);return r}async parseEmptyResponse(e){if(e.ok&&204===e.status)return;const t=e.headers.get("Content-Type");if(null===t)throw new ParseError("Response does not contain content type header.");if(!t.includes("application/problem+json"))throw new ParseError("Unable to parse response as content type is not 'application/problem+json'.");const r=await e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)});throw this.createResponseErrorFromBadResponse(e,r)}parseLocationResponse(e){if(e.ok&&(201===e.status||204===e.status)&&e.headers.has("Location")){const t=e.headers.get("Location").split("/").at(-1);return Promise.resolve(validateUuidFromString(t))}const t=e.headers.get("Content-Type");return null===t?Promise.reject(new ParseError("Response does not contain content type header.")):t.includes("application/problem+json")?e.json().catch(e=>{throw new ParseError(`Failed to parse response body as JSON: ${e}`)}).then(t=>{throw this.createResponseErrorFromBadResponse(e,t)}):Promise.reject(new ParseError("Unable to parse response as content type is not 'application/problem+json'."))}createResponseErrorFromBadResponse(e,t){let r=null;return 401===e.status&&(r=new Response401UnauthorizedError("Server returned 401 unauthorized.")),403===e.status&&(r=new Response403ForbiddenError("Server returned 403 forbidden.")),404===e.status&&(r=new Response404NotFoundError("Server returned 404 not found.")),429===e.status&&(r=new Response429TooManyRequestsError("Server returned 429 too many requests.")),null===r&&(r=new ResponseError("Generic response error.")),"type"in t&&r.setType(String(t.type)),"title"in t&&r.setTitle(String(t.title)),"detail"in t&&r.setDetail(String(t.detail)),"status"in t&&null===r.getStatus()&&r.setStatus(Number(t.status)),r}addAuthorizationHeader(e){this.apiConfiguration.hasToken()&&(e.Authorization=`Bearer ${this.apiConfiguration.getToken()}`)}addAcceptJsonAndProblemJsonHeader(e){e.Accept="application/json, application/problem+json"}addIfNoneMatchHeader(e,t){e["If-None-Match"]=t}addContentTypeJsonHeader(e){e["Content-Type"]="application/json"}getDefaultGetOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),void 0!==e&&this.addIfNoneMatchHeader(t,e),{method:y.GET,headers:t,redirect:"follow",referrerPolicy:"no-referrer",cache:"no-store"}}getDefaultDeleteOptions(){const e={};return this.addAuthorizationHeader(e),this.addAcceptJsonAndProblemJsonHeader(e),{method:y.DELETE,headers:e,redirect:"follow",referrerPolicy:"no-referrer"}}getDefaultPostOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.POST,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPatchOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.PATCH,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}getDefaultPutOptions(e){const t={};return this.addAuthorizationHeader(t),this.addAcceptJsonAndProblemJsonHeader(t),this.addContentTypeJsonHeader(t),{method:y.PUT,headers:t,redirect:"follow",referrerPolicy:"no-referrer",body:e}}buildUrl(e){return`${this.apiConfiguration.getApiHost()}${e}`}runWrappedFetch(e,t){return e=`${this.apiConfiguration.getApiHost()}${e}`,this.logger.debug(`Executing HTTP ${t?.method??"-"} request against url ${e} .`),fetch(e,t)}}class Logger{constructor(e){this.logger=e}debug(...e){return this.logger.debug(e)}error(...e){return this.logger.error(e)}info(...e){return this.logger.info(e)}warn(...e){return this.logger.warn(e)}}class ServiceResolver{constructor(){this.services=new Map}hasService(e){return this.services.has(String(e))}getService(e){return this.hasService(String(e))?this.services.get(String(e)):null}getServiceOrFail(e){if(!this.hasService(String(e)))throw new Error(`Requested service with identifier ${String(e)} could not be resolved.`);return this.services.get(String(e))}setService(e,t){return this.services.set(String(e),t),this}deleteService(e){return this.services.delete(String(e)),this}getServiceIdentifiers(){return[...this.services.keys()]}getServices(){return[...this.services.values()]}clearServices(){return this.services.clear(),this}}class TokenParser_TokenParser{static{this.identifier=w.serviceTokenParser}constructor(){}static constructFromServiceResolver(){return new TokenParser_TokenParser}rawTokenToToken(e){if(!("type"in e))throw new Error("Raw token must contain property 'type' in order to be parsed to a token.");if("_TokenResponse"!==String(e.type))throw new Error("Type must be '_TokenResponse' in order to be parsed to a token.");if(!("token"in e))throw new Error("Raw token must contain property 'token' in order to be parsed to a token.");return validateTokenFromString(String(e.token))}}function initEventListener(e){const t=e.getServiceOrFail(EventDispatcher.identifier),r=[DateTimeNormalizedValueToRawValueEventListener,DateTimeRawValueToNormalizedValueEventListener,GenericNormalizedValueToRawValueEventListener,GenericRawValueToNormalizedValueEventListener];for(let e=0;e<r.length;e++)t.addListener(r[e].eventListenerTarget,r[e].constructFromServiceResolver(),r[e].priority)}const Ut={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function formatTemplate(e,t,r,n=!1){const i=String(t),ansiColorWrap=(e,t)=>`[${t[0]}m${e}[${t[1]}m`,styleWrap=(e,t)=>null!=t&&"string"==typeof t?ansiColorWrap(e,Ut[t]):null!=t&&Array.isArray(t)?t.reduce((e,t)=>styleWrap(e,t),e):null!=t&&null!=t[e.trim()]?styleWrap(e,t[e.trim()]):null!=t&&null!=t["*"]?styleWrap(e,t["*"]):e;return i.replace(/{{(.+?)}}/g,(t,i)=>{const s=null!=r[i]?String(r[i]):n?"":t;return e.stylePrettyLogs?styleWrap(s,e?.prettyLogStyles?.[i]??null)+ansiColorWrap("",Ut.reset):s})}function formatNumberAddZeros(e,t=2,r=0){return null!=e&&isNaN(e)?"":(e=null!=e?e+r:e,2===t?null==e?"--":e<10?"0"+e:e.toString():null==e?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function jsonStringifyRecursive(e){const t=new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return"[Circular]";t.add(r)}return"bigint"==typeof r?`${r}`:r})}function inspect(e,t){const r={seen:[],stylize:stylizeNoColor};return null!=t&&_extend(r,t),util_inspect_polyfil_isUndefined(r.showHidden)&&(r.showHidden=!1),util_inspect_polyfil_isUndefined(r.depth)&&(r.depth=2),util_inspect_polyfil_isUndefined(r.colors)&&(r.colors=!0),util_inspect_polyfil_isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,e,r.depth)}function util_inspect_polyfil_isUndefined(e){return void 0===e}function stylizeNoColor(e){return e}function stylizeWithColor(e,t){const r=inspect.styles[t];return null!=r&&null!=inspect?.colors?.[r]?.[0]&&null!=inspect?.colors?.[r]?.[1]?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function isFunction(e){return"function"==typeof e}function util_inspect_polyfil_isString(e){return"string"==typeof e}function isNull(e){return null===e}function hasOwn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function util_inspect_polyfil_isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function objectToString(e){return Object.prototype.toString.call(e)}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatValue(e,t,r=0){if(e.customInspect&&null!=t&&isFunction(t)&&t?.inspect!==inspect&&(!t?.constructor||t?.constructor.prototype!==t)){if("function"!=typeof t.inspect&&null!=t.toString)return t.toString();let n=t?.inspect(r,e);return util_inspect_polyfil_isString(n)||(n=formatValue(e,n,r)),n}const n=formatPrimitive(e,t);if(n)return n;let i=Object.keys(t);const s=function arrayToHash(e){const t={};return e.forEach(e=>{t[e]=!0}),t}(i);try{e.showHidden&&Object.getOwnPropertyNames&&(i=Object.getOwnPropertyNames(t))}catch(e){}if(isError(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return formatError(t);if(0===i.length){if(!isFunction(e.stylize))return t;if(isFunction(t)){const r=t.name?": "+t.name:"";return e.stylize("[Function"+r+"]","special")}if(isRegExp(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(util_inspect_polyfil_isDate(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(isError(t))return formatError(t)}let o,a="",l=!1,c=["{\n","\n}"];if(Array.isArray(t)&&(l=!0,c=["[\n","\n]"]),isFunction(t)){a=" [Function"+(t.name?": "+t.name:"")+"]"}return isRegExp(t)&&(a=" "+RegExp.prototype.toString.call(t)),util_inspect_polyfil_isDate(t)&&(a=" "+Date.prototype.toUTCString.call(t)),isError(t)&&(a=" "+formatError(t)),0!==i.length||l&&0!=t.length?r<0?isRegExp(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),o=l?function formatArray(e,t,r,n,i){const s=[];for(let i=0,o=t.length;i<o;++i)hasOwn(t,String(i))?s.push(formatProperty(e,t,r,n,String(i),!0)):s.push("");return i.forEach(i=>{i.match(/^\d+$/)||s.push(formatProperty(e,t,r,n,i,!0))}),s}(e,t,r,s,i):i.map(n=>formatProperty(e,t,r,s,n,l)),e.seen.pop(),function reduceToSingleString(e,t,r){return r[0]+(""===t?"":t+"\n")+" "+e.join(",\n ")+" "+r[1]}(o,a,c)):c[0]+a+c[1]}function formatProperty(e,t,r,n,i,s){let o,a,l={value:void 0};try{l.value=t[i]}catch(e){}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,i)||l)}catch(e){}if(l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),hasOwn(n,i)||(o="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=isNull(r)?formatValue(e,l.value,void 0):formatValue(e,l.value,r-1),a.indexOf("\n")>-1&&(a=s?a.split("\n").map(e=>" "+e).join("\n").substr(2):"\n"+a.split("\n").map(e=>" "+e).join("\n"))):a=e.stylize("[Circular]","special")),util_inspect_polyfil_isUndefined(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function formatPrimitive(e,t){if(util_inspect_polyfil_isUndefined(t))return e.stylize("undefined","undefined");if(util_inspect_polyfil_isString(t)){const r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(r,"string")}return function util_inspect_polyfil_isNumber(e){return"number"==typeof e}(t)?e.stylize(""+t,"number"):function isBoolean(e){return"boolean"==typeof e}(t)?e.stylize(""+t,"boolean"):isNull(t)?e.stylize("null","null"):void 0}function _extend(e,t){const r={...e};if(!t||!isObject(t))return e;const n={...t},i=Object.keys(t);let s=i.length;for(;s--;)r[i[s]]=n[i[s]];return r}inspect.colors=Ut,inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};const _t={getCallerStackFrame,getErrorTrace,getMeta:function getMeta(e,t,r,n,i,s){return Object.assign({},Ht,{name:i,parentNames:s,date:new Date,logLevelId:e,logLevelName:t,path:n?void 0:getCallerStackFrame(r)})},transportJSON:function transportJSON(e){console.log(jsonStringifyRecursive(e))},transportFormatted:function transportFormatted(e,t,r,n){const i=(r.length>0&&t.length>0?"\n":"")+r.join("\n");n.prettyInspectOptions.colors=n.stylePrettyLogs,console.log(e+function formatWithOptions(e,...t){const r={seen:[],stylize:stylizeNoColor};null!=e&&_extend(r,e);const n=t[0];let i=0,s="",o="";if("string"==typeof n){if(1===t.length)return n;let a,l=0;for(let o=0;o<n.length-1;o++)if(37===n.charCodeAt(o)){const c=n.charCodeAt(++o);if(i+1!==t.length){switch(c){case 115:{const n=t[++i];a="number"==typeof n||"bigint"==typeof n?formatPrimitive(r,n):"object"!=typeof n||null===n?String(n):inspect(n,{...e,compact:3,colors:!1,depth:0});break}case 106:a=jsonStringifyRecursive(t[++i]);break;case 100:{const e=t[++i];a="bigint"==typeof e?formatPrimitive(r,e):"symbol"==typeof e?"NaN":formatPrimitive(r,e);break}case 79:a=inspect(t[++i],e);break;case 111:a=inspect(t[++i],{...e,showHidden:!0,showProxy:!0,depth:4});break;case 105:{const e=t[++i];a="bigint"==typeof e?formatPrimitive(r,e):"symbol"==typeof e?"NaN":formatPrimitive(r,parseInt(a));break}case 102:{const e=t[++i];a="symbol"==typeof e?"NaN":formatPrimitive(r,parseInt(e));break}case 99:i+=1,a="";break;case 37:s+=n.slice(l,o),l=o+1;continue;default:continue}l!==o-1&&(s+=n.slice(l,o-1)),s+=a,l=o+1}else 37===c&&(s+=n.slice(l,o),l=o+1)}0!==l&&(i++,o=" ",l<n.length&&(s+=n.slice(l)))}for(;i<t.length;){const r=t[i];s+=o,s+="string"!=typeof r?inspect(r,e):r,o=" ",i++}return s}(n.prettyInspectOptions,...t)+i)},isBuffer:function isBuffer(e){return!1},isError:browser_isError,prettyFormatLogObj:function prettyFormatLogObj(e,t){return e.reduce((e,r)=>(browser_isError(r)?e.errors.push(prettyFormatErrorObj(r,t)):e.args.push(r),e),{args:[],errors:[]})},prettyFormatErrorObj},Ht={runtime:[typeof window,typeof document].includes("undefined")?"Generic":"Browser",browser:globalThis?.navigator?.userAgent},Wt=/(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/;function getCallerStackFrame(e,t=Error()){return stackLineToStackFrame(t?.stack?.split("\n")?.filter(e=>!e.includes("Error: "))?.[e])}function getErrorTrace(e){return(e?.stack?.split("\n")??[])?.filter(e=>!e.includes("Error: "))?.reduce((e,t)=>(e.push(stackLineToStackFrame(t)),e),[])}function stackLineToStackFrame(e){const t=globalThis?.location?.origin,r={fullFilePath:void 0,fileName:void 0,fileNameWithLine:void 0,fileColumn:void 0,fileLine:void 0,filePath:void 0,filePathWithLine:void 0,method:void 0};if(null!=e){const n=e.match(Wt);if(n){r.filePath=n[1].replace(/\?.*$/,""),r.fullFilePath=`${t}${r.filePath}`;const e=r.filePath.split("/");r.fileName=e[e.length-1],r.fileLine=n[2],r.fileColumn=n[3],r.filePathWithLine=`${r.filePath}:${r.fileLine}`,r.fileNameWithLine=`${r.fileName}:${r.fileLine}`}}return r}function browser_isError(e){return e instanceof Error}function prettyFormatErrorObj(e,t){const r=getErrorTrace(e).map(e=>formatTemplate(t,t.prettyErrorStackTemplate,{...e},!0)),n={errorName:` ${e.name} `,errorMessage:Object.getOwnPropertyNames(e).reduce((t,r)=>("stack"!==r&&t.push(e[r]),t),[]).join(", "),errorStack:r.join("\n")};return formatTemplate(t,t.prettyErrorTemplate,n)}class BaseLogger{constructor(e,t,r=4){this.logObj=t,this.stackDepthLevel=r,this.runtime=_t,this.settings={type:e?.type??"pretty",name:e?.name,parentNames:e?.parentNames,minLevel:e?.minLevel??0,argumentsArrayName:e?.argumentsArrayName,hideLogPositionForProduction:e?.hideLogPositionForProduction??!1,prettyLogTemplate:e?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{filePathWithLine}}{{nameWithDelimiterPrefix}}\t",prettyErrorTemplate:e?.prettyErrorTemplate??"\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}",prettyErrorStackTemplate:e?.prettyErrorStackTemplate??" • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}",prettyErrorParentNamesSeparator:e?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:e?.prettyErrorLoggerNameDelimiter??"\t",stylePrettyLogs:e?.stylePrettyLogs??!0,prettyLogTimeZone:e?.prettyLogTimeZone??"UTC",prettyLogStyles:e?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:e?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:e?.metaProperty??"_meta",maskPlaceholder:e?.maskPlaceholder??"[***]",maskValuesOfKeys:e?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:e?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:e?.maskValuesRegEx,prefix:[...e?.prefix??[]],attachedTransports:[...e?.attachedTransports??[]],overwrite:{mask:e?.overwrite?.mask,toLogObj:e?.overwrite?.toLogObj,addMeta:e?.overwrite?.addMeta,addPlaceholders:e?.overwrite?.addPlaceholders,formatMeta:e?.overwrite?.formatMeta,formatLogObj:e?.overwrite?.formatLogObj,transportFormatted:e?.overwrite?.transportFormatted,transportJSON:e?.overwrite?.transportJSON}}}log(e,t,...r){if(e<this.settings.minLevel)return;const n=[...this.settings.prefix,...r],i=null!=this.settings.overwrite?.mask?this.settings.overwrite?.mask(n):null!=this.settings.maskValuesOfKeys&&this.settings.maskValuesOfKeys.length>0?this._mask(n):n,s=null!=this.logObj?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,o=null!=this.settings.overwrite?.toLogObj?this.settings.overwrite?.toLogObj(i,s):this._toLogObj(i,s),a=null!=this.settings.overwrite?.addMeta?this.settings.overwrite?.addMeta(o,e,t):this._addMetaToLogObj(o,e,t);let l,c;return null!=this.settings.overwrite?.formatMeta&&(l=this.settings.overwrite?.formatMeta(a?.[this.settings.metaProperty])),null!=this.settings.overwrite?.formatLogObj&&(c=this.settings.overwrite?.formatLogObj(i,this.settings)),"pretty"===this.settings.type&&(l=l??this._prettyFormatLogObjMeta(a?.[this.settings.metaProperty]),c=c??this.runtime.prettyFormatLogObj(i,this.settings)),null!=l&&null!=c?null!=this.settings.overwrite?.transportFormatted?this.settings.overwrite?.transportFormatted(l,c.args,c.errors,this.settings):this.runtime.transportFormatted(l,c.args,c.errors,this.settings):null!=this.settings.overwrite?.transportJSON?this.settings.overwrite?.transportJSON(a):"hidden"!==this.settings.type&&this.runtime.transportJSON(a),null!=this.settings.attachedTransports&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(e=>{e(a)}),a}attachTransport(e){this.settings.attachedTransports.push(e)}getSubLogger(e,t){const r={...this.settings,...e,parentNames:null!=this.settings?.parentNames&&null!=this.settings?.name?[...this.settings.parentNames,this.settings.name]:null!=this.settings?.name?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...e?.prefix??[]]};return new this.constructor(r,t??this.logObj,this.stackDepthLevel)}_mask(e){const t=!0!==this.settings.maskValuesOfKeysCaseInsensitive?this.settings.maskValuesOfKeys:this.settings.maskValuesOfKeys.map(e=>e.toLowerCase());return e?.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t))}_recursiveCloneAndMaskValuesOfKeys(e,t,r=[]){if(r.includes(e))return{...e};if("object"==typeof e&&null!==e&&r.push(e),this.runtime.isError(e)||this.runtime.isBuffer(e))return e;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Array.isArray(e))return e.map(e=>this._recursiveCloneAndMaskValuesOfKeys(e,t,r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof URL)return function urlToObject(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([e,t])=>({key:e,value:t})),hash:e.hash,origin:e.origin}}(e);if(null!==e&&"object"==typeof e){const n=this.runtime.isError(e)?this._cloneError(e):Object.create(Object.getPrototypeOf(e));return Object.getOwnPropertyNames(e).reduce((n,i)=>(n[i]=t.includes(!0!==this.settings?.maskValuesOfKeysCaseInsensitive?i:i.toLowerCase())?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(e[i],t,r)}catch(e){return null}})(),n),n)}if("string"==typeof e){let t=e;for(const e of this.settings?.maskValuesRegEx||[])t=t.replace(e,this.settings?.maskPlaceholder||"");return t}return e}_recursiveCloneAndExecuteFunctions(e,t=[]){return this.isObjectOrArray(e)&&t.includes(e)?this.shallowCopy(e):(this.isObjectOrArray(e)&&t.push(e),Array.isArray(e)?e.map(e=>this._recursiveCloneAndExecuteFunctions(e,t)):e instanceof Date?new Date(e.getTime()):this.isObject(e)?Object.getOwnPropertyNames(e).reduce((r,n)=>{const i=Object.getOwnPropertyDescriptor(e,n);if(i){Object.defineProperty(r,n,i);const s=e[n];r[n]="function"==typeof s?s():this._recursiveCloneAndExecuteFunctions(s,t)}return r},Object.create(Object.getPrototypeOf(e))):e)}isObjectOrArray(e){return"object"==typeof e&&null!==e}isObject(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}shallowCopy(e){return Array.isArray(e)?[...e]:{...e}}_toLogObj(e,t={}){return e=e?.map(e=>this.runtime.isError(e)?this._toErrorObject(e):e),t=null==this.settings.argumentsArrayName?1!==e.length||Array.isArray(e[0])||!0===this.runtime.isBuffer(e[0])||e[0]instanceof Date?{...t,...e}:"object"==typeof e[0]&&null!=e[0]?{...e[0],...t}:{0:e[0],...t}:{...t,[this.settings.argumentsArrayName]:e}}_cloneError(e){const t=new e.constructor;return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=e[r]}),t}_toErrorObject(e){return{nativeError:e,name:e.name??"Error",message:e.message,stack:this.runtime.getErrorTrace(e)}}_addMetaToLogObj(e,t,r){return{...e,[this.settings.metaProperty]:this.runtime.getMeta(t,r,this.stackDepthLevel,this.settings.hideLogPositionForProduction,this.settings.name,this.settings.parentNames)}}_prettyFormatLogObjMeta(e){if(null==e)return"";let t=this.settings.prettyLogTemplate;const r={};t.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?t=t.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):"UTC"===this.settings.prettyLogTimeZone?(r.yyyy=e?.date?.getUTCFullYear()??"----",r.mm=formatNumberAddZeros(e?.date?.getUTCMonth(),2,1),r.dd=formatNumberAddZeros(e?.date?.getUTCDate(),2),r.hh=formatNumberAddZeros(e?.date?.getUTCHours(),2),r.MM=formatNumberAddZeros(e?.date?.getUTCMinutes(),2),r.ss=formatNumberAddZeros(e?.date?.getUTCSeconds(),2),r.ms=formatNumberAddZeros(e?.date?.getUTCMilliseconds(),3)):(r.yyyy=e?.date?.getFullYear()??"----",r.mm=formatNumberAddZeros(e?.date?.getMonth(),2,1),r.dd=formatNumberAddZeros(e?.date?.getDate(),2),r.hh=formatNumberAddZeros(e?.date?.getHours(),2),r.MM=formatNumberAddZeros(e?.date?.getMinutes(),2),r.ss=formatNumberAddZeros(e?.date?.getSeconds(),2),r.ms=formatNumberAddZeros(e?.date?.getMilliseconds(),3));const n="UTC"===this.settings.prettyLogTimeZone?e?.date:new Date(e?.date?.getTime()-6e4*e?.date?.getTimezoneOffset());r.rawIsoStr=n?.toISOString(),r.dateIsoStr=n?.toISOString().replace("T"," ").replace("Z",""),r.logLevelName=e?.logLevelName,r.fileNameWithLine=e?.path?.fileNameWithLine??"",r.filePathWithLine=e?.path?.filePathWithLine??"",r.fullFilePath=e?.path?.fullFilePath??"";let i=this.settings.parentNames?.join(this.settings.prettyErrorParentNamesSeparator);return i=null!=i&&null!=e?.name?i+this.settings.prettyErrorParentNamesSeparator:void 0,r.name=null!=e?.name||null!=i?(i??"")+e?.name??"":"",r.nameWithDelimiterPrefix=r.name.length>0?this.settings.prettyErrorLoggerNameDelimiter+r.name:"",r.nameWithDelimiterSuffix=r.name.length>0?r.name+this.settings.prettyErrorLoggerNameDelimiter:"",null!=this.settings.overwrite?.addPlaceholders&&this.settings.overwrite?.addPlaceholders(e,r),formatTemplate(this.settings,t,r)}}class esm_Logger extends BaseLogger{constructor(e,t){const r="undefined"!=typeof window&&"undefined"!=typeof document,n=!!r&&(void 0!==window.chrome&&void 0!==window.CSS&&window.CSS.supports("color","green")),i=!!r&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);(e=e||{}).stylePrettyLogs=!(e.stylePrettyLogs&&r&&!n)&&e.stylePrettyLogs,super(e,t,i?4:5)}log(e,t,...r){return super.log(e,t,...r)}silly(...e){return super.log(0,"SILLY",...e)}trace(...e){return super.log(1,"TRACE",...e)}debug(...e){return super.log(2,"DEBUG",...e)}info(...e){return super.log(3,"INFO",...e)}warn(...e){return super.log(4,"WARN",...e)}error(...e){return super.log(5,"ERROR",...e)}fatal(...e){return super.log(6,"FATAL",...e)}getSubLogger(e,t){return super.getSubLogger(e,t)}}function init(e){const t=new ServiceResolver;t.setService(w.action,new PriorityRegistry),t.setService(w.setting,new Registry),t.setService(w.icon,new Registry);const r=new esm_Logger({name:"app-core",type:"pretty"});t.setService(w.logger,r);const n=[EventDispatcher,ElementParser,CollectionParser,TokenParser_TokenParser,ApiConfiguration,FetchHelper,DeleteElementEndpoint,GetElementEndpoint,GetElementChildrenEndpoint,GetElementParentsEndpoint,GetElementRelatedEndpoint,GetIndexEndpoint,PatchElementEndpoint,PostElementEndpoint,PostIndexEndpoint,PutElementEndpoint,DeleteTokenEndpoint,GetMeEndpoint,GetTokenEndpoint,PostChangePasswordEndpoint,PostRegisterEndpoint,PostTokenEndpoint,ElementCache,ElementChildrenCache,ElementParentsCache,ElementRelatedCache,IndexCache,EventDispatcher,ApiWrapper];for(let e=0;e<n.length;e++)t.setService(n[e].identifier,n[e].constructFromServiceResolver(t));return initEventListener(t),e.addEventListener(p.GetServiceResolver,e=>{e.setServiceResolver(t),e.stopPropagation()}),t}export{n as BrowserEvent,i as BrowserEventListener,o as Cache,c as Endpoint,s as Error,d as Event,f as EventListener,m as Service,S as Type,init};
2
2
  //# sourceMappingURL=index.js.map