@launchdarkly/akamai-server-base-sdk 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/bundle.cjs.js +3 -3
- package/dist/cjs/bundle.cjs.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/bundle.es.js +3 -3
- package/dist/esm/bundle.es.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/package.json +3 -3
package/dist/cjs/bundle.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var e=require("crypto"),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},i={},n={};Object.defineProperty(n,"__esModule",{value:!0});n.default=class{constructor(e){this._onRequestStatus=e}getStatus(){return this._lastStatus}async requireStatus(){return this._lastStatus||await this._onRequestStatus(),this._lastStatus}notify(){var e;this._lastStatus&&(null===(e=this._listener)||void 0===e||e.call(this,this._lastStatus))}setListener(e){this._listener=e}setStatus(e){this._lastStatus=e}};var s={},a={};!function(e){function t(e){return e.indexOf("~")?e.replace(/~1/g,"/").replace(/~0/g,"~"):e}class r{constructor(e,r=!1){if(r){const t=e;this._components=[t],this.isValid=""!==t,this.redactionName=t.startsWith("/")?`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`:t}else{if(this.redactionName=e,""===e||"/"===e||e.match(/\/\/|(^\/.*~[^0|^1])|~$/))return this.isValid=!1,void(this._components=[]);!function(e){return!e.startsWith("/")}(e)?e.indexOf("/",1)<0?this._components=[t(e.slice(1))]:this._components=function(e){return(e.startsWith("/")?e.substring(1):e).split("/").map((e=>t(e)))}(e):this._components=[e],"_meta"===this._components[0]?this.isValid=!1:this.isValid=!0}}get(e){const{_components:t,isValid:r}=this;if(!r)return;let i=e;for(let e=0;e<t.length;e+=1){const r=t[e];if(null==i||!Object.prototype.hasOwnProperty.call(i,r)||"object"!=typeof i||Array.isArray(i))return;i=i[r]}return i}getComponent(e){return this._components[e]}get depth(){return this._components.length}get isKind(){return 1===this._components.length&&"kind"===this._components[0]}compare(e){return this.depth===e.depth&&this._components.every(((t,r)=>t===e.getComponent(r)))}}r.InvalidReference=new r("");class i{is(e){if(Array.isArray(e))return!1;const t=typeof e;return"function"===t||"object"===t}getType(){return"factory method or object"}}class n{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!Array.isArray(e)&&typeof e===this.typeOf}getType(){return this._typeName}}class s{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!!Array.isArray(e)&&(!(e.length>0)||e.every((e=>typeof e===this.typeOf)))}getType(){return this._typeName}}class a extends n{constructor(e){super(`number with minimum value of ${e}`,0),this.min=e}is(e){return typeof e===this.typeOf&&e>=this.min}}class o extends n{constructor(e){super(`string matching ${e}`,""),this.expression=e}is(e){return"string"==typeof e&&!!e.match(this.expression)}}class l{is(e){return"function"==typeof e}getType(){return"function"}}class c{is(e){return"boolean"==typeof e||null==e}getType(){return"boolean | undefined | null"}}const u=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/;class h{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class d extends o{constructor(){super(/^(\w|\.|-)+$/)}is(e){return super.is(e)&&"kind"!==e}}class f{static createTypeArray(e,t){return new s(e,t)}static numberWithMin(e){return new a(e)}static stringMatchingRegex(e){return new o(e)}}function p(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"!==e.kind)}function v(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"===e.kind)}function g(e){return!("kind"in e)||null===e.kind||void 0===e.kind}f.String=new n("string",""),f.Number=new n("number",0),f.ObjectOrFactory=new i,f.Object=new n("object",{}),f.StringArray=new s("string[]",""),f.Boolean=new n("boolean",!0),f.Function=new l,f.Date=new h,f.Kind=new d,f.NullableBoolean=new c;const _="user";function y(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function m(e){return f.Kind.is(e)}function b(e){return f.String.is(e)&&""!==e}function E(e,t=!1){return e?e.map((e=>new r(e,t))):[]}class w{constructor(e,t,r){this._isMulti=!1,this._isUser=!1,this._wasLegacy=!1,this._contexts={},this.kind=t,this.valid=e,this.message=r}static _contextForError(e,t){return new w(!1,e,t)}static _getValueFromContext(e,t){if(t&&e.isValid)return 1===e.depth&&"anonymous"===e.getComponent(0)?!!t?.anonymous:e.get(t)}_contextForKind(e){return this._isMulti?this._contexts[e]:this.kind===e?this._context:void 0}static _fromMultiKindContext(e){const t=Object.keys(e).filter((e=>"kind"!==e)),r=t.every(m);if(!t.length)return w._contextForError("multi","A multi-kind context must contain at least one kind");if(!r)return w._contextForError("multi","Context contains invalid kinds");const i={};let n=!0;const s=t.reduce(((t,r)=>{const s=e[r];var a;return(a=s)&&f.Object.is(a)?(t[r]=s,i[r]=E(s._meta?.privateAttributes)):n=!1,t}),{});if(!n)return w._contextForError("multi","Context contained contexts that were not objects");if(!Object.values(s).every((e=>b(e.key))))return w._contextForError("multi","Context contained invalid keys");if(1===t.length){const e=t[0],r=new w(!0,e);return r._context={...s[e],kind:e},r._privateAttributeReferences=i,r._isUser="user"===e,r}const a=new w(!0,e.kind);return a._contexts=s,a._privateAttributeReferences=i,a._isMulti=!0,a}static _fromSingleKindContext(e){const{key:t,kind:r}=e,i=m(r),n=b(t);if(!i)return w._contextForError(r??"unknown","The kind was not valid for the context");if(!n)return w._contextForError(r,"The key for the context was not valid");const s=E(e._meta?.privateAttributes),a=new w(!0,r);return a._isUser="user"===r,a._context=e,a._privateAttributeReferences={[r]:s},a}static _fromLegacyUser(e){if(!(void 0!==e.key&&null!==e.key))return w._contextForError("user","The key for the context was not valid");const t=new w(!0,"user");return t._isUser=!0,t._wasLegacy=!0,t._context=function(e){const t={...e.custom||[],kind:"user",key:String(e.key)};if(null!=e.anonymous){const r=!!e.anonymous;delete t.anonymous,t.anonymous=r}return null!==e.name&&void 0!==e.name&&(t.name=e.name),null!==e.ip&&void 0!==e.ip&&(t.ip=e.ip),null!==e.firstName&&void 0!==e.firstName&&(t.firstName=e.firstName),null!==e.lastName&&void 0!==e.lastName&&(t.lastName=e.lastName),null!==e.email&&void 0!==e.email&&(t.email=e.email),null!==e.avatar&&void 0!==e.avatar&&(t.avatar=e.avatar),null!==e.country&&void 0!==e.country&&(t.country=e.country),null!==e.privateAttributeNames&&void 0!==e.privateAttributeNames&&(t._meta={privateAttributes:e.privateAttributeNames}),t}(e),t._privateAttributeReferences={user:E(e.privateAttributeNames,!0)},t}static fromLDContext(e){return e?p(e)?w._fromSingleKindContext(e):v(e)?w._fromMultiKindContext(e):g(e)?w._fromLegacyUser(e):w._contextForError("unknown","Context was not of a valid kind"):w._contextForError("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;const t=e.getContexts();if(!e._isMulti)return t[0][1];const r={kind:"multi"};return t.forEach((e=>{const t=e[0],i=e[1];r[t]=i})),r}valueForKind(e,t=_){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=_){return this._contextForKind(e)?.key}get isMultiKind(){return this._isMulti}get canonicalKey(){return this._isUser?this._context.key:this._isMulti?Object.keys(this._contexts).sort().map((e=>`${e}:${y(this._contexts[e].key)}`)).join(":"):`${this.kind}:${y(this._context.key)}`}get kinds(){return this._isMulti?Object.keys(this._contexts):[this.kind]}get kindsAndKeys(){return this._isMulti?Object.entries(this._contexts).reduce(((e,[t,r])=>(e[t]=r.key,e)),{}):{[this.kind]:this._context.key}}privateAttributes(e){return this._privateAttributeReferences?.[e]||[]}getContexts(){return this._isMulti?Object.entries(this._contexts):[[this.kind,this._context]]}get legacy(){return this._wasLegacy}}w.UserKind=_;const S=["key","kind","_meta","anonymous"].map((e=>new r(e,!0))),k=["name","ip","firstName","lastName","email","avatar","country"];class x{constructor(e,t){this._allAttributesPrivate=e,this._privateAttributes=t}filter(e,t=!1){const r=e.getContexts();if(1===r.length)return this._filterSingleKind(e,r[0][1],r[0][0],t);const i={kind:"multi"};return r.forEach((([r,n])=>{i[r]=this._filterSingleKind(e,n,r,t)})),i}_getAttributesToFilter(e,t,i,n){return(n?Object.keys(t).map((e=>new r(e,!0))):[...this._privateAttributes,...e.privateAttributes(i)]).filter((e=>!S.some((t=>t.compare(e)))))}_filterSingleKind(e,t,r,i){const n=this._allAttributesPrivate||i&&!0===t.anonymous,{cloned:s,excluded:a}=function(e,t){const r=[],i={},n=[];for(r.push(...Object.keys(e).map((t=>({key:t,ptr:[t],source:e,parent:i,visited:[e]}))));r.length;){const e=r.pop(),i=t.find((t=>{return r=t,i=e.ptr,r.depth===i.length&&i.every(((e,t)=>e===r.getComponent(t)));var r,i}));if(i)n.push(i.redactionName);else{const t=e.source[e.key];null===t?e.parent[e.key]=t:Array.isArray(t)?e.parent[e.key]=[...t]:"object"==typeof t?e.visited.includes(t)||(e.parent[e.key]={},r.push(...Object.keys(t).map((r=>({key:r,ptr:[...e.ptr,r],source:t,parent:e.parent[e.key],visited:[...e.visited,t]}))))):e.parent[e.key]=t}}return{cloned:i,excluded:n.sort()}}(t,this._getAttributesToFilter(e,t,r,n));return e.legacy&&k.forEach((e=>{e in s&&(s[e]=String(s[e]))})),a.length&&(s._meta||(s._meta={}),s._meta.redactedAttributes=a),s._meta&&(delete s._meta.privateAttributes,0===Object.keys(s._meta).length&&delete s._meta),s}}var O,R,D,I;e.DataSourceErrorKind=void 0,(O=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",O.NetworkError="NETWORK_ERROR",O.ErrorResponse="ERROR_RESPONSE",O.InvalidData="INVALID_DATA";class A extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class P extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class T extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}e.AutoEnvAttributes=void 0,(R=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[R.Disabled=0]="Disabled",R[R.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(D||(D={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(I||(I={}));var M=Object.freeze({__proto__:null,get LDDeliveryStatus(){return I},get LDEventType(){return D}});function C(e){if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if(Object.prototype.hasOwnProperty.call(e,"toString"))try{return e.toString()}catch{}if("bigint"==typeof e)return`${e}n`;try{return JSON.stringify(e)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}const N={s:e=>C(e),d:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(Number(e))}(e),i:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(parseInt(e,10))}(e),f:e=>function(e){return"symbol"==typeof e?"NaN":String(parseFloat(e))}(e),j:e=>C(e),o:e=>C(e),O:e=>C(e),c:()=>""};function j(...e){const t=e.shift();if(f.String.is(t)){let r="",i=0;for(;i<t.length;){const n=t.charAt(i);if("%"===n){if(i+1<t.length){const n=t.charAt(i+1);if(n in N&&e.length){const t=e.shift();r+=N[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map(C).join(" ")),r}return e.map(C).join(" ")}var F;!function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error",e[e.none=4]="none"}(F||(F={}));const $=["debug","info","warn","error","none"];class L{static get(){return new L({})}constructor(e){if(this._logLevel=F[e.level??"info"]??F.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[F.debug]:e.destination.debug,[F.info]:e.destination.info,[F.warn]:e.destination.warn,[F.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[F.debug]:t,[F.info]:t,[F.warn]:t,[F.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):j(...e)}catch{return j(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${$[e]}: [${this._name}]`;try{const i=this._destinations?.[e];i?this._tryWrite(i,`${r} ${this._tryFormat(...t)}`):console.error(...t)}catch{console.error(...t)}}}error(...e){this._log(F.error,e)}warn(...e){this._log(F.warn,e)}info(...e){this._log(F.info,e)}debug(...e){this._log(F.debug,e)}}const B={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class V{constructor(e,t){Object.entries(B).forEach((([t,r])=>{if(!r.is(e[t]))throw new Error(`Provided logger instance must support logger.${t}(...) method`)})),this._logger=e,this._fallback=t}_log(e,t){try{this._logger[e](...t)}catch{this._fallback[e](...t)}}error(...e){this._log("error",e)}warn(...e){this._log("warn",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}}class z{static deprecated(e,t){return`"${e}" is deprecated, please use "${t}"`}static optionBelowMinimum(e,t,r){return`Config option "${e}" had invalid value of ${t}, using minimum of ${r} instead`}static unknownOption(e){return`Ignoring unknown config option "${e}"`}static wrongOptionType(e,t,r){return`Config option "${e}" should be of type ${t}, got ${r}, using default value`}static wrongOptionTypeBoolean(e,t){return`Config option "${e}" should be a boolean, got ${t}, converting to boolean`}static invalidTagValue(e){return`Config option "${e}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(e){return`Value of "${e}" was longer than 64 characters and was discarded.`}static partialEndpoint(e){return`You have set custom uris without specifying the ${e} URI; connections may not work properly`}}const H=f.stringMatchingRegex(/^(\w|\.|-)+$/),K=(e,t)=>H.is(e)?e.length>64?{valid:!1,message:z.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:z.invalidTagValue(t)};function U(e){return e.replace(/\/+$/,"")}function q(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class W{constructor(e,t,r=W.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=U(e),this.polling=U(t),this.events=U(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function G(e,t){if(0===t.length)return e;return`${e}?${t.map((({key:e,value:t})=>`${e}=${t}`)).join("&")}`}function X(e,t,r){const i=q(t);return G(`${e.events}/${i}`,r)}W.DEFAULT_EVENTS="https://events.launchdarkly.com";class J extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class Y extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class Z extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function Q(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ee(e){return 413===e||Q(e)}const te=(e,t)=>e?Object.entries(e).reduce(((e,[r,i])=>(!Boolean(i)||(e=>"{}"===JSON.stringify(e))(i)||t?.includes(r)||(e[r]="object"==typeof i?te(i,t):i),e)),{}):e;function re(e,t,r){let i;i=e.status?`error ${e.status}${401===e.status?" (invalid SDK key)":""}`:`I/O error (${e.message||"unknown error"})`;return`Received ${i} for ${t} - ${r??"giving up permanently"}`}const ie=async(e=1e3)=>new Promise((e=>{}));var ne;!function(e){e.MalformedFlag="MALFORMED_FLAG",e.UserNotSpecified="USER_NOT_SPECIFIED",e.FlagNotFound="FLAG_NOT_FOUND",e.ClientNotReady="CLIENT_NOT_READY",e.WrongType="WRONG_TYPE"}(ne||(ne={}));var se=ne;class ae{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}ae.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class oe{constructor(e,t){const{basicConfiguration:r,platform:i}=e,{serviceEndpoints:{analyticsEventPath:n,diagnosticEventPath:s}}=r,{crypto:a,requests:o}=i;this._defaultHeaders={...t},this._eventsUri=X(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=X(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:I.Succeeded},s={...this._defaultHeaders,"content-type":"application/json"};let a;r&&(s["x-launchdarkly-payload-id"]=r,s["x-launchDarkly-event-schema"]="4");try{const{status:r,headers:i}=await this._requests.fetch(t,{headers:s,body:JSON.stringify(e),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new J(re({status:r,message:"some events were dropped"},"event posting")),!Q(r))return ee(r)?n.status=I.Failed:n.status=I.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=I.Failed,n.error=a,n):(await ie(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===D.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===D.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function le(e){return"feature"===e.kind}class ce{constructor(e,t,r,i,n,s){this.count=e,this.key=t,this.value=r,this.version=n,this.variation=s,this.default=i}increment(){this.count+=1}}class ue{constructor(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(le(e)&&!e.excludeFromSummaries){const t=function(e){return`${e.key}:${null!==e.variation&&void 0!==e.variation?e.variation:""}:${null!==e.version&&void 0!==e.version?e.version:""}`}(e),r=this._counters[t];let i=this._contextKinds[e.key];i||(i=new Set,this._contextKinds[e.key]=i),e.context.kinds.forEach((e=>i.add(e))),r?r.increment():this._counters[t]=new ce(1,e.key,e.value,e.default,e.version,e.variation),(0===this._startDate||e.creationDate<this._startDate)&&(this._startDate=e.creationDate),e.creationDate>this._endDate&&(this._endDate=e.creationDate)}}getSummary(){const e=Object.values(this._counters).reduce(((e,t)=>{let r=e[t.key];r||(r={default:t.default,counters:[],contextKinds:[...this._contextKinds[t.key]]},e[t.key]=r);const i={value:t.value,count:t.count};return void 0!==t.variation&&null!==t.variation&&(i.variation=t.variation),void 0!==t.version&&null!==t.version?i.version=t.version:i.unknown=!0,r.counters.push(i),e}),{});return{startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary"}}clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class he extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}function de(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class fe{constructor(e,t,r,i,n=1,s){this.context=e,this.key=t,this.data=r,this.metricValue=i,this.samplingRatio=n,this.url=s,this.kind="custom",this.creationDate=Date.now(),this.context=e}}class pe{constructor(e,t,r,i,n,s,a,o,l,c,u,h,d=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=d,this.kind="feature",this.creationDate=Date.now(),this.value=i,this.default=n,void 0!==s&&(this.version=s),void 0!==a&&(this.variation=a),void 0!==o&&(this.trackEvents=o),void 0!==l&&(this.prereqOf=l),void 0!==c&&(this.reason=c),void 0!==u&&(this.debugEventsUntilDate=u),void 0!==h&&(this.excludeFromSummaries=h)}}class ve{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}var ge=Object.freeze({__proto__:null,ClientMessages:ae,DiagnosticsManager:class{constructor(e,t,r){this._platform=t,this._diagnosticInitConfig=r,this._streamInits=[],this._startTime=Date.now(),this._dataSinceDate=this._startTime,this._id={diagnosticId:t.crypto.randomUUID(),sdkKeySuffix:e.length>6?e.substring(e.length-6):e}}createInitEvent(){const e=this._platform.info.sdkData(),t=this._platform.info.platformData();return{kind:"diagnostic-init",id:this._id,creationDate:this._startTime,sdk:e,configuration:this._diagnosticInitConfig,platform:{name:t.name,osArch:t.os?.arch,osName:t.os?.name,osVersion:t.os?.version,...t.additional||{}}}}recordStreamInit(e,t,r){const i={timestamp:e,failed:t,durationMillis:r};this._streamInits.push(i)}createStatsEventAndReset(e,t,r){const i=Date.now(),n={kind:"diagnostic",id:this._id,creationDate:i,dataSinceDate:this._dataSinceDate,droppedEvents:e,deduplicatedUsers:t,eventsInLastBatch:r,streamInits:this._streamInits};return this._streamInits=[],this._dataSinceDate=i,n}},ErrorKinds:se,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new pe(this._withReasons,e.context,e.flagKey,e.value,e.defaultVal,e.version,e.variation??void 0,e.trackEvents||e.addExperimentData,e.prereqOfFlagKey,this._withReasons||e.addExperimentData?e.reason:void 0,e.debugEventsUntilDate,e.excludeFromSummaries,e.samplingRatio)}unknownFlagEvent(e,t,r){return new pe(this._withReasons,r,e,t,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(e){return new ve(e,1)}customEvent(e,t,r,i,n=1){return new fe(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._summarizer=new ue,this._queue=[],this._lastKnownPastTime=0,this._droppedEvents=0,this._deduplicatedUsers=0,this._exceededCapacity=!1,this._eventsInLastBatch=0,this._shutdown=!1,this._flushUsersTimer=null,this._capacity=e.eventsCapacity,this._logger=t.basicConfiguration.logger,this._eventSender=new oe(t,i),this._contextFilter=new x(e.allAttributesPrivate,e.privateAttributes.map((e=>new r(e)))),a&&this.start()}start(){if(void 0!==this._contextDeduplicator?.flushInterval&&(this._flushUsersTimer=void this._contextDeduplicator.flushInterval),this._flushTimer=void this._config.flushInterval,this._diagnosticsManager){const e=this._diagnosticsManager.createInitEvent();this._postDiagnosticEvent(e),this._diagnosticsTimer=void this._config.diagnosticRecordingInterval}this._logger?.debug("Started EventProcessor.")}_postDiagnosticEvent(e){this._eventSender.sendEventData(D.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new he("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");const e=this._queue;this._queue=[];const t=this._summarizer.getSummary();this._summarizer.clearSummary(),Object.keys(t.features).length&&e.push(t),e.length&&(this._eventsInLastBatch=e.length,this._logger?.debug("Flushing %d events",e.length),await this._tryPostingEvents(e))}sendEvent(e){if(this._shutdown)return;if("migration_op"===e.kind){if(de(e.samplingRatio)){const t={...e,context:e.context?this._contextFilter.filter(e.context):void 0};1===t.samplingRatio&&delete t.samplingRatio,this._enqueue(t)}return}this._summarizer.summarizeEvent(e);const t=le(e),r=t&&e.trackEvents||!t,i=this._shouldDebugEvent(e),n=function(e){return"identify"===e.kind}(e),s=this._contextDeduplicator?.processContext(e.context);s||n||(this._deduplicatedUsers+=1);s&&!n&&this._enqueue(this._makeOutputEvent({kind:"index",creationDate:e.creationDate,context:e.context,samplingRatio:1},!1)),r&&de(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&de(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!0))}_makeOutputEvent(e,t){switch(e.kind){case"feature":{const r={kind:t?"debug":"feature",creationDate:e.creationDate,context:this._contextFilter.filter(e.context,!t),key:e.key,value:e.value,default:e.default};return 1!==e.samplingRatio&&(r.samplingRatio=e.samplingRatio),e.prereqOf&&(r.prereqOf=e.prereqOf),void 0!==e.variation&&(r.variation=e.variation),void 0!==e.version&&(r.version=e.version),e.reason&&(r.reason=e.reason),r}case"index":case"identify":{const t={kind:e.kind,creationDate:e.creationDate,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),t}case"custom":{const t={kind:"custom",creationDate:e.creationDate,key:e.key,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),void 0!==e.data&&(t.data=e.data),void 0!==e.metricValue&&(t.metricValue=e.metricValue),void 0!==e.url&&(t.url=e.url),t}case"click":return{kind:"click",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url,selector:e.selector};case"pageview":return{kind:"pageview",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url};default:return e}}_enqueue(e){this._queue.length<this._capacity?(this._queue.push(e),this._exceededCapacity=!1):(this._exceededCapacity||(this._exceededCapacity=!0,this._logger?.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this._droppedEvents+=1)}_shouldDebugEvent(e){return le(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(D.AnalyticsEvents,e);if(t.status===I.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},InputCustomEvent:fe,InputEvalEvent:pe,InputIdentifyEvent:ve,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadReader:class{constructor(e,t,r,i){this._objProcessors=t,this._errorHandler=r,this._logger=i,this._listeners=[],this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetState(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.code){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":case"none":this._tempBasis=!1;break;default:return}this._tempId=t?.id},this._processPutObject=e=>{if(!(this._tempId&&e.kind&&e.key&&e.version&&e.object))return;const t=this._processObj(e.kind,e.object);t?this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,object:t}):this._logger?.warn(`Unable to prcoess object for kind: '${e.kind}'`)},this._processDeleteObject=e=>{this._tempId&&e.kind&&e.key&&e.version&&this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,deleted:!0})},this._processPayloadTransferred=e=>{if(!this._tempId||!e.state||!e.version||void 0===this._tempBasis)return void this._resetState();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach((e=>e(t))),this._resetState()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetState()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}. Automatic retry will occur.`),this._resetState()},this._attachHandler(e,"server-intent",this._processServerIntent),this._attachHandler(e,"put-object",this._processPutObject),this._attachHandler(e,"delete-object",this._processDeleteObject),this._attachHandler(e,"payload-transferred",this._processPayloadTransferred),this._attachHandler(e,"goodbye",this._processGoodbye),this._attachHandler(e,"error",this._processError)}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}_attachHandler(t,r,i){t.addEventListener(r,(async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{i(JSON.parse(t.data))}catch{this._logger?.error(`Stream received data that was unable to be processed in "${r}" message`),this._logger?.debug(`Data follows: ${t.data}`),this._errorHandler?.(e.DataSourceErrorKind.InvalidData,"Malformed data in event stream")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Unexpected message from event stream")}))}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetState(){this._tempId=void 0,this._tempBasis=void 0,this._tempUpdates=[]}},isLegacyUser:g,isMultiKind:v,isSingleKind:p,shouldSample:de});e.ApplicationTags=class{constructor(e){const t={},r=e?.application,i=e?.logger;r&&Object.entries(r).forEach((([e,r])=>{if(null!=r){const{valid:n,message:s}=K(r,`application.${e}`);n?"versionName"===e?t["application-version-name"]=[r]:t[`application-${e}`]=[r]:i?.warn(s)}}));const n=Object.keys(t);n.length&&(this.value=n.sort().flatMap((e=>t[e].sort().map((t=>`${e}/${t}`)))).join(" "))}},e.AttributeReference=r,e.BasicLogger=L,e.ClientContext=class{constructor(e,t,r){this.platform=r,this.basicConfiguration={tags:t.tags,logger:t.logger,offline:t.offline,serviceEndpoints:t.serviceEndpoints,sdkKey:e}}},e.Context=w,e.ContextFilter=x,e.DateValidator=h,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=d,e.LDClientError=Y,e.LDFileDataSourceError=A,e.LDPollingError=P,e.LDStreamingError=T,e.LDTimeoutError=Z,e.LDUnexpectedResponseError=J,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=z,e.SafeLogger=V,e.ServiceEndpoints=W,e.StringMatchingRegex=o,e.Type=n,e.TypeArray=s,e.TypeValidators=f,e.base64UrlEncode=(e,t)=>t.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),e.cancelableTimedPromise=function(e,t){let r,i;return{promise:new Promise(((e,t)=>{i=e,r=e=>{e()}})),cancel:()=>{i(),clearTimeout(r)}}},e.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},e.createSafeLogger=e=>{const t=new L({level:"info",destination:console.error,formatter:j});return e?new V(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=te,e.defaultHeaders=function(e,t,r,i=!0,n="user-agent"){const{userAgentBase:s,version:a,wrapperName:o,wrapperVersion:l}=t.sdkData(),c={[n]:`${s??"NodeJSClient"}/${a}`};return i&&(c.authorization=e),o&&(c["x-launchdarkly-wrapper"]=l?`${o}/${l}`:o),r?.value&&(c["x-launchdarkly-tags"]=r.value),c},e.fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;0!=n--;){var a=s[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},e.getEventsUri=X,e.getPollingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=q(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),G(`${e.streaming}/${i}`,n)},e.httpErrorMessage=re,e.internal=ge,e.isHttpLocallyRecoverable=ee,e.isHttpRecoverable=Q,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||Q(e)},e.sleep=ie,e.subsystem=M,e.timedPromise=(e,t)=>new Promise(((e,t)=>{}))}(a);var o={},l={},c={};Object.defineProperty(c,"__esModule",{value:!0});var u={};Object.defineProperty(u,"__esModule",{value:!0});var h,d={};Object.defineProperty(d,"__esModule",{value:!0}),d.IsMigrationStage=d.LDMigrationStage=void 0,function(e){e.Off="off",e.DualWrite="dualwrite",e.Shadow="shadow",e.Live="live",e.RampDown="rampdown",e.Complete="complete"}(h||(d.LDMigrationStage=h={})),d.IsMigrationStage=function(e){return Object.values(h).includes(e)};var f={};Object.defineProperty(f,"__esModule",{value:!0});var p,v={};Object.defineProperty(v,"__esModule",{value:!0}),v.LDConsistencyCheck=void 0,function(e){e[e.Inconsistent=0]="Inconsistent",e[e.Consistent=1]="Consistent",e[e.NotChecked=2]="NotChecked"}(p||(v.LDConsistencyCheck=p={})),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(c,e),i(u,e),i(d,e),i(f,e),i(v,e)}(l);var g={},_={};Object.defineProperty(_,"__esModule",{value:!0});var y={};Object.defineProperty(y,"__esModule",{value:!0});var m={};Object.defineProperty(m,"__esModule",{value:!0});var b={};Object.defineProperty(b,"__esModule",{value:!0});var E,w,S={};Object.defineProperty(S,"__esModule",{value:!0}),S.LDConcurrentExecution=S.LDSerialExecution=S.LDExecution=S.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(E||(S.LDExecutionOrdering=E={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(w||(S.LDExecution=w={}));S.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=w.Serial}};S.LDConcurrentExecution=class{constructor(){this.type=w.Concurrent}},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(_,e),i(y,e),i(m,e),i(b,e),i(S,e)}(g);var k={};Object.defineProperty(k,"__esModule",{value:!0});var x={};Object.defineProperty(x,"__esModule",{value:!0});var O={};Object.defineProperty(O,"__esModule",{value:!0});var R={};Object.defineProperty(R,"__esModule",{value:!0});var D={};Object.defineProperty(D,"__esModule",{value:!0});var I={},A={};Object.defineProperty(A,"__esModule",{value:!0});var P={};Object.defineProperty(P,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(A,e),i(P,e)}(I);var T={},M={};Object.defineProperty(M,"__esModule",{value:!0});var C={};Object.defineProperty(C,"__esModule",{value:!0});var N={};Object.defineProperty(N,"__esModule",{value:!0});var j={};Object.defineProperty(j,"__esModule",{value:!0});var F={};Object.defineProperty(F,"__esModule",{value:!0});var $={};Object.defineProperty($,"__esModule",{value:!0});var L={};Object.defineProperty(L,"__esModule",{value:!0});var B={};Object.defineProperty(B,"__esModule",{value:!0});var V={};Object.defineProperty(V,"__esModule",{value:!0});var z={};Object.defineProperty(z,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(M,e),i(C,e),i(N,e),i(j,e),i(F,e),i(O,e),i($,e),i(L,e),i(B,e),i(V,e),i(z,e)}(T);var H={},K={};Object.defineProperty(K,"__esModule",{value:!0});var U={};Object.defineProperty(U,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(K,e),i(R,e),i(U,e)}(H),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.subsystems=e.interfaces=e.integrations=void 0,i(l,e),i(g,e),i(k,e),i(x,e),i(O,e),i(R,e),i(D,e),e.integrations=I,e.interfaces=T,e.subsystems=H}(o);var q={},W={};Object.defineProperty(W,"__esModule",{value:!0});W.default=class{constructor(e){this._keyMap=new Map,this._head=0,this._tail=0,this._size=0;const{max:t}=e;this._max=t,this._values=new Array(t),this._keys=new Array(t),this._next=new Uint32Array(t),this._prev=new Uint32Array(t),e.maxAge?(this._lastUpdated=new Array(t).fill(0),this._maxAge=e.maxAge):(this._lastUpdated=[],this._maxAge=0)}set(e,t){let r=this._keyMap.get(e);void 0===r?(r=this._index(),this._keys[r]=e,this._keyMap.set(e,r),this._next[this._tail]=r,this._prev[r]=this._tail,this._tail=r,this._size+=1):this._setTail(r),this._values[r]=t,this._maxAge&&(this._lastUpdated[r]=Date.now())}get(e){const t=this._keyMap.get(e);if(void 0!==t){if(this._maxAge){const e=this._lastUpdated[t];if(Date.now()-e>this._maxAge)return}return this._setTail(t),this._maxAge&&(this._lastUpdated[t]=Date.now()),this._values[t]}}clear(){this._head=0,this._tail=0,this._size=0,this._values.fill(void 0),this._keys.fill(void 0),this._next.fill(0),this._prev.fill(0),this._keyMap.clear()}_index(){return 0===this._size?this._tail:this._size===this._max?this._evict():this._size}_evict(){const{_head:e}=this,t=this._keys[e];return this._head=this._next[e],this._keyMap.delete(t),this._size-=1,e}_link(e,t){this._prev[t]=e,this._next[e]=t}_setTail(e){e!==this._tail&&(e===this._head?this._head=this._next[e]:this._link(this._prev[e],this._next[e]),this._link(this._tail,e),this._tail=e)}},Object.defineProperty(q,"__esModule",{value:!0});const G=a,X=n,J=W;q.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new X.default((async()=>this._pollStoreAndUpdateStatus())),this._staleTimeMs=1e3*(G.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);G.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new J.default({max:t.userCacheSize||1e3,maxAge:1e3*(t.userCacheTime||5)}))}close(){this._pollHandle&&(clearInterval(this._pollHandle),this._pollHandle=void 0),this._store&&this._store.close()}async getUserMembership(e){var t,r,i;if(!this._store)return;const n=null===(t=this._cache)||void 0===t?void 0:t.get(e);let s;if(n)s=n.membership;else try{s=await this._store.getUserMembership(this._hashForUserKey(e));const t={membership:s};null===(r=this._cache)||void 0===r||r.set(e,t)}catch(e){return null===(i=this._logger)||void 0===i||i.error(`Big Segment store membership query returned error: ${e}`),[null,"STORE_ERROR"]}this.statusProvider.getStatus()||await this._pollStoreAndUpdateStatus();const a=this.statusProvider.getStatus();return a.available?[s||null,a.stale?"STALE":"HEALTHY"]:[s||null,"STORE_ERROR"]}async _pollStoreAndUpdateStatus(){var e,t,r;if(!this._store)return void this.statusProvider.setStatus({available:!1,stale:!1});let i;null===(e=this._logger)||void 0===e||e.debug("Querying Big Segment store status");try{const e=await this._store.getMetadata();i={available:!0,stale:!e||!e.lastUpToDate||this._isStale(e.lastUpToDate)}}catch(e){null===(t=this._logger)||void 0===t||t.error(`Big Segment store status query returned error: ${e}`),i={available:!1,stale:!1}}const n=this.statusProvider.getStatus();n&&n.available===i.available&&n.stale===i.stale||(null===(r=this._logger)||void 0===r||r.debug("Big Segment store status changed from %s to %s",JSON.stringify(n),JSON.stringify(i)),this.statusProvider.setStatus(i),this.statusProvider.notify())}_hashForUserKey(e){const t=this._crypto.createHash("sha256");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("base64")}_isStale(e){return Date.now()-e>=this._staleTimeMs}};var Y={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});class ee{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ee.Features={namespace:"features",streamApiPath:"/flags/"},ee.Segments={namespace:"segments",streamApiPath:"/segments/"},Q.default=ee,Object.defineProperty(Z,"__esModule",{value:!0}),Z.deserializeSegment=Z.serializeSegment=Z.deserializeFlag=Z.serializeFlag=Z.deserializeDelete=Z.deserializePatch=Z.deserializePoll=Z.deserializeAll=Z.processSegment=Z.processFlag=Z.replacer=Z.nullReplacer=void 0;const te=a,re=Q,ie=100;function ne(e,t){const r=[];if(null==e)return;const i=Object.entries(e).filter((([e,r])=>!(null==t?void 0:t.includes(e))));for(r.push(...i.map((([t,r])=>({key:t,value:r,parent:e}))));r.length;){const e=r.pop();null!==e.value||Array.isArray(e.parent)?"object"==typeof e.value&&null!==e.value&&r.push(...Object.entries(e.value).map((([t,r])=>({key:t,value:r,parent:e.value})))):delete e.parent[e.key]}}function se(e,t){if(!(t instanceof te.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof te.AttributeReference))return null==t||(t.generated_includedSet&&(t.included=[...t.generated_includedSet],delete t.generated_includedSet),t.generated_excludedSet&&(t.excluded=[...t.generated_excludedSet],delete t.generated_excludedSet),t.includedContexts&&t.includedContexts.forEach((e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet})),t.excludedContexts&&t.excludedContexts.forEach((e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet}))),t}function ae(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new te.AttributeReference(e.bucketBy,!e.contextKind))}function oe(e){var t;if(ne(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ae(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach((e=>{var t;ae(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new te.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=te.AttributeReference.InvalidReference)}))}))}function le(e){var t,r,i,n,s;ne(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>ie&&(e.generated_includedSet=new Set(e.included),delete e.included),(null===(r=null==e?void 0:e.excluded)||void 0===r?void 0:r.length)&&e.excluded.length>ie&&(e.generated_excludedSet=new Set(e.excluded),delete e.excluded),(null===(i=null==e?void 0:e.includedContexts)||void 0===i?void 0:i.length)&&e.includedContexts.forEach((e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>ie&&(e.generated_valuesSet=new Set(e.values),e.values=[])})),(null===(n=null==e?void 0:e.excludedContexts)||void 0===n?void 0:n.length)&&e.excludedContexts.forEach((e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>ie&&(e.generated_valuesSet=new Set(e.values),e.values=[])})),null===(s=null==e?void 0:e.rules)||void 0===s||s.forEach((e=>{var t;e.bucketBy&&(e.bucketByAttributeReference=new te.AttributeReference(e.bucketBy,!e.rolloutContextKind)),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new te.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=te.AttributeReference.InvalidReference)}))}))}function ce(e){try{return JSON.parse(e)}catch(e){return}}Z.nullReplacer=ne,Z.replacer=se,Z.processFlag=oe,Z.processSegment=le,Z.deserializeAll=function(e){var t,r;const i=ce(e);if(i)return Object.values((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.flags)||[]).forEach((e=>{oe(e)})),Object.values((null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.segments)||[]).forEach((e=>{le(e)})),i},Z.deserializePoll=function(e){const t=ce(e);if(t)return Object.values((null==t?void 0:t.flags)||[]).forEach((e=>{oe(e)})),Object.values((null==t?void 0:t.segments)||[]).forEach((e=>{le(e)})),t},Z.deserializePatch=function(e){const t=ce(e);if(t)return t.path.startsWith(re.default.Features.streamApiPath)?(oe(t.data),t.kind=re.default.Features):t.path.startsWith(re.default.Segments.streamApiPath)&&(le(t.data),t.kind=re.default.Segments),t},Z.deserializeDelete=function(e){const t=ce(e);if(t)return t.path.startsWith(re.default.Features.streamApiPath)?t.kind=re.default.Features:t.path.startsWith(re.default.Segments.streamApiPath)&&(t.kind=re.default.Segments),t},Z.serializeFlag=function(e){return JSON.stringify(e,se)},Z.deserializeFlag=function(e){const t=ce(e);if(t)return oe(t),t},Z.serializeSegment=function(e){return JSON.stringify(e,se)},Z.deserializeSegment=function(e){const t=ce(e);if(t)return le(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=Z,r=Q;e.createPutListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeAll,processJson:async({data:{flags:t,segments:s}})=>{const a={[r.default.Features.namespace]:t,[r.default.Segments.namespace]:s};null==i||i.debug("Initializing all data"),e.init(a,n)}});e.createPatchListener=(e,i,n=()=>{})=>({deserializeData:t.deserializePatch,processJson:async({data:t,kind:s,path:a})=>{if(s){const o=r.default.getKeyFromPath(s,a);o&&(null==i||i.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,t,n))}}});e.createDeleteListener=(e,i,n=()=>{})=>({deserializeData:t.deserializeDelete,processJson:async({kind:t,path:s,version:a})=>{if(t){const o=r.default.getKeyFromPath(t,s);o&&(null==i||i.debug(`Deleting ${o} in ${t.namespace}`),e.upsert(t,{key:o,version:a,deleted:!0},n))}}});e.createStreamListeners=(t,r,i)=>{const n=new Map;return n.set("put",(0,e.createPutListener)(t,r,null==i?void 0:i.put)),n.set("patch",(0,e.createPatchListener)(t,r,null==i?void 0:i.patch)),n.set("delete",(0,e.createDeleteListener)(t,r,null==i?void 0:i.delete)),n}}(Y);var ue={},he={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.default=class{constructor(){this._itemsByNamespace={}}get(e,t){var r;return null===(r=this._itemsByNamespace[e])||void 0===r?void 0:r[t]}set(e,t,r){e in this._itemsByNamespace||(this._itemsByNamespace[e]={}),this._itemsByNamespace[e][t]=r}remove(e,t){const r=this._itemsByNamespace[e];r&&delete r[t]}removeAll(){this._itemsByNamespace={}}enumerate(e){Object.entries(this._itemsByNamespace).forEach((([t,r])=>{Object.entries(r).forEach((([r,i])=>{e(t,r,i)}))}))}mergeFrom(e){e.enumerate(this.set.bind(this))}},Object.defineProperty(he,"__esModule",{value:!0});const fe=de;he.default=class{constructor(){this._dependenciesFrom=new fe.default,this._dependenciesTo=new fe.default}updateDependenciesFrom(e,t,r){const i=this._dependenciesFrom.get(e,t);null==i||i.enumerate(((r,i)=>{const n=this._dependenciesTo.get(r,i);null==n||n.remove(e,t)})),this._dependenciesFrom.set(e,t,r),null==r||r.enumerate(((r,i)=>{let n=this._dependenciesTo.get(r,i);n||(n=new fe.default,this._dependenciesTo.set(r,i,n)),n.set(e,t,!0)}))}updateModifiedItems(e,t,r){if(!e.get(t,r)){e.set(t,r,!0);const i=this._dependenciesTo.get(t,r);null==i||i.enumerate(((t,r)=>{this.updateModifiedItems(e,t,r)}))}}reset(){this._dependenciesFrom.removeAll(),this._dependenciesTo.removeAll()}},Object.defineProperty(ue,"__esModule",{value:!0});const pe=Q,ve=he,ge=de;function _e(e,t){var r,i;const n=new ge.default,s=e===pe.default.Features.namespace,a=e===pe.default.Segments.namespace;if(s){const i=t;null===(r=null==i?void 0:i.prerequisites)||void 0===r||r.forEach((t=>{n.set(e,t.key,!0)}))}if(s||a){const e=t;null===(i=null==e?void 0:e.rules)||void 0===i||i.forEach((e=>{var t;null===(t=e.clauses)||void 0===t||t.forEach((e=>{"segmentMatch"===e.op&&e.values.forEach((e=>{n.set(pe.default.Segments.namespace,e,!0)}))}))}))}return n}ue.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new ve.default}init(e,t){const r=this._hasEventListeners(),i=i=>{this._featureStore.init(e,(()=>{Promise.resolve().then((()=>{if(this._dependencyTracker.reset(),Object.entries(e).forEach((([e,t])=>{Object.keys(t||{}).forEach((r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,_e(e,i))}))})),r){const t=new ge.default;Object.keys(e).forEach((r=>{const n=(null==i?void 0:i[r])||{},s=e[r],a=Object.assign(Object.assign({},n),s);Object.keys(a).forEach((e=>{this.addIfModified(r,e,n&&n[e],s&&s[e],t)}))})),this.sendChangeEvents(t)}})),null==t||t()}))};r?this._featureStore.all(pe.default.Features,(e=>{this._featureStore.all(pe.default.Segments,(t=>{const r={[pe.default.Features.namespace]:e,[pe.default.Segments.namespace]:t};i(r)}))})):i()}upsert(e,t,r){const{key:i}=t,n=this._hasEventListeners(),s=s=>{this._featureStore.upsert(e,t,(()=>{Promise.resolve().then((()=>{if(this._dependencyTracker.updateDependenciesFrom(e.namespace,i,_e(e.namespace,t)),n){const r=new ge.default;this.addIfModified(e.namespace,i,s,t,r),this.sendChangeEvents(r)}})),null==r||r()}))};n?this._featureStore.get(e,i,s):s()}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate(((e,t)=>{e===pe.default.Features.namespace&&this._onChange(t)}))}};var ye={},me={},be={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.default=function(e){return new Promise((t=>{e((e=>{t(e)}))}))},Object.defineProperty(be,"__esModule",{value:!0});const we=Ee;be.default=class{constructor(e){this._store=e}async get(e,t){return(0,we.default)((r=>{this._store.get(e,t,r)}))}async all(e){return(0,we.default)((t=>{this._store.all(e,t)}))}async init(e){return(0,we.default)((t=>{this._store.init(e,t)}))}async delete(e,t,r){return(0,we.default)((i=>{this._store.delete(e,t,r,i)}))}async upsert(e,t){return(0,we.default)((r=>{this._store.upsert(e,t,r)}))}async initialized(){return(0,we.default)((e=>{this._store.initialized(e)}))}close(){this._store.close()}};var Se={},ke={};function xe(e){return Date.now()>e.expiration}Object.defineProperty(ke,"__esModule",{value:!0});ke.default=class{constructor(e){this._options=e,this._storage=new Map,this._checkIntervalHandle=void e.checkInterval}get(e){const t=this._storage.get(e);if(!t||!xe(t))return null==t?void 0:t.value;this._storage.delete(e)}set(e,t){this._storage.set(e,{value:t,expiration:Date.now()+1e3*this._options.ttl})}delete(e){this._storage.delete(e)}clear(){this._storage.clear()}close(){this.clear(),this._checkIntervalHandle&&(clearInterval(this._checkIntervalHandle),this._checkIntervalHandle=null)}_purgeStale(){this._storage.forEach(((e,t)=>{xe(e)&&this._storage.delete(t)}))}get size(){return this._storage.size}};var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.persistentStoreKinds=void 0;const Re=Z,De=Q;Oe.persistentStoreKinds={segments:{namespace:De.default.Segments.namespace,deserialize:e=>{const t=(0,Re.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Re.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:De.default.Features.namespace,deserialize:e=>{const t=(0,Re.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,Re.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Ie={};Object.defineProperty(Ie,"__esModule",{value:!0});const Ae=Oe;function Pe(e,t){const r=[],i=new Set(Object.keys(t)),n=s=>{if(!i.has(s))return;i.delete(s);const a=t[s];var o;"features"===e.namespace&&(o=a,o.prerequisites&&o.prerequisites.length?o.prerequisites.map((e=>e.key)):[]).forEach((e=>{n(e)})),r.push({key:s,item:e.serialize(a)})};for(;i.size>0;){const e=i.values().next().value;n(e)}return r}Ie.default=function(e){const t=[];return Object.keys(e).forEach((r=>{const i=Ae.persistentStoreKinds[r];t.push({key:i,item:Pe(i,e[r])})})),t.sort(((e,t)=>e.key.priority-t.key.priority)),t};var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.default=class{constructor(){this._queue=[]}enqueue(e,t){this._queue.push([e,t]),1===this._queue.length&&this.executePendingUpdates()}executePendingUpdates(){if(this._queue.length>0){const[e,t]=this._queue[0];e((()=>{this._queue.shift(),this._queue.length,null==t||t()}))}}},Object.defineProperty(Se,"__esModule",{value:!0});const Me=ke,Ce=Oe,Ne=Ie,je=Te;function Fe(e,t){return`${e.namespace}:${t}`}function $e(e){return`$all:${e.namespace}`}const Le="$checkedInit";function Be(e){return!e||e.item.deleted?null:e.item}function Ve(e){return{version:e,item:{version:e,deleted:!0}}}function ze(e,t){if(t.deleted||!t.serializedItem)return Ve(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?Ve(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}Se.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new je.default,t&&(this._itemCache=new Me.default({ttl:t,checkInterval:600}),this._allItemsCache=new Me.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue((t=>{this._core.init((0,Ne.default)(e),(()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach((t=>{const r=Ce.persistentStoreKinds[t],i=e[t];this._allItemsCache.set($e(r),i),Object.keys(i).forEach((e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(Fe(r,e),n)}))}))),t()}))}),t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(Fe(e,t));if(i)return void r(Be(i))}const i=Ce.persistentStoreKinds[e.namespace];this._core.get(i,t,(n=>{var s;if(n&&n.serializedItem){const a=ze(i,n);return null===(s=this._itemCache)||void 0===s||s.set(Fe(e,t),a),void r(Be(a))}r(null)}))}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(Le))?e(!1):this._core.initialized((t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(Le,!0),e(this._isInitialized)}))}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get($e(e));if(i)return void t(i);const n=Ce.persistentStoreKinds[e.namespace];this._core.getAll(n,(r=>{var i;if(!r)return void t({});const s={};r.forEach((({key:e,item:t})=>{const r=Be(ze(n,t));r&&(s[e]=r)})),null===(i=this._allItemsCache)||void 0===i||i.set($e(e),s),t(s)}))}upsert(e,t,r){this._queue.enqueue((r=>{this._allItemsCache&&this._allItemsCache.clear();const i=Ce.persistentStoreKinds[e.namespace];this._core.upsert(i,t.key,i.serialize(t),((n,s)=>{var a,o;if(!n&&s)if(s.serializedItem){const r=ze(i,s);null===(a=this._itemCache)||void 0===a||a.set(Fe(e,t.key),r)}else s.deleted&&(null===(o=this._itemCache)||void 0===o||o.set(t.key,{key:t.key,version:s.version,deleted:!0}));r()}))}),r)}delete(e,t,r,i){this.upsert(e,{key:t,version:r,deleted:!0},i)}close(){var e,t;null===(e=this._itemCache)||void 0===e||e.close(),null===(t=this._allItemsCache)||void 0===t||t.close(),this._core.close()}getDescription(){return this._core.getDescription()}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializePoll=e.PersistentDataStoreWrapper=e.AsyncStoreFacade=void 0;const t=be;e.AsyncStoreFacade=t.default;const r=Se;e.PersistentDataStoreWrapper=r.default;const i=Z;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return i.deserializePoll}})}(me),Object.defineProperty(ye,"__esModule",{value:!0});const He=a,Ke=me,Ue=Q;ye.default=class{constructor(e,t,r,i=()=>{},n){this._requestor=t,this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._stopped=!1,this._logger=e.logger,this._pollInterval=e.pollInterval}_poll(){var e;if(this._stopped)return;const t=e=>{var t,r,i;null===(t=this._logger)||void 0===t||t.error("Polling received invalid data"),null===(r=this._logger)||void 0===r||r.debug(`Invalid JSON follows: ${e}`),null===(i=this._errorHandler)||void 0===i||i.call(this,new He.LDPollingError(He.DataSourceErrorKind.InvalidData,"Malformed JSON data in polling response"))},r=Date.now();null===(e=this._logger)||void 0===e||e.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData(((e,i)=>{var n,s,a,o;const l=Date.now()-r,c=Math.max(1e3*this._pollInterval-l,0);if(null===(n=this._logger)||void 0===n||n.debug("Elapsed: %d ms, sleeping for %d ms",l,c),e){const{status:t}=e;if(t&&!(0,He.isHttpRecoverable)(t)){const r=(0,He.httpErrorMessage)(e,"polling request");return null===(s=this._logger)||void 0===s||s.error(r),void(null===(a=this._errorHandler)||void 0===a||a.call(this,new He.LDPollingError(He.DataSourceErrorKind.ErrorResponse,r,t)))}null===(o=this._logger)||void 0===o||o.warn((0,He.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,Ke.deserializePoll)(i);if(e){const t={[Ue.default.Features.namespace]:e.flags,[Ue.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,(()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}}))}t(i)}this._timeoutHandle=e=>{e()}}))}start(){this._poll()}stop(){this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this._stopped=!0}close(){this.stop()}};var qe={};Object.defineProperty(qe,"__esModule",{value:!0});const We=a;qe.default=class{constructor(e,t,r){this._requests=t,this._eTagCache={},this._headers=Object.assign({},r),this._uri=(0,We.getPollingUri)(e.serviceEndpoints,"/sdk/latest-all",[])}async _requestWithETagCache(e,t){const r=this._eTagCache[e],i=null==r?void 0:r.etag,n=i?Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),{"if-none-match":i})}):t,s=await this._requests.fetch(e,n);if(304===s.status&&r)return{res:s,body:r.body};const a=s.headers.get("etag"),o=await s.text();return a&&(this._eTagCache[e]={etag:a,body:o}),{res:s,body:o}}async requestAllData(e){const t={method:"GET",headers:this._headers};try{const{res:r,body:i}=await this._requestWithETagCache(this._uri,t);if(200!==r.status&&304!==r.status){return e(new We.LDPollingError(We.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${r.status}`,r.status),void 0)}return e(void 0,304===r.status?null:i)}catch(t){return e(t,void 0)}}};var Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});const Xe=a;Ge.default=class{constructor(e,t,r,i,n,s,a,o=1){this._listeners=i,this._diagnosticsManager=s,this._errorHandler=a,this._streamInitialReconnectDelay=o;const{basicConfiguration:l,platform:c}=e,{logger:u}=l,{requests:h}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=h,this._streamUri=(0,Xe.getStreamingUri)(l.serviceEndpoints,t,r)}_logConnectionStarted(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e){var t,r,i;return(0,Xe.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,Xe.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionStarted(),!0):(this._logConnectionResult(!1),null===(t=this._errorHandler)||void 0===t||t.call(this,new Xe.LDStreamingError(Xe.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,Xe.httpErrorMessage)(e,"streaming request")),!1)}start(){this._logConnectionStarted();const e=this._requests.createEventSource(this._streamUri,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=e,e.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Opened LaunchDarkly stream connection")},e.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)},this._listeners.forEach((({deserializeData:t,processJson:r},i)=>{e.addEventListener(i,(e=>{var n,s;if(null===(n=this._logger)||void 0===n||n.debug(`Received ${i} event`),null==e?void 0:e.data){this._logConnectionResult(!0);const{data:n}=e,s=t(n);if(!s)return void((e,t,r,i)=>{null==r||r.error(`Stream received invalid data in "${e}" message`),null==r||r.debug(`Invalid JSON follows: ${t}`),null==i||i(new Xe.LDStreamingError(Xe.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new Xe.LDStreamingError(Xe.DataSourceErrorKind.Unknown,"Unexpected payload from event stream"))}))}))}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var Je={},Ye={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=class{constructor(){this._allData={},this._initCalled=!1}_addItem(e,t,r){let i=this._allData[e.namespace];if(i||(i={},this._allData[e.namespace]=i),Object.hasOwnProperty.call(i,t)){const e=i[t];(!e||e.version<r.version)&&(i[t]=r)}else i[t]=r}get(e,t,r){const i=this._allData[e.namespace];if(i&&Object.prototype.hasOwnProperty.call(i,t)){const e=i[t];if(e&&!e.deleted)return null==r?void 0:r(e)}return null==r?void 0:r(null)}all(e,t){var r;const i={},n=null!==(r=this._allData[e.namespace])&&void 0!==r?r:{};Object.entries(n).forEach((([e,t])=>{t&&!t.deleted&&(i[e]=t)})),null==t||t(i)}init(e,t){this._initCalled=!0,this._allData=e,null==t||t()}delete(e,t,r,i){const n={version:r,deleted:!0};this._addItem(e,t,n),null==i||i()}upsert(e,t,r){this._addItem(e,t.key,t),null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=void 0;const t=a,r=Ze,i={baseUri:t.TypeValidators.String,streamUri:t.TypeValidators.String,eventsUri:t.TypeValidators.String,timeout:t.TypeValidators.Number,capacity:t.TypeValidators.Number,logger:t.TypeValidators.Object,featureStore:t.TypeValidators.ObjectOrFactory,bigSegments:t.TypeValidators.Object,updateProcessor:t.TypeValidators.ObjectOrFactory,flushInterval:t.TypeValidators.Number,pollInterval:t.TypeValidators.numberWithMin(30),proxyOptions:t.TypeValidators.Object,offline:t.TypeValidators.Boolean,stream:t.TypeValidators.Boolean,streamInitialReconnectDelay:t.TypeValidators.Number,useLdd:t.TypeValidators.Boolean,sendEvents:t.TypeValidators.Boolean,allAttributesPrivate:t.TypeValidators.Boolean,privateAttributes:t.TypeValidators.StringArray,contextKeysCapacity:t.TypeValidators.Number,contextKeysFlushInterval:t.TypeValidators.Number,tlsParams:t.TypeValidators.Object,diagnosticOptOut:t.TypeValidators.Boolean,diagnosticRecordingInterval:t.TypeValidators.numberWithMin(60),wrapperName:t.TypeValidators.String,wrapperVersion:t.TypeValidators.String,application:t.TypeValidators.Object,payloadFilterKey:t.TypeValidators.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:t.TypeValidators.createTypeArray("Hook[]",{}),enableEventCompression:t.TypeValidators.Boolean};e.defaultValues={baseUri:"https://sdk.launchdarkly.com",streamUri:"https://stream.launchdarkly.com",eventsUri:t.ServiceEndpoints.DEFAULT_EVENTS,stream:!0,streamInitialReconnectDelay:1,sendEvents:!0,timeout:5,capacity:1e4,flushInterval:5,pollInterval:30,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new r.default,enableEventCompression:!1};e.default=class{constructor(r={},n={}){r=r||{},this.logger=r.logger;const{errors:s,validatedOptions:a}=function(r){const n=[],s=Object.assign({},e.defaultValues);return Object.keys(r).forEach((a=>{var o;const l=r[a],c=i[a];if(c)if(c.is(l))s[a]=l;else if("boolean"===c.getType())n.push(t.OptionMessages.wrongOptionTypeBoolean(a,typeof l)),s[a]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;n.push(t.OptionMessages.optionBelowMinimum(a,l,e)),s[a]=e}else n.push(t.OptionMessages.wrongOptionType(a,c.getType(),typeof l)),s[a]=e.defaultValues[a];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(a))})),{errors:n,validatedOptions:s}}(r);s.forEach((e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)})),function(e,r){var i,n,s;const{baseUri:a,streamUri:o,eventsUri:l}=e,c=null!=o,u=null!=a,h=null!=l;c===u&&c===h||(!c&&r.stream&&(null===(i=r.logger)||void 0===i||i.warn(t.OptionMessages.partialEndpoint("streamUri"))),u||null===(n=r.logger)||void 0===n||n.warn(t.OptionMessages.partialEndpoint("baseUri")),!h&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(r,a),this.serviceEndpoints=new t.ServiceEndpoints(a.streamUri,a.baseUri,a.eventsUri,n.analyticsEventPath,n.diagnosticEventPath,n.includeAuthorizationHeader,a.payloadFilterKey),this.eventsCapacity=a.capacity,this.timeout=a.timeout,this.bigSegments=a.bigSegments,this.flushInterval=a.flushInterval,this.pollInterval=a.pollInterval,this.proxyOptions=a.proxyOptions,this.offline=a.offline,this.stream=a.stream,this.streamInitialReconnectDelay=a.streamInitialReconnectDelay,this.useLdd=a.useLdd,this.sendEvents=a.sendEvents,this.allAttributesPrivate=a.allAttributesPrivate,this.privateAttributes=a.privateAttributes,this.contextKeysCapacity=a.contextKeysCapacity,this.contextKeysFlushInterval=a.contextKeysFlushInterval,this.tlsParams=a.tlsParams,this.diagnosticOptOut=a.diagnosticOptOut,this.wrapperName=a.wrapperName,this.payloadFilterKey=a.payloadFilterKey,this.wrapperVersion=a.wrapperVersion,this.tags=new t.ApplicationTags(a),this.diagnosticRecordingInterval=a.diagnosticRecordingInterval,t.TypeValidators.Function.is(a.updateProcessor)?this.updateProcessorFactory=a.updateProcessor:this.updateProcessorFactory=()=>a.updateProcessor,t.TypeValidators.Function.is(a.featureStore)?this.featureStoreFactory=a.featureStore:this.featureStoreFactory=()=>a.featureStore,this.hooks=a.hooks,this.enableEventCompression=a.enableEventCompression}}}(Ye),Object.defineProperty(Je,"__esModule",{value:!0});const Qe=a,et=Ye;Je.default=(e,t,r)=>{var i,n,s,a,o,l;return{customBaseURI:e.serviceEndpoints.polling!==et.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==et.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==et.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,Qe.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,Qe.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,Qe.secondsToMillis)(e.flushInterval),pollingIntervalMillis:(0,Qe.secondsToMillis)(e.pollInterval),reconnectTimeMillis:(0,Qe.secondsToMillis)(e.streamInitialReconnectDelay),contextKeysFlushIntervalMillis:(0,Qe.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,Qe.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:!e.stream,usingRelayDaemon:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(n=(i=t.requests).usingProxy)||void 0===n?void 0:n.call(i)),usingProxyAuthenticator:!!(null===(a=(s=t.requests).usingProxyAuth)||void 0===a?void 0:a.call(s)),dataStoreType:null!==(l=null===(o=r.getDescription)||void 0===o?void 0:o.call(r))&&void 0!==l?l:"memory"}};var tt={};Object.defineProperty(tt,"__esModule",{value:!0}),tt.allAsync=tt.firstSeriesAsync=tt.allSeriesAsync=tt.firstResult=void 0,tt.firstResult=function(e,t){let r;return null==e||e.some(((e,i)=>(r=t(e,i),!!r))),r};function rt(e,t,r,i,n){e?i<(null==e?void 0:e.length)?t(e[i],i,(s=>{if(r){if(!s)return void n(!1)}else if(s)return void n(!0);e.length>50?Promise.resolve().then((()=>{rt(e,t,r,i+1,n)})):rt(e,t,r,i+1,n)})):n(r):n(!1)}tt.allSeriesAsync=function(e,t,r){rt(e,t,!0,0,r)},tt.firstSeriesAsync=function(e,t,r){rt(e,t,!1,0,r)},tt.allAsync=function(e,t,r){e?Promise.all(null==e?void 0:e.map((e=>new Promise((r=>{t(e,r)}))))).then((e=>{r(e.every((e=>e)))})):r(!1)};var it={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});class st{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}st.Fallthrough={kind:"FALLTHROUGH"},st.Off={kind:"OFF"},st.TargetMatch={kind:"TARGET_MATCH"},nt.default=st,Object.defineProperty(it,"__esModule",{value:!0});const at=nt;class ot{constructor(e,t,r){this.isError=e,this.detail=t,this.message=r,this.isError=e,this.detail=t,this.message=r}get isOff(){return this.detail.reason.kind===at.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new ot(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new ot(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}it.default=ot;var lt={},ct={};Object.defineProperty(ct,"__esModule",{value:!0});ct.default=class{constructor(e){this._crypto=e}_sha1Hex(e){const t=this._crypto.createHash("sha1");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("hex")}bucket(e,t,r,i,n="user",s){const a=function(e){return"string"==typeof e?e:Number.isInteger(e)?String(e):null}(e.valueForKind(r,n));if(null===a){return[0,e.kinds.indexOf(n)>=0]}const o=`${s?Number(s):`${t}.${i}`}.${a}`;return[parseInt(this._sha1Hex(o).substring(0,15),16)/0x1000000000000000,!0]}};var ut={},ht={};Object.defineProperty(ht,"__esModule",{value:!0}),ht.getBucketBy=ht.getOffVariation=ht.getVariation=void 0;const dt=a,ft=it,{ErrorKinds:pt}=dt.internal,vt=new dt.AttributeReference("key");function gt(e,t,r){return dt.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?ft.default.forSuccess(e.variations[t],r,t):ft.default.forError(pt.MalformedFlag,"Invalid variation index in flag")}ht.getVariation=gt,ht.getOffVariation=function(e,t){return dt.TypeValidators.Number.is(e.offVariation)?gt(e,e.offVariation,t):ft.default.forSuccess(null,t)},ht.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:vt},Object.defineProperty(ut,"__esModule",{value:!0});const _t=a,yt=tt,mt=nt,bt=ht;function Et(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,bt.getVariation)(e,t.variation,mt.default.TargetMatch)}}ut.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,yt.firstResult)(e.contextTargets,(r=>{if(!r.contextKind||r.contextKind===_t.Context.UserKind){const i=(e.targets||[]).find((e=>e.variation===r.variation));return i?Et(e,i,t):void 0}return Et(e,r,t)})):(0,yt.firstResult)(e.targets,(r=>Et(e,r,t)))};var wt={};Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=function(e){return`${e.key}.g${e.generation}`};var St={},kt={},xt={exports:{}};var Ot={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var Rt="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=Ot,s=Rt,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),n=u++;s(e,n,t),c[e]=n,l[n]=t,a[n]=new RegExp(t,r?"g":void 0),o[n]=new RegExp(i,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),f("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${h}+`),f("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),f("FULL",`^${l[c.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),f("LOOSE",`^${l[c.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),f("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),f("COERCERTL",l[c.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(xt,xt.exports);var Dt=xt.exports;const It=Object.freeze({loose:!0}),At=Object.freeze({});var Pt=e=>e?"object"!=typeof e?It:e:At;const Tt=/^[0-9]+$/,Mt=(e,t)=>{const r=Tt.test(e),i=Tt.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var Ct={compareIdentifiers:Mt,rcompareIdentifiers:(e,t)=>Mt(t,e)};const Nt=Rt,{MAX_LENGTH:jt,MAX_SAFE_INTEGER:Ft}=Ot,{safeRe:$t,t:Lt}=Dt,Bt=Pt,{compareIdentifiers:Vt}=Ct;var zt=class e{constructor(t,r){if(r=Bt(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>jt)throw new TypeError(`version is longer than ${jt} characters`);Nt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?$t[Lt.LOOSE]:$t[Lt.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>Ft||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ft||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ft||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<Ft)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Nt("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),Vt(this.major,t.major)||Vt(this.minor,t.minor)||Vt(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const e=this.prerelease[r],i=t.prerelease[r];if(Nt("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return Vt(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{const e=this.build[r],i=t.build[r];if(Nt("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return Vt(e,i)}while(++r)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===r&&(i=[t]),0===Vt(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const Ht=zt;var Kt=(e,t,r=!1)=>{if(e instanceof Ht)return e;try{return new Ht(e,t)}catch(e){if(!r)return null;throw e}};const Ut=Kt;var qt=(e,t)=>{const r=Ut(e,t);return r?r.version:null};const Wt=Kt;var Gt=(e,t)=>{const r=Wt(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Xt=zt;var Jt=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Xt(e instanceof Xt?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const Yt=Kt;var Zt=(e,t)=>{const r=Yt(e,null,!0),i=Yt(t,null,!0),n=r.compare(i);if(0===n)return null;const s=n>0,a=s?r:i,o=s?i:r,l=!!a.prerelease.length;if(!!o.prerelease.length&&!l)return o.patch||o.minor?a.patch?"patch":a.minor?"minor":"major":"major";const c=l?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};const Qt=zt;var er=(e,t)=>new Qt(e,t).major;const tr=zt;var rr=(e,t)=>new tr(e,t).minor;const ir=zt;var nr=(e,t)=>new ir(e,t).patch;const sr=Kt;var ar=(e,t)=>{const r=sr(e,t);return r&&r.prerelease.length?r.prerelease:null};const or=zt;var lr=(e,t,r)=>new or(e,r).compare(new or(t,r));const cr=lr;var ur=(e,t,r)=>cr(t,e,r);const hr=lr;var dr=(e,t)=>hr(e,t,!0);const fr=zt;var pr=(e,t,r)=>{const i=new fr(e,r),n=new fr(t,r);return i.compare(n)||i.compareBuild(n)};const vr=pr;var gr=(e,t)=>e.sort(((e,r)=>vr(e,r,t)));const _r=pr;var yr=(e,t)=>e.sort(((e,r)=>_r(r,e,t)));const mr=lr;var br=(e,t,r)=>mr(e,t,r)>0;const Er=lr;var wr=(e,t,r)=>Er(e,t,r)<0;const Sr=lr;var kr=(e,t,r)=>0===Sr(e,t,r);const xr=lr;var Or=(e,t,r)=>0!==xr(e,t,r);const Rr=lr;var Dr=(e,t,r)=>Rr(e,t,r)>=0;const Ir=lr;var Ar=(e,t,r)=>Ir(e,t,r)<=0;const Pr=kr,Tr=Or,Mr=br,Cr=Dr,Nr=wr,jr=Ar;var Fr=(e,t,r,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Pr(e,r,i);case"!=":return Tr(e,r,i);case">":return Mr(e,r,i);case">=":return Cr(e,r,i);case"<":return Nr(e,r,i);case"<=":return jr(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const $r=zt,Lr=Kt,{safeRe:Br,t:Vr}=Dt;var zr,Hr,Kr,Ur,qr,Wr,Gr,Xr,Jr,Yr,Zr=(e,t)=>{if(e instanceof $r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=Br[Vr.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Br[Vr.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Br[Vr.COERCERTL].lastIndex=-1}else r=e.match(Br[Vr.COERCE]);return null===r?null:Lr(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function Qr(){if(Ur)return Kr;function e(t){var r=this;if(r instanceof e||(r=new e),r.tail=null,r.head=null,r.length=0,t&&"function"==typeof t.forEach)t.forEach((function(e){r.push(e)}));else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}function t(e,t,r){var i=t===e.head?new n(r,null,t,e):new n(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function r(e,t){e.tail=new n(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new n(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function n(e,t,r,i){if(!(this instanceof n))return new n(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}Ur=1,Kr=e,e.Node=n,e.create=e,e.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},e.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},e.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},e.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)r(this,arguments[e]);return this.length},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},e.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},e.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},e.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},e.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},e.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},e.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},e.prototype.map=function(t,r){r=r||this;for(var i=new e,n=this.head;null!==n;)i.push(t.call(r,n.value,this)),n=n.next;return i},e.prototype.mapReverse=function(t,r){r=r||this;for(var i=new e,n=this.tail;null!==n;)i.push(t.call(r,n.value,this)),n=n.prev;return i},e.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},e.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},e.prototype.slice=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,s=this.head;null!==s&&n<t;n++)s=s.next;for(;null!==s&&n<r;n++,s=s.next)i.push(s.value);return i},e.prototype.sliceReverse=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,s=this.tail;null!==s&&n>r;n--)s=s.prev;for(;null!==s&&n>t;n--,s=s.prev)i.push(s.value);return i},e.prototype.splice=function(e,r,...i){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;var a=[];for(n=0;s&&n<r;n++)a.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(n=0;n<i.length;n++)s=t(this,s,i[n]);return a},e.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{(Hr?zr:(Hr=1,zr=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return Kr}function ei(){if(Xr)return Gr;Xr=1;class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&f))+":"+e,i=r.get(t);if(i)return i;const a=this.options.loose,v=a?o[l.HYPHENRANGELOOSE]:o[l.HYPHENRANGE];e=e.replace(v,R(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[l.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[l.TILDETRIM],u),s("tilde trim",e),e=e.replace(o[l.CARETTRIM],h),s("caret trim",e);let g=e.split(" ").map((e=>_(e,this.options))).join(" ").split(/\s+/).map((e=>O(e,this.options)));a&&(g=g.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(o[l.COMPARATORLOOSE]))))),s("range list",g);const y=new Map,m=g.map((e=>new n(e,this.options)));for(const e of m){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const b=[...y.values()];return r.set(t,b),b}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>g(e,r)&&t.set.some((t=>g(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(D(this.set[t],e,this.options))return!0;return!1}}Gr=e;const t=function(){if(Wr)return qr;Wr=1;const e=Qr(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),c=Symbol("cache"),u=Symbol("updateAgeOnGet"),h=()=>1,d=(e,t,r)=>{const i=e[c].get(t);if(i){const t=i.value;if(f(e,t)){if(v(e,i),!e[n])return}else r&&(e[u]&&(i.value.now=Date.now()),e[l].unshiftNode(i));return t.value}},f=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[s]&&r>e[s]},p=e=>{if(e[r]>e[t])for(let i=e[l].tail;e[r]>e[t]&&null!==i;){const t=i.prev;v(e,i),i=t}},v=(e,t)=>{if(t){const i=t.value;e[a]&&e[a](i.key,i.value),e[r]-=i.length,e[c].delete(i.key),e[l].removeNode(t)}};class g{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let s=r.value;f(e,s)&&(v(e,r),e[n]||(s=void 0)),s&&t.call(i,s.value,s.key,e)};return qr=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const r=e.length||h;if(this[i]="function"!=typeof r?h:r,this[n]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[s]=e.maxAge||0,this[a]=e.dispose,this[o]=e.noDisposeOnSet||!1,this[u]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[n]=!!e}get allowStale(){return this[n]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[s]=e,p(this)}get maxAge(){return this[s]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[i]&&(this[i]=e,this[r]=0,this[l].forEach((e=>{e.length=this[i](e.value,e.key),this[r]+=e.length}))),p(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let r=this[l].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[l].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[l].toArray().map((e=>e.key))}values(){return this[l].toArray().map((e=>e.value))}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach((e=>this[a](e.key,e.value))),this[c]=new Map,this[l]=new e,this[r]=0}dump(){return this[l].map((e=>!f(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[l]}set(e,n,u){if((u=u||this[s])&&"number"!=typeof u)throw new TypeError("maxAge must be a number");const h=u?Date.now():0,d=this[i](n,e);if(this[c].has(e)){if(d>this[t])return v(this,this[c].get(e)),!1;const i=this[c].get(e).value;return this[a]&&(this[o]||this[a](e,i.value)),i.now=h,i.maxAge=u,i.value=n,this[r]+=d-i.length,i.length=d,this.get(e),p(this),!0}const f=new g(e,n,d,h,u);return f.length>this[t]?(this[a]&&this[a](e,n),!1):(this[r]+=f.length,this[l].unshift(f),this[c].set(e,this[l].head),p(this),!0)}has(e){if(!this[c].has(e))return!1;const t=this[c].get(e).value;return!f(this,t)}get(e){return d(this,e,!0)}peek(e){return d(this,e,!1)}pop(){const e=this[l].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[c].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[c].forEach(((e,t)=>d(this,t,!1)))}},qr}(),r=new t({max:1e3}),i=Pt,n=ti(),s=Rt,a=zt,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:h}=Dt,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=Ot,p=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every((e=>n.intersects(e,t))),n=i.pop();return r},_=(e,t)=>(s("comp",e,t),e=E(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=S(e,t),s("xrange",e),e=x(e,t),s("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,m=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const r=t.loose?o[l.TILDELOOSE]:o[l.TILDE];return e.replace(r,((t,r,i,n,a)=>{let o;return s("tilde",e,t,r,i,n,a),y(r)?o="":y(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:y(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:a?(s("replaceTilde pr",a),o=`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,s("tilde return",o),o}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{s("caret",e,t);const r=t.loose?o[l.CARETLOOSE]:o[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,a,o)=>{let l;return s("caret",e,t,r,n,a,o),y(r)?l="":y(n)?l=`>=${r}.0.0${i} <${+r+1}.0.0-0`:y(a)?l="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(s("replaceCaret pr",o),l="0"===r?"0"===n?`>=${r}.${n}.${a}-${o} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a}-${o} <${+r+1}.0.0-0`):(s("no pr"),l="0"===r?"0"===n?`>=${r}.${n}.${a}${i} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a} <${+r+1}.0.0-0`),s("caret return",l),l}))},S=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>k(e,t))).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[l.XRANGELOOSE]:o[l.XRANGE];return e.replace(r,((r,i,n,a,o,l)=>{s("xRange",e,r,i,n,a,o,l);const c=y(n),u=c||y(a),h=u||y(o),d=h;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(u&&(a=0),o=0,">"===i?(i=">=",u?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",u?n=+n+1:a=+a+1),"<"===i&&(l="-0"),r=`${i+n}.${a}.${o}${l}`):u?r=`>=${n}.0.0${l} <${+n+1}.0.0-0`:h&&(r=`>=${n}.${a}.0${l} <${n}.${+a+1}.0-0`),s("xRange return",r),r}))},x=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[l.STAR],"")),O=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),R=e=>(t,r,i,n,s,a,o,l,c,u,h,d,f)=>`${r=y(i)?"":y(n)?`>=${i}.0.0${e?"-0":""}`:y(s)?`>=${i}.${n}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=y(c)?"":y(u)?`<${+c+1}.0.0-0`:y(h)?`<${c}.${+u+1}.0-0`:d?`<=${c}.${u}.${h}-${d}`:e?`<${c}.${u}.${+h+1}-0`:`<=${l}`}`.trim(),D=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(s(e[r].semver),e[r].semver!==n.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return Gr}function ti(){if(Yr)return Jr;Yr=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(i,n){if(n=r(n),i instanceof t){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),a("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?i[n.COMPARATORLOOSE]:i[n.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new o(s[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new o(t,this.options)}catch(e){return!1}return s(t,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,i).test(this.value):""===e.operator?""===e.value||new l(this.value,i).test(e.semver):(!(i=r(i)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(s(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(s(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Jr=t;const r=Pt,{safeRe:i,t:n}=Dt,s=Fr,a=Rt,o=zt,l=ei();return Jr}const ri=ei();var ii=(e,t,r)=>{try{t=new ri(t,r)}catch(e){return!1}return t.test(e)};const ni=ei();var si=(e,t)=>new ni(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const ai=zt,oi=ei();var li=(e,t,r)=>{let i=null,n=null,s=null;try{s=new oi(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&-1!==n.compare(e)||(i=e,n=new ai(i,r)))})),i};const ci=zt,ui=ei();var hi=(e,t,r)=>{let i=null,n=null,s=null;try{s=new ui(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new ci(i,r)))})),i};const di=zt,fi=ei(),pi=br;var vi=(e,t)=>{e=new fi(e,t);let r=new di("0.0.0");if(e.test(r))return r;if(r=new di("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let n=null;i.forEach((e=>{const t=new di(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!pi(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!n||r&&!pi(r,n)||(r=n)}return r&&e.test(r)?r:null};const gi=ei();var _i=(e,t)=>{try{return new gi(e,t).range||"*"}catch(e){return null}};const yi=zt,mi=ti(),{ANY:bi}=mi,Ei=ei(),wi=ii,Si=br,ki=wr,xi=Ar,Oi=Dr;var Ri=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new yi(e,i),t=new Ei(t,i),r){case">":n=Si,s=xi,a=ki,o=">",l=">=";break;case"<":n=ki,s=Oi,a=Si,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(wi(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,h=null;if(c.forEach((e=>{e.semver===bi&&(e=new mi(">=0.0.0")),u=u||e,h=h||e,n(e.semver,u.semver,i)?u=e:a(e.semver,h.semver,i)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&s(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0};const Di=Ri;var Ii=(e,t,r)=>Di(e,t,">",r);const Ai=Ri;var Pi=(e,t,r)=>Ai(e,t,"<",r);const Ti=ei();var Mi=(e,t,r)=>(e=new Ti(e,r),t=new Ti(t,r),e.intersects(t,r));const Ci=ii,Ni=lr;const ji=ei(),Fi=ti(),{ANY:$i}=Fi,Li=ii,Bi=lr,Vi=[new Fi(">=0.0.0-0")],zi=[new Fi(">=0.0.0")],Hi=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===$i){if(1===t.length&&t[0].semver===$i)return!0;e=r.includePrerelease?Vi:zi}if(1===t.length&&t[0].semver===$i){if(r.includePrerelease)return!0;t=zi}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=Ki(n,t,r):"<"===t.operator||"<="===t.operator?s=Ui(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=Bi(n.semver,s.semver,r),a>0)return null;if(0===a&&(">="!==n.operator||"<="!==s.operator))return null}for(const e of i){if(n&&!Li(e,String(n),r))return null;if(s&&!Li(e,String(s),r))return null;for(const i of t)if(!Li(e,String(i),r))return!1;return!0}let h=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,d=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;h&&1===h.prerelease.length&&"<"===s.operator&&0===h.prerelease[0]&&(h=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),">"===e.operator||">="===e.operator){if(o=Ki(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!Li(n.semver,String(e),r))return!1;if(s)if(h&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===h.major&&e.semver.minor===h.minor&&e.semver.patch===h.patch&&(h=!1),"<"===e.operator||"<="===e.operator){if(l=Ui(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!Li(s.semver,String(e),r))return!1;if(!e.operator&&(s||n)&&0!==a)return!1}return!(n&&c&&!s&&0!==a)&&(!(s&&u&&!n&&0!==a)&&(!d&&!h))},Ki=(e,t,r)=>{if(!e)return t;const i=Bi(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},Ui=(e,t,r)=>{if(!e)return t;const i=Bi(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var qi=(e,t,r={})=>{if(e===t)return!0;e=new ji(e,r),t=new ji(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=Hi(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const Wi=Dt,Gi=Ot,Xi=zt,Ji=Ct,Yi=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort(((e,t)=>Ni(e,t,r)));for(const e of a){Ci(e,t,r)?(s=e,n||(n=e)):(s&&i.push([n,s]),s=null,n=null)}n&&i.push([n,null]);const o=[];for(const[e,t]of i)e===t?o.push(e):t||e!==a[0]?t?e===a[0]?o.push(`<=${t}`):o.push(`${e} - ${t}`):o.push(`>=${e}`):o.push("*");const l=o.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t};var Zi={parse:Kt,valid:qt,clean:Gt,inc:Jt,diff:Zt,major:er,minor:rr,patch:nr,prerelease:ar,compare:lr,rcompare:ur,compareLoose:dr,compareBuild:pr,sort:gr,rsort:yr,gt:br,lt:wr,eq:kr,neq:Or,gte:Dr,lte:Ar,cmp:Fr,coerce:Zr,Comparator:ti(),Range:ei(),satisfies:ii,toComparators:si,maxSatisfying:li,minSatisfying:hi,minVersion:vi,validRange:_i,outside:Ri,gtr:Ii,ltr:Pi,intersects:Mi,simplifyRange:Yi,subset:qi,SemVer:Xi,re:Wi.re,src:Wi.src,tokens:Wi.t,SEMVER_SPEC_VERSION:Gi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Gi.RELEASE_TYPES,compareIdentifiers:Ji.compareIdentifiers,rcompareIdentifiers:Ji.rcompareIdentifiers};Object.defineProperty(kt,"__esModule",{value:!0});const Qi=Zi,en=a,tn=/^\d+(\.\d+)?(\.\d+)?/;function rn(e){if(en.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,Qi.parse)(e);if(t)return t;const r=tn.exec(e);if(r){let t=r[0];for(let e=1;e<r.length;e+=1)void 0===r[e]&&(t+=".0");return t+=e.substring(r[0].length),(0,Qi.parse)(t)}}return null}function nn(e){return(t,r)=>{const i=rn(t),n=rn(r);return!!(i&&n&&e(i,n))}}function sn(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function an(e){return"number"==typeof e?e:Date.parse(e)}const on={in:(e,t)=>e===t,endsWith:sn(((e,t)=>e.endsWith(t)),en.TypeValidators.String),startsWith:sn(((e,t)=>e.startsWith(t)),en.TypeValidators.String),matches:sn(((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e)),en.TypeValidators.String),contains:sn(((e,t)=>e.indexOf(t)>-1),en.TypeValidators.String),lessThan:sn(((e,t)=>e<t),en.TypeValidators.Number),lessThanOrEqual:sn(((e,t)=>e<=t),en.TypeValidators.Number),greaterThan:sn(((e,t)=>e>t),en.TypeValidators.Number),greaterThanOrEqual:sn(((e,t)=>e>=t),en.TypeValidators.Number),before:sn(((e,t)=>e<t),en.TypeValidators.Date,an),after:sn(((e,t)=>e>t),en.TypeValidators.Date,an),semVerEqual:nn(((e,t)=>0===e.compare(t))),semVerLessThan:nn(((e,t)=>e.compare(t)<0)),semVerGreaterThan:nn(((e,t)=>e.compare(t)>0))};kt.default=class{static is(e){return Object.prototype.hasOwnProperty.call(on,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=on[e])||void 0===i?void 0:i.call(on,t,r))&&void 0!==n&&n}},Object.defineProperty(St,"__esModule",{value:!0}),St.maybeNegate=void 0;const ln=kt;function cn(e,t){return e.negate?!t:t}function un(e,t,r){return r.some((r=>ln.default.execute(e,t,r)))}St.maybeNegate=cn,St.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?cn(e,r.some((t=>un(e.op,t,e.values)))):cn(e,un(e.op,r,e.values)))};var hn={};function dn(e,t,r,i){if(t)for(let r=0;r<t.length;r+=1){const i=t[r],n=e.key(i.contextKind);if(n)if(i.generated_valuesSet){if(i.generated_valuesSet.has(n))return!0}else if(i.values.includes(n))return!0}if(i){const t=e.key("user");if(t&&i.has(t))return!0}else if(r){const t=e.key("user");if(t&&r.includes(t))return!0}return!1}Object.defineProperty(hn,"__esModule",{value:!0}),hn.default=function(e,t){if(dn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=dn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(lt,"__esModule",{value:!0});const fn=a,pn=ct,vn=tt,gn=it,_n=ut,yn=wt,mn=St,bn=hn,En=nt,wn=ht,{ErrorKinds:Sn}=fn.internal,kn={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function xn(e){return void 0!==e&&kn[e]||0}function On(e,t){return void 0!==e&&xn(e)>xn(t)?e:t}function Rn(e){return{error:!1,isMatch:e,result:void 0}}function Dn(e){return{error:!0,isMatch:!1,result:e}}lt.default=class{constructor(e,t){this._queries=t,this._bucketer=new pn.default(e.crypto)}async evaluate(e,t,r){return new Promise((i=>{this.evaluateCb(e,t,i,r)}))}evaluateCb(e,t,r,i){const n={};this._evaluateInternal(e,t,n,[],(e=>{n.bigSegmentsStatus&&(e.detail.reason=Object.assign(Object.assign({},e.detail.reason),{bigSegmentsStatus:n.bigSegmentsStatus})),n.prerequisites&&(e.prerequisites=n.prerequisites),e.events=n.events,r(e)}),!0,i)}_evaluateInternal(e,t,r,i,n,s,a){e.on?this._checkPrerequisites(e,t,r,i,(i=>{if(i)return void n(i);const s=(0,_n.default)(e,t);s?n(s):this._evaluateRules(e,t,r,(r=>{n(r||this._variationForContext(e.fallthrough,t,e,En.default.Fallthrough))}))}),s,a):n((0,wn.getOffVariation)(e,En.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,vn.allSeriesAsync)(e.prerequisites,((n,l,c)=>{if(-1!==i.indexOf(n.key))return o=gn.default.forError(Sn.MalformedFlag,`Prerequisite of ${e.key} causing a circular reference. This is probably a temporary condition due to an incomplete update.`),void c(!0);const u=[...i,n.key];this._queries.getFlag(n.key,(i=>{if(!i)return o=(0,wn.getOffVariation)(e,En.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,(l=>{var u,h;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(h=r.prerequisites)&&void 0!==h||(r.prerequisites=[]),r.prerequisites.push(i.key)),a&&r.events.push(a.evalEventServer(i,t,l.detail,null,e)),l.isError?(o=l,c(!1)):l.isOff||l.detail.variationIndex!==n.variation?(o=(0,wn.getOffVariation)(e,En.default.prerequisiteFailed(n.key)),c(!1)):c(!0)}),!1,a)}))}),(()=>{n(o)})):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,vn.firstSeriesAsync)(e.rules,((i,s,a)=>{this._ruleMatchContext(e,i,s,t,r,[],(e=>{n=e,a(!!e)}))}),(()=>i(n)))}_clauseMatchContext(e,t,r,i,n){let s;"segmentMatch"!==e.op?e.attributeReference.isValid?n(Rn((0,mn.default)(e,t))):n(Dn(gn.default.forError(Sn.MalformedFlag,"Invalid attribute reference in clause"))):(0,vn.firstSeriesAsync)(e.values,((e,n,a)=>{this._queries.getSegment(e,(e=>{if(e){if(r.includes(e.key))return s=gn.default.forError(Sn.MalformedFlag,`Segment rule referencing segment ${e.key} caused a circular reference. This is probably a temporary condition due to an incomplete update`),void a(!0);const n=[...r,null==e?void 0:e.key];this.segmentMatchContext(e,t,i,n,(e=>{e.error&&(s=e.result),a(e.error||e.isMatch)}))}else a(!1)}))}),(t=>n(s?Dn(s):Rn((0,mn.maybeNegate)(e,t)))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,vn.allSeriesAsync)(t.clauses,((e,t,r)=>{this._clauseMatchContext(e,i,s,n,(e=>(o=e.result,r(e.error||e.isMatch))))}),(n=>a(o||(n?this._variationForContext(t,i,e,En.default.ruleMatch(t.id,r)):void 0))))}_variationForContext(e,t,r,i){if(void 0===e)return gn.default.forError(Sn.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,wn.getVariation)(r,e.variation,i);if(e.rollout){const{rollout:n}=e,{variations:s}=n,a="experiment"===n.kind;if(s&&s.length){const e=(0,wn.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return gn.default.forError(Sn.MalformedFlag,"Invalid attribute reference for bucketBy in rollout");const[o,l]=this._bucketer.bucket(t,r.key,e,r.salt||"",n.contextKind,n.seed),c=Object.assign({},i);let u=0;for(let e=0;e<s.length;e+=1){const t=s[e];if(u+=t.weight/1e5,o<u)return a&&l&&!t.untracked&&(c.inExperiment=!0),(0,wn.getVariation)(r,t.variation,c)}const h=s[s.length-1];return a&&!h.untracked&&(c.inExperiment=!0),(0,wn.getVariation)(r,h.variation,c)}}return gn.default.forError(Sn.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,vn.allSeriesAsync)(t.clauses,((e,t,s)=>{this._clauseMatchContext(e,r,n,i,(e=>{a=e.result,s(e.error||e.isMatch)}))}),(i=>{if(a)return s(Dn(a));if(i){if(void 0===t.weight)return s(Rn(i));const n=(0,wn.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(Dn(gn.default.forError(Sn.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(Rn(a<t.weight/1e5))}return s(Rn(!1))}))}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,bn.default)(e,t);if(void 0!==r)return void n(Rn(r))}let s;(0,vn.firstSeriesAsync)(e.rules,((n,a,o)=>{this.segmentRuleMatchContext(e,n,t,r,i,(e=>(s=e.result,o(e.error||e.isMatch))))}),(e=>n(s?Dn(s):Rn(e))))}segmentMatchContext(e,t,r,i,n){if(!e.unbounded)return void this.simpleSegmentMatchContext(e,t,r,i,n);const s=e.unboundedContextKind||"user",a=t.key(s);if(a)return e.generation?void(r.bigSegmentsMembership&&r.bigSegmentsMembership[a]?this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n):this._queries.getBigSegmentsMembership(a).then((i=>{if(r.bigSegmentsMembership=r.bigSegmentsMembership||{},i){const[e,t]=i;r.bigSegmentsMembership[a]=e,r.bigSegmentsStatus=On(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=On(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)}))):(r.bigSegmentsStatus=On(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(Rn(!1)));n(Rn(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,yn.default)(t),s=null==e?void 0:e[n];return new Promise((e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(Rn(s))}))}};var In={};Object.defineProperty(In,"__esModule",{value:!0});const An=W;In.default=class{constructor(e){this._contextKeysCache=new An.default({max:e.contextKeysCapacity}),this.flushInterval=e.contextKeysFlushInterval}processContext(e){const{canonicalKey:t}=e,r=this._contextKeysCache.get(t);return this._contextKeysCache.set(t,!0),!r}flush(){this._contextKeysCache.clear()}};var Pn={},Tn={};Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.default=function(e,t){if(t){if(t.inExperiment)return!0;switch(t.kind){case"RULE_MATCH":{const r=t.ruleIndex;if(void 0!==r){const t=e.rules||[];return r>=0&&r<t.length&&!!t[r].trackEvents}break}case"FALLTHROUGH":return!!e.trackEventsFallthrough}}return!1},Object.defineProperty(Pn,"__esModule",{value:!0});const Mn=a,Cn=Tn;class Nn extends Mn.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,Cn.default)(e,r.reason);return super.evalEvent({addExperimentData:a,context:t,debugEventsUntilDate:e.debugEventsUntilDate,defaultVal:i,excludeFromSummaries:e.excludeFromSummaries,flagKey:e.key,prereqOfFlagKey:null==n?void 0:n.key,reason:r.reason,samplingRatio:e.samplingRatio,trackEvents:e.trackEvents||a,value:r.value,variation:null!==(s=r.variationIndex)&&void 0!==s?s:void 0,version:e.version})}}Pn.default=Nn;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.default=class{constructor(e,t){this._valid=e,this._withReasons=t,this._flagValues={},this._flagMetadata={}}addFlag(e,t,r,i,n,s,a,o){this._flagValues[e.key]=t;const l={};void 0!==r&&(l.variation=r);const c=a&&!n&&!s&&void 0===e.debugEventsUntilDate;c||(l.version=e.version),i&&(s||this._withReasons&&!c)&&(l.reason=i),n&&(l.trackEvents=!0),s&&(l.trackReason=!0),void 0!==e.debugEventsUntilDate&&(l.debugEventsUntilDate=e.debugEventsUntilDate),o&&o.length&&(l.prerequisites=o),this._flagMetadata[e.key]=l}build(){return{valid:this._valid,allValues:()=>this._flagValues,getFlagValue:e=>this._flagValues[e],getFlagReason:e=>{var t;return null!==(t=this._flagMetadata[e]?this._flagMetadata[e].reason:null)&&void 0!==t?t:null},toJSON:()=>Object.assign(Object.assign({},this._flagValues),{$flagsState:this._flagMetadata,$valid:this._valid})}}};var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const $n="unknown hook";Fn.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,(async()=>({detail:await n()}))).then((({detail:e})=>e))}async withEvaluationSeriesExtraDetail(e,t,r,i,n){if(0===this._hooks.length)return n();const{hooks:s,hookContext:a}=this._prepareHooks(e,t,r,i),o=this._executeBeforeEvaluation(s,a),l=await n();return this._executeAfterEvaluation(s,a,o,l.detail),l}_tryExecuteStage(e,t,r){var i;try{return r()}catch(r){return null===(i=this._logger)||void 0===i||i.error(`An error was encountered in "${e}" of the "${t}" hook: ${r}`),{}}}_hookName(e){var t,r;try{return null!==(t=null==e?void 0:e.getMetadata().name)&&void 0!==t?t:$n}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),$n}}_executeAfterEvaluation(e,t,r,i){var n;for(let s=e.length-1;s>=0;s-=1){const a=e[s],o=null!==(n=r[s])&&void 0!==n?n:{};this._tryExecuteStage("afterEvaluation",this._hookName(a),(()=>{var e,r;return null!==(r=null===(e=null==a?void 0:a.afterEvaluation)||void 0===e?void 0:e.call(a,t,o,i))&&void 0!==r?r:{}}))}}_executeBeforeEvaluation(e,t){return e.map((e=>this._tryExecuteStage("beforeEvaluation",this._hookName(e),(()=>{var r,i;return null!==(i=null===(r=null==e?void 0:e.beforeEvaluation)||void 0===r?void 0:r.call(e,t,{}))&&void 0!==i?i:{}}))))}_prepareHooks(e,t,r,i){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i}}}addHook(e){this._hooks.push(e)}};var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const Bn=a;function Vn(e){const t=e.old,r=e.new;return!(void 0!==t&&!Bn.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!Bn.TypeValidators.Boolean.is(r))}function zn(e){if(Bn.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!Bn.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!Bn.TypeValidators.Number.is(t)||void 0!==r&&!Bn.TypeValidators.Number.is(r))}(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"error"===e.key}(e)){if(!Bn.TypeValidators.Object.is(e.values))return;if(!Vn(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"consistent"===e.key}(e)){if(!Bn.TypeValidators.Boolean.is(e.value)||!Bn.TypeValidators.Number.is(e.samplingRatio))return;return{key:e.key,value:e.value,samplingRatio:e.samplingRatio}}if(function(e){return"invoked"===e.key}(e)){if(!Bn.TypeValidators.Object.is(e.values))return;if(!Vn(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}Ln.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!Bn.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!Bn.TypeValidators.Number.is(e.creationDate))return;const i={};if(Bn.TypeValidators.Object.is(e.context)){const t=Bn.Context.fromLDContext(e.context);t.valid&&(i.context=t)}else Bn.TypeValidators.Object.is(e.contextKeys)&&Object.keys(e.contextKeys).every((e=>Bn.TypeValidators.Kind.is(e)))&&Object.values(e.contextKeys).every((e=>Bn.TypeValidators.String.is(e)&&""!==e))&&(i.contextKeys=Object.assign({},e.contextKeys));if(!i.context&&!i.contextKeys)return;const n=null!==(t=e.samplingRatio)&&void 0!==t?t:1;if(!Bn.TypeValidators.Number.is(n))return;const s=function(e){if(!Bn.TypeValidators.String.is(e.key)||""===e.key)return;if(!Bn.TypeValidators.Object.is(e.reason))return;if(!Bn.TypeValidators.String.is(e.reason.kind)||""===e.reason.kind)return;const t={key:e.key,value:e.value,default:e.default,reason:{kind:e.reason.kind}},r=e.reason,i=t.reason;return Bn.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),Bn.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),Bn.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),Bn.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),Bn.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),Bn.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&Bn.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&Bn.TypeValidators.Number.is(e.version)&&(t.version=e.version),t}(e.evaluation);var a;return s?Object.assign(Object.assign({kind:e.kind,operation:e.operation,creationDate:e.creationDate},i),{measurements:(a=e.measurements,a.map(zn).filter((e=>void 0!==e))),evaluation:s,samplingRatio:n}):void 0};var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const Kn=a,Un=l;function qn(e){return!Number.isNaN(e)}Hn.default=class{constructor(e,t,r,i,n,s,a,o,l,c){this._flagKey=e,this._context=t,this._defaultStage=r,this._stage=i,this._reason=n,this._checkRatio=s,this._variation=a,this._version=o,this._samplingRatio=l,this._logger=c,this._errors={old:!1,new:!1},this._wasInvoked={old:!1,new:!1},this._consistencyCheck=Un.LDConsistencyCheck.NotChecked,this._latencyMeasurement={old:NaN,new:NaN}}op(e){this._operation=e}error(e){this._errors[e]=!0}consistency(e){var t,r;if(Kn.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?Un.LDConsistencyCheck.Consistent:Un.LDConsistencyCheck.Inconsistent}catch(e){null===(r=this._logger)||void 0===r||r.error(`Exception when executing consistency check function for migration '${this._flagKey}' the consistency check will not be included in the generated migration op event. Exception: ${e}`)}}latency(e,t){this._latencyMeasurement[e]=t}invoked(e){this._wasInvoked[e]=!0}createEvent(){var e,t,r,i,n;if(!Kn.TypeValidators.String.is(this._flagKey)||""===this._flagKey)return void(null===(e=this._logger)||void 0===e||e.error("The flag key for a migration operation must be a non-empty string."));if(!this._operation)return void(null===(t=this._logger)||void 0===t||t.error('The operation must be set using "op" before an event can be created.'));if(!Kn.Context.fromLDContext(this._context).valid)return void(null===(r=this._logger)||void 0===r||r.error("The migration was not done against a valid context and cannot generate an event."));if(!this._wasInvoked.old&&!this._wasInvoked.new)return void(null===(i=this._logger)||void 0===i||i.error('The migration invoked neither the "old" or "new" implementation andan event cannot be generated'));if(!this._measurementConsistencyCheck())return;const s=[];return this._populateInvoked(s),this._populateConsistency(s),this._populateLatency(s),this._populateErrors(s),{kind:"migration_op",operation:this._operation,creationDate:Date.now(),context:this._context,evaluation:{key:this._flagKey,value:this._stage,default:this._defaultStage,reason:this._reason,variation:this._variation,version:this._version},measurements:s,samplingRatio:null!==(n=this._samplingRatio)&&void 0!==n?n:1}}_logTag(){return`For migration ${this._operation}-${this._flagKey}:`}_latencyConsistencyMessage(e){return`Latency measurement for "${e}", but "${e}" was not invoked.`}_errorConsistencyMessage(e){return`Error occurred for "${e}", but "${e}" was not invoked.`}_consistencyCheckConsistencyMessage(e){return`Consistency check was done, but "${e}" was not invoked.Both "old" and "new" must be invoked to do a consistency check.`}_checkOriginEventConsistency(e){var t,r,i;return!!this._wasInvoked[e]||(Number.isNaN(this._latencyMeasurement[e])?this._errors[e]?(null===(r=this._logger)||void 0===r||r.error(`${this._logTag()} ${this._errorConsistencyMessage(e)}`),!1):this._consistencyCheck===Un.LDConsistencyCheck.NotChecked||(null===(i=this._logger)||void 0===i||i.error(`${this._logTag()} ${this._consistencyCheckConsistencyMessage(e)}`),!1):(null===(t=this._logger)||void 0===t||t.error(`${this._logTag()} ${this._latencyConsistencyMessage(e)}`),!1))}_measurementConsistencyCheck(){return this._checkOriginEventConsistency("old")&&this._checkOriginEventConsistency("new")}_populateInvoked(e){var t;const r={key:"invoked",values:{}};this._wasInvoked.old||this._wasInvoked.new||null===(t=this._logger)||void 0===t||t.error("Migration op completed without executing any origins (old/new)."),this._wasInvoked.old&&(r.values.old=!0),this._wasInvoked.new&&(r.values.new=!0),e.push(r)}_populateConsistency(e){var t;void 0!==this._consistencyCheck&&this._consistencyCheck!==Un.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===Un.LDConsistencyCheck.Consistent,samplingRatio:null!==(t=this._checkRatio)&&void 0!==t?t:1})}_populateErrors(e){if(this._errors.new||this._errors.old){const t={key:"error",values:{}};this._errors.new&&(t.values.new=!0),this._errors.old&&(t.values.old=!0),e.push(t)}}_populateLatency(e){const t=qn(this._latencyMeasurement.new),r=qn(this._latencyMeasurement.old);if(t||r){const i={};t&&(i.new=this._latencyMeasurement.new),r&&(i.old=this._latencyMeasurement.old),e.push({key:"latency_ms",values:i})}}},Object.defineProperty(s,"__esModule",{value:!0});const Wn=a,Gn=o,Xn=q,Jn=Y,Yn=ue,Zn=ye,Qn=qe,es=Ge,ts=Je,rs=tt,is=it,ns=lt,ss=In,as=Pn,os=Tn,ls=jn,cs=Fn,us=Ln,hs=Hn,ds=Ye,fs=Q,{ClientMessages:ps,ErrorKinds:vs,NullEventProcessor:gs}=Wn.internal;var _s;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(_s||(_s={}));s.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){var s,a,o,l,c;this._sdkKey=e,this._platform=t,this._initState=_s.Initializing,this._eventFactoryDefault=new as.default(!1),this._eventFactoryWithReasons=new as.default(!0),this._onError=i.onError,this._onFailed=i.onFailed,this._onReady=i.onReady;const{onUpdate:u,hasEventListeners:h}=i,d=new ds.default(r,n);if(this._hookRunner=new cs.default(d.logger,d.hooks||[]),!e&&!d.offline)throw new Error("You must configure the client with an SDK key");this._config=d,this._logger=d.logger;const f=(0,Wn.defaultHeaders)(e,t.info,d.tags),p=new Wn.ClientContext(e,d,t),v=d.featureStoreFactory(p),g=new Yn.default(v,h,u);!d.sendEvents||d.offline||d.diagnosticOptOut||(this._diagnosticsManager=new Wn.internal.DiagnosticsManager(e,t,(0,ts.default)(d,t,v))),!d.sendEvents||d.offline?this._eventProcessor=new gs:this._eventProcessor=new Wn.internal.EventProcessor(d,p,f,new ss.default(d),this._diagnosticsManager),this._featureStore=v;const _=new Xn.default(null===(a=null===(s=d.bigSegments)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,p),null!==(o=d.bigSegments)&&void 0!==o?o:{},d.logger,this._platform.crypto);this._bigSegmentsManager=_,this.bigSegmentStatusProviderInternal=_.statusProvider;const y={getFlag(e,t){v.get(fs.default.Features,e,(e=>t(e)))},getSegment(e,t){v.get(fs.default.Segments,e,(e=>t(e)))},getBigSegmentsMembership:e=>_.getUserMembership(e)};this._evaluator=new ns.default(this._platform,y);const m=(0,Jn.createStreamListeners)(g,this._logger,{put:()=>this._initSuccess()}),b=()=>d.stream?new es.default(p,"/all",[],m,f,this._diagnosticsManager,(e=>this._dataSourceErrorHandler(e)),this._config.streamInitialReconnectDelay):new Zn.default(d,new Qn.default(d,this._platform.requests,f),g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e)));d.offline||d.useLdd||(this._updateProcessor=null!==(c=null===(l=d.updateProcessorFactory)||void 0===l?void 0:l.call(d,p,g,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e))))&&void 0!==c?c:b()),this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===_s.Initialized}waitForInitialization(e){var t,r;return void 0===(null==e?void 0:e.timeout)&&void 0!==this._updateProcessor&&(null===(t=this._logger)||void 0===t||t.warn("The waitForInitialization function was called without a timeout specified. In a future version a default timeout will be applied.")),void 0!==(null==e?void 0:e.timeout)&&(null==e?void 0:e.timeout)>60&&void 0!==this._updateProcessor&&(null===(r=this._logger)||void 0===r||r.warn("The waitForInitialization function was called with a timeout greater than 60 seconds. We recommend a timeout of less than 60 seconds.")),this._initializedPromise?this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger):this._initState===_s.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===_s.Failed?(this._initializedPromise=Promise.reject(this._rejectionReason),this._initializedPromise):(this._initializedPromise||(this._initializedPromise=new Promise(((e,t)=>{this._initResolve=e,this._initReject=t}))),this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger))}variation(e,t,r,i){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>(null==i||i(null,e.value),e.value)))}variationDetail(e,t,r,i){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variationDetail",(()=>new Promise((n=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{n(e.detail),null==i||i(null,e.detail)}))}))))}_typedEval(e,t,r,i,n,s){return this._hookRunner.withEvaluationSeries(e,t,r,n,(()=>new Promise((n=>{this._evaluateIfPossible(e,t,r,i,(e=>{const t={value:e.detail.value,reason:e.detail.reason,variationIndex:e.detail.variationIndex};n(t)}),s)}))))}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",(e=>[Wn.TypeValidators.Boolean.is(e),Wn.TypeValidators.Boolean.getType()]))).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",(e=>[Wn.TypeValidators.Number.is(e),Wn.TypeValidators.Number.getType()]))).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",(e=>[Wn.TypeValidators.String.is(e),Wn.TypeValidators.String.getType()]))).value}jsonVariation(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))})))).then((e=>e.value))}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",(e=>[Wn.TypeValidators.Boolean.is(e),Wn.TypeValidators.Boolean.getType()]))}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",(e=>[Wn.TypeValidators.Number.is(e),Wn.TypeValidators.Number.getType()]))}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",(e=>[Wn.TypeValidators.String.is(e),Wn.TypeValidators.String.getType()]))}jsonVariationDetail(e,t,r){return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{i(e.detail)}))}))))}async _migrationVariationInternal(e,t,r){var i;const n=await new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(({detail:t},n)=>{if((0,Gn.IsMigrationStage)(t.value))i({detail:t,flag:n});else{const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:vs.WrongType};i({detail:{value:r,reason:s},flag:n})}}))})),{detail:s,flag:a}=n,o=null===(i=null==a?void 0:a.migration)||void 0===i?void 0:i.checkRatio,l=null==a?void 0:a.samplingRatio;return{detail:s,migration:{value:s.value,tracker:new hs.default(e,t,r,s.value,s.reason,o,null===s.variationIndex?void 0:s.variationIndex,null==a?void 0:a.version,l,this._logger)}}}async migrationVariation(e,t,r){return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",(()=>this._migrationVariationInternal(e,t,r)))).migration}allFlagsState(e,t,r){var i,n,s;if(this._config.offline){null===(i=this._logger)||void 0===i||i.info("allFlagsState() called in offline mode. Returning empty state.");const e=new ls.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=Wn.Context.fromLDContext(e);return a.valid?new Promise((e=>{const i=i=>this._featureStore.all(fs.default.Features,(n=>{const s=new ls.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,rs.allAsync)(Object.values(n),((e,t)=>{var r;const i=e;!o||(null===(r=i.clientSideAvailability)||void 0===r?void 0:r.usingEnvironmentId)?this._evaluator.evaluateCb(i,a,(e=>{var r;e.isError&&this._onError(new Error(`Error for feature flag "${i.key}" while evaluating all flags: ${e.message}`));const n=(0,os.default)(i,e.detail.reason);s.addFlag(i,e.detail.value,null!==(r=e.detail.variationIndex)&&void 0!==r?r:void 0,e.detail.reason,i.trackEvents||n,n,l,e.prerequisites),t(!0)})):t(!0)}),(()=>{const t=s.build();null==r||r(null,t),e(t)}))}));this.initialized()?i(!0):this._featureStore.initialized((e=>{var t,r;let n=!0;e?null===(t=this._logger)||void 0===t||t.warn("Called allFlagsState before client initialization; using last known values from data store"):(null===(r=this._logger)||void 0===r||r.warn("Called allFlagsState before client initialization. Data store not available; returning empty state"),n=!1),i(n)}))})):(null===(n=this._logger)||void 0===n||n.info(`${null!==(s=a.message)&&void 0!==s?s:"Invalid context."}. Returning empty state.`),Promise.resolve(new ls.default(!1,!1).build()))}secureModeHash(e){const t=Wn.Context.fromLDContext(e),r=t.valid?t.canonicalKey:void 0;if(!this._platform.crypto.createHmac)throw new Error("Platform must implement createHmac");const i=this._platform.crypto.createHmac("sha256",this._sdkKey);if(void 0===r)throw new Wn.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=Wn.Context.fromLDContext(t);a.valid?(void 0===i||Wn.TypeValidators.Number.is(i)||null===(s=this._logger)||void 0===s||s.warn(ps.invalidMetricValue(typeof i)),this._eventProcessor.sendEvent(this._eventFactoryDefault.customEvent(e,a,r,i))):null===(n=this._logger)||void 0===n||n.warn(ps.MissingContextKeyNoEvent)}trackMigration(e){const t=(0,us.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=Wn.Context.fromLDContext(e);r.valid?this._eventProcessor.sendEvent(this._eventFactoryDefault.identifyEvent(r)):null===(t=this._logger)||void 0===t||t.warn(ps.MissingContextKeyNoEvent)}async flush(e){try{await this._eventProcessor.flush()}catch(t){return null==e?void 0:e(t,!1)}return null==e?void 0:e(null,!0)}addHook(e){this._hookRunner.addHook(e)}_variationInternal(e,t,r,i,n,s){var a,o;if(this._config.offline)return null===(a=this._logger)||void 0===a||a.info("Variation called in offline mode. Returning default value."),void n(is.default.forError(vs.ClientNotReady,void 0,r));const l=Wn.Context.fromLDContext(t);if(!l.valid)return this._onError(new Wn.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(is.default.forError(vs.UserNotSpecified,void 0,r));this._featureStore.get(fs.default.Features,e,(t=>{const a=t;if(!a){const t=new Wn.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=is.default.forError(vs.FlagNotFound,void 0,r);return this._eventProcessor.sendEvent(this._eventFactoryDefault.unknownFlagEvent(e,r,l)),void n(i)}this._evaluator.evaluateCb(a,l,(t=>{var o;if(void 0!==t.detail.variationIndex&&null!==t.detail.variationIndex||(null===(o=this._logger)||void 0===o||o.debug("Result value is null in variation"),t.setDefault(r)),s){const[o,c]=s(t.detail.value);if(!o){const t=is.default.forError(vs.WrongType,`Did not receive expected type (${c}) evaluating feature flag "${e}"`,r);return this._sendEvalEvent(t,i,a,l,r),void n(t,a)}}this._sendEvalEvent(t,i,a,l,r),n(t,a)}),i)}))}_sendEvalEvent(e,t,r,i,n){var s;null===(s=e.events)||void 0===s||s.forEach((e=>{this._eventProcessor.sendEvent(Object.assign({},e))})),this._eventProcessor.sendEvent(t.evalEventServer(r,i,e.detail,n,void 0))}_evaluateIfPossible(e,t,r,i,n,s){this.initialized()?this._variationInternal(e,t,r,i,n,s):this._featureStore.initialized((a=>{var o,l;if(a)return null===(o=this._logger)||void 0===o||o.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the 'ready' event?) - using last known values from feature store"),void this._variationInternal(e,t,r,i,n,s);null===(l=this._logger)||void 0===l||l.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the'ready' event?) - using default value"),n(is.default.forError(vs.ClientNotReady,void 0,r))}))}_dataSourceErrorHandler(e){var t;const r=401===e.code?new Error("Authentication failed. Double check your SDK key."):e;this._onError(r),this._onFailed(r),this.initialized()||(this._initState=_s.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=_s.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,Wn.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then((()=>this)),i.promise.then((()=>this))]).catch((e=>{throw e instanceof Wn.LDTimeoutError&&(null==r||r.error(e.message)),e})).finally((()=>i.cancel()))}return e}};var ys={};Object.defineProperty(ys,"__esModule",{value:!0}),ys.createMigration=ys.LDMigrationError=ys.LDMigrationSuccess=void 0;const ms=o,bs=S;ys.LDMigrationSuccess=function(e){return{success:!0,result:e}},ys.LDMigrationError=function(e){return{success:!1,error:e}};class Es{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[ms.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ms.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[ms.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[ms.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[ms.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[ms.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[ms.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[ms.LDMigrationStage.DualWrite]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ms.LDMigrationStage.Shadow]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[ms.LDMigrationStage.Live]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ms.LDMigrationStage.RampDown]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[ms.LDMigrationStage.Complete]:async e=>({authoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))})},this._config.execution?this._execution=this._config.execution:this._execution=new bs.LDConcurrentExecution,this._latencyTracking=null===(r=this._config.latencyTracking)||void 0===r||r,this._errorTracking=null===(i=this._config.errorTracking)||void 0===i||i}async read(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._readTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("read"),this._sendEvent(n.tracker),s}async write(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._writeTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("write"),this._sendEvent(n.tracker),s}_sendEvent(e){const t=e.createEvent();t&&this._client.trackMigration(t)}_trackConsistency(e,t,r){this._config.check&&t.success&&r.success&&e.tracker.consistency((()=>this._config.check(t.result,r.result)))}async _readSequentialFixed(e){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}async _readConcurrent(e){const t=this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),r=this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[i,n]=await Promise.all([t,r]);return{fromOld:i,fromNew:n}}async _readSequentialRandom(e){if(0===Math.floor(2*Math.random())){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}const t=await this._doSingleOp(e,"new",this._config.readNew.bind(this._config));return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:t}}async _doRead(e){var t;if((null===(t=this._execution)||void 0===t?void 0:t.type)===bs.LDExecution.Serial){return this._execution.ordering===bs.LDExecutionOrdering.Fixed?this._readSequentialFixed(e):this._readSequentialRandom(e)}return this._readConcurrent(e)}async _doSingleOp(e,t,r){e.tracker.invoked(t);const i=await this._trackLatency(e.tracker,t,(()=>async function(e){try{return await e()}catch(e){return{success:!1,error:e}}}((()=>r(e.payload)))));return!i.success&&this._errorTracking&&e.tracker.error(t),Object.assign({origin:t},i)}async _trackLatency(e,t,r){if(!this._latencyTracking)return r();let i,n,s;"undefined"!=typeof performance?(i=performance.now(),s=await r(),n=performance.now()):(i=Date.now(),s=await r(),n=Date.now());const a=n-i;return e.latency(t,a),s}}ys.createMigration=function(e,t){return new Es(e,t)};var ws={},Ss={},ks={},xs={};Object.defineProperty(xs,"__esModule",{value:!0});xs.default=class{constructor(e,t,r,i){this._filesystem=e,this._paths=t,this._watch=r,this._callback=i,this._watchers=[],this._fileData={},this._fileTimestamps={}}async loadAndWatch(){const e=this._paths.map((async e=>({data:await this._filesystem.readFile(e),path:e,timeStamp:await this._filesystem.getFileTimestamp(e)}))),t=await Promise.all(e);t.forEach((e=>{this._fileData[e.path]=e.data,this._fileTimestamps[e.path]=e.timeStamp})),this._callback(t),this._watch&&this._paths.forEach((e=>{const t=this._filesystem.watch(e,(async(e,t)=>{const r=await this._filesystem.getFileTimestamp(t);if(r===this._fileTimestamps[t])return;this._fileTimestamps[t]=r;const i=await this._filesystem.readFile(t);this._fileData[t]=i,this._debounceCallback()}));this._watchers.push(t)}))}close(){this._watchers.forEach((e=>e.close()))}_debounceCallback(){this._debounceHandle||(this._debounceHandle=e=>{e()})}},Object.defineProperty(ks,"__esModule",{value:!0});const Os=Z,Rs=Q,Ds=xs;ks.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new Ds.default(t,e.paths,null!==(s=e.autoUpdate)&&void 0!==s&&s,(e=>{var t,r;try{this._processFileData(e)}catch(e){null===(t=this._errorHandler)||void 0===t||t.call(this,e),null===(r=this._logger)||void 0===r||r.error(`Error processing files: ${e}`)}})),this._logger=e.logger,this._yamlParser=e.yamlParser}start(){(async()=>{var e;try{await this._fileLoader.loadAndWatch()}catch(t){null===(e=this._errorHandler)||void 0===e||e.call(this,t)}})()}stop(){this._fileLoader.close()}close(){this.stop()}_addItem(e,t){if(this._allData[e.namespace]||(this._allData[e.namespace]={}),this._allData[e.namespace][t.key])throw new Error(`found duplicate key: "${t.key}"`);this._allData[e.namespace][t.key]=t}_processFileData(e){const t=this._allData;this._allData={},e.forEach((e=>{let r;if(e.path.endsWith(".yml")||e.path.endsWith(".yaml")){if(!this._yamlParser)throw new Error(`Attempted to parse yaml file (${e.path}) without parser.`);r=this._yamlParser(e.data)}else r=JSON.parse(e.data);this._processParsedData(r,t)})),this._featureStore.init(this._allData,(()=>{this._initSuccessHandler(),this._initSuccessHandler=()=>{}}))}_processParsedData(e,t){Object.keys(e.flags||{}).forEach((t=>{(0,Os.processFlag)(e.flags[t]),this._addItem(Rs.default.Features,e.flags[t])})),Object.keys(e.flagValues||{}).forEach((r=>{var i,n;const s=null===(i=t[Rs.default.Features.namespace])||void 0===i?void 0:i[r];let{version:a}=null!=s?s:{version:1};s&&JSON.stringify(e.flagValues[r])!==JSON.stringify(null===(n=null==s?void 0:s.variations)||void 0===n?void 0:n[0])&&(a+=1);const o=function(e,t,r){return{key:e,on:!0,fallthrough:{variation:0},variations:[t],version:r}}(r,e.flagValues[r],a);(0,Os.processFlag)(o),this._addItem(Rs.default.Features,o)})),Object.keys(e.segments||{}).forEach((t=>{(0,Os.processSegment)(e.segments[t]),this._addItem(Rs.default.Segments,e.segments[t])}))}},Object.defineProperty(Ss,"__esModule",{value:!0});const Is=ks;Ss.default=class{constructor(e){this._options=e}create(e,t,r,i){const n={paths:this._options.paths,autoUpdate:this._options.autoUpdate,logger:this._options.logger||e.basicConfiguration.logger,yamlParser:this._options.yamlParser};return new Is.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var As={},Ps={},Ts={},Ms={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.variationForBoolean=e.FALSE_VARIATION_INDEX=e.TRUE_VARIATION_INDEX=void 0,e.TRUE_VARIATION_INDEX=0,e.FALSE_VARIATION_INDEX=1,e.variationForBoolean=function(t){return t?e.TRUE_VARIATION_INDEX:e.FALSE_VARIATION_INDEX}}(Ms);var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});const Ns=a,js=Ms;class Fs{constructor(e,t,r){this._flagBuilder=e,this._clauses=[],t&&(this._clauses=[...t]),void 0!==r&&(this._variation=r)}andMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Ns.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Ns.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return Ns.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,js.variationForBoolean)(e))):(this._variation=e,this._flagBuilder.addRule(this),this._flagBuilder)}build(e){return{id:`rule${e}`,variation:this._variation,clauses:this._clauses}}clone(){return new Fs(this._flagBuilder,this._clauses,this._variation)}}Cs.default=Fs,Object.defineProperty(Ts,"__esModule",{value:!0});const $s=a,Ls=Ms,Bs=Cs;class Vs{constructor(e,t){this._key=e,this._data={on:!0,variations:[]},t&&(this._data={on:t.on,variations:[...t.variations]},void 0!==t.offVariation&&(this._data.offVariation=t.offVariation),void 0!==t.fallthroughVariation&&(this._data.fallthroughVariation=t.fallthroughVariation),t.targetsByVariation&&(this._data.targetsByVariation=JSON.parse(JSON.stringify(t.targetsByVariation))),t.rules&&(this._data.rules=[],t.rules.forEach((e=>{var t;null===(t=this._data.rules)||void 0===t||t.push(e.clone())}))))}get _isBooleanFlag(){return 2===this._data.variations.length&&!0===this._data.variations[Ls.TRUE_VARIATION_INDEX]&&!1===this._data.variations[Ls.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(Ls.TRUE_VARIATION_INDEX).offVariation(Ls.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return $s.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,Ls.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return $s.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,Ls.variationForBoolean)(e)):(this._data.offVariation=e,this)}variationForAll(e){return this.on(!0).clearRules().clearAllTargets().fallthroughVariation(e)}valueForAll(e){return this.variations(e).variationForAll(0)}variationForUser(e,t){return this.variationForContext("user",e,t)}variationForContext(e,t,r){return $s.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,Ls.variationForBoolean)(r)):(this._data.targetsByVariation||(this._data.targetsByVariation={}),this._data.variations.forEach(((i,n)=>{if(n===r){const r=this._data.targetsByVariation[n]||{};e in r||(r[e]=[]);-1!==r[e].indexOf(t)||r[e].push(t),this._data.targetsByVariation[n]=r}else{const r=this._data.targetsByVariation[n];if(r){const i=r[e];if(i){const n=i.indexOf(t);-1!==n&&(i.splice(n,1),i.length||delete r[e])}Object.keys(r).length||delete this._data.targetsByVariation[n]}}})),this)}clearRules(){return delete this._data.rules,this}clearAllTargets(){return delete this._data.targetsByVariation,this}ifMatch(e,t,...r){return new Bs.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new Bs.default(this).andNotMatch(e,t,...r)}checkRatio(e){var t;return this._data.migration=null!==(t=this._data.migration)&&void 0!==t?t:{},this._data.migration.checkRatio=e,this}samplingRatio(e){return this._data.samplingRatio=e,this}addRule(e){this._data.rules||(this._data.rules=[]),this._data.rules.push(e)}build(e){const t={key:this._key,version:e,on:this._data.on,offVariation:this._data.offVariation,fallthrough:{variation:this._data.fallthroughVariation},variations:[...this._data.variations],migration:this._data.migration,samplingRatio:this._data.samplingRatio};if(this._data.targetsByVariation){const e=[],r=[];Object.entries(this._data.targetsByVariation).forEach((([t,i])=>{Object.entries(i).forEach((([i,n])=>{const s=parseInt(t,10);e.push({contextKind:i,values:"user"===i?[]:n,variation:s}),"user"===i&&r.push({values:n,variation:s})}))})),t.targets=r,t.contextTargets=e}return this._data.rules&&(t.rules=this._data.rules.map(((e,t)=>e.build(String(t))))),t}clone(){return new Vs(this._key,this._data)}getKey(){return this._key}}Ts.default=Vs;var zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.default=class{constructor(e,t,r,i,n){this._featureStore=e,this._onStop=i,this._listeners=n,this._flags=Object.assign({},t),this._segments=Object.assign({},r)}async start(){this._listeners.forEach((({processJson:e})=>{e({data:{flags:this._flags,segments:this._segments}})}))}stop(){this._onStop(this)}close(){this.stop()}async upsert(e,t){return this._featureStore.upsert(e,t)}},Object.defineProperty(Ps,"__esModule",{value:!0});const Hs=Y,Ks=be,Us=Z,qs=Q,Ws=Ts,Gs=zs;Ps.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Hs.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new Gs.default(new Ks.default(t),this._currentFlags,this._currentSegments,(e=>{this._dataSources.splice(this._dataSources.indexOf(e))}),n);return this._dataSources.push(s),s}}flag(e){return this._flagBuilders[e]?this._flagBuilders[e].clone():new Ws.default(e).booleanFlag()}update(e){const t=e.getKey(),r=this._currentFlags[t],i=r?r.version:0,n=e.build(i+1);return this._currentFlags[t]=n,this._flagBuilders[t]=e.clone(),Promise.all(this._dataSources.map((e=>e.upsert(qs.default.Features,n))))}usePreconfiguredFlag(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentFlags[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Us.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(qs.default.Features,i))))}usePreconfiguredSegment(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentSegments[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,Us.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(qs.default.Segments,i))))}},Object.defineProperty(As,"__esModule",{value:!0}),As.TestDataRuleBuilder=As.TestDataFlagBuilder=As.TestData=void 0;const Xs=Ps;As.TestData=Xs.default;const Js=Ts;As.TestDataFlagBuilder=Js.default;const Ys=Cs;As.TestDataRuleBuilder=Ys.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.FileDataSourceFactory=void 0;const n=Ss;e.FileDataSourceFactory=n.default,i(As,e),i(I,e)}(ws);var Zs={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.default=class{constructor(e,t){this.handlers={},this.closed=!1,this.url=e,this.options=t}addEventListener(e,t){this.handlers[e]=t}close(){this.closed=!0}simulateError(e){this.options.errorFilter(e)||(this.closed=!0)}},Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.NullEventSource=void 0;const ea=Qs;Zs.NullEventSource=ea.default;var ta={};Object.defineProperty(ta,"__esModule",{value:!0}),ta.TtlCache=void 0;const ra=ke;ta.TtlCache=ra.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMigration=e.LDMigrationSuccess=e.LDMigrationError=e.BigSegmentStoreStatusProviderImpl=e.LDClientImpl=e.internalServer=e.platform=e.integrations=void 0;const l=n;e.BigSegmentStoreStatusProviderImpl=l.default;const c=s;e.LDClientImpl=c.default;const u=ys;Object.defineProperty(e,"createMigration",{enumerable:!0,get:function(){return u.createMigration}}),Object.defineProperty(e,"LDMigrationError",{enumerable:!0,get:function(){return u.LDMigrationError}}),Object.defineProperty(e,"LDMigrationSuccess",{enumerable:!0,get:function(){return u.LDMigrationSuccess}}),e.integrations=ws,e.platform=a,i(o,e),i(me,e),i(Zs,e),i(a,e),e.internalServer=ta}(i);var ia={},na={},sa={};Object.defineProperty(sa,"__esModule",{value:!0}),sa.createCallbacks=void 0;sa.createCallbacks=e=>({onError:t=>{var r;null===(r=null==e?void 0:e.error)||void 0===r||r.call(e,t.message)},onFailed:e=>{},onReady:()=>{},onUpdate:e=>{},hasEventListeners:()=>!1});var aa={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createOptions=e.defaultOptions=void 0;const t=i;e.defaultOptions={stream:!1,sendEvents:!1,useLdd:!0,diagnosticOptOut:!0,logger:t.BasicLogger.get()};e.createOptions=t=>{var r;const i=Object.assign(Object.assign({},e.defaultOptions),t);return null===(r=i.logger)||void 0===r||r.debug(`Using LD options: ${JSON.stringify(i)}`),i}}(aa);var oa={},la=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(oa,"__esModule",{value:!0}),oa.validateOptions=void 0;oa.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=la(t,["featureStore","logger","sendEvents"]);if(!e)throw new Error("You must configure the client with a client key");if(!r||"object"!=typeof r||!r.get)throw new Error("You must configure the client with a feature store");if(!i)throw new Error("You must configure the client with a logger");if("{}"!==JSON.stringify(s))throw new Error(`Invalid configuration: ${Object.keys(s).toString()} not supported`);return!0},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(sa,e),i(aa,e),i(oa,e)}(na),Object.defineProperty(ia,"__esModule",{value:!0});const ca=i,ua=na;ia.default=class extends ca.LDClientImpl{constructor(e,t,r){const i=(0,ua.createOptions)(r);super(e,t,i,(0,ua.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var ha={},da={};Object.defineProperty(da,"__esModule",{value:!0});da.default=class{constructor(e){this._cacheTtlMs=e}get(){if(!(this._cacheTtlMs<0)&&void 0!==this._cache)return 0===this._cacheTtlMs||Date.now()<this._cache.expiration?this._cache.value:void(this._cache=void 0)}set(e){this._cache={value:e,expiration:Date.now()+this._cacheTtlMs}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeFeatureStore=e.buildRootKey=void 0;const t=i,r=da;e.buildRootKey=e=>`LD-Env-${e}`;e.EdgeFeatureStore=class{constructor(i,n,s,a,o){this._edgeProvider=i,this._sdkKey=n,this._description=s,this._logger=a,this.close=t.noop,this.delete=t.noop,this.upsert=t.noop,this._rootKey=(0,e.buildRootKey)(this._sdkKey),this._cache=new r.default(o)}async get(e,t,r){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting ${t} from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags[t]);break;case"segments":r(e.segments[t]);break;default:r(null)}}catch(e){this._logger.error(e),r(null)}}async all(e,r=t.noop){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting all from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags);break;case"segments":r(e.segments);break;default:throw new Error(`Unsupported DataKind: ${i}`)}}catch(e){this._logger.error(e),r({})}}async _getStorePayload(){let e=this._cache.get();if(void 0!==e)return e;const r=await this._edgeProvider.get(this._rootKey);if(!r)throw new Error(`${this._rootKey} is not found in KV.`);if(e=(0,t.deserializePoll)(r),!e)throw new Error(`Error deserializing ${this._rootKey}`);return this._cache.set(e),e}async initialized(e=t.noop){const r=null!==await this._edgeProvider.get(this._rootKey);this._logger.debug(`Is ${this._rootKey} initialized? ${r}`),e(r)}init(e,t){t()}getDescription(){return this._description}}}(ha);var fa={},pa={},va={},ga={exports:{}};var _a,ya={exports:{}};function ma(){return _a||(_a=1,ya.exports=function(){var e=e||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=require("crypto")}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},l=o.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var a=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o<n;o+=4)t[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},h=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(r,t)}},f=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,u=e.min(4*l,s);if(l){for(var h=0;h<l;h+=a)this._doProcessBlock(n,h);r=n.splice(0,l),i.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=a.algo={};return a}(Math);return e}()),ya.exports}var ba,Ea={exports:{}};function wa(){return ba?Ea.exports:(ba=1,Ea.exports=function(e){return i=(r=e).lib,n=i.Base,s=i.WordArray,(a=r.x64={}).Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),e;var t,r,i,n,s,a}(ma()))}var Sa,ka={exports:{}};function xa(){return Sa||(Sa=1,ka.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,i=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,i=[],n=0;n<t;n++)i[n>>>2]|=e[n]<<24-n%4*8;r.call(this,i,t)}else r.apply(this,arguments)};i.prototype=t}}(),e.lib.WordArray}(ma())),ka.exports}var Oa,Ra={exports:{}};function Da(){return Oa?Ra.exports:(Oa=1,Ra.exports=function(e){return function(){var t=e,r=t.lib.WordArray,i=t.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return r.create(i,2*t)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s<r;s+=2){var a=n(t[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s++)i[s>>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return r.create(i,2*t)}}}(),e.enc.Utf16}(ma()))}var Ia,Aa={exports:{}},Pa=Aa.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<r;o++)n.push(i.charAt(a>>>6*(3-o)&63));var l=i.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s<r.length;s++)n[r.charCodeAt(s)]=s}var a=r.charAt(64);if(a){var o=e.indexOf(a);-1!==o&&(t=o)}return i(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(ma()),Ta={exports:{}};function Ma(){return Ia?Ta.exports:(Ia=1,Ta.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a<i;a+=3)for(var o=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l<i;l++)s.push(n.charAt(o>>>6*(3-l)&63));var c=n.charAt(64);if(c)for(;s.length%4;)s.push(c);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a<n.length;a++)s[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var l=e.indexOf(o);-1!==l&&(r=l)}return i(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(ma()))}var Ca,Na={exports:{}};function ja(){return Ca||(Ca=1,Na.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=a.MD5=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],l=e[t+1],f=e[t+2],p=e[t+3],v=e[t+4],g=e[t+5],_=e[t+6],y=e[t+7],m=e[t+8],b=e[t+9],E=e[t+10],w=e[t+11],S=e[t+12],k=e[t+13],x=e[t+14],O=e[t+15],R=s[0],D=s[1],I=s[2],A=s[3];R=c(R,D,I,A,a,7,o[0]),A=c(A,R,D,I,l,12,o[1]),I=c(I,A,R,D,f,17,o[2]),D=c(D,I,A,R,p,22,o[3]),R=c(R,D,I,A,v,7,o[4]),A=c(A,R,D,I,g,12,o[5]),I=c(I,A,R,D,_,17,o[6]),D=c(D,I,A,R,y,22,o[7]),R=c(R,D,I,A,m,7,o[8]),A=c(A,R,D,I,b,12,o[9]),I=c(I,A,R,D,E,17,o[10]),D=c(D,I,A,R,w,22,o[11]),R=c(R,D,I,A,S,7,o[12]),A=c(A,R,D,I,k,12,o[13]),I=c(I,A,R,D,x,17,o[14]),R=u(R,D=c(D,I,A,R,O,22,o[15]),I,A,l,5,o[16]),A=u(A,R,D,I,_,9,o[17]),I=u(I,A,R,D,w,14,o[18]),D=u(D,I,A,R,a,20,o[19]),R=u(R,D,I,A,g,5,o[20]),A=u(A,R,D,I,E,9,o[21]),I=u(I,A,R,D,O,14,o[22]),D=u(D,I,A,R,v,20,o[23]),R=u(R,D,I,A,b,5,o[24]),A=u(A,R,D,I,x,9,o[25]),I=u(I,A,R,D,p,14,o[26]),D=u(D,I,A,R,m,20,o[27]),R=u(R,D,I,A,k,5,o[28]),A=u(A,R,D,I,f,9,o[29]),I=u(I,A,R,D,y,14,o[30]),R=h(R,D=u(D,I,A,R,S,20,o[31]),I,A,g,4,o[32]),A=h(A,R,D,I,m,11,o[33]),I=h(I,A,R,D,w,16,o[34]),D=h(D,I,A,R,x,23,o[35]),R=h(R,D,I,A,l,4,o[36]),A=h(A,R,D,I,v,11,o[37]),I=h(I,A,R,D,y,16,o[38]),D=h(D,I,A,R,E,23,o[39]),R=h(R,D,I,A,k,4,o[40]),A=h(A,R,D,I,a,11,o[41]),I=h(I,A,R,D,p,16,o[42]),D=h(D,I,A,R,_,23,o[43]),R=h(R,D,I,A,b,4,o[44]),A=h(A,R,D,I,S,11,o[45]),I=h(I,A,R,D,O,16,o[46]),R=d(R,D=h(D,I,A,R,f,23,o[47]),I,A,a,6,o[48]),A=d(A,R,D,I,y,10,o[49]),I=d(I,A,R,D,x,15,o[50]),D=d(D,I,A,R,g,21,o[51]),R=d(R,D,I,A,S,6,o[52]),A=d(A,R,D,I,p,10,o[53]),I=d(I,A,R,D,E,15,o[54]),D=d(D,I,A,R,l,21,o[55]),R=d(R,D,I,A,m,6,o[56]),A=d(A,R,D,I,O,10,o[57]),I=d(I,A,R,D,_,15,o[58]),D=d(D,I,A,R,k,21,o[59]),R=d(R,D,I,A,v,6,o[60]),A=d(A,R,D,I,w,10,o[61]),I=d(I,A,R,D,f,15,o[62]),D=d(D,I,A,R,b,21,o[63]),s[0]=s[0]+R|0,s[1]=s[1]+D|0,s[2]=s[2]+I|0,s[3]=s[3]+A|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var s=t.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,l=o.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<<s|o>>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<<s|o>>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function d(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<<s|o>>>32-s)+t}r.MD5=s._createHelper(l),r.HmacMD5=s._createHmacHelper(l)}(Math),e.MD5}(ma())),Na.exports}var Fa,$a={exports:{}};function La(){return Fa||(Fa=1,$a.exports=function(e){return r=(t=e).lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=[],o=s.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],l=r[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var u=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=u<<1|u>>>31}var h=(i<<5|i>>>27)+l+a[c];h+=c<20?1518500249+(n&s|~n&o):c<40?1859775393+(n^s^o):c<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,l=o,o=s,s=n<<30|n>>>2,n=i,i=h}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o),e.SHA1;var t,r,i,n,s,a,o}(ma())),$a.exports}var Ba,Va={exports:{}};function za(){return Ba||(Ba=1,Va.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],l=[];!function(){function e(e){for(var r=t.sqrt(e),i=2;i<=r;i++)if(!(e%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)e(i)&&(n<8&&(o[n]=r(t.pow(i,.5))),l[n]=r(t.pow(i,1/3)),n++),i++}();var c=[],u=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],h=r[6],d=r[7],f=0;f<64;f++){if(f<16)c[f]=0|e[t+f];else{var p=c[f-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=c[f-2],_=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[f]=v+c[f-7]+_+c[f-16]}var y=i&n^i&s^n&s,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&h)+l[f]+c[f];d=h,h=u,u=o,o=a+b|0,a=s,s=n,n=i,i=b+(m+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+d|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=t.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(ma())),Va.exports}var Ha,Ka={exports:{}};var Ua,qa={exports:{}};function Wa(){return Ua||(Ua=1,qa.exports=function(e){return function(){var t=e,r=t.lib.Hasher,i=t.x64,n=i.Word,s=i.WordArray,a=t.algo;function o(){return n.create.apply(n,arguments)}var l=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=o()}();var u=a.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],h=r[6],d=r[7],f=i.high,p=i.low,v=n.high,g=n.low,_=s.high,y=s.low,m=a.high,b=a.low,E=o.high,w=o.low,S=u.high,k=u.low,x=h.high,O=h.low,R=d.high,D=d.low,I=f,A=p,P=v,T=g,M=_,C=y,N=m,j=b,F=E,$=w,L=S,B=k,V=x,z=O,H=R,K=D,U=0;U<80;U++){var q,W,G=c[U];if(U<16)W=G.high=0|e[t+2*U],q=G.low=0|e[t+2*U+1];else{var X=c[U-15],J=X.high,Y=X.low,Z=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=c[U-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=c[U-7],ae=se.high,oe=se.low,le=c[U-16],ce=le.high,ue=le.low;W=(W=(W=Z+ae+((q=Q+oe)>>>0<Q>>>0?1:0))+ie+((q+=ne)>>>0<ne>>>0?1:0))+ce+((q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=q}var he,de=F&L^~F&V,fe=$&B^~$&z,pe=I&P^I&M^P&M,ve=A&T^A&C^T&C,ge=(I>>>28|A<<4)^(I<<30|A>>>2)^(I<<25|A>>>7),_e=(A>>>28|I<<4)^(A<<30|I>>>2)^(A<<25|I>>>7),ye=(F>>>14|$<<18)^(F>>>18|$<<14)^(F<<23|$>>>9),me=($>>>14|F<<18)^($>>>18|F<<14)^($<<23|F>>>9),be=l[U],Ee=be.high,we=be.low,Se=H+ye+((he=K+me)>>>0<K>>>0?1:0),ke=_e+ve;H=V,K=z,V=L,z=B,L=F,B=$,F=N+(Se=(Se=(Se=Se+de+((he+=fe)>>>0<fe>>>0?1:0))+Ee+((he+=we)>>>0<we>>>0?1:0))+W+((he+=q)>>>0<q>>>0?1:0))+(($=j+he|0)>>>0<j>>>0?1:0)|0,N=M,j=C,M=P,C=T,P=I,T=A,I=Se+(ge+pe+(ke>>>0<_e>>>0?1:0))+((A=he+ke|0)>>>0<he>>>0?1:0)|0}p=i.low=p+A,i.high=f+I+(p>>>0<A>>>0?1:0),g=n.low=g+T,n.high=v+P+(g>>>0<T>>>0?1:0),y=s.low=y+C,s.high=_+M+(y>>>0<C>>>0?1:0),b=a.low=b+j,a.high=m+N+(b>>>0<j>>>0?1:0),w=o.low=w+$,o.high=E+F+(w>>>0<$>>>0?1:0),k=u.low=k+B,u.high=S+L+(k>>>0<B>>>0?1:0),O=h.low=O+z,h.high=x+V+(O>>>0<z>>>0?1:0),D=d.low=D+K,d.high=R+H+(D>>>0<K>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(ma(),wa())),qa.exports}var Ga,Xa={exports:{}};var Ja,Ya={exports:{}};function Za(){return Ja||(Ja=1,Ya.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.x64.Word,o=r.algo,l=[],c=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){l[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,h=0,d=0;d<7;d++){if(1&n){var f=(1<<d)-1;f<32?h^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var d=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],a=e[t+2*n+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(D=r[n]).high^=a,D.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var f=0,p=0,v=0;v<5;v++)f^=(D=r[d+5*v]).high,p^=D.low;var g=h[d];g.high=f,g.low=p}for(d=0;d<5;d++){var _=h[(d+4)%5],y=h[(d+1)%5],m=y.high,b=y.low;for(f=_.high^(m<<1|b>>>31),p=_.low^(b<<1|m>>>31),v=0;v<5;v++)(D=r[d+5*v]).high^=f,D.low^=p}for(var E=1;E<25;E++){var w=(D=r[E]).high,S=D.low,k=l[E];k<32?(f=w<<k|S>>>32-k,p=S<<k|w>>>32-k):(f=S<<k-32|w>>>64-k,p=w<<k-32|S>>>64-k);var x=h[c[E]];x.high=f,x.low=p}var O=h[0],R=r[0];for(O.high=R.high,O.low=R.low,d=0;d<5;d++)for(v=0;v<5;v++){var D=r[E=d+5*v],I=h[E],A=h[(d+1)%5+5*v],P=h[(d+2)%5+5*v];D.high=I.high^~A.high&P.high,D.low=I.low^~A.low&P.low}D=r[0];var T=u[o];D.high^=T.high,D.low^=T.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var i=8*e.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(t.ceil((i+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,l=o/8,c=[],u=0;u<l;u++){var h=a[u],d=h.high,f=h.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(d)}return new n.init(c,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(d),r.HmacSHA3=s._createHmacHelper(d)}(Math),e.SHA3}(ma(),wa())),Ya.exports}var Qa,eo={exports:{}};var to,ro={exports:{}};function io(){return to?ro.exports:(to=1,ro.exports=function(e){var t,r,i;r=(t=e).lib.Base,i=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,l=a.words,c=0;c<r;c++)o[c]^=1549556828,l[c]^=909522486;s.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(ma()))}var no,so={exports:{}};var ao,oo={exports:{}};function lo(){return ao?oo.exports:(ao=1,oo.exports=function(e){return r=(t=e).lib,i=r.Base,n=r.WordArray,s=t.algo,a=s.MD5,o=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,s=i.hasher.create(),a=n.create(),o=a.words,l=i.keySize,c=i.iterations;o.length<l;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<c;u++)r=s.finalize(r),s.reset();a.concat(r)}return a.sigBytes=4*l,a}}),t.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF;var t,r,i,n,s,a,o}(ma(),La(),io()))}var co,uo={exports:{}};function ho(){return co||(co=1,uo.exports=function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=i.BufferedBlockAlgorithm,o=r.enc;o.Utf8;var l=o.Base64,c=r.algo.EvpKDF,u=i.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?m:_}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()});i.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=r.mode={},d=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=h.CBC=function(){var e=d.extend();function r(e,r,i){var n,s=this._iv;s?(n=s,this._iv=t):n=this._prevBlock;for(var a=0;a<i;a++)e[r+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);i.decryptBlock(e,t),r.call(this,e,t,n),this._prevBlock=s}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,a=[],o=0;o<i;o+=4)a.push(n);var l=s.create(a,i);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},_=i.SerializableCipher=n.extend({cfg:n.extend({format:g}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return v.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=c.create({keySize:t+r,hasher:n}).compute(e,i);else var a=c.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:o,salt:i})}},m=i.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=_.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,_.decrypt.call(this,e,t,n.key,i)}})}()}(ma(),lo())),uo.exports}var fo,po={exports:{}};function vo(){return fo?po.exports:(fo=1,po.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a<r;a++)e[t+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n,i),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);r.call(this,e,t,n,i),this._prevBlock=s}}),t}(),e.mode.CFB}(ma(),ho()))}var go,_o={exports:{}};function yo(){return go?_o.exports:(go=1,_o.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var a=s.slice(0);r.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var o=0;o<i;o++)e[t+o]^=a[o]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(ma(),ho()))}var mo,bo={exports:{}};function Eo(){return mo?bo.exports:(mo=1,bo.exports=function(e){
|
|
1
|
+
"use strict";var e=require("crypto"),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},i={},n={};Object.defineProperty(n,"__esModule",{value:!0});n.default=class{constructor(e){this._onRequestStatus=e}getStatus(){return this._lastStatus}async requireStatus(){return this._lastStatus||await this._onRequestStatus(),this._lastStatus}notify(){var e;this._lastStatus&&(null===(e=this._listener)||void 0===e||e.call(this,this._lastStatus))}setListener(e){this._listener=e}setStatus(e){this._lastStatus=e}};var s={},a={};!function(e){function t(e){return e.indexOf("~")?e.replace(/~1/g,"/").replace(/~0/g,"~"):e}class r{constructor(e,r=!1){if(r){const t=e;this._components=[t],this.isValid=""!==t,this.redactionName=t.startsWith("/")?`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`:t}else{if(this.redactionName=e,""===e||"/"===e||e.match(/\/\/|(^\/.*~[^0|^1])|~$/))return this.isValid=!1,void(this._components=[]);!function(e){return!e.startsWith("/")}(e)?e.indexOf("/",1)<0?this._components=[t(e.slice(1))]:this._components=function(e){return(e.startsWith("/")?e.substring(1):e).split("/").map((e=>t(e)))}(e):this._components=[e],"_meta"===this._components[0]?this.isValid=!1:this.isValid=!0}}get(e){const{_components:t,isValid:r}=this;if(!r)return;let i=e;for(let e=0;e<t.length;e+=1){const r=t[e];if(null==i||!Object.prototype.hasOwnProperty.call(i,r)||"object"!=typeof i||Array.isArray(i))return;i=i[r]}return i}getComponent(e){return this._components[e]}get depth(){return this._components.length}get isKind(){return 1===this._components.length&&"kind"===this._components[0]}compare(e){return this.depth===e.depth&&this._components.every(((t,r)=>t===e.getComponent(r)))}}r.InvalidReference=new r("");class i{is(e){if(Array.isArray(e))return!1;const t=typeof e;return"function"===t||"object"===t}getType(){return"factory method or object"}}class n{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!Array.isArray(e)&&typeof e===this.typeOf}getType(){return this._typeName}}class s{constructor(e,t){this._typeName=e,this.typeOf=typeof t}is(e){return!!Array.isArray(e)&&(!(e.length>0)||e.every((e=>typeof e===this.typeOf)))}getType(){return this._typeName}}class a extends n{constructor(e){super(`number with minimum value of ${e}`,0),this.min=e}is(e){return typeof e===this.typeOf&&e>=this.min}}class o extends n{constructor(e){super(`string matching ${e}`,""),this.expression=e}is(e){return"string"==typeof e&&!!e.match(this.expression)}}class l{is(e){return"function"==typeof e}getType(){return"function"}}class c{is(e){return"boolean"==typeof e||null==e}getType(){return"boolean | undefined | null"}}const u=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/;class h{is(e){return"number"==typeof e||"string"==typeof e&&u.test(e)}getType(){return"date"}}class d extends o{constructor(){super(/^(\w|\.|-)+$/)}is(e){return super.is(e)&&"kind"!==e}}class f{static createTypeArray(e,t){return new s(e,t)}static numberWithMin(e){return new a(e)}static stringMatchingRegex(e){return new o(e)}}function p(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"!==e.kind)}function v(e){return"kind"in e&&(f.String.is(e.kind)&&"multi"===e.kind)}function _(e){return!("kind"in e)||null===e.kind||void 0===e.kind}f.String=new n("string",""),f.Number=new n("number",0),f.ObjectOrFactory=new i,f.Object=new n("object",{}),f.StringArray=new s("string[]",""),f.Boolean=new n("boolean",!0),f.Function=new l,f.Date=new h,f.Kind=new d,f.NullableBoolean=new c;const g="user";function y(e){return e.includes("%")||e.includes(":")?e.replace(/%/g,"%25").replace(/:/g,"%3A"):e}function m(e){return f.Kind.is(e)}function b(e){return f.String.is(e)&&""!==e}function E(e,t=!1){return e?e.map((e=>new r(e,t))):[]}class w{constructor(e,t,r){this._isMulti=!1,this._isUser=!1,this._wasLegacy=!1,this._contexts={},this.kind=t,this.valid=e,this.message=r}static _contextForError(e,t){return new w(!1,e,t)}static _getValueFromContext(e,t){if(t&&e.isValid)return 1===e.depth&&"anonymous"===e.getComponent(0)?!!t?.anonymous:e.get(t)}_contextForKind(e){return this._isMulti?this._contexts[e]:this.kind===e?this._context:void 0}static _fromMultiKindContext(e){const t=Object.keys(e).filter((e=>"kind"!==e)),r=t.every(m);if(!t.length)return w._contextForError("multi","A multi-kind context must contain at least one kind");if(!r)return w._contextForError("multi","Context contains invalid kinds");const i={};let n=!0;const s=t.reduce(((t,r)=>{const s=e[r];var a;return(a=s)&&f.Object.is(a)?(t[r]=s,i[r]=E(s._meta?.privateAttributes)):n=!1,t}),{});if(!n)return w._contextForError("multi","Context contained contexts that were not objects");if(!Object.values(s).every((e=>b(e.key))))return w._contextForError("multi","Context contained invalid keys");if(1===t.length){const e=t[0],r=new w(!0,e);return r._context={...s[e],kind:e},r._privateAttributeReferences=i,r._isUser="user"===e,r}const a=new w(!0,e.kind);return a._contexts=s,a._privateAttributeReferences=i,a._isMulti=!0,a}static _fromSingleKindContext(e){const{key:t,kind:r}=e,i=m(r),n=b(t);if(!i)return w._contextForError(r??"unknown","The kind was not valid for the context");if(!n)return w._contextForError(r,"The key for the context was not valid");const s=E(e._meta?.privateAttributes),a=new w(!0,r);return a._isUser="user"===r,a._context=e,a._privateAttributeReferences={[r]:s},a}static _fromLegacyUser(e){if(!(void 0!==e.key&&null!==e.key))return w._contextForError("user","The key for the context was not valid");const t=new w(!0,"user");return t._isUser=!0,t._wasLegacy=!0,t._context=function(e){const t={...e.custom||[],kind:"user",key:String(e.key)};if(null!=e.anonymous){const r=!!e.anonymous;delete t.anonymous,t.anonymous=r}return null!==e.name&&void 0!==e.name&&(t.name=e.name),null!==e.ip&&void 0!==e.ip&&(t.ip=e.ip),null!==e.firstName&&void 0!==e.firstName&&(t.firstName=e.firstName),null!==e.lastName&&void 0!==e.lastName&&(t.lastName=e.lastName),null!==e.email&&void 0!==e.email&&(t.email=e.email),null!==e.avatar&&void 0!==e.avatar&&(t.avatar=e.avatar),null!==e.country&&void 0!==e.country&&(t.country=e.country),null!==e.privateAttributeNames&&void 0!==e.privateAttributeNames&&(t._meta={privateAttributes:e.privateAttributeNames}),t}(e),t._privateAttributeReferences={user:E(e.privateAttributeNames,!0)},t}static fromLDContext(e){return e?p(e)?w._fromSingleKindContext(e):v(e)?w._fromMultiKindContext(e):_(e)?w._fromLegacyUser(e):w._contextForError("unknown","Context was not of a valid kind"):w._contextForError("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;const t=e.getContexts();if(!e._isMulti)return t[0][1];const r={kind:"multi"};return t.forEach((e=>{const t=e[0],i=e[1];r[t]=i})),r}valueForKind(e,t=g){return e.isKind?this.kinds:w._getValueFromContext(e,this._contextForKind(t))}key(e=g){return this._contextForKind(e)?.key}get isMultiKind(){return this._isMulti}get canonicalKey(){return this._isUser?this._context.key:this._isMulti?Object.keys(this._contexts).sort().map((e=>`${e}:${y(this._contexts[e].key)}`)).join(":"):`${this.kind}:${y(this._context.key)}`}get kinds(){return this._isMulti?Object.keys(this._contexts):[this.kind]}get kindsAndKeys(){return this._isMulti?Object.entries(this._contexts).reduce(((e,[t,r])=>(e[t]=r.key,e)),{}):{[this.kind]:this._context.key}}privateAttributes(e){return this._privateAttributeReferences?.[e]||[]}getContexts(){return this._isMulti?Object.entries(this._contexts):[[this.kind,this._context]]}get legacy(){return this._wasLegacy}}w.UserKind=g;const S=["key","kind","_meta","anonymous"].map((e=>new r(e,!0))),k=["name","ip","firstName","lastName","email","avatar","country"];class x{constructor(e,t){this._allAttributesPrivate=e,this._privateAttributes=t}filter(e,t=!1){const r=e.getContexts();if(1===r.length)return this._filterSingleKind(e,r[0][1],r[0][0],t);const i={kind:"multi"};return r.forEach((([r,n])=>{i[r]=this._filterSingleKind(e,n,r,t)})),i}_getAttributesToFilter(e,t,i,n){return(n?Object.keys(t).map((e=>new r(e,!0))):[...this._privateAttributes,...e.privateAttributes(i)]).filter((e=>!S.some((t=>t.compare(e)))))}_filterSingleKind(e,t,r,i){const n=this._allAttributesPrivate||i&&!0===t.anonymous,{cloned:s,excluded:a}=function(e,t){const r=[],i={},n=[];for(r.push(...Object.keys(e).map((t=>({key:t,ptr:[t],source:e,parent:i,visited:[e]}))));r.length;){const e=r.pop(),i=t.find((t=>{return r=t,i=e.ptr,r.depth===i.length&&i.every(((e,t)=>e===r.getComponent(t)));var r,i}));if(i)n.push(i.redactionName);else{const t=e.source[e.key];null===t?e.parent[e.key]=t:Array.isArray(t)?e.parent[e.key]=[...t]:"object"==typeof t?e.visited.includes(t)||(e.parent[e.key]={},r.push(...Object.keys(t).map((r=>({key:r,ptr:[...e.ptr,r],source:t,parent:e.parent[e.key],visited:[...e.visited,t]}))))):e.parent[e.key]=t}}return{cloned:i,excluded:n.sort()}}(t,this._getAttributesToFilter(e,t,r,n));return e.legacy&&k.forEach((e=>{e in s&&(s[e]=String(s[e]))})),a.length&&(s._meta||(s._meta={}),s._meta.redactedAttributes=a),s._meta&&(delete s._meta.privateAttributes,0===Object.keys(s._meta).length&&delete s._meta),s}}class O{constructor(e,t,r=Math.random){this._retryResetIntervalMillis=t,this._random=r,this._retryCount=0,this._initialRetryDelayMillis=Math.max(1,e),this._maxExponent=Math.ceil(Math.log2(3e4/this._initialRetryDelayMillis))}_backoff(){const e=Math.min(this._retryCount,this._maxExponent),t=this._initialRetryDelayMillis*2**e;return Math.min(t,3e4)}_jitter(e){return e-Math.trunc(.5*this._random()*e)}success(e=Date.now()){this._activeSince=e}fail(e=Date.now()){void 0!==this._activeSince&&e-this._activeSince>this._retryResetIntervalMillis&&(this._retryCount=0),this._activeSince=void 0;const t=this._jitter(this._backoff());return this._retryCount+=1,t}}class D{constructor(e,t){this._dataCallback=e,this._statusCallback=t,this._disabled=!1}disable(){this._disabled=!0}async dataHandler(e,t){this._disabled||this._dataCallback(e,t)}async statusHandler(e,t){this._disabled||this._statusCallback(e,t)}}var R;!function(e){e[e.Valid=0]="Valid",e[e.Initializing=1]="Initializing",e[e.Interrupted=2]="Interrupted",e[e.Closed=3]="Closed"}(R||(R={}));class I{constructor(e,t){this._list=t?[...t]:[],this._circular=e,this._pos=0}next(){if(this._list.length<=0||this._pos>=this._list.length)return;const e=this._list[this._pos];return this._circular?this._pos=(this._pos+1)%this._list.length:this._pos+=1,e}replace(e){this._list=[...e],this._pos=0}remove(e){const t=this._list.indexOf(e);return!(t<0)&&(this._list.splice(t,1),this._list.length>0&&(t<this._pos&&(this._pos-=1),this._circular&&this._pos>this._list.length-1&&(this._pos=0)),!0)}reset(){this._pos=0}pos(){return this._pos}length(){return this._list.length}clear(){this._list=[],this._pos=0}}var P,A,T,M;e.DataSourceErrorKind=void 0,(P=e.DataSourceErrorKind||(e.DataSourceErrorKind={})).Unknown="UNKNOWN",P.NetworkError="NETWORK_ERROR",P.ErrorResponse="ERROR_RESPONSE",P.InvalidData="INVALID_DATA";class C extends Error{constructor(e){super(e),this.name="LaunchDarklyFileDataSourceError"}}class N extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.status=r,this.name="LaunchDarklyPollingError",this.recoverable=i}}class F extends Error{constructor(e,t,r,i=!0){super(t),this.kind=e,this.code=r,this.name="LaunchDarklyStreamingError",this.recoverable=i}}e.AutoEnvAttributes=void 0,(A=e.AutoEnvAttributes||(e.AutoEnvAttributes={}))[A.Disabled=0]="Disabled",A[A.Enabled=1]="Enabled",function(e){e[e.AnalyticsEvents=0]="AnalyticsEvents",e[e.DiagnosticEvent=1]="DiagnosticEvent"}(T||(T={})),function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.FailedAndMustShutDown=2]="FailedAndMustShutDown"}(M||(M={}));var j=Object.freeze({__proto__:null,get DataSourceState(){return R},get LDDeliveryStatus(){return M},get LDEventType(){return T}});function $(e){if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if(Object.prototype.hasOwnProperty.call(e,"toString"))try{return e.toString()}catch{}if("bigint"==typeof e)return`${e}n`;try{return JSON.stringify(e)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}const L={s:e=>$(e),d:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(Number(e))}(e),i:e=>function(e){return"symbol"==typeof e?"NaN":"bigint"==typeof e?`${e}n`:String(parseInt(e,10))}(e),f:e=>function(e){return"symbol"==typeof e?"NaN":String(parseFloat(e))}(e),j:e=>$(e),o:e=>$(e),O:e=>$(e),c:()=>""};function B(...e){const t=e.shift();if(f.String.is(t)){let r="",i=0;for(;i<t.length;){const n=t.charAt(i);if("%"===n){if(i+1<t.length){const n=t.charAt(i+1);if(n in L&&e.length){const t=e.shift();r+=L[n]?.(t)}else r+="%"===n?"%":`%${n}`;i+=2}}else r+=n,i+=1}return e.length&&(r.length&&(r+=" "),r+=e.map($).join(" ")),r}return e.map($).join(" ")}var V;!function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error",e[e.none=4]="none"}(V||(V={}));const z=["debug","info","warn","error","none"];class H{static get(){return new H({})}constructor(e){if(this._logLevel=V[e.level??"info"]??V.info,this._name=e.name??"LaunchDarkly",this._formatter=e.formatter,"object"==typeof e.destination)this._destinations={[V.debug]:e.destination.debug,[V.info]:e.destination.info,[V.warn]:e.destination.warn,[V.error]:e.destination.error};else if("function"==typeof e.destination){const{destination:t}=e;this._destinations={[V.debug]:t,[V.info]:t,[V.warn]:t,[V.error]:t}}}_tryFormat(...e){try{return this._formatter?this._formatter?.(...e):B(...e)}catch{return B(...e)}}_tryWrite(e,t){try{e(t)}catch{console.error(t)}}_log(e,t){if(e>=this._logLevel){const r=`${z[e]}: [${this._name}]`;try{const i=this._destinations?.[e];i?this._tryWrite(i,`${r} ${this._tryFormat(...t)}`):console.error(...t)}catch{console.error(...t)}}}error(...e){this._log(V.error,e)}warn(...e){this._log(V.warn,e)}info(...e){this._log(V.info,e)}debug(...e){this._log(V.debug,e)}}const U={error:f.Function,warn:f.Function,info:f.Function,debug:f.Function};class K{constructor(e,t){Object.entries(U).forEach((([t,r])=>{if(!r.is(e[t]))throw new Error(`Provided logger instance must support logger.${t}(...) method`)})),this._logger=e,this._fallback=t}_log(e,t){try{this._logger[e](...t)}catch{this._fallback[e](...t)}}error(...e){this._log("error",e)}warn(...e){this._log("warn",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}}class q{static deprecated(e,t){return`"${e}" is deprecated, please use "${t}"`}static optionBelowMinimum(e,t,r){return`Config option "${e}" had invalid value of ${t}, using minimum of ${r} instead`}static unknownOption(e){return`Ignoring unknown config option "${e}"`}static wrongOptionType(e,t,r){return`Config option "${e}" should be of type ${t}, got ${r}, using default value`}static wrongOptionTypeBoolean(e,t){return`Config option "${e}" should be a boolean, got ${t}, converting to boolean`}static invalidTagValue(e){return`Config option "${e}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(e){return`Value of "${e}" was longer than 64 characters and was discarded.`}static partialEndpoint(e){return`You have set custom uris without specifying the ${e} URI; connections may not work properly`}}const W=f.stringMatchingRegex(/^(\w|\.|-)+$/),G=(e,t)=>W.is(e)?e.length>64?{valid:!1,message:q.tagValueTooLong(t)}:{valid:!0}:{valid:!1,message:q.invalidTagValue(t)};function X(e){return e.replace(/\/+$/,"")}function J(e){return e.replace(/^\/+/,"").replace(/\?$/,"")}class Y{constructor(e,t,r=Y.DEFAULT_EVENTS,i="/bulk",n="/diagnostic",s=!0,a){this.streaming=X(e),this.polling=X(t),this.events=X(r),this.analyticsEventPath=i,this.diagnosticEventPath=n,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}}function Z(e,t){if(0===t.length)return e;return`${e}?${t.map((({key:e,value:t})=>`${e}=${t}`)).join("&")}`}function Q(e,t,r){const i=J(t);return Z(`${e.events}/${i}`,r)}Y.DEFAULT_EVENTS="https://events.launchdarkly.com";class ee extends Error{constructor(e){super(e),this.name="LaunchDarklyUnexpectedResponseError"}}class te extends Error{constructor(e){super(e),this.name="LaunchDarklyClientError"}}class re extends Error{constructor(e){super(e),this.name="LaunchDarklyTimeoutError"}}function ie(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}function ne(e){return 413===e||ie(e)}const se=(e,t)=>e?Object.entries(e).reduce(((e,[r,i])=>(!Boolean(i)||(e=>"{}"===JSON.stringify(e))(i)||t?.includes(r)||(e[r]="object"==typeof i?se(i,t):i),e)),{}):e;function ae(e,t,r){let i;i=e.status?`error ${e.status}${401===e.status?" (invalid SDK key)":""}`:`I/O error (${e.message||"unknown error"})`;return`Received ${i} for ${t} - ${r??"giving up permanently"}`}const oe=async(e=1e3)=>new Promise((e=>{}));var le;!function(e){e.MalformedFlag="MALFORMED_FLAG",e.UserNotSpecified="USER_NOT_SPECIFIED",e.FlagNotFound="FLAG_NOT_FOUND",e.ClientNotReady="CLIENT_NOT_READY",e.WrongType="WRONG_TYPE"}(le||(le={}));var ce=le;class ue{static invalidMetricValue(e){return`The track function was called with a non-numeric "metricValue" (${e}), only numeric metric values are supported.`}}ue.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";class he{constructor(e,t){const{basicConfiguration:r,platform:i}=e,{serviceEndpoints:{analyticsEventPath:n,diagnosticEventPath:s}}=r,{crypto:a,requests:o}=i;this._defaultHeaders={...t},this._eventsUri=Q(r.serviceEndpoints,n,[]),this._diagnosticEventsUri=Q(r.serviceEndpoints,s,[]),this._requests=o,this._crypto=a}async _tryPostingEvents(e,t,r,i){const n={status:M.Succeeded},s={...this._defaultHeaders,"content-type":"application/json"};let a;r&&(s["x-launchdarkly-payload-id"]=r,s["x-launchDarkly-event-schema"]="4");try{const{status:r,headers:i}=await this._requests.fetch(t,{headers:s,body:JSON.stringify(e),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),o=Date.parse(i.get("date")||"");if(o&&(n.serverTime=o),r<=204)return n;if(a=new ee(ae({status:r,message:"some events were dropped"},"event posting")),!ie(r))return ne(r)?n.status=M.Failed:n.status=M.FailedAndMustShutDown,n.error=a,n}catch(e){a=e}return a&&!i?(n.status=M.Failed,n.error=a,n):(await oe(),this._tryPostingEvents(e,this._eventsUri,r,!1))}async sendEventData(e,t){const r=e===T.AnalyticsEvents?this._crypto.randomUUID():void 0,i=e===T.AnalyticsEvents?this._eventsUri:this._diagnosticEventsUri;return this._tryPostingEvents(t,i,r,!0)}}function de(e){return"feature"===e.kind}class fe{constructor(e,t,r,i,n,s){this.count=e,this.key=t,this.value=r,this.version=n,this.variation=s,this.default=i}increment(){this.count+=1}}class pe{constructor(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}summarizeEvent(e){if(de(e)&&!e.excludeFromSummaries){const t=function(e){return`${e.key}:${null!==e.variation&&void 0!==e.variation?e.variation:""}:${null!==e.version&&void 0!==e.version?e.version:""}`}(e),r=this._counters[t];let i=this._contextKinds[e.key];i||(i=new Set,this._contextKinds[e.key]=i),e.context.kinds.forEach((e=>i.add(e))),r?r.increment():this._counters[t]=new fe(1,e.key,e.value,e.default,e.version,e.variation),(0===this._startDate||e.creationDate<this._startDate)&&(this._startDate=e.creationDate),e.creationDate>this._endDate&&(this._endDate=e.creationDate)}}getSummary(){const e=Object.values(this._counters).reduce(((e,t)=>{let r=e[t.key];r||(r={default:t.default,counters:[],contextKinds:[...this._contextKinds[t.key]]},e[t.key]=r);const i={value:t.value,count:t.count};return void 0!==t.variation&&null!==t.variation&&(i.variation=t.variation),void 0!==t.version&&null!==t.version?i.version=t.version:i.unknown=!0,r.counters.push(i),e}),{});return{startDate:this._startDate,endDate:this._endDate,features:e,kind:"summary"}}clearSummary(){this._startDate=0,this._endDate=0,this._counters={},this._contextKinds={}}}class ve extends Error{constructor(e){super(e),this.name="LaunchDarklyInvalidSDKKeyError"}}function _e(e){const t=Math.trunc(e);return 1===t||0!==t&&0===Math.floor(Math.random()*t)}class ge{constructor(e,t,r,i,n=1,s){this.context=e,this.key=t,this.data=r,this.metricValue=i,this.samplingRatio=n,this.url=s,this.kind="custom",this.creationDate=Date.now(),this.context=e}}class ye{constructor(e,t,r,i,n,s,a,o,l,c,u,h,d=1){this.withReasons=e,this.context=t,this.key=r,this.samplingRatio=d,this.kind="feature",this.creationDate=Date.now(),this.value=i,this.default=n,void 0!==s&&(this.version=s),void 0!==a&&(this.variation=a),void 0!==o&&(this.trackEvents=o),void 0!==l&&(this.prereqOf=l),void 0!==c&&(this.reason=c),void 0!==u&&(this.debugEventsUntilDate=u),void 0!==h&&(this.excludeFromSummaries=h)}}class me{constructor(e,t=1){this.context=e,this.samplingRatio=t,this.kind="identify",this.creationDate=Date.now()}}class be{constructor(e,t,r){this._objProcessors=e,this._errorHandler=t,this._logger=r,this._listeners=[],this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[],this._processServerIntent=e=>{if(this._resetAll(),!e.payloads.length)return;const t=e.payloads[0];switch(t?.code){case"xfer-full":this._tempBasis=!0;break;case"xfer-changes":this._tempBasis=!1;break;case"none":this._tempBasis=!1,this._processIntentNone(t);break;default:return}this._tempId=t?.id},this._processPutObject=e=>{if(!(this._tempId&&e.kind&&e.key&&e.version&&e.object))return;const t=this._processObj(e.kind,e.object);t?this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,object:t}):this._logger?.warn(`Unable to process object for kind: '${e.kind}'`)},this._processDeleteObject=e=>{this._tempId&&e.kind&&e.key&&e.version&&this._tempUpdates.push({kind:e.kind,key:e.key,version:e.version,deleted:!0})},this._processIntentNone=e=>{if(!e.id||!e.target)return;const t={id:e.id,version:e.target,basis:!1,updates:[]};this._listeners.forEach((e=>e(t))),this._resetAfterEmission()},this._processPayloadTransferred=e=>{if(!this._tempId||!e.state||!e.version)return void this._resetAll();const t={id:this._tempId,version:e.version,state:e.state,basis:this._tempBasis,updates:this._tempUpdates};this._listeners.forEach((e=>e(t))),this._resetAfterEmission()},this._processGoodbye=e=>{this._logger?.info(`Goodbye was received from the LaunchDarkly connection with reason: ${e.reason}.`),this._resetAll()},this._processError=e=>{this._logger?.info(`An issue was encountered receiving updates for payload ${this._tempId} with reason: ${e.reason}.`),this._resetAfterError()}}addPayloadListener(e){this._listeners.push(e)}removePayloadListener(e){const t=this._listeners.indexOf(e,0);t>-1&&this._listeners.splice(t,1)}processEvents(e){e.forEach((e=>{switch(e.event){case"server-intent":this._processServerIntent(e.data);break;case"put-object":this._processPutObject(e.data);break;case"delete-object":this._processDeleteObject(e.data);break;case"payload-transferred":this._processPayloadTransferred(e.data);break;case"goodbye":this._processGoodbye(e.data);break;case"error":this._processError(e.data)}}))}_processObj(e,t){return this._objProcessors[e]?.(t)}_resetAfterEmission(){this._tempBasis=!1,this._tempUpdates=[]}_resetAfterError(){this._tempUpdates=[]}_resetAll(){this._tempId=void 0,this._tempBasis=!1,this._tempUpdates=[]}}const Ee="unknown plugin";function we(e,t){try{return t.getMetadata().name||Ee}catch{return e.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),Ee}}var Se=Object.freeze({__proto__:null,ClientMessages:ue,DiagnosticsManager:class{constructor(e,t,r){this._platform=t,this._diagnosticInitConfig=r,this._streamInits=[],this._startTime=Date.now(),this._dataSinceDate=this._startTime,this._id={diagnosticId:t.crypto.randomUUID(),sdkKeySuffix:e.length>6?e.substring(e.length-6):e}}createInitEvent(){const e=this._platform.info.sdkData(),t=this._platform.info.platformData();return{kind:"diagnostic-init",id:this._id,creationDate:this._startTime,sdk:e,configuration:this._diagnosticInitConfig,platform:{name:t.name,osArch:t.os?.arch,osName:t.os?.name,osVersion:t.os?.version,...t.additional||{}}}}recordStreamInit(e,t,r){const i={timestamp:e,failed:t,durationMillis:r};this._streamInits.push(i)}createStatsEventAndReset(e,t,r){const i=Date.now(),n={kind:"diagnostic",id:this._id,creationDate:i,dataSinceDate:this._dataSinceDate,droppedEvents:e,deduplicatedUsers:t,eventsInLastBatch:r,streamInits:this._streamInits};return this._streamInits=[],this._dataSinceDate=i,n}},ErrorKinds:ce,EventFactoryBase:class{constructor(e){this._withReasons=e}evalEvent(e){return new ye(this._withReasons,e.context,e.flagKey,e.value,e.defaultVal,e.version,e.variation??void 0,e.trackEvents||e.addExperimentData,e.prereqOfFlagKey,this._withReasons||e.addExperimentData?e.reason:void 0,e.debugEventsUntilDate,e.excludeFromSummaries,e.samplingRatio)}unknownFlagEvent(e,t,r){return new ye(this._withReasons,r,e,t,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(e){return new me(e,1)}customEvent(e,t,r,i,n=1){return new ge(t,e,r??void 0,i??void 0,n)}},EventProcessor:class{constructor(e,t,i,n,s,a=!0){this._config=e,this._contextDeduplicator=n,this._diagnosticsManager=s,this._summarizer=new pe,this._queue=[],this._lastKnownPastTime=0,this._droppedEvents=0,this._deduplicatedUsers=0,this._exceededCapacity=!1,this._eventsInLastBatch=0,this._shutdown=!1,this._flushUsersTimer=null,this._capacity=e.eventsCapacity,this._logger=t.basicConfiguration.logger,this._eventSender=new he(t,i),this._contextFilter=new x(e.allAttributesPrivate,e.privateAttributes.map((e=>new r(e)))),a&&this.start()}start(){if(void 0!==this._contextDeduplicator?.flushInterval&&(this._flushUsersTimer=void this._contextDeduplicator.flushInterval),this._flushTimer=void this._config.flushInterval,this._diagnosticsManager){const e=this._diagnosticsManager.createInitEvent();this._postDiagnosticEvent(e),this._diagnosticsTimer=void this._config.diagnosticRecordingInterval}this._logger?.debug("Started EventProcessor.")}_postDiagnosticEvent(e){this._eventSender.sendEventData(T.DiagnosticEvent,e)}close(){clearInterval(this._flushTimer),this._flushUsersTimer&&clearInterval(this._flushUsersTimer),this._diagnosticsTimer&&clearInterval(this._diagnosticsTimer)}async flush(){if(this._shutdown)throw new ve("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");const e=this._queue;this._queue=[];const t=this._summarizer.getSummary();this._summarizer.clearSummary(),Object.keys(t.features).length&&e.push(t),e.length&&(this._eventsInLastBatch=e.length,this._logger?.debug("Flushing %d events",e.length),await this._tryPostingEvents(e))}sendEvent(e){if(this._shutdown)return;if("migration_op"===e.kind){if(_e(e.samplingRatio)){const t={...e,context:e.context?this._contextFilter.filter(e.context):void 0};1===t.samplingRatio&&delete t.samplingRatio,this._enqueue(t)}return}this._summarizer.summarizeEvent(e);const t=de(e),r=t&&e.trackEvents||!t,i=this._shouldDebugEvent(e),n=function(e){return"identify"===e.kind}(e),s=this._contextDeduplicator?.processContext(e.context);s||n||(this._deduplicatedUsers+=1);s&&!n&&this._enqueue(this._makeOutputEvent({kind:"index",creationDate:e.creationDate,context:e.context,samplingRatio:1},!1)),r&&_e(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!1)),i&&_e(e.samplingRatio)&&this._enqueue(this._makeOutputEvent(e,!0))}_makeOutputEvent(e,t){switch(e.kind){case"feature":{const r={kind:t?"debug":"feature",creationDate:e.creationDate,context:this._contextFilter.filter(e.context,!t),key:e.key,value:e.value,default:e.default};return 1!==e.samplingRatio&&(r.samplingRatio=e.samplingRatio),e.prereqOf&&(r.prereqOf=e.prereqOf),void 0!==e.variation&&(r.variation=e.variation),void 0!==e.version&&(r.version=e.version),e.reason&&(r.reason=e.reason),r}case"index":case"identify":{const t={kind:e.kind,creationDate:e.creationDate,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),t}case"custom":{const t={kind:"custom",creationDate:e.creationDate,key:e.key,context:this._contextFilter.filter(e.context)};return 1!==e.samplingRatio&&(t.samplingRatio=e.samplingRatio),void 0!==e.data&&(t.data=e.data),void 0!==e.metricValue&&(t.metricValue=e.metricValue),void 0!==e.url&&(t.url=e.url),t}case"click":return{kind:"click",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url,selector:e.selector};case"pageview":return{kind:"pageview",creationDate:e.creationDate,contextKeys:e.context.kindsAndKeys,key:e.key,url:e.url};default:return e}}_enqueue(e){this._queue.length<this._capacity?(this._queue.push(e),this._exceededCapacity=!1):(this._exceededCapacity||(this._exceededCapacity=!0,this._logger?.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this._droppedEvents+=1)}_shouldDebugEvent(e){return de(e)&&e.debugEventsUntilDate&&e.debugEventsUntilDate>this._lastKnownPastTime&&e.debugEventsUntilDate>Date.now()}async _tryPostingEvents(e){const t=await this._eventSender.sendEventData(T.AnalyticsEvents,e);if(t.status===M.FailedAndMustShutDown&&(this._shutdown=!0),t.serverTime&&(this._lastKnownPastTime=t.serverTime),t.error)throw t.error}},InputCustomEvent:ge,InputEvalEvent:ye,InputIdentifyEvent:me,NullEventProcessor:class{close(){}async flush(){}sendEvent(){}},PayloadProcessor:be,PayloadStreamReader:class{constructor(e,t,r,i){this._errorHandler=r,this._logger=i,this._attachHandler(e,"server-intent"),this._attachHandler(e,"put-object"),this._attachHandler(e,"delete-object"),this._attachHandler(e,"payload-transferred"),this._attachHandler(e,"goodbye"),this._attachHandler(e,"error"),this._payloadProcessor=new be(t,r,i)}addPayloadListener(e){this._payloadProcessor.addPayloadListener(e)}removePayloadListener(e){this._payloadProcessor.removePayloadListener(e)}_attachHandler(t,r){t.addEventListener(r,(async t=>{if(t?.data){this._logger?.debug(`Received ${r} event. Data is ${t.data}`);try{this._payloadProcessor.processEvents([{event:r,data:JSON.parse(t.data)}])}catch{this._logger?.error(`Stream received data that was unable to be processed in "${r}" message`),this._logger?.debug(`Data follows: ${t.data}`),this._errorHandler?.(e.DataSourceErrorKind.InvalidData,"Malformed data in EventStream.")}}else this._errorHandler?.(e.DataSourceErrorKind.Unknown,"Event from EventStream missing data.")}))}},initMetadataFromHeaders:function(e){if(e){const t=Object.keys(e).find((e=>"x-ld-envid"===e.toLowerCase()));if(t)return{environmentId:e[t]}}},isLegacyUser:_,isMultiKind:v,isSingleKind:p,safeGetHooks:function(e,t,r){const i=[];return r.forEach((r=>{try{const n=r.getHooks?.(t);void 0===n?e.error(`Plugin ${we(e,r)} returned undefined from getHooks.`):n&&n.length>0&&i.push(...n)}catch(t){e.error(`Exception thrown getting hooks for plugin ${we(e,r)}. Unable to get hooks.`)}})),i},safeGetName:we,safeRegisterPlugins:function(e,t,r,i){i.forEach((i=>{try{i.register(r,t)}catch(t){e.error(`Exception thrown registering plugin ${we(e,i)}.`)}}))},shouldSample:_e});e.ApplicationTags=class{constructor(e){const t={},r=e?.application,i=e?.logger;r&&Object.entries(r).forEach((([e,r])=>{if(null!=r){const{valid:n,message:s}=G(r,`application.${e}`);n?"versionName"===e?t["application-version-name"]=[r]:t[`application-${e}`]=[r]:i?.warn(s)}}));const n=Object.keys(t);n.length&&(this.value=n.sort().flatMap((e=>t[e].sort().map((t=>`${e}/${t}`)))).join(" "))}},e.AttributeReference=r,e.BasicLogger=H,e.ClientContext=class{constructor(e,t,r){this.platform=r,this.basicConfiguration={tags:t.tags,logger:t.logger,offline:t.offline,serviceEndpoints:t.serviceEndpoints,sdkKey:e}}},e.CompositeDataSource=class{constructor(e,t,r,i={[R.Valid]:{durationMS:3e5,transition:"recover"},[R.Interrupted]:{durationMS:12e4,transition:"fallback"}},n=new O(1e3,3e4)){this._logger=r,this._transitionConditions=i,this._backoff=n,this._stopped=!0,this._cancelTokens=[],this._cancellableDelay=e=>{let t;return{promise:new Promise(((e,r)=>{t=e=>{e()}})),cancel(){t&&(clearTimeout(t),t=void 0)}}},this._externalTransitionPromise=new Promise((e=>{this._externalTransitionResolve=e})),this._initPhaseActive=e.length>0,this._initFactories=new I(!1,e),this._syncFactories=new I(!0,t)}async start(e,t){if(!this._stopped)return void this._logger?.info("CompositeDataSource already running. Ignoring call to start.");this._stopped=!1,this._logger?.debug(`CompositeDataSource starting with (${this._initFactories.length()} initializers, ${this._syncFactories.length()} synchronizers).`);const r=this._wrapStatusCallbackWithSanitizer(t);let i;for(r(R.Initializing);;){const{dataSource:n,isPrimary:s,cullDSFactory:a}=this._pickDataSource(i),o=new Promise((t=>{if(n){let i,o=()=>{};const l=new D(((i,n)=>{this._backoff.success(),e(i,n),i&&this._initPhaseActive&&(l.disable(),this._consumeCancelToken(o),r(R.Interrupted),t({transition:"switchToSync"}))}),((e,n)=>{if(this._logger?.debug(`CompositeDataSource received state ${e} from underlying data source.`),n||e===R.Closed)l.disable(),!1===n.recoverable&&a?.(),r(e,n),this._consumeCancelToken(o),t({transition:"fallback",err:n});else if(r(e),e!==i){i=e,this._consumeCancelToken(o);const n=this._lookupTransitionCondition(e,s);if(n){const{promise:e,cancel:i}=this._cancellableDelay(n.durationMS);o=i,this._cancelTokens.push(o),e.then((()=>{this._consumeCancelToken(i),l.disable(),r(R.Interrupted),t({transition:n.transition})}))}}}));n.start(((e,t)=>l.dataHandler(e,t)),((e,t)=>l.statusHandler(e,t)))}else t({transition:"stop",err:{name:"ExhaustedDataSources",message:"CompositeDataSource has exhausted all configured initializers and synchronizers."}})}));let l=await Promise.race([o,this._externalTransitionPromise]);if(n?.stop(),l.err&&"stop"!==l.transition){const e=this._backoff.fail(),{promise:t,cancel:r}=this._cancellableDelay(e);this._cancelTokens.push(r);const i=t.then((()=>(this._consumeCancelToken(r),l)));l=await Promise.race([i,this._externalTransitionPromise]),this._consumeCancelToken(r)}if(i=l.transition,"stop"===l.transition){t(R.Closed,l.err);break}}this._reset()}async stop(){this._cancelTokens.forEach((e=>e())),this._cancelTokens=[],this._externalTransitionResolve?.({transition:"stop"})}_reset(){this._stopped=!0,this._initPhaseActive=this._initFactories.length()>0,this._initFactories.reset(),this._syncFactories.reset(),this._externalTransitionPromise=new Promise((e=>{this._externalTransitionResolve=e}))}_pickDataSource(e){let t,r;switch(e){case"switchToSync":this._initPhaseActive=!1,this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next();break;case"recover":this._initPhaseActive?(this._initFactories.reset(),r=0===this._initFactories.pos(),t=this._initFactories.next()):(this._syncFactories.reset(),r=0===this._syncFactories.pos(),t=this._syncFactories.next());break;default:this._initPhaseActive?(r=0===this._initFactories.pos(),t=this._initFactories.next()):(r=0===this._syncFactories.pos(),t=this._syncFactories.next())}return t?{dataSource:t(),isPrimary:r,cullDSFactory:()=>{t&&this._syncFactories.remove(t)}}:{dataSource:void 0,isPrimary:r,cullDSFactory:void 0}}_lookupTransitionCondition(e,t){const r=this._transitionConditions[e];if(!t||"recover"!==r?.transition)return r}_consumeCancelToken(e){e();const t=this._cancelTokens.indexOf(e,0);t>-1&&this._cancelTokens.splice(t,1)}_wrapStatusCallbackWithSanitizer(e){let t,r,i=!1;return(n,s)=>{let a=n;if(n===R.Closed&&(a=R.Interrupted),a!==t||s!==r){if(a===R.Initializing){if(i)return;i=!0}t=a,r=s,e(a,s)}}}},e.Context=w,e.ContextFilter=x,e.DateValidator=h,e.DefaultBackoff=O,e.FactoryOrInstance=i,e.Function=l,e.KindValidator=d,e.LDClientError=te,e.LDFileDataSourceError=C,e.LDPollingError=N,e.LDStreamingError=F,e.LDTimeoutError=re,e.LDUnexpectedResponseError=ee,e.NullableBoolean=c,e.NumberWithMinimum=a,e.OptionMessages=q,e.SafeLogger=K,e.ServiceEndpoints=Y,e.StringMatchingRegex=o,e.Type=n,e.TypeArray=s,e.TypeValidators=f,e.base64UrlEncode=(e,t)=>t.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),e.cancelableTimedPromise=function(e,t){let r,i;return{promise:new Promise(((e,t)=>{i=e,r=e=>{e()}})),cancel:()=>{i(),clearTimeout(r)}}},e.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},e.createSafeLogger=e=>{const t=new H({level:"info",destination:console.error,formatter:B});return e?new K(e,t):t},e.debounce=(e,t=5e3)=>{let r;return(...e)=>{clearTimeout(r),r=e=>{e()}}},e.deepCompact=se,e.defaultHeaders=function(e,t,r,i=!0,n="user-agent"){const{userAgentBase:s,version:a,wrapperName:o,wrapperVersion:l}=t.sdkData(),c={[n]:`${s??"NodeJSClient"}/${a}`};return i&&(c.authorization=e),o&&(c["x-launchdarkly-wrapper"]=l?`${o}/${l}`:o),r?.value&&(c["x-launchdarkly-tags"]=r.value),c},e.fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var i,n,s;if(Array.isArray(t)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((i=t.length)!=r.length)return!1;for(n=i;0!=n--;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((i=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=i;0!=n--;){var a=s[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},e.getEventsUri=Q,e.getPollingUri=function(e,t,r){const i=J(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),Z(`${e.polling}/${i}`,n)},e.getStreamingUri=function(e,t,r){const i=J(t),n=[...r];return e.payloadFilterKey&&n.push({key:"filter",value:e.payloadFilterKey}),Z(`${e.streaming}/${i}`,n)},e.httpErrorMessage=ae,e.internal=Se,e.isHttpLocallyRecoverable=ne,e.isHttpRecoverable=ie,e.noop=()=>{},e.secondsToMillis=function(e){return Math.trunc(1e3*e)},e.shouldRetry=function({status:e}){return!e||ie(e)},e.sleep=oe,e.subsystem=j,e.timedPromise=(e,t)=>new Promise(((e,t)=>{}))}(a);var o={},l={},c={};Object.defineProperty(c,"__esModule",{value:!0});var u={};Object.defineProperty(u,"__esModule",{value:!0});var h,d={};Object.defineProperty(d,"__esModule",{value:!0}),d.IsMigrationStage=d.LDMigrationStage=void 0,function(e){e.Off="off",e.DualWrite="dualwrite",e.Shadow="shadow",e.Live="live",e.RampDown="rampdown",e.Complete="complete"}(h||(d.LDMigrationStage=h={})),d.IsMigrationStage=function(e){return Object.values(h).includes(e)};var f={};Object.defineProperty(f,"__esModule",{value:!0});var p,v={};Object.defineProperty(v,"__esModule",{value:!0}),v.LDConsistencyCheck=void 0,function(e){e[e.Inconsistent=0]="Inconsistent",e[e.Consistent=1]="Consistent",e[e.NotChecked=2]="NotChecked"}(p||(v.LDConsistencyCheck=p={})),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(c,e),i(u,e),i(d,e),i(f,e),i(v,e)}(l);var _={},g={};Object.defineProperty(g,"__esModule",{value:!0});var y={};Object.defineProperty(y,"__esModule",{value:!0});var m={};Object.defineProperty(m,"__esModule",{value:!0});var b={};Object.defineProperty(b,"__esModule",{value:!0});var E,w,S={};Object.defineProperty(S,"__esModule",{value:!0}),S.LDConcurrentExecution=S.LDSerialExecution=S.LDExecution=S.LDExecutionOrdering=void 0,function(e){e[e.Fixed=0]="Fixed",e[e.Random=1]="Random"}(E||(S.LDExecutionOrdering=E={})),function(e){e[e.Serial=0]="Serial",e[e.Concurrent=1]="Concurrent"}(w||(S.LDExecution=w={}));S.LDSerialExecution=class{constructor(e){this.ordering=e,this.type=w.Serial}};S.LDConcurrentExecution=class{constructor(){this.type=w.Concurrent}},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(g,e),i(y,e),i(m,e),i(b,e),i(S,e)}(_);var k={};Object.defineProperty(k,"__esModule",{value:!0});var x={};Object.defineProperty(x,"__esModule",{value:!0});var O={};Object.defineProperty(O,"__esModule",{value:!0});var D={};Object.defineProperty(D,"__esModule",{value:!0});var R={};Object.defineProperty(R,"__esModule",{value:!0});var I={},P={};Object.defineProperty(P,"__esModule",{value:!0});var A={};Object.defineProperty(A,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(P,e),i(A,e)}(I);var T={},M={};Object.defineProperty(M,"__esModule",{value:!0});var C={};Object.defineProperty(C,"__esModule",{value:!0});var N={};Object.defineProperty(N,"__esModule",{value:!0});var F={};Object.defineProperty(F,"__esModule",{value:!0});var j={};Object.defineProperty(j,"__esModule",{value:!0});var $={};Object.defineProperty($,"__esModule",{value:!0});var L={};Object.defineProperty(L,"__esModule",{value:!0});var B={};Object.defineProperty(B,"__esModule",{value:!0});var V={};Object.defineProperty(V,"__esModule",{value:!0});var z={};Object.defineProperty(z,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(M,e),i(C,e),i(N,e),i(F,e),i(j,e),i(O,e),i($,e),i(L,e),i(B,e),i(V,e),i(z,e)}(T);var H={},U={};Object.defineProperty(U,"__esModule",{value:!0});var K={};Object.defineProperty(K,"__esModule",{value:!0}),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(U,e),i(D,e),i(K,e)}(H),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.subsystems=e.interfaces=e.integrations=void 0,i(l,e),i(_,e),i(k,e),i(x,e),i(O,e),i(D,e),i(R,e),e.integrations=I,e.interfaces=T,e.subsystems=H}(o);var q={},W={};Object.defineProperty(W,"__esModule",{value:!0});W.default=class{constructor(e){this._keyMap=new Map,this._head=0,this._tail=0,this._size=0;const{max:t}=e;this._max=t,this._values=new Array(t),this._keys=new Array(t),this._next=new Uint32Array(t),this._prev=new Uint32Array(t),e.maxAge?(this._lastUpdated=new Array(t).fill(0),this._maxAge=e.maxAge):(this._lastUpdated=[],this._maxAge=0)}set(e,t){let r=this._keyMap.get(e);void 0===r?(r=this._index(),this._keys[r]=e,this._keyMap.set(e,r),this._next[this._tail]=r,this._prev[r]=this._tail,this._tail=r,this._size+=1):this._setTail(r),this._values[r]=t,this._maxAge&&(this._lastUpdated[r]=Date.now())}get(e){const t=this._keyMap.get(e);if(void 0!==t){if(this._maxAge){const e=this._lastUpdated[t];if(Date.now()-e>this._maxAge)return}return this._setTail(t),this._maxAge&&(this._lastUpdated[t]=Date.now()),this._values[t]}}clear(){this._head=0,this._tail=0,this._size=0,this._values.fill(void 0),this._keys.fill(void 0),this._next.fill(0),this._prev.fill(0),this._keyMap.clear()}_index(){return 0===this._size?this._tail:this._size===this._max?this._evict():this._size}_evict(){const{_head:e}=this,t=this._keys[e];return this._head=this._next[e],this._keyMap.delete(t),this._size-=1,e}_link(e,t){this._prev[t]=e,this._next[e]=t}_setTail(e){e!==this._tail&&(e===this._head?this._head=this._next[e]:this._link(this._prev[e],this._next[e]),this._link(this._tail,e),this._tail=e)}},Object.defineProperty(q,"__esModule",{value:!0});const G=a,X=n,J=W;q.default=class{constructor(e,t,r,i){this._store=e,this._logger=r,this._crypto=i,this.statusProvider=new X.default((async()=>this._pollStoreAndUpdateStatus())),this._staleTimeMs=1e3*(G.TypeValidators.Number.is(t.staleAfter)&&t.staleAfter>0?t.staleAfter:120);G.TypeValidators.Number.is(t.statusPollInterval)&&t.statusPollInterval>0&&t.statusPollInterval;this._pollHandle=e?void 0:null,e&&(this._cache=new J.default({max:t.userCacheSize||1e3,maxAge:1e3*(t.userCacheTime||5)}))}close(){this._pollHandle&&(clearInterval(this._pollHandle),this._pollHandle=void 0),this._store&&this._store.close()}async getUserMembership(e){var t,r,i;if(!this._store)return;const n=null===(t=this._cache)||void 0===t?void 0:t.get(e);let s;if(n)s=n.membership;else try{s=await this._store.getUserMembership(this._hashForUserKey(e));const t={membership:s};null===(r=this._cache)||void 0===r||r.set(e,t)}catch(e){return null===(i=this._logger)||void 0===i||i.error(`Big Segment store membership query returned error: ${e}`),[null,"STORE_ERROR"]}this.statusProvider.getStatus()||await this._pollStoreAndUpdateStatus();const a=this.statusProvider.getStatus();return a.available?[s||null,a.stale?"STALE":"HEALTHY"]:[s||null,"STORE_ERROR"]}async _pollStoreAndUpdateStatus(){var e,t,r;if(!this._store)return void this.statusProvider.setStatus({available:!1,stale:!1});let i;null===(e=this._logger)||void 0===e||e.debug("Querying Big Segment store status");try{const e=await this._store.getMetadata();i={available:!0,stale:!e||!e.lastUpToDate||this._isStale(e.lastUpToDate)}}catch(e){null===(t=this._logger)||void 0===t||t.error(`Big Segment store status query returned error: ${e}`),i={available:!1,stale:!1}}const n=this.statusProvider.getStatus();n&&n.available===i.available&&n.stale===i.stale||(null===(r=this._logger)||void 0===r||r.debug("Big Segment store status changed from %s to %s",JSON.stringify(n),JSON.stringify(i)),this.statusProvider.setStatus(i),this.statusProvider.notify())}_hashForUserKey(e){const t=this._crypto.createHash("sha256");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("base64")}_isStale(e){return Date.now()-e>=this._staleTimeMs}};var Y={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});class ee{static getKeyFromPath(e,t){return t.startsWith(e.streamApiPath)?t.substring(e.streamApiPath.length):void 0}}ee.Features={namespace:"features",streamApiPath:"/flags/"},ee.Segments={namespace:"segments",streamApiPath:"/segments/"},Q.default=ee,Object.defineProperty(Z,"__esModule",{value:!0}),Z.deserializeSegment=Z.serializeSegment=Z.deserializeFlag=Z.serializeFlag=Z.deserializeDelete=Z.deserializePatch=Z.deserializePoll=Z.deserializeAll=Z.processSegment=Z.processFlag=Z.replacer=Z.nullReplacer=void 0;const te=a,re=Q,ie=100;function ne(e,t){const r=[];if(null==e)return;const i=Object.entries(e).filter((([e,r])=>!(null==t?void 0:t.includes(e))));for(r.push(...i.map((([t,r])=>({key:t,value:r,parent:e}))));r.length;){const e=r.pop();null!==e.value||Array.isArray(e.parent)?"object"==typeof e.value&&null!==e.value&&r.push(...Object.entries(e.value).map((([t,r])=>({key:t,value:r,parent:e.value})))):delete e.parent[e.key]}}function se(e,t){if(!(t instanceof te.AttributeReference||Array.isArray(t)&&t[0]&&t[0]instanceof te.AttributeReference))return null==t||(t.generated_includedSet&&(t.included=[...t.generated_includedSet],delete t.generated_includedSet),t.generated_excludedSet&&(t.excluded=[...t.generated_excludedSet],delete t.generated_excludedSet),t.includedContexts&&t.includedContexts.forEach((e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet})),t.excludedContexts&&t.excludedContexts.forEach((e=>{e.generated_valuesSet&&(e.values=[...e.generated_valuesSet]),delete e.generated_valuesSet}))),t}function ae(e){e&&e.bucketBy&&(e.bucketByAttributeReference=new te.AttributeReference(e.bucketBy,!e.contextKind))}function oe(e){var t;if(ne(e,["variations"]),e.fallthrough&&e.fallthrough.rollout){ae(e.fallthrough.rollout)}null===(t=null==e?void 0:e.rules)||void 0===t||t.forEach((e=>{var t;ae(e.rollout),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new te.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=te.AttributeReference.InvalidReference)}))}))}function le(e){var t,r,i,n,s;ne(e),(null===(t=null==e?void 0:e.included)||void 0===t?void 0:t.length)&&e.included.length>ie&&(e.generated_includedSet=new Set(e.included),delete e.included),(null===(r=null==e?void 0:e.excluded)||void 0===r?void 0:r.length)&&e.excluded.length>ie&&(e.generated_excludedSet=new Set(e.excluded),delete e.excluded),(null===(i=null==e?void 0:e.includedContexts)||void 0===i?void 0:i.length)&&e.includedContexts.forEach((e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>ie&&(e.generated_valuesSet=new Set(e.values),e.values=[])})),(null===(n=null==e?void 0:e.excludedContexts)||void 0===n?void 0:n.length)&&e.excludedContexts.forEach((e=>{var t;(null===(t=null==e?void 0:e.values)||void 0===t?void 0:t.length)&&e.values.length>ie&&(e.generated_valuesSet=new Set(e.values),e.values=[])})),null===(s=null==e?void 0:e.rules)||void 0===s||s.forEach((e=>{var t;e.bucketBy&&(e.bucketByAttributeReference=new te.AttributeReference(e.bucketBy,!e.rolloutContextKind)),null===(t=null==e?void 0:e.clauses)||void 0===t||t.forEach((e=>{e&&e.attribute?e.attributeReference=new te.AttributeReference(e.attribute,!e.contextKind):e&&(e.attributeReference=te.AttributeReference.InvalidReference)}))}))}function ce(e){try{return JSON.parse(e)}catch(e){return}}Z.nullReplacer=ne,Z.replacer=se,Z.processFlag=oe,Z.processSegment=le,Z.deserializeAll=function(e){var t,r;const i=ce(e);if(i)return Object.values((null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.flags)||[]).forEach((e=>{oe(e)})),Object.values((null===(r=null==i?void 0:i.data)||void 0===r?void 0:r.segments)||[]).forEach((e=>{le(e)})),i},Z.deserializePoll=function(e){const t=ce(e);if(t)return Object.values((null==t?void 0:t.flags)||[]).forEach((e=>{oe(e)})),Object.values((null==t?void 0:t.segments)||[]).forEach((e=>{le(e)})),t},Z.deserializePatch=function(e){const t=ce(e);if(t)return t.path.startsWith(re.default.Features.streamApiPath)?(oe(t.data),t.kind=re.default.Features):t.path.startsWith(re.default.Segments.streamApiPath)&&(le(t.data),t.kind=re.default.Segments),t},Z.deserializeDelete=function(e){const t=ce(e);if(t)return t.path.startsWith(re.default.Features.streamApiPath)?t.kind=re.default.Features:t.path.startsWith(re.default.Segments.streamApiPath)&&(t.kind=re.default.Segments),t},Z.serializeFlag=function(e){return JSON.stringify(e,se)},Z.deserializeFlag=function(e){const t=ce(e);if(t)return oe(t),t},Z.serializeSegment=function(e){return JSON.stringify(e,se)},Z.deserializeSegment=function(e){const t=ce(e);if(t)return le(t),t},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createStreamListeners=e.createDeleteListener=e.createPatchListener=e.createPutListener=void 0;const t=a,r=Z,i=Q,{initMetadataFromHeaders:n}=t.internal;e.createPutListener=(e,t,s=()=>{})=>({deserializeData:r.deserializeAll,processJson:async({data:{flags:r,segments:a}},o)=>{const l={[i.default.Features.namespace]:r,[i.default.Segments.namespace]:a};null==t||t.debug("Initializing all data"),e.init(l,s,n(o))}});e.createPatchListener=(e,t,n=()=>{})=>({deserializeData:r.deserializePatch,processJson:async({data:r,kind:s,path:a})=>{if(s){const o=i.default.getKeyFromPath(s,a);o&&(null==t||t.debug(`Updating ${o} in ${s.namespace}`),e.upsert(s,r,n))}}});e.createDeleteListener=(e,t,n=()=>{})=>({deserializeData:r.deserializeDelete,processJson:async({kind:r,path:s,version:a})=>{if(r){const o=i.default.getKeyFromPath(r,s);o&&(null==t||t.debug(`Deleting ${o} in ${r.namespace}`),e.upsert(r,{key:o,version:a,deleted:!0},n))}}});e.createStreamListeners=(t,r,i)=>{const n=new Map;return n.set("put",(0,e.createPutListener)(t,r,null==i?void 0:i.put)),n.set("patch",(0,e.createPatchListener)(t,r,null==i?void 0:i.patch)),n.set("delete",(0,e.createDeleteListener)(t,r,null==i?void 0:i.delete)),n}}(Y);var ue={},he={},de={};Object.defineProperty(de,"__esModule",{value:!0});de.default=class{constructor(){this._itemsByNamespace={}}get(e,t){var r;return null===(r=this._itemsByNamespace[e])||void 0===r?void 0:r[t]}set(e,t,r){e in this._itemsByNamespace||(this._itemsByNamespace[e]={}),this._itemsByNamespace[e][t]=r}remove(e,t){const r=this._itemsByNamespace[e];r&&delete r[t]}removeAll(){this._itemsByNamespace={}}enumerate(e){Object.entries(this._itemsByNamespace).forEach((([t,r])=>{Object.entries(r).forEach((([r,i])=>{e(t,r,i)}))}))}mergeFrom(e){e.enumerate(this.set.bind(this))}},Object.defineProperty(he,"__esModule",{value:!0});const fe=de;he.default=class{constructor(){this._dependenciesFrom=new fe.default,this._dependenciesTo=new fe.default}updateDependenciesFrom(e,t,r){const i=this._dependenciesFrom.get(e,t);null==i||i.enumerate(((r,i)=>{const n=this._dependenciesTo.get(r,i);null==n||n.remove(e,t)})),this._dependenciesFrom.set(e,t,r),null==r||r.enumerate(((r,i)=>{let n=this._dependenciesTo.get(r,i);n||(n=new fe.default,this._dependenciesTo.set(r,i,n)),n.set(e,t,!0)}))}updateModifiedItems(e,t,r){if(!e.get(t,r)){e.set(t,r,!0);const i=this._dependenciesTo.get(t,r);null==i||i.enumerate(((t,r)=>{this.updateModifiedItems(e,t,r)}))}}reset(){this._dependenciesFrom.removeAll(),this._dependenciesTo.removeAll()}},Object.defineProperty(ue,"__esModule",{value:!0});const pe=Q,ve=he,_e=de;function ge(e,t){var r,i;const n=new _e.default,s=e===pe.default.Features.namespace,a=e===pe.default.Segments.namespace;if(s){const i=t;null===(r=null==i?void 0:i.prerequisites)||void 0===r||r.forEach((t=>{n.set(e,t.key,!0)}))}if(s||a){const e=t;null===(i=null==e?void 0:e.rules)||void 0===i||i.forEach((e=>{var t;null===(t=e.clauses)||void 0===t||t.forEach((e=>{"segmentMatch"===e.op&&e.values.forEach((e=>{n.set(pe.default.Segments.namespace,e,!0)}))}))}))}return n}ue.default=class{constructor(e,t,r){this._featureStore=e,this._hasEventListeners=t,this._onChange=r,this._dependencyTracker=new ve.default}init(e,t,r){const i=this._hasEventListeners(),n=n=>{this._featureStore.init(e,(()=>{Promise.resolve().then((()=>{if(this._dependencyTracker.reset(),Object.entries(e).forEach((([e,t])=>{Object.keys(t||{}).forEach((r=>{const i=t[r];this._dependencyTracker.updateDependenciesFrom(e,r,ge(e,i))}))})),i){const t=new _e.default;Object.keys(e).forEach((r=>{const i=(null==n?void 0:n[r])||{},s=e[r],a=Object.assign(Object.assign({},i),s);Object.keys(a).forEach((e=>{this.addIfModified(r,e,i&&i[e],s&&s[e],t)}))})),this.sendChangeEvents(t)}})),null==t||t()}),r)};i?this._featureStore.all(pe.default.Features,(e=>{this._featureStore.all(pe.default.Segments,(t=>{const r={[pe.default.Features.namespace]:e,[pe.default.Segments.namespace]:t};n(r)}))})):n()}upsert(e,t,r){const{key:i}=t,n=this._hasEventListeners(),s=s=>{this._featureStore.upsert(e,t,(()=>{Promise.resolve().then((()=>{if(this._dependencyTracker.updateDependenciesFrom(e.namespace,i,ge(e.namespace,t)),n){const r=new _e.default;this.addIfModified(e.namespace,i,s,t,r),this.sendChangeEvents(r)}})),null==r||r()}))};n?this._featureStore.get(e,i,s):s()}addIfModified(e,t,r,i,n){i&&r&&i.version<=r.version||this._dependencyTracker.updateModifiedItems(n,e,t)}sendChangeEvents(e){e.enumerate(((e,t)=>{e===pe.default.Features.namespace&&this._onChange(t)}))}};var ye={},me={},be={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.default=function(e){return new Promise((t=>{e((e=>{t(e)}))}))},Object.defineProperty(be,"__esModule",{value:!0});const we=Ee;be.default=class{constructor(e){this._store=e}async get(e,t){return(0,we.default)((r=>{this._store.get(e,t,r)}))}async all(e){return(0,we.default)((t=>{this._store.all(e,t)}))}async init(e,t){return(0,we.default)((r=>{this._store.init(e,r,t)}))}async delete(e,t,r){return(0,we.default)((i=>{this._store.delete(e,t,r,i)}))}async upsert(e,t){return(0,we.default)((r=>{this._store.upsert(e,t,r)}))}async initialized(){return(0,we.default)((e=>{this._store.initialized(e)}))}close(){this._store.close()}getInitMetadata(){var e,t;return null===(t=(e=this._store).getInitMetaData)||void 0===t?void 0:t.call(e)}};var Se={},ke={};function xe(e){return Date.now()>e.expiration}Object.defineProperty(ke,"__esModule",{value:!0});ke.default=class{constructor(e){this._options=e,this._storage=new Map,this._checkIntervalHandle=void e.checkInterval}get(e){const t=this._storage.get(e);if(!t||!xe(t))return null==t?void 0:t.value;this._storage.delete(e)}set(e,t){this._storage.set(e,{value:t,expiration:Date.now()+1e3*this._options.ttl})}delete(e){this._storage.delete(e)}clear(){this._storage.clear()}close(){this.clear(),this._checkIntervalHandle&&(clearInterval(this._checkIntervalHandle),this._checkIntervalHandle=null)}_purgeStale(){this._storage.forEach(((e,t)=>{xe(e)&&this._storage.delete(t)}))}get size(){return this._storage.size}};var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.persistentStoreKinds=void 0;const De=Z,Re=Q;Oe.persistentStoreKinds={segments:{namespace:Re.default.Segments.namespace,deserialize:e=>{const t=(0,De.deserializeSegment)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,De.serializeSegment)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:0},features:{namespace:Re.default.Features.namespace,deserialize:e=>{const t=(0,De.deserializeFlag)(e);if(t)return{version:t.version,item:t}},serialize:e=>{const t=(0,De.serializeFlag)(e);return{version:e.version,deleted:e.deleted,serializedItem:t}},priority:1}};var Ie={};Object.defineProperty(Ie,"__esModule",{value:!0});const Pe=Oe;function Ae(e,t){const r=[],i=new Set(Object.keys(t)),n=s=>{if(!i.has(s))return;i.delete(s);const a=t[s];var o;"features"===e.namespace&&(o=a,o.prerequisites&&o.prerequisites.length?o.prerequisites.map((e=>e.key)):[]).forEach((e=>{n(e)})),r.push({key:s,item:e.serialize(a)})};for(;i.size>0;){const e=i.values().next().value;n(e)}return r}Ie.default=function(e){const t=[];return Object.keys(e).forEach((r=>{const i=Pe.persistentStoreKinds[r];t.push({key:i,item:Ae(i,e[r])})})),t.sort(((e,t)=>e.key.priority-t.key.priority)),t};var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.default=class{constructor(){this._queue=[]}enqueue(e,t){this._queue.push([e,t]),1===this._queue.length&&this.executePendingUpdates()}executePendingUpdates(){if(this._queue.length>0){const[e,t]=this._queue[0];e((()=>{this._queue.shift(),this._queue.length,null==t||t()}))}}},Object.defineProperty(Se,"__esModule",{value:!0});const Me=ke,Ce=Oe,Ne=Ie,Fe=Te;function je(e,t){return`${e.namespace}:${t}`}function $e(e){return`$all:${e.namespace}`}const Le="$checkedInit";function Be(e){return!e||e.item.deleted?null:e.item}function Ve(e){return{version:e,item:{version:e,deleted:!0}}}function ze(e,t){if(t.deleted||!t.serializedItem)return Ve(t.version);const r=e.deserialize(t.serializedItem);return void 0===r?Ve(t.version):0===r.version||r.version===t.version||void 0===r.item?r:{version:t.version,item:r.item}}Se.default=class{constructor(e,t){this._core=e,this._isInitialized=!1,this._queue=new Fe.default,t&&(this._itemCache=new Me.default({ttl:t,checkInterval:600}),this._allItemsCache=new Me.default({ttl:t,checkInterval:600}))}init(e,t){this._queue.enqueue((t=>{this._core.init((0,Ne.default)(e),(()=>{this._isInitialized=!0,this._itemCache&&(this._itemCache.clear(),this._allItemsCache.clear(),Object.keys(e).forEach((t=>{const r=Ce.persistentStoreKinds[t],i=e[t];this._allItemsCache.set($e(r),i),Object.keys(i).forEach((e=>{const t=i[e],n={version:t.version,item:t};this._itemCache.set(je(r,e),n)}))}))),t()}))}),t)}get(e,t,r){if(this._itemCache){const i=this._itemCache.get(je(e,t));if(i)return void r(Be(i))}const i=Ce.persistentStoreKinds[e.namespace];this._core.get(i,t,(n=>{var s;if(n&&n.serializedItem){const a=ze(i,n);return null===(s=this._itemCache)||void 0===s||s.set(je(e,t),a),void r(Be(a))}r(null)}))}initialized(e){var t;this._isInitialized?e(!0):(null===(t=this._itemCache)||void 0===t?void 0:t.get(Le))?e(!1):this._core.initialized((t=>{var r;this._isInitialized=t,this._isInitialized||null===(r=this._itemCache)||void 0===r||r.set(Le,!0),e(this._isInitialized)}))}all(e,t){var r;const i=null===(r=this._allItemsCache)||void 0===r?void 0:r.get($e(e));if(i)return void t(i);const n=Ce.persistentStoreKinds[e.namespace];this._core.getAll(n,(r=>{var i;if(!r)return void t({});const s={};r.forEach((({key:e,item:t})=>{const r=Be(ze(n,t));r&&(s[e]=r)})),null===(i=this._allItemsCache)||void 0===i||i.set($e(e),s),t(s)}))}upsert(e,t,r){this._queue.enqueue((r=>{this._allItemsCache&&this._allItemsCache.clear();const i=Ce.persistentStoreKinds[e.namespace];this._core.upsert(i,t.key,i.serialize(t),((n,s)=>{var a,o;if(!n&&s)if(s.serializedItem){const r=ze(i,s);null===(a=this._itemCache)||void 0===a||a.set(je(e,t.key),r)}else s.deleted&&(null===(o=this._itemCache)||void 0===o||o.set(t.key,{key:t.key,version:s.version,deleted:!0}));r()}))}),r)}delete(e,t,r,i){this.upsert(e,{key:t,version:r,deleted:!0},i)}close(){var e,t;null===(e=this._itemCache)||void 0===e||e.close(),null===(t=this._allItemsCache)||void 0===t||t.close(),this._core.close()}getDescription(){return this._core.getDescription()}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializePoll=e.PersistentDataStoreWrapper=e.AsyncStoreFacade=void 0;const t=be;e.AsyncStoreFacade=t.default;const r=Se;e.PersistentDataStoreWrapper=r.default;const i=Z;Object.defineProperty(e,"deserializePoll",{enumerable:!0,get:function(){return i.deserializePoll}})}(me),Object.defineProperty(ye,"__esModule",{value:!0});const He=a,Ue=me,Ke=Q,{initMetadataFromHeaders:qe}=He.internal;ye.default=class{constructor(e,t,r,i=()=>{},n){this._requestor=t,this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._stopped=!1,this._logger=e.logger,this._pollInterval=e.pollInterval}_poll(){var e;if(this._stopped)return;const t=e=>{var t,r,i;null===(t=this._logger)||void 0===t||t.error("Polling received invalid data"),null===(r=this._logger)||void 0===r||r.debug(`Invalid JSON follows: ${e}`),null===(i=this._errorHandler)||void 0===i||i.call(this,new He.LDPollingError(He.DataSourceErrorKind.InvalidData,"Malformed JSON data in polling response"))},r=Date.now();null===(e=this._logger)||void 0===e||e.debug("Polling LaunchDarkly for feature flag updates"),this._requestor.requestAllData(((e,i,n)=>{var s,a,o,l;const c=Date.now()-r,u=Math.max(1e3*this._pollInterval-c,0);if(null===(s=this._logger)||void 0===s||s.debug("Elapsed: %d ms, sleeping for %d ms",c,u),e){const{status:t}=e;if(t&&!(0,He.isHttpRecoverable)(t)){const r=(0,He.httpErrorMessage)(e,"polling request");return null===(a=this._logger)||void 0===a||a.error(r),void(null===(o=this._errorHandler)||void 0===o||o.call(this,new He.LDPollingError(He.DataSourceErrorKind.ErrorResponse,r,t)))}null===(l=this._logger)||void 0===l||l.warn((0,He.httpErrorMessage)(e,"polling request","will retry"))}else if(i){const e=(0,Ue.deserializePoll)(i);if(e){const t={[Ke.default.Features.namespace]:e.flags,[Ke.default.Segments.namespace]:e.segments};return void this._featureStore.init(t,(()=>{this._initSuccessHandler(),this._timeoutHandle=e=>{e()}}),qe(n))}t(i)}this._timeoutHandle=e=>{e()}}))}start(){this._poll()}stop(){this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this._stopped=!0}close(){this.stop()}};var We={};Object.defineProperty(We,"__esModule",{value:!0});const Ge=a;We.default=class{constructor(e,t,r){this._requests=t,this._eTagCache={},this._headers=Object.assign({},r),this._uri=(0,Ge.getPollingUri)(e.serviceEndpoints,"/sdk/latest-all",[])}async _requestWithETagCache(e,t){const r=this._eTagCache[e],i=null==r?void 0:r.etag,n=i?Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},t.headers),{"if-none-match":i})}):t,s=await this._requests.fetch(e,n);if(304===s.status&&r)return{res:s,body:r.body};const a=s.headers.get("etag"),o=await s.text();return a&&(this._eTagCache[e]={etag:a,body:o}),{res:s,body:o}}async requestAllData(e){const t={method:"GET",headers:this._headers};try{const{res:r,body:i}=await this._requestWithETagCache(this._uri,t);if(200!==r.status&&304!==r.status){return e(new Ge.LDPollingError(Ge.DataSourceErrorKind.ErrorResponse,`Unexpected status code: ${r.status}`,r.status),void 0,void 0)}return e(void 0,304===r.status?null:i,Object.fromEntries(r.headers.entries()))}catch(t){return e(t,void 0,void 0)}}};var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});const Je=a;Xe.default=class{constructor(e,t,r,i,n,s,a,o=1){this._listeners=i,this._diagnosticsManager=s,this._errorHandler=a,this._streamInitialReconnectDelay=o;const{basicConfiguration:l,platform:c}=e,{logger:u}=l,{requests:h}=c;this._headers=Object.assign({},n),this._logger=u,this._requests=h,this._streamUri=(0,Je.getStreamingUri)(l.serviceEndpoints,t,r)}_logConnectionStarted(){this._connectionAttemptStartTime=Date.now()}_logConnectionResult(e){this._connectionAttemptStartTime&&this._diagnosticsManager&&this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime,!e,Date.now()-this._connectionAttemptStartTime),this._connectionAttemptStartTime=void 0}_retryAndHandleError(e){var t,r,i;return(0,Je.shouldRetry)(e)?(null===(i=this._logger)||void 0===i||i.warn((0,Je.httpErrorMessage)(e,"streaming request","will retry")),this._logConnectionResult(!1),this._logConnectionStarted(),!0):(this._logConnectionResult(!1),null===(t=this._errorHandler)||void 0===t||t.call(this,new Je.LDStreamingError(Je.DataSourceErrorKind.ErrorResponse,e.message,e.status)),null===(r=this._logger)||void 0===r||r.error((0,Je.httpErrorMessage)(e,"streaming request")),!1)}start(){this._logConnectionStarted();const e=this._requests.createEventSource(this._streamUri,{headers:this._headers,errorFilter:e=>this._retryAndHandleError(e),initialRetryDelayMillis:1e3*this._streamInitialReconnectDelay,readTimeoutMillis:3e5,retryResetIntervalMillis:6e4});this._eventSource=e,e.onclose=()=>{var e;null===(e=this._logger)||void 0===e||e.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=e=>{var t;this._initHeaders=e.headers,null===(t=this._logger)||void 0===t||t.info("Opened LaunchDarkly stream connection")},e.onretrying=e=>{var t;null===(t=this._logger)||void 0===t||t.info(`Will retry stream connection in ${e.delayMillis} milliseconds`)},this._listeners.forEach((({deserializeData:t,processJson:r},i)=>{e.addEventListener(i,(e=>{var n,s;if(null===(n=this._logger)||void 0===n||n.debug(`Received ${i} event`),null==e?void 0:e.data){this._logConnectionResult(!0);const{data:n}=e,s=t(n);if(!s)return void((e,t,r,i)=>{null==r||r.error(`Stream received invalid data in "${e}" message`),null==r||r.debug(`Invalid JSON follows: ${t}`),null==i||i(new Je.LDStreamingError(Je.DataSourceErrorKind.InvalidData,"Malformed JSON data in event stream"))})(i,n,this._logger,this._errorHandler);r(s,this._initHeaders)}else null===(s=this._errorHandler)||void 0===s||s.call(this,new Je.LDStreamingError(Je.DataSourceErrorKind.Unknown,"Unexpected payload from event stream"))}))}))}stop(){var e;null===(e=this._eventSource)||void 0===e||e.close(),this._eventSource=void 0}close(){this.stop()}};var Ye={},Ze={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.default=class{constructor(){this._allData={},this._initCalled=!1}_addItem(e,t,r){let i=this._allData[e.namespace];if(i||(i={},this._allData[e.namespace]=i),Object.hasOwnProperty.call(i,t)){const e=i[t];(!e||e.version<r.version)&&(i[t]=r)}else i[t]=r}get(e,t,r){const i=this._allData[e.namespace];if(i&&Object.prototype.hasOwnProperty.call(i,t)){const e=i[t];if(e&&!e.deleted)return null==r?void 0:r(e)}return null==r?void 0:r(null)}all(e,t){var r;const i={},n=null!==(r=this._allData[e.namespace])&&void 0!==r?r:{};Object.entries(n).forEach((([e,t])=>{t&&!t.deleted&&(i[e]=t)})),null==t||t(i)}init(e,t,r){this._initCalled=!0,this._allData=e,this._initMetadata=r,null==t||t()}delete(e,t,r,i){const n={version:r,deleted:!0};this._addItem(e,t,n),null==i||i()}upsert(e,t,r){this._addItem(e,t.key,t),null==r||r()}initialized(e){return null==e?void 0:e(this._initCalled)}close(){}getDescription(){return"memory"}getInitMetaData(){return this._initMetadata}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultValues=void 0;const t=a,r=Qe,i={baseUri:t.TypeValidators.String,streamUri:t.TypeValidators.String,eventsUri:t.TypeValidators.String,timeout:t.TypeValidators.Number,capacity:t.TypeValidators.Number,logger:t.TypeValidators.Object,featureStore:t.TypeValidators.ObjectOrFactory,bigSegments:t.TypeValidators.Object,updateProcessor:t.TypeValidators.ObjectOrFactory,flushInterval:t.TypeValidators.Number,pollInterval:t.TypeValidators.numberWithMin(30),proxyOptions:t.TypeValidators.Object,offline:t.TypeValidators.Boolean,stream:t.TypeValidators.Boolean,streamInitialReconnectDelay:t.TypeValidators.Number,useLdd:t.TypeValidators.Boolean,sendEvents:t.TypeValidators.Boolean,allAttributesPrivate:t.TypeValidators.Boolean,privateAttributes:t.TypeValidators.StringArray,contextKeysCapacity:t.TypeValidators.Number,contextKeysFlushInterval:t.TypeValidators.Number,tlsParams:t.TypeValidators.Object,diagnosticOptOut:t.TypeValidators.Boolean,diagnosticRecordingInterval:t.TypeValidators.numberWithMin(60),wrapperName:t.TypeValidators.String,wrapperVersion:t.TypeValidators.String,application:t.TypeValidators.Object,payloadFilterKey:t.TypeValidators.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:t.TypeValidators.createTypeArray("Hook[]",{}),enableEventCompression:t.TypeValidators.Boolean};e.defaultValues={baseUri:"https://sdk.launchdarkly.com",streamUri:"https://stream.launchdarkly.com",eventsUri:t.ServiceEndpoints.DEFAULT_EVENTS,stream:!0,streamInitialReconnectDelay:1,sendEvents:!0,timeout:5,capacity:1e4,flushInterval:5,pollInterval:30,offline:!1,useLdd:!1,allAttributesPrivate:!1,privateAttributes:[],contextKeysCapacity:1e3,contextKeysFlushInterval:300,diagnosticOptOut:!1,diagnosticRecordingInterval:900,featureStore:()=>new r.default,enableEventCompression:!1};e.default=class{constructor(r={},n={}){r=r||{},this.logger=r.logger;const{errors:s,validatedOptions:a}=function(r){const n=[],s=Object.assign({},e.defaultValues);return Object.keys(r).forEach((a=>{var o;const l=r[a],c=i[a];if(c)if(c.is(l))s[a]=l;else if("boolean"===c.getType())n.push(t.OptionMessages.wrongOptionTypeBoolean(a,typeof l)),s[a]=!!l;else if(c instanceof t.NumberWithMinimum&&t.TypeValidators.Number.is(l)){const{min:e}=c;n.push(t.OptionMessages.optionBelowMinimum(a,l,e)),s[a]=e}else n.push(t.OptionMessages.wrongOptionType(a,c.getType(),typeof l)),s[a]=e.defaultValues[a];else null===(o=r.logger)||void 0===o||o.warn(t.OptionMessages.unknownOption(a))})),{errors:n,validatedOptions:s}}(r);s.forEach((e=>{var t;null===(t=this.logger)||void 0===t||t.warn(e)})),function(e,r){var i,n,s;const{baseUri:a,streamUri:o,eventsUri:l}=e,c=null!=o,u=null!=a,h=null!=l;c===u&&c===h||(!c&&r.stream&&(null===(i=r.logger)||void 0===i||i.warn(t.OptionMessages.partialEndpoint("streamUri"))),u||null===(n=r.logger)||void 0===n||n.warn(t.OptionMessages.partialEndpoint("baseUri")),!h&&r.sendEvents&&(null===(s=r.logger)||void 0===s||s.warn(t.OptionMessages.partialEndpoint("eventsUri"))))}(r,a),this.serviceEndpoints=new t.ServiceEndpoints(a.streamUri,a.baseUri,a.eventsUri,n.analyticsEventPath,n.diagnosticEventPath,n.includeAuthorizationHeader,a.payloadFilterKey),this.eventsCapacity=a.capacity,this.timeout=a.timeout,this.bigSegments=a.bigSegments,this.flushInterval=a.flushInterval,this.pollInterval=a.pollInterval,this.proxyOptions=a.proxyOptions,this.offline=a.offline,this.stream=a.stream,this.streamInitialReconnectDelay=a.streamInitialReconnectDelay,this.useLdd=a.useLdd,this.sendEvents=a.sendEvents,this.allAttributesPrivate=a.allAttributesPrivate,this.privateAttributes=a.privateAttributes,this.contextKeysCapacity=a.contextKeysCapacity,this.contextKeysFlushInterval=a.contextKeysFlushInterval,this.tlsParams=a.tlsParams,this.diagnosticOptOut=a.diagnosticOptOut,this.wrapperName=a.wrapperName,this.payloadFilterKey=a.payloadFilterKey,this.wrapperVersion=a.wrapperVersion,this.tags=new t.ApplicationTags(a),this.diagnosticRecordingInterval=a.diagnosticRecordingInterval,t.TypeValidators.Function.is(a.updateProcessor)?this.updateProcessorFactory=a.updateProcessor:this.updateProcessorFactory=()=>a.updateProcessor,t.TypeValidators.Function.is(a.featureStore)?this.featureStoreFactory=a.featureStore:this.featureStoreFactory=()=>a.featureStore,this.hooks=a.hooks,this.enableEventCompression=a.enableEventCompression}}}(Ze),Object.defineProperty(Ye,"__esModule",{value:!0});const et=a,tt=Ze;Ye.default=(e,t,r)=>{var i,n,s,a,o,l;return{customBaseURI:e.serviceEndpoints.polling!==tt.defaultValues.baseUri,customStreamURI:e.serviceEndpoints.streaming!==tt.defaultValues.streamUri,customEventsURI:e.serviceEndpoints.events!==tt.defaultValues.eventsUri,eventsCapacity:e.eventsCapacity,connectTimeoutMillis:(0,et.secondsToMillis)(e.timeout),socketTimeoutMillis:(0,et.secondsToMillis)(e.timeout),eventsFlushIntervalMillis:(0,et.secondsToMillis)(e.flushInterval),pollingIntervalMillis:(0,et.secondsToMillis)(e.pollInterval),reconnectTimeMillis:(0,et.secondsToMillis)(e.streamInitialReconnectDelay),contextKeysFlushIntervalMillis:(0,et.secondsToMillis)(e.contextKeysFlushInterval),diagnosticRecordingIntervalMillis:(0,et.secondsToMillis)(e.diagnosticRecordingInterval),streamingDisabled:!e.stream,usingRelayDaemon:e.useLdd,offline:e.offline,allAttributesPrivate:e.allAttributesPrivate,contextKeysCapacity:e.contextKeysCapacity,usingProxy:!!(null===(n=(i=t.requests).usingProxy)||void 0===n?void 0:n.call(i)),usingProxyAuthenticator:!!(null===(a=(s=t.requests).usingProxyAuth)||void 0===a?void 0:a.call(s)),dataStoreType:null!==(l=null===(o=r.getDescription)||void 0===o?void 0:o.call(r))&&void 0!==l?l:"memory"}};var rt={};Object.defineProperty(rt,"__esModule",{value:!0}),rt.allAsync=rt.firstSeriesAsync=rt.allSeriesAsync=rt.firstResult=void 0,rt.firstResult=function(e,t){let r;return null==e||e.some(((e,i)=>(r=t(e,i),!!r))),r};function it(e,t,r,i,n){e?i<(null==e?void 0:e.length)?t(e[i],i,(s=>{if(r){if(!s)return void n(!1)}else if(s)return void n(!0);e.length>50?Promise.resolve().then((()=>{it(e,t,r,i+1,n)})):it(e,t,r,i+1,n)})):n(r):n(!1)}rt.allSeriesAsync=function(e,t,r){it(e,t,!0,0,r)},rt.firstSeriesAsync=function(e,t,r){it(e,t,!1,0,r)},rt.allAsync=function(e,t,r){e?Promise.all(null==e?void 0:e.map((e=>new Promise((r=>{t(e,r)}))))).then((e=>{r(e.every((e=>e)))})):r(!1)};var nt={},st={};Object.defineProperty(st,"__esModule",{value:!0});class at{static prerequisiteFailed(e){return{kind:"PREREQUISITE_FAILED",prerequisiteKey:e}}static ruleMatch(e,t){return{kind:"RULE_MATCH",ruleId:e,ruleIndex:t}}}at.Fallthrough={kind:"FALLTHROUGH"},at.Off={kind:"OFF"},at.TargetMatch={kind:"TARGET_MATCH"},st.default=at,Object.defineProperty(nt,"__esModule",{value:!0});const ot=st;class lt{constructor(e,t,r){this.isError=e,this.detail=t,this.message=r,this.isError=e,this.detail=t,this.message=r}get isOff(){return this.detail.reason.kind===ot.default.Off.kind}setDefault(e){this.detail.value=e}static forError(e,t,r){return new lt(!0,{value:null!=r?r:null,variationIndex:null,reason:{kind:"ERROR",errorKind:e}},t)}static forSuccess(e,t,r){return new lt(!1,{value:e,variationIndex:void 0===r?null:r,reason:t})}}nt.default=lt;var ct={},ut={};Object.defineProperty(ut,"__esModule",{value:!0});ut.default=class{constructor(e){this._crypto=e}_sha1Hex(e){const t=this._crypto.createHash("sha1");if(t.update(e),!t.digest)throw new Error("Platform must implement digest or asyncDigest");return t.digest("hex")}bucket(e,t,r,i,n="user",s){const a=function(e){return"string"==typeof e?e:Number.isInteger(e)?String(e):null}(e.valueForKind(r,n));if(null===a){return[0,e.kinds.indexOf(n)>=0]}const o=`${s?Number(s):`${t}.${i}`}.${a}`;return[parseInt(this._sha1Hex(o).substring(0,15),16)/0x1000000000000000,!0]}};var ht={},dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.getBucketBy=dt.getOffVariation=dt.getVariation=void 0;const ft=a,pt=nt,{ErrorKinds:vt}=ft.internal,_t=new ft.AttributeReference("key");function gt(e,t,r){return ft.TypeValidators.Number.is(t)&&t>=0&&t<e.variations.length?pt.default.forSuccess(e.variations[t],r,t):pt.default.forError(vt.MalformedFlag,"Invalid variation index in flag")}dt.getVariation=gt,dt.getOffVariation=function(e,t){return ft.TypeValidators.Number.is(e.offVariation)?gt(e,e.offVariation,t):pt.default.forSuccess(null,t)},dt.getBucketBy=function(e,t){var r;return null!==(r=e?void 0:t)&&void 0!==r?r:_t},Object.defineProperty(ht,"__esModule",{value:!0});const yt=a,mt=rt,bt=st,Et=dt;function wt(e,t,r){const i=r.key(t.contextKind);if(void 0!==i){if(t.values.indexOf(i)>=0)return(0,Et.getVariation)(e,t.variation,bt.default.TargetMatch)}}ht.default=function(e,t){var r;return(null===(r=e.contextTargets)||void 0===r?void 0:r.length)?(0,mt.firstResult)(e.contextTargets,(r=>{if(!r.contextKind||r.contextKind===yt.Context.UserKind){const i=(e.targets||[]).find((e=>e.variation===r.variation));return i?wt(e,i,t):void 0}return wt(e,r,t)})):(0,mt.firstResult)(e.targets,(r=>wt(e,r,t)))};var St={};Object.defineProperty(St,"__esModule",{value:!0}),St.default=function(e){return`${e.key}.g${e.generation}`};var kt={},xt={},Ot={exports:{}};var Dt={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var Rt="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:n}=Dt,s=Rt,a=(t=e.exports={}).re=[],o=t.safeRe=[],l=t.src=[],c=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",n],[h,i]],f=(e,t,r)=>{const i=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),n=u++;s(e,n,t),c[e]=n,l[n]=t,a[n]=new RegExp(t,r?"g":void 0),o[n]=new RegExp(i,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),f("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${h}+`),f("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),f("FULL",`^${l[c.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),f("LOOSE",`^${l[c.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),f("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),f("COERCERTL",l[c.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ot,Ot.exports);var It=Ot.exports;const Pt=Object.freeze({loose:!0}),At=Object.freeze({});var Tt=e=>e?"object"!=typeof e?Pt:e:At;const Mt=/^[0-9]+$/,Ct=(e,t)=>{const r=Mt.test(e),i=Mt.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};var Nt={compareIdentifiers:Ct,rcompareIdentifiers:(e,t)=>Ct(t,e)};const Ft=Rt,{MAX_LENGTH:jt,MAX_SAFE_INTEGER:$t}=Dt,{safeRe:Lt,t:Bt}=It,Vt=Tt,{compareIdentifiers:zt}=Nt;var Ht=class e{constructor(t,r){if(r=Vt(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>jt)throw new TypeError(`version is longer than ${jt} characters`);Ft("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?Lt[Bt.LOOSE]:Lt[Bt.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>$t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$t||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<$t)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Ft("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),zt(this.major,t.major)||zt(this.minor,t.minor)||zt(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const e=this.prerelease[r],i=t.prerelease[r];if(Ft("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return zt(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{const e=this.build[r],i=t.build[r];if(Ft("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return zt(e,i)}while(++r)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===r&&(i=[t]),0===zt(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const Ut=Ht;var Kt=(e,t,r=!1)=>{if(e instanceof Ut)return e;try{return new Ut(e,t)}catch(e){if(!r)return null;throw e}};const qt=Kt;var Wt=(e,t)=>{const r=qt(e,t);return r?r.version:null};const Gt=Kt;var Xt=(e,t)=>{const r=Gt(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const Jt=Ht;var Yt=(e,t,r,i,n)=>{"string"==typeof r&&(n=i,i=r,r=void 0);try{return new Jt(e instanceof Jt?e.version:e,r).inc(t,i,n).version}catch(e){return null}};const Zt=Kt;var Qt=(e,t)=>{const r=Zt(e,null,!0),i=Zt(t,null,!0),n=r.compare(i);if(0===n)return null;const s=n>0,a=s?r:i,o=s?i:r,l=!!a.prerelease.length;if(!!o.prerelease.length&&!l)return o.patch||o.minor?a.patch?"patch":a.minor?"minor":"major":"major";const c=l?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};const er=Ht;var tr=(e,t)=>new er(e,t).major;const rr=Ht;var ir=(e,t)=>new rr(e,t).minor;const nr=Ht;var sr=(e,t)=>new nr(e,t).patch;const ar=Kt;var or=(e,t)=>{const r=ar(e,t);return r&&r.prerelease.length?r.prerelease:null};const lr=Ht;var cr=(e,t,r)=>new lr(e,r).compare(new lr(t,r));const ur=cr;var hr=(e,t,r)=>ur(t,e,r);const dr=cr;var fr=(e,t)=>dr(e,t,!0);const pr=Ht;var vr=(e,t,r)=>{const i=new pr(e,r),n=new pr(t,r);return i.compare(n)||i.compareBuild(n)};const _r=vr;var gr=(e,t)=>e.sort(((e,r)=>_r(e,r,t)));const yr=vr;var mr=(e,t)=>e.sort(((e,r)=>yr(r,e,t)));const br=cr;var Er=(e,t,r)=>br(e,t,r)>0;const wr=cr;var Sr=(e,t,r)=>wr(e,t,r)<0;const kr=cr;var xr=(e,t,r)=>0===kr(e,t,r);const Or=cr;var Dr=(e,t,r)=>0!==Or(e,t,r);const Rr=cr;var Ir=(e,t,r)=>Rr(e,t,r)>=0;const Pr=cr;var Ar=(e,t,r)=>Pr(e,t,r)<=0;const Tr=xr,Mr=Dr,Cr=Er,Nr=Ir,Fr=Sr,jr=Ar;var $r=(e,t,r,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Tr(e,r,i);case"!=":return Mr(e,r,i);case">":return Cr(e,r,i);case">=":return Nr(e,r,i);case"<":return Fr(e,r,i);case"<=":return jr(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const Lr=Ht,Br=Kt,{safeRe:Vr,t:zr}=It;var Hr,Ur,Kr,qr,Wr,Gr,Xr,Jr,Yr,Zr,Qr=(e,t)=>{if(e instanceof Lr)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=Vr[zr.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Vr[zr.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Vr[zr.COERCERTL].lastIndex=-1}else r=e.match(Vr[zr.COERCE]);return null===r?null:Br(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function ei(){if(qr)return Kr;function e(t){var r=this;if(r instanceof e||(r=new e),r.tail=null,r.head=null,r.length=0,t&&"function"==typeof t.forEach)t.forEach((function(e){r.push(e)}));else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}function t(e,t,r){var i=t===e.head?new n(r,null,t,e):new n(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function r(e,t){e.tail=new n(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new n(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function n(e,t,r,i){if(!(this instanceof n))return new n(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}qr=1,Kr=e,e.Node=n,e.create=e,e.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},e.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},e.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},e.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)r(this,arguments[e]);return this.length},e.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},e.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},e.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},e.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},e.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},e.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},e.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},e.prototype.map=function(t,r){r=r||this;for(var i=new e,n=this.head;null!==n;)i.push(t.call(r,n.value,this)),n=n.next;return i},e.prototype.mapReverse=function(t,r){r=r||this;for(var i=new e,n=this.tail;null!==n;)i.push(t.call(r,n.value,this)),n=n.prev;return i},e.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},e.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},e.prototype.slice=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,s=this.head;null!==s&&n<t;n++)s=s.next;for(;null!==s&&n<r;n++,s=s.next)i.push(s.value);return i},e.prototype.sliceReverse=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var i=new e;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,s=this.tail;null!==s&&n>r;n--)s=s.prev;for(;null!==s&&n>t;n--,s=s.prev)i.push(s.value);return i},e.prototype.splice=function(e,r,...i){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;var a=[];for(n=0;s&&n<r;n++)a.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(n=0;n<i.length;n++)s=t(this,s,i[n]);return a},e.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{(Ur?Hr:(Ur=1,Hr=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(e)}catch(e){}return Kr}function ti(){if(Jr)return Xr;Jr=1;class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&f))+":"+e,i=r.get(t);if(i)return i;const a=this.options.loose,v=a?o[l.HYPHENRANGELOOSE]:o[l.HYPHENRANGE];e=e.replace(v,D(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[l.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[l.TILDETRIM],u),s("tilde trim",e),e=e.replace(o[l.CARETTRIM],h),s("caret trim",e);let _=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>O(e,this.options)));a&&(_=_.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(o[l.COMPARATORLOOSE]))))),s("range list",_);const y=new Map,m=_.map((e=>new n(e,this.options)));for(const e of m){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const b=[...y.values()];return r.set(t,b),b}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>_(e,r)&&t.set.some((t=>_(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(R(this.set[t],e,this.options))return!0;return!1}}Xr=e;const t=function(){if(Gr)return Wr;Gr=1;const e=ei(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),c=Symbol("cache"),u=Symbol("updateAgeOnGet"),h=()=>1,d=(e,t,r)=>{const i=e[c].get(t);if(i){const t=i.value;if(f(e,t)){if(v(e,i),!e[n])return}else r&&(e[u]&&(i.value.now=Date.now()),e[l].unshiftNode(i));return t.value}},f=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[s]&&r>e[s]},p=e=>{if(e[r]>e[t])for(let i=e[l].tail;e[r]>e[t]&&null!==i;){const t=i.prev;v(e,i),i=t}},v=(e,t)=>{if(t){const i=t.value;e[a]&&e[a](i.key,i.value),e[r]-=i.length,e[c].delete(i.key),e[l].removeNode(t)}};class _{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const g=(e,t,r,i)=>{let s=r.value;f(e,s)&&(v(e,r),e[n]||(s=void 0)),s&&t.call(i,s.value,s.key,e)};return Wr=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const r=e.length||h;if(this[i]="function"!=typeof r?h:r,this[n]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[s]=e.maxAge||0,this[a]=e.dispose,this[o]=e.noDisposeOnSet||!1,this[u]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[n]=!!e}get allowStale(){return this[n]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[s]=e,p(this)}get maxAge(){return this[s]}set lengthCalculator(e){"function"!=typeof e&&(e=h),e!==this[i]&&(this[i]=e,this[r]=0,this[l].forEach((e=>{e.length=this[i](e.value,e.key),this[r]+=e.length}))),p(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let r=this[l].tail;null!==r;){const i=r.prev;g(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[l].head;null!==r;){const i=r.next;g(this,e,r,t),r=i}}keys(){return this[l].toArray().map((e=>e.key))}values(){return this[l].toArray().map((e=>e.value))}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach((e=>this[a](e.key,e.value))),this[c]=new Map,this[l]=new e,this[r]=0}dump(){return this[l].map((e=>!f(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[l]}set(e,n,u){if((u=u||this[s])&&"number"!=typeof u)throw new TypeError("maxAge must be a number");const h=u?Date.now():0,d=this[i](n,e);if(this[c].has(e)){if(d>this[t])return v(this,this[c].get(e)),!1;const i=this[c].get(e).value;return this[a]&&(this[o]||this[a](e,i.value)),i.now=h,i.maxAge=u,i.value=n,this[r]+=d-i.length,i.length=d,this.get(e),p(this),!0}const f=new _(e,n,d,h,u);return f.length>this[t]?(this[a]&&this[a](e,n),!1):(this[r]+=f.length,this[l].unshift(f),this[c].set(e,this[l].head),p(this),!0)}has(e){if(!this[c].has(e))return!1;const t=this[c].get(e).value;return!f(this,t)}get(e){return d(this,e,!0)}peek(e){return d(this,e,!1)}pop(){const e=this[l].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[c].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[c].forEach(((e,t)=>d(this,t,!1)))}},Wr}(),r=new t({max:1e3}),i=Tt,n=ri(),s=Rt,a=Ht,{safeRe:o,t:l,comparatorTrimReplace:c,tildeTrimReplace:u,caretTrimReplace:h}=It,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=Dt,p=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,_=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every((e=>n.intersects(e,t))),n=i.pop();return r},g=(e,t)=>(s("comp",e,t),e=E(e,t),s("caret",e),e=m(e,t),s("tildes",e),e=S(e,t),s("xrange",e),e=x(e,t),s("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,m=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const r=t.loose?o[l.TILDELOOSE]:o[l.TILDE];return e.replace(r,((t,r,i,n,a)=>{let o;return s("tilde",e,t,r,i,n,a),y(r)?o="":y(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:y(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:a?(s("replaceTilde pr",a),o=`>=${r}.${i}.${n}-${a} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,s("tilde return",o),o}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{s("caret",e,t);const r=t.loose?o[l.CARETLOOSE]:o[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,a,o)=>{let l;return s("caret",e,t,r,n,a,o),y(r)?l="":y(n)?l=`>=${r}.0.0${i} <${+r+1}.0.0-0`:y(a)?l="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(s("replaceCaret pr",o),l="0"===r?"0"===n?`>=${r}.${n}.${a}-${o} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a}-${o} <${+r+1}.0.0-0`):(s("no pr"),l="0"===r?"0"===n?`>=${r}.${n}.${a}${i} <${r}.${n}.${+a+1}-0`:`>=${r}.${n}.${a}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${a} <${+r+1}.0.0-0`),s("caret return",l),l}))},S=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>k(e,t))).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[l.XRANGELOOSE]:o[l.XRANGE];return e.replace(r,((r,i,n,a,o,l)=>{s("xRange",e,r,i,n,a,o,l);const c=y(n),u=c||y(a),h=u||y(o),d=h;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(u&&(a=0),o=0,">"===i?(i=">=",u?(n=+n+1,a=0,o=0):(a=+a+1,o=0)):"<="===i&&(i="<",u?n=+n+1:a=+a+1),"<"===i&&(l="-0"),r=`${i+n}.${a}.${o}${l}`):u?r=`>=${n}.0.0${l} <${+n+1}.0.0-0`:h&&(r=`>=${n}.${a}.0${l} <${n}.${+a+1}.0-0`),s("xRange return",r),r}))},x=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[l.STAR],"")),O=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,r,i,n,s,a,o,l,c,u,h,d,f)=>`${r=y(i)?"":y(n)?`>=${i}.0.0${e?"-0":""}`:y(s)?`>=${i}.${n}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=y(c)?"":y(u)?`<${+c+1}.0.0-0`:y(h)?`<${c}.${+u+1}.0-0`:d?`<=${c}.${u}.${h}-${d}`:e?`<${c}.${u}.${+h+1}-0`:`<=${l}`}`.trim(),R=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(s(e[r].semver),e[r].semver!==n.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return Xr}function ri(){if(Zr)return Yr;Zr=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(i,n){if(n=r(n),i instanceof t){if(i.loose===!!n.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),a("comparator",i,n),this.options=n,this.loose=!!n.loose,this.parse(i),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?i[n.COMPARATORLOOSE]:i[n.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new o(s[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new o(t,this.options)}catch(e){return!1}return s(t,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,i).test(this.value):""===e.operator?""===e.value||new l(this.value,i).test(e.semver):(!(i=r(i)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(s(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(s(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Yr=t;const r=Tt,{safeRe:i,t:n}=It,s=$r,a=Rt,o=Ht,l=ti();return Yr}const ii=ti();var ni=(e,t,r)=>{try{t=new ii(t,r)}catch(e){return!1}return t.test(e)};const si=ti();var ai=(e,t)=>new si(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const oi=Ht,li=ti();var ci=(e,t,r)=>{let i=null,n=null,s=null;try{s=new li(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&-1!==n.compare(e)||(i=e,n=new oi(i,r)))})),i};const ui=Ht,hi=ti();var di=(e,t,r)=>{let i=null,n=null,s=null;try{s=new hi(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&1!==n.compare(e)||(i=e,n=new ui(i,r)))})),i};const fi=Ht,pi=ti(),vi=Er;var _i=(e,t)=>{e=new pi(e,t);let r=new fi("0.0.0");if(e.test(r))return r;if(r=new fi("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let n=null;i.forEach((e=>{const t=new fi(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!vi(t,n)||(n=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!n||r&&!vi(r,n)||(r=n)}return r&&e.test(r)?r:null};const gi=ti();var yi=(e,t)=>{try{return new gi(e,t).range||"*"}catch(e){return null}};const mi=Ht,bi=ri(),{ANY:Ei}=bi,wi=ti(),Si=ni,ki=Er,xi=Sr,Oi=Ar,Di=Ir;var Ri=(e,t,r,i)=>{let n,s,a,o,l;switch(e=new mi(e,i),t=new wi(t,i),r){case">":n=ki,s=Oi,a=xi,o=">",l=">=";break;case"<":n=xi,s=Di,a=ki,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Si(e,t,i))return!1;for(let r=0;r<t.set.length;++r){const c=t.set[r];let u=null,h=null;if(c.forEach((e=>{e.semver===Ei&&(e=new bi(">=0.0.0")),u=u||e,h=h||e,n(e.semver,u.semver,i)?u=e:a(e.semver,h.semver,i)&&(h=e)})),u.operator===o||u.operator===l)return!1;if((!h.operator||h.operator===o)&&s(e,h.semver))return!1;if(h.operator===l&&a(e,h.semver))return!1}return!0};const Ii=Ri;var Pi=(e,t,r)=>Ii(e,t,">",r);const Ai=Ri;var Ti=(e,t,r)=>Ai(e,t,"<",r);const Mi=ti();var Ci=(e,t,r)=>(e=new Mi(e,r),t=new Mi(t,r),e.intersects(t,r));const Ni=ni,Fi=cr;const ji=ti(),$i=ri(),{ANY:Li}=$i,Bi=ni,Vi=cr,zi=[new $i(">=0.0.0-0")],Hi=[new $i(">=0.0.0")],Ui=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===Li){if(1===t.length&&t[0].semver===Li)return!0;e=r.includePrerelease?zi:Hi}if(1===t.length&&t[0].semver===Li){if(r.includePrerelease)return!0;t=Hi}const i=new Set;let n,s,a,o,l,c,u;for(const t of e)">"===t.operator||">="===t.operator?n=Ki(n,t,r):"<"===t.operator||"<="===t.operator?s=qi(s,t,r):i.add(t.semver);if(i.size>1)return null;if(n&&s){if(a=Vi(n.semver,s.semver,r),a>0)return null;if(0===a&&(">="!==n.operator||"<="!==s.operator))return null}for(const e of i){if(n&&!Bi(e,String(n),r))return null;if(s&&!Bi(e,String(s),r))return null;for(const i of t)if(!Bi(e,String(i),r))return!1;return!0}let h=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,d=!(!n||r.includePrerelease||!n.semver.prerelease.length)&&n.semver;h&&1===h.prerelease.length&&"<"===s.operator&&0===h.prerelease[0]&&(h=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,n)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),">"===e.operator||">="===e.operator){if(o=Ki(n,e,r),o===e&&o!==n)return!1}else if(">="===n.operator&&!Bi(n.semver,String(e),r))return!1;if(s)if(h&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===h.major&&e.semver.minor===h.minor&&e.semver.patch===h.patch&&(h=!1),"<"===e.operator||"<="===e.operator){if(l=qi(s,e,r),l===e&&l!==s)return!1}else if("<="===s.operator&&!Bi(s.semver,String(e),r))return!1;if(!e.operator&&(s||n)&&0!==a)return!1}return!(n&&c&&!s&&0!==a)&&(!(s&&u&&!n&&0!==a)&&(!d&&!h))},Ki=(e,t,r)=>{if(!e)return t;const i=Vi(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},qi=(e,t,r)=>{if(!e)return t;const i=Vi(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};var Wi=(e,t,r={})=>{if(e===t)return!0;e=new ji(e,r),t=new ji(t,r);let i=!1;e:for(const n of e.set){for(const e of t.set){const t=Ui(n,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0};const Gi=It,Xi=Dt,Ji=Ht,Yi=Nt,Zi=(e,t,r)=>{const i=[];let n=null,s=null;const a=e.sort(((e,t)=>Fi(e,t,r)));for(const e of a){Ni(e,t,r)?(s=e,n||(n=e)):(s&&i.push([n,s]),s=null,n=null)}n&&i.push([n,null]);const o=[];for(const[e,t]of i)e===t?o.push(e):t||e!==a[0]?t?e===a[0]?o.push(`<=${t}`):o.push(`${e} - ${t}`):o.push(`>=${e}`):o.push("*");const l=o.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t};var Qi={parse:Kt,valid:Wt,clean:Xt,inc:Yt,diff:Qt,major:tr,minor:ir,patch:sr,prerelease:or,compare:cr,rcompare:hr,compareLoose:fr,compareBuild:vr,sort:gr,rsort:mr,gt:Er,lt:Sr,eq:xr,neq:Dr,gte:Ir,lte:Ar,cmp:$r,coerce:Qr,Comparator:ri(),Range:ti(),satisfies:ni,toComparators:ai,maxSatisfying:ci,minSatisfying:di,minVersion:_i,validRange:yi,outside:Ri,gtr:Pi,ltr:Ti,intersects:Ci,simplifyRange:Zi,subset:Wi,SemVer:Ji,re:Gi.re,src:Gi.src,tokens:Gi.t,SEMVER_SPEC_VERSION:Xi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Xi.RELEASE_TYPES,compareIdentifiers:Yi.compareIdentifiers,rcompareIdentifiers:Yi.rcompareIdentifiers};Object.defineProperty(xt,"__esModule",{value:!0});const en=Qi,tn=a,rn=/^\d+(\.\d+)?(\.\d+)?/;function nn(e){if(tn.TypeValidators.String.is(e)&&!e.startsWith("v")){const t=(0,en.parse)(e);if(t)return t;const r=rn.exec(e);if(r){let t=r[0];for(let e=1;e<r.length;e+=1)void 0===r[e]&&(t+=".0");return t+=e.substring(r[0].length),(0,en.parse)(t)}}return null}function sn(e){return(t,r)=>{const i=nn(t),n=nn(r);return!!(i&&n&&e(i,n))}}function an(e,t,r){return(i,n)=>!(!t.is(i)||!t.is(n))&&(r?e(r(i),r(n)):e(i,n))}function on(e){return"number"==typeof e?e:Date.parse(e)}const ln={in:(e,t)=>e===t,endsWith:an(((e,t)=>e.endsWith(t)),tn.TypeValidators.String),startsWith:an(((e,t)=>e.startsWith(t)),tn.TypeValidators.String),matches:an(((e,t)=>function(e,t){try{return new RegExp(e).test(t)}catch(e){return!1}}(t,e)),tn.TypeValidators.String),contains:an(((e,t)=>e.indexOf(t)>-1),tn.TypeValidators.String),lessThan:an(((e,t)=>e<t),tn.TypeValidators.Number),lessThanOrEqual:an(((e,t)=>e<=t),tn.TypeValidators.Number),greaterThan:an(((e,t)=>e>t),tn.TypeValidators.Number),greaterThanOrEqual:an(((e,t)=>e>=t),tn.TypeValidators.Number),before:an(((e,t)=>e<t),tn.TypeValidators.Date,on),after:an(((e,t)=>e>t),tn.TypeValidators.Date,on),semVerEqual:sn(((e,t)=>0===e.compare(t))),semVerLessThan:sn(((e,t)=>e.compare(t)<0)),semVerGreaterThan:sn(((e,t)=>e.compare(t)>0))};xt.default=class{static is(e){return Object.prototype.hasOwnProperty.call(ln,e)}static execute(e,t,r){var i,n;return null!==(n=null===(i=ln[e])||void 0===i?void 0:i.call(ln,t,r))&&void 0!==n&&n}},Object.defineProperty(kt,"__esModule",{value:!0}),kt.maybeNegate=void 0;const cn=xt;function un(e,t){return e.negate?!t:t}function hn(e,t,r){return r.some((r=>cn.default.execute(e,t,r)))}kt.maybeNegate=un,kt.default=function(e,t){const r=t.valueForKind(e.attributeReference,e.contextKind);return null!=r&&(Array.isArray(r)?un(e,r.some((t=>hn(e.op,t,e.values)))):un(e,hn(e.op,r,e.values)))};var dn={};function fn(e,t,r,i){if(t)for(let r=0;r<t.length;r+=1){const i=t[r],n=e.key(i.contextKind);if(n)if(i.generated_valuesSet){if(i.generated_valuesSet.has(n))return!0}else if(i.values.includes(n))return!0}if(i){const t=e.key("user");if(t&&i.has(t))return!0}else if(r){const t=e.key("user");if(t&&r.includes(t))return!0}return!1}Object.defineProperty(dn,"__esModule",{value:!0}),dn.default=function(e,t){if(fn(t,e.includedContexts,e.included,e.generated_includedSet))return!0;const r=fn(t,e.excludedContexts,e.excluded,e.generated_excludedSet);return r?!r:void 0},Object.defineProperty(ct,"__esModule",{value:!0});const pn=a,vn=ut,_n=rt,gn=nt,yn=ht,mn=St,bn=kt,En=dn,wn=st,Sn=dt,{ErrorKinds:kn}=pn.internal,xn={HEALTHY:1,STALE:2,STORE_ERROR:3,NOT_CONFIGURED:4};function On(e){return void 0!==e&&xn[e]||0}function Dn(e,t){return void 0!==e&&On(e)>On(t)?e:t}function Rn(e){return{error:!1,isMatch:e,result:void 0}}function In(e){return{error:!0,isMatch:!1,result:e}}ct.default=class{constructor(e,t){this._queries=t,this._bucketer=new vn.default(e.crypto)}async evaluate(e,t,r){return new Promise((i=>{this.evaluateCb(e,t,i,r)}))}evaluateCb(e,t,r,i){const n={};this._evaluateInternal(e,t,n,[],(e=>{n.bigSegmentsStatus&&(e.detail.reason=Object.assign(Object.assign({},e.detail.reason),{bigSegmentsStatus:n.bigSegmentsStatus})),n.prerequisites&&(e.prerequisites=n.prerequisites),e.events=n.events,r(e)}),!0,i)}_evaluateInternal(e,t,r,i,n,s,a){e.on?this._checkPrerequisites(e,t,r,i,(i=>{if(i)return void n(i);const s=(0,yn.default)(e,t);s?n(s):this._evaluateRules(e,t,r,(r=>{n(r||this._variationForContext(e.fallthrough,t,e,wn.default.Fallthrough))}))}),s,a):n((0,Sn.getOffVariation)(e,wn.default.Off))}_checkPrerequisites(e,t,r,i,n,s,a){let o;e.prerequisites&&e.prerequisites.length?(0,_n.allSeriesAsync)(e.prerequisites,((n,l,c)=>{if(-1!==i.indexOf(n.key))return o=gn.default.forError(kn.MalformedFlag,`Prerequisite of ${e.key} causing a circular reference. This is probably a temporary condition due to an incomplete update.`),void c(!0);const u=[...i,n.key];this._queries.getFlag(n.key,(i=>{if(!i)return o=(0,Sn.getOffVariation)(e,wn.default.prerequisiteFailed(n.key)),void c(!1);this._evaluateInternal(i,t,r,u,(l=>{var u,h;return null!==(u=r.events)&&void 0!==u||(r.events=[]),s&&(null!==(h=r.prerequisites)&&void 0!==h||(r.prerequisites=[]),r.prerequisites.push(i.key)),a&&r.events.push(a.evalEventServer(i,t,l.detail,null,e)),l.isError?(o=l,c(!1)):l.isOff||l.detail.variationIndex!==n.variation?(o=(0,Sn.getOffVariation)(e,wn.default.prerequisiteFailed(n.key)),c(!1)):c(!0)}),!1,a)}))}),(()=>{n(o)})):n(void 0)}_evaluateRules(e,t,r,i){let n;(0,_n.firstSeriesAsync)(e.rules,((i,s,a)=>{this._ruleMatchContext(e,i,s,t,r,[],(e=>{n=e,a(!!e)}))}),(()=>i(n)))}_clauseMatchContext(e,t,r,i,n){let s;"segmentMatch"!==e.op?e.attributeReference.isValid?n(Rn((0,bn.default)(e,t))):n(In(gn.default.forError(kn.MalformedFlag,"Invalid attribute reference in clause"))):(0,_n.firstSeriesAsync)(e.values,((e,n,a)=>{this._queries.getSegment(e,(e=>{if(e){if(r.includes(e.key))return s=gn.default.forError(kn.MalformedFlag,`Segment rule referencing segment ${e.key} caused a circular reference. This is probably a temporary condition due to an incomplete update`),void a(!0);const n=[...r,null==e?void 0:e.key];this.segmentMatchContext(e,t,i,n,(e=>{e.error&&(s=e.result),a(e.error||e.isMatch)}))}else a(!1)}))}),(t=>n(s?In(s):Rn((0,bn.maybeNegate)(e,t)))))}_ruleMatchContext(e,t,r,i,n,s,a){if(!t.clauses)return void a(void 0);let o;(0,_n.allSeriesAsync)(t.clauses,((e,t,r)=>{this._clauseMatchContext(e,i,s,n,(e=>(o=e.result,r(e.error||e.isMatch))))}),(n=>a(o||(n?this._variationForContext(t,i,e,wn.default.ruleMatch(t.id,r)):void 0))))}_variationForContext(e,t,r,i){if(void 0===e)return gn.default.forError(kn.MalformedFlag,"Fallthrough variation undefined");if(void 0!==e.variation)return(0,Sn.getVariation)(r,e.variation,i);if(e.rollout){const{rollout:n}=e,{variations:s}=n,a="experiment"===n.kind;if(s&&s.length){const e=(0,Sn.getBucketBy)(a,n.bucketByAttributeReference);if(!e.isValid)return gn.default.forError(kn.MalformedFlag,"Invalid attribute reference for bucketBy in rollout");const[o,l]=this._bucketer.bucket(t,r.key,e,r.salt||"",n.contextKind,n.seed),c=Object.assign({},i);let u=0;for(let e=0;e<s.length;e+=1){const t=s[e];if(u+=t.weight/1e5,o<u)return a&&l&&!t.untracked&&(c.inExperiment=!0),(0,Sn.getVariation)(r,t.variation,c)}const h=s[s.length-1];return a&&!h.untracked&&(c.inExperiment=!0),(0,Sn.getVariation)(r,h.variation,c)}}return gn.default.forError(kn.MalformedFlag,"Variation/rollout object with no variation or rollout")}segmentRuleMatchContext(e,t,r,i,n,s){let a;(0,_n.allSeriesAsync)(t.clauses,((e,t,s)=>{this._clauseMatchContext(e,r,n,i,(e=>{a=e.result,s(e.error||e.isMatch)}))}),(i=>{if(a)return s(In(a));if(i){if(void 0===t.weight)return s(Rn(i));const n=(0,Sn.getBucketBy)(!1,t.bucketByAttributeReference);if(!n.isValid)return s(In(gn.default.forError(kn.MalformedFlag,"Invalid attribute reference in clause")));const[a]=this._bucketer.bucket(r,e.key,n,e.salt||"",t.rolloutContextKind);return s(Rn(a<t.weight/1e5))}return s(Rn(!1))}))}simpleSegmentMatchContext(e,t,r,i,n){if(!e.unbounded){const r=(0,En.default)(e,t);if(void 0!==r)return void n(Rn(r))}let s;(0,_n.firstSeriesAsync)(e.rules,((n,a,o)=>{this.segmentRuleMatchContext(e,n,t,r,i,(e=>(s=e.result,o(e.error||e.isMatch))))}),(e=>n(s?In(s):Rn(e))))}segmentMatchContext(e,t,r,i,n){if(!e.unbounded)return void this.simpleSegmentMatchContext(e,t,r,i,n);const s=e.unboundedContextKind||"user",a=t.key(s);if(a)return e.generation?void(r.bigSegmentsMembership&&r.bigSegmentsMembership[a]?this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n):this._queries.getBigSegmentsMembership(a).then((i=>{if(r.bigSegmentsMembership=r.bigSegmentsMembership||{},i){const[e,t]=i;r.bigSegmentsMembership[a]=e,r.bigSegmentsStatus=Dn(r.bigSegmentsStatus,t)}else r.bigSegmentsStatus=Dn(r.bigSegmentsStatus,"NOT_CONFIGURED");this.bigSegmentMatchContext(r.bigSegmentsMembership[a],e,t,r).then(n)}))):(r.bigSegmentsStatus=Dn(r.bigSegmentsStatus,"NOT_CONFIGURED"),void n(Rn(!1)));n(Rn(!1))}bigSegmentMatchContext(e,t,r,i){const n=(0,mn.default)(t),s=null==e?void 0:e[n];return new Promise((e=>{null==s?this.simpleSegmentMatchContext(t,r,i,[],e):e(Rn(s))}))}};var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});const An=W;Pn.default=class{constructor(e){this._contextKeysCache=new An.default({max:e.contextKeysCapacity}),this.flushInterval=e.contextKeysFlushInterval}processContext(e){const{canonicalKey:t}=e,r=this._contextKeysCache.get(t);return this._contextKeysCache.set(t,!0),!r}flush(){this._contextKeysCache.clear()}};var Tn={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.default=function(e,t){if(t){if(t.inExperiment)return!0;switch(t.kind){case"RULE_MATCH":{const r=t.ruleIndex;if(void 0!==r){const t=e.rules||[];return r>=0&&r<t.length&&!!t[r].trackEvents}break}case"FALLTHROUGH":return!!e.trackEventsFallthrough}}return!1},Object.defineProperty(Tn,"__esModule",{value:!0});const Cn=a,Nn=Mn;class Fn extends Cn.internal.EventFactoryBase{evalEventServer(e,t,r,i,n){var s;const a=(0,Nn.default)(e,r.reason);return super.evalEvent({addExperimentData:a,context:t,debugEventsUntilDate:e.debugEventsUntilDate,defaultVal:i,excludeFromSummaries:e.excludeFromSummaries,flagKey:e.key,prereqOfFlagKey:null==n?void 0:n.key,reason:r.reason,samplingRatio:e.samplingRatio,trackEvents:e.trackEvents||a,value:r.value,variation:null!==(s=r.variationIndex)&&void 0!==s?s:void 0,version:e.version})}}Tn.default=Fn;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.default=class{constructor(e,t){this._valid=e,this._withReasons=t,this._flagValues={},this._flagMetadata={}}addFlag(e,t,r,i,n,s,a,o){this._flagValues[e.key]=t;const l={};void 0!==r&&(l.variation=r);const c=a&&!n&&!s&&void 0===e.debugEventsUntilDate;c||(l.version=e.version),i&&(s||this._withReasons&&!c)&&(l.reason=i),n&&(l.trackEvents=!0),s&&(l.trackReason=!0),void 0!==e.debugEventsUntilDate&&(l.debugEventsUntilDate=e.debugEventsUntilDate),o&&o.length&&(l.prerequisites=o),this._flagMetadata[e.key]=l}build(){return{valid:this._valid,allValues:()=>this._flagValues,getFlagValue:e=>this._flagValues[e],getFlagReason:e=>{var t;return null!==(t=this._flagMetadata[e]?this._flagMetadata[e].reason:null)&&void 0!==t?t:null},toJSON:()=>Object.assign(Object.assign({},this._flagValues),{$flagsState:this._flagMetadata,$valid:this._valid})}}};var $n={};Object.defineProperty($n,"__esModule",{value:!0});const Ln="unknown hook";$n.default=class{constructor(e,t){this._logger=e,this._hooks=[],this._hooks.push(...t)}async withEvaluationSeries(e,t,r,i,n,s){return 0===this._hooks.length?n():this.withEvaluationSeriesExtraDetail(e,t,r,i,(async()=>({detail:await n()})),s).then((({detail:e})=>e))}async withEvaluationSeriesExtraDetail(e,t,r,i,n,s){if(0===this._hooks.length)return n();const{hooks:a,hookContext:o}=this._prepareHooks(e,t,r,i,s),l=this._executeBeforeEvaluation(a,o),c=await n();return this._executeAfterEvaluation(a,o,l,c.detail),c}_tryExecuteStage(e,t,r){var i;try{return r()}catch(r){return null===(i=this._logger)||void 0===i||i.error(`An error was encountered in "${e}" of the "${t}" hook: ${r}`),{}}}_hookName(e){var t,r;try{return null!==(t=null==e?void 0:e.getMetadata().name)&&void 0!==t?t:Ln}catch(e){return null===(r=this._logger)||void 0===r||r.error("Exception thrown getting metadata for hook. Unable to get hook name."),Ln}}_executeAfterEvaluation(e,t,r,i){var n;for(let s=e.length-1;s>=0;s-=1){const a=e[s],o=null!==(n=r[s])&&void 0!==n?n:{};this._tryExecuteStage("afterEvaluation",this._hookName(a),(()=>{var e,r;return null!==(r=null===(e=null==a?void 0:a.afterEvaluation)||void 0===e?void 0:e.call(a,t,o,i))&&void 0!==r?r:{}}))}}_executeBeforeEvaluation(e,t){return e.map((e=>this._tryExecuteStage("beforeEvaluation",this._hookName(e),(()=>{var r,i;return null!==(i=null===(r=null==e?void 0:e.beforeEvaluation)||void 0===r?void 0:r.call(e,t,{}))&&void 0!==i?i:{}}))))}_prepareHooks(e,t,r,i,n){return{hooks:[...this._hooks],hookContext:{flagKey:e,context:t,defaultValue:r,method:i,environmentId:n}}}addHook(e){this._hooks.push(e)}};var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});const Vn=a;function zn(e){const t=e.old,r=e.new;return!(void 0!==t&&!Vn.TypeValidators.Boolean.is(t))&&!(void 0!==r&&!Vn.TypeValidators.Boolean.is(r))}function Hn(e){if(Vn.TypeValidators.String.is(e.key)&&""!==e.key){if("latency_ms"===e.key){if(!Vn.TypeValidators.Object.is(e.values))return;if(!function(e){const t=e.old,r=e.new;return!(void 0!==t&&!Vn.TypeValidators.Number.is(t)||void 0!==r&&!Vn.TypeValidators.Number.is(r))}(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"error"===e.key}(e)){if(!Vn.TypeValidators.Object.is(e.values))return;if(!zn(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}if(function(e){return"consistent"===e.key}(e)){if(!Vn.TypeValidators.Boolean.is(e.value)||!Vn.TypeValidators.Number.is(e.samplingRatio))return;return{key:e.key,value:e.value,samplingRatio:e.samplingRatio}}if(function(e){return"invoked"===e.key}(e)){if(!Vn.TypeValidators.Object.is(e.values))return;if(!zn(e.values))return;return{key:e.key,values:{old:e.values.old,new:e.values.new}}}}}Bn.default=function(e){var t,r;if("migration_op"!==e.kind)return;if(r=e.operation,!Vn.TypeValidators.String.is(r)||"read"!==r&&"write"!==r)return;if(!Vn.TypeValidators.Number.is(e.creationDate))return;const i={};if(Vn.TypeValidators.Object.is(e.context)){const t=Vn.Context.fromLDContext(e.context);t.valid&&(i.context=t)}else Vn.TypeValidators.Object.is(e.contextKeys)&&Object.keys(e.contextKeys).every((e=>Vn.TypeValidators.Kind.is(e)))&&Object.values(e.contextKeys).every((e=>Vn.TypeValidators.String.is(e)&&""!==e))&&(i.contextKeys=Object.assign({},e.contextKeys));if(!i.context&&!i.contextKeys)return;const n=null!==(t=e.samplingRatio)&&void 0!==t?t:1;if(!Vn.TypeValidators.Number.is(n))return;const s=function(e){if(!Vn.TypeValidators.String.is(e.key)||""===e.key)return;if(!Vn.TypeValidators.Object.is(e.reason))return;if(!Vn.TypeValidators.String.is(e.reason.kind)||""===e.reason.kind)return;const t={key:e.key,value:e.value,default:e.default,reason:{kind:e.reason.kind}},r=e.reason,i=t.reason;return Vn.TypeValidators.String.is(r.errorKind)&&(i.errorKind=r.errorKind),Vn.TypeValidators.String.is(r.ruleId)&&(i.ruleId=r.ruleId),Vn.TypeValidators.String.is(r.prerequisiteKey)&&(i.prerequisiteKey=r.prerequisiteKey),Vn.TypeValidators.Boolean.is(r.inExperiment)&&(i.inExperiment=r.inExperiment),Vn.TypeValidators.Number.is(r.ruleIndex)&&(i.ruleIndex=r.ruleIndex),Vn.TypeValidators.String.is(r.bigSegmentsStatus)&&(i.bigSegmentsStatus=r.bigSegmentsStatus),void 0!==e.variation&&Vn.TypeValidators.Number.is(e.variation)&&(t.variation=e.variation),void 0!==e.version&&Vn.TypeValidators.Number.is(e.version)&&(t.version=e.version),t}(e.evaluation);var a;return s?Object.assign(Object.assign({kind:e.kind,operation:e.operation,creationDate:e.creationDate},i),{measurements:(a=e.measurements,a.map(Hn).filter((e=>void 0!==e))),evaluation:s,samplingRatio:n}):void 0};var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const Kn=a,qn=l;function Wn(e){return!Number.isNaN(e)}Un.default=class{constructor(e,t,r,i,n,s,a,o,l,c){this._flagKey=e,this._context=t,this._defaultStage=r,this._stage=i,this._reason=n,this._checkRatio=s,this._variation=a,this._version=o,this._samplingRatio=l,this._logger=c,this._errors={old:!1,new:!1},this._wasInvoked={old:!1,new:!1},this._consistencyCheck=qn.LDConsistencyCheck.NotChecked,this._latencyMeasurement={old:NaN,new:NaN}}op(e){this._operation=e}error(e){this._errors[e]=!0}consistency(e){var t,r;if(Kn.internal.shouldSample(null!==(t=this._checkRatio)&&void 0!==t?t:1))try{const t=e();this._consistencyCheck=t?qn.LDConsistencyCheck.Consistent:qn.LDConsistencyCheck.Inconsistent}catch(e){null===(r=this._logger)||void 0===r||r.error(`Exception when executing consistency check function for migration '${this._flagKey}' the consistency check will not be included in the generated migration op event. Exception: ${e}`)}}latency(e,t){this._latencyMeasurement[e]=t}invoked(e){this._wasInvoked[e]=!0}createEvent(){var e,t,r,i,n;if(!Kn.TypeValidators.String.is(this._flagKey)||""===this._flagKey)return void(null===(e=this._logger)||void 0===e||e.error("The flag key for a migration operation must be a non-empty string."));if(!this._operation)return void(null===(t=this._logger)||void 0===t||t.error('The operation must be set using "op" before an event can be created.'));if(!Kn.Context.fromLDContext(this._context).valid)return void(null===(r=this._logger)||void 0===r||r.error("The migration was not done against a valid context and cannot generate an event."));if(!this._wasInvoked.old&&!this._wasInvoked.new)return void(null===(i=this._logger)||void 0===i||i.error('The migration invoked neither the "old" or "new" implementation andan event cannot be generated'));if(!this._measurementConsistencyCheck())return;const s=[];return this._populateInvoked(s),this._populateConsistency(s),this._populateLatency(s),this._populateErrors(s),{kind:"migration_op",operation:this._operation,creationDate:Date.now(),context:this._context,evaluation:{key:this._flagKey,value:this._stage,default:this._defaultStage,reason:this._reason,variation:this._variation,version:this._version},measurements:s,samplingRatio:null!==(n=this._samplingRatio)&&void 0!==n?n:1}}_logTag(){return`For migration ${this._operation}-${this._flagKey}:`}_latencyConsistencyMessage(e){return`Latency measurement for "${e}", but "${e}" was not invoked.`}_errorConsistencyMessage(e){return`Error occurred for "${e}", but "${e}" was not invoked.`}_consistencyCheckConsistencyMessage(e){return`Consistency check was done, but "${e}" was not invoked.Both "old" and "new" must be invoked to do a consistency check.`}_checkOriginEventConsistency(e){var t,r,i;return!!this._wasInvoked[e]||(Number.isNaN(this._latencyMeasurement[e])?this._errors[e]?(null===(r=this._logger)||void 0===r||r.error(`${this._logTag()} ${this._errorConsistencyMessage(e)}`),!1):this._consistencyCheck===qn.LDConsistencyCheck.NotChecked||(null===(i=this._logger)||void 0===i||i.error(`${this._logTag()} ${this._consistencyCheckConsistencyMessage(e)}`),!1):(null===(t=this._logger)||void 0===t||t.error(`${this._logTag()} ${this._latencyConsistencyMessage(e)}`),!1))}_measurementConsistencyCheck(){return this._checkOriginEventConsistency("old")&&this._checkOriginEventConsistency("new")}_populateInvoked(e){var t;const r={key:"invoked",values:{}};this._wasInvoked.old||this._wasInvoked.new||null===(t=this._logger)||void 0===t||t.error("Migration op completed without executing any origins (old/new)."),this._wasInvoked.old&&(r.values.old=!0),this._wasInvoked.new&&(r.values.new=!0),e.push(r)}_populateConsistency(e){var t;void 0!==this._consistencyCheck&&this._consistencyCheck!==qn.LDConsistencyCheck.NotChecked&&e.push({key:"consistent",value:this._consistencyCheck===qn.LDConsistencyCheck.Consistent,samplingRatio:null!==(t=this._checkRatio)&&void 0!==t?t:1})}_populateErrors(e){if(this._errors.new||this._errors.old){const t={key:"error",values:{}};this._errors.new&&(t.values.new=!0),this._errors.old&&(t.values.old=!0),e.push(t)}}_populateLatency(e){const t=Wn(this._latencyMeasurement.new),r=Wn(this._latencyMeasurement.old);if(t||r){const i={};t&&(i.new=this._latencyMeasurement.new),r&&(i.old=this._latencyMeasurement.old),e.push({key:"latency_ms",values:i})}}},Object.defineProperty(s,"__esModule",{value:!0});const Gn=a,Xn=o,Jn=q,Yn=Y,Zn=ue,Qn=ye,es=We,ts=Xe,rs=Ye,is=rt,ns=nt,ss=ct,as=Pn,os=Tn,ls=Mn,cs=jn,us=$n,hs=Bn,ds=Un,fs=Ze,ps=Q,{ClientMessages:vs,ErrorKinds:_s,NullEventProcessor:gs}=Gn.internal;var ys;!function(e){e[e.Initializing=0]="Initializing",e[e.Initialized=1]="Initialized",e[e.Failed=2]="Failed"}(ys||(ys={}));s.default=class{get logger(){return this._logger}constructor(e,t,r,i,n){var s,a,o,l,c;this._sdkKey=e,this._platform=t,this._initState=ys.Initializing,this._eventFactoryDefault=new os.default(!1),this._eventFactoryWithReasons=new os.default(!0),this._onError=i.onError,this._onFailed=i.onFailed,this._onReady=i.onReady;const{onUpdate:u,hasEventListeners:h}=i,d=new fs.default(r,n);if(this._hookRunner=new us.default(d.logger,d.hooks||[]),!e&&!d.offline)throw new Error("You must configure the client with an SDK key");this._config=d,this._logger=d.logger;const f=(0,Gn.defaultHeaders)(e,t.info,d.tags),p=new Gn.ClientContext(e,d,t),v=d.featureStoreFactory(p),_=new Zn.default(v,h,u);!d.sendEvents||d.offline||d.diagnosticOptOut||(this._diagnosticsManager=new Gn.internal.DiagnosticsManager(e,t,(0,rs.default)(d,t,v))),!d.sendEvents||d.offline?this._eventProcessor=new gs:this._eventProcessor=new Gn.internal.EventProcessor(d,p,f,new as.default(d),this._diagnosticsManager),this._featureStore=v;const g=new Jn.default(null===(a=null===(s=d.bigSegments)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,p),null!==(o=d.bigSegments)&&void 0!==o?o:{},d.logger,this._platform.crypto);this._bigSegmentsManager=g,this.bigSegmentStatusProviderInternal=g.statusProvider;const y={getFlag(e,t){v.get(ps.default.Features,e,(e=>t(e)))},getSegment(e,t){v.get(ps.default.Segments,e,(e=>t(e)))},getBigSegmentsMembership:e=>g.getUserMembership(e)};this._evaluator=new ss.default(this._platform,y);const m=(0,Yn.createStreamListeners)(_,this._logger,{put:()=>this._initSuccess()}),b=()=>d.stream?new ts.default(p,"/all",[],m,f,this._diagnosticsManager,(e=>this._dataSourceErrorHandler(e)),this._config.streamInitialReconnectDelay):new Qn.default(d,new es.default(d,this._platform.requests,f),_,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e)));d.offline||d.useLdd||(this._updateProcessor=null!==(c=null===(l=d.updateProcessorFactory)||void 0===l?void 0:l.call(d,p,_,(()=>this._initSuccess()),(e=>this._dataSourceErrorHandler(e))))&&void 0!==c?c:b()),this._updateProcessor&&this._updateProcessor.start()}initialized(){return this._initState===ys.Initialized}waitForInitialization(e){var t,r;return void 0===(null==e?void 0:e.timeout)&&void 0!==this._updateProcessor&&(null===(t=this._logger)||void 0===t||t.warn("The waitForInitialization function was called without a timeout specified. In a future version a default timeout will be applied.")),void 0!==(null==e?void 0:e.timeout)&&(null==e?void 0:e.timeout)>60&&void 0!==this._updateProcessor&&(null===(r=this._logger)||void 0===r||r.warn("The waitForInitialization function was called with a timeout greater than 60 seconds. We recommend a timeout of less than 60 seconds.")),this._initializedPromise?this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger):this._initState===ys.Initialized?(this._initializedPromise=Promise.resolve(this),this._initializedPromise):this._initState===ys.Failed?(this._initializedPromise=Promise.reject(this._rejectionReason),this._initializedPromise):(this._initializedPromise||(this._initializedPromise=new Promise(((e,t)=>{this._initResolve=e,this._initReject=t}))),this._clientWithTimeout(this._initializedPromise,null==e?void 0:e.timeout,this._logger))}variation(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))}))),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId).then((e=>(null==i||i(null,e.value),e.value)))}variationDetail(e,t,r,i){var n,s,a;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.variationDetail",(()=>new Promise((n=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{n(e.detail),null==i||i(null,e.detail)}))}))),null===(a=null===(s=(n=this._featureStore).getInitMetaData)||void 0===s?void 0:s.call(n))||void 0===a?void 0:a.environmentId)}_typedEval(e,t,r,i,n,s){var a,o,l;return this._hookRunner.withEvaluationSeries(e,t,r,n,(()=>new Promise((n=>{this._evaluateIfPossible(e,t,r,i,(e=>{const t={value:e.detail.value,reason:e.detail.reason,variationIndex:e.detail.variationIndex};n(t)}),s)}))),null===(l=null===(o=(a=this._featureStore).getInitMetaData)||void 0===o?void 0:o.call(a))||void 0===l?void 0:l.environmentId)}async boolVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.boolVariation",(e=>[Gn.TypeValidators.Boolean.is(e),Gn.TypeValidators.Boolean.getType()]))).value}async numberVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.numberVariation",(e=>[Gn.TypeValidators.Number.is(e),Gn.TypeValidators.Number.getType()]))).value}async stringVariation(e,t,r){return(await this._typedEval(e,t,r,this._eventFactoryDefault,"LDClient.stringVariation",(e=>[Gn.TypeValidators.String.is(e),Gn.TypeValidators.String.getType()]))).value}jsonVariation(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariation",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryDefault,(e=>{i(e.detail)}))}))),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId).then((e=>e.value))}boolVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.boolVariationDetail",(e=>[Gn.TypeValidators.Boolean.is(e),Gn.TypeValidators.Boolean.getType()]))}numberVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.numberVariationDetail",(e=>[Gn.TypeValidators.Number.is(e),Gn.TypeValidators.Number.getType()]))}stringVariationDetail(e,t,r){return this._typedEval(e,t,r,this._eventFactoryWithReasons,"LDClient.stringVariationDetail",(e=>[Gn.TypeValidators.String.is(e),Gn.TypeValidators.String.getType()]))}jsonVariationDetail(e,t,r){var i,n,s;return this._hookRunner.withEvaluationSeries(e,t,r,"LDClient.jsonVariationDetail",(()=>new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(e=>{i(e.detail)}))}))),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)}async _migrationVariationInternal(e,t,r){var i;const n=await new Promise((i=>{this._evaluateIfPossible(e,t,r,this._eventFactoryWithReasons,(({detail:t},n)=>{if((0,Xn.IsMigrationStage)(t.value))i({detail:t,flag:n});else{const t=new Error(`Unrecognized MigrationState for "${e}"; returning default value.`);this._onError(t);const s={kind:"ERROR",errorKind:_s.WrongType};i({detail:{value:r,reason:s},flag:n})}}))})),{detail:s,flag:a}=n,o=null===(i=null==a?void 0:a.migration)||void 0===i?void 0:i.checkRatio,l=null==a?void 0:a.samplingRatio;return{detail:s,migration:{value:s.value,tracker:new ds.default(e,t,r,s.value,s.reason,o,null===s.variationIndex?void 0:s.variationIndex,null==a?void 0:a.version,l,this._logger)}}}async migrationVariation(e,t,r){var i,n,s;return(await this._hookRunner.withEvaluationSeriesExtraDetail(e,t,r,"LDClient.migrationVariation",(()=>this._migrationVariationInternal(e,t,r)),null===(s=null===(n=(i=this._featureStore).getInitMetaData)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.environmentId)).migration}allFlagsState(e,t,r){var i,n,s;if(this._config.offline){null===(i=this._logger)||void 0===i||i.info("allFlagsState() called in offline mode. Returning empty state.");const e=new cs.default(!1,!1).build();return null==r||r(null,e),Promise.resolve(e)}const a=Gn.Context.fromLDContext(e);return a.valid?new Promise((e=>{const i=i=>this._featureStore.all(ps.default.Features,(n=>{const s=new cs.default(i,!!(null==t?void 0:t.withReasons)),o=!!(null==t?void 0:t.clientSideOnly),l=!!(null==t?void 0:t.detailsOnlyForTrackedFlags);(0,is.allAsync)(Object.values(n),((e,t)=>{var r;const i=e;!o||(null===(r=i.clientSideAvailability)||void 0===r?void 0:r.usingEnvironmentId)?this._evaluator.evaluateCb(i,a,(e=>{var r;e.isError&&this._onError(new Error(`Error for feature flag "${i.key}" while evaluating all flags: ${e.message}`));const n=(0,ls.default)(i,e.detail.reason);s.addFlag(i,e.detail.value,null!==(r=e.detail.variationIndex)&&void 0!==r?r:void 0,e.detail.reason,i.trackEvents||n,n,l,e.prerequisites),t(!0)})):t(!0)}),(()=>{const t=s.build();null==r||r(null,t),e(t)}))}));this.initialized()?i(!0):this._featureStore.initialized((e=>{var t,r;let n=!0;e?null===(t=this._logger)||void 0===t||t.warn("Called allFlagsState before client initialization; using last known values from data store"):(null===(r=this._logger)||void 0===r||r.warn("Called allFlagsState before client initialization. Data store not available; returning empty state"),n=!1),i(n)}))})):(null===(n=this._logger)||void 0===n||n.info(`${null!==(s=a.message)&&void 0!==s?s:"Invalid context."}. Returning empty state.`),Promise.resolve(new cs.default(!1,!1).build()))}secureModeHash(e){const t=Gn.Context.fromLDContext(e),r=t.valid?t.canonicalKey:void 0;if(!this._platform.crypto.createHmac)throw new Error("Platform must implement createHmac");const i=this._platform.crypto.createHmac("sha256",this._sdkKey);if(void 0===r)throw new Gn.LDClientError("Could not generate secure mode hash for invalid context");return i.update(r),i.digest("hex")}close(){var e;this._eventProcessor.close(),null===(e=this._updateProcessor)||void 0===e||e.close(),this._featureStore.close(),this._bigSegmentsManager.close()}isOffline(){return this._config.offline}track(e,t,r,i){var n,s;const a=Gn.Context.fromLDContext(t);a.valid?(void 0===i||Gn.TypeValidators.Number.is(i)||null===(s=this._logger)||void 0===s||s.warn(vs.invalidMetricValue(typeof i)),this._eventProcessor.sendEvent(this._eventFactoryDefault.customEvent(e,a,r,i))):null===(n=this._logger)||void 0===n||n.warn(vs.MissingContextKeyNoEvent)}trackMigration(e){const t=(0,hs.default)(e);t&&this._eventProcessor.sendEvent(t)}identify(e){var t;const r=Gn.Context.fromLDContext(e);r.valid?this._eventProcessor.sendEvent(this._eventFactoryDefault.identifyEvent(r)):null===(t=this._logger)||void 0===t||t.warn(vs.MissingContextKeyNoEvent)}async flush(e){try{await this._eventProcessor.flush()}catch(t){return null==e?void 0:e(t,!1)}return null==e?void 0:e(null,!0)}addHook(e){this._hookRunner.addHook(e)}_variationInternal(e,t,r,i,n,s){var a,o;if(this._config.offline)return null===(a=this._logger)||void 0===a||a.info("Variation called in offline mode. Returning default value."),void n(ns.default.forError(_s.ClientNotReady,void 0,r));const l=Gn.Context.fromLDContext(t);if(!l.valid)return this._onError(new Gn.LDClientError(`${null!==(o=l.message)&&void 0!==o?o:"Context not valid;"} returning default value.`)),void n(ns.default.forError(_s.UserNotSpecified,void 0,r));this._featureStore.get(ps.default.Features,e,(t=>{const a=t;if(!a){const t=new Gn.LDClientError(`Unknown feature flag "${e}"; returning default value`);this._onError(t);const i=ns.default.forError(_s.FlagNotFound,void 0,r);return this._eventProcessor.sendEvent(this._eventFactoryDefault.unknownFlagEvent(e,r,l)),void n(i)}this._evaluator.evaluateCb(a,l,(t=>{var o;if(void 0!==t.detail.variationIndex&&null!==t.detail.variationIndex||(null===(o=this._logger)||void 0===o||o.debug("Result value is null in variation"),t.setDefault(r)),s){const[o,c]=s(t.detail.value);if(!o){const t=ns.default.forError(_s.WrongType,`Did not receive expected type (${c}) evaluating feature flag "${e}"`,r);return this._sendEvalEvent(t,i,a,l,r),void n(t,a)}}this._sendEvalEvent(t,i,a,l,r),n(t,a)}),i)}))}_sendEvalEvent(e,t,r,i,n){var s;null===(s=e.events)||void 0===s||s.forEach((e=>{this._eventProcessor.sendEvent(Object.assign({},e))})),this._eventProcessor.sendEvent(t.evalEventServer(r,i,e.detail,n,void 0))}_evaluateIfPossible(e,t,r,i,n,s){this.initialized()?this._variationInternal(e,t,r,i,n,s):this._featureStore.initialized((a=>{var o,l;if(a)return null===(o=this._logger)||void 0===o||o.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the 'ready' event?) - using last known values from feature store"),void this._variationInternal(e,t,r,i,n,s);null===(l=this._logger)||void 0===l||l.warn("Variation called before LaunchDarkly client initialization completed (did you wait for the'ready' event?) - using default value"),n(ns.default.forError(_s.ClientNotReady,void 0,r))}))}_dataSourceErrorHandler(e){var t;const r=401===e.code?new Error("Authentication failed. Double check your SDK key."):e;this._onError(r),this._onFailed(r),this.initialized()||(this._initState=ys.Failed,this._rejectionReason=r,null===(t=this._initReject)||void 0===t||t.call(this,r))}_initSuccess(){var e;this.initialized()||(this._initState=ys.Initialized,null===(e=this._initResolve)||void 0===e||e.call(this,this),this._onReady())}_clientWithTimeout(e,t,r){if(t){const i=(0,Gn.cancelableTimedPromise)(t,"waitForInitialization");return Promise.race([e.then((()=>this)),i.promise.then((()=>this))]).catch((e=>{throw e instanceof Gn.LDTimeoutError&&(null==r||r.error(e.message)),e})).finally((()=>i.cancel()))}return e}};var ms={};Object.defineProperty(ms,"__esModule",{value:!0}),ms.createMigration=ms.LDMigrationError=ms.LDMigrationSuccess=void 0;const bs=o,Es=S;ms.LDMigrationSuccess=function(e){return{success:!0,result:e}},ms.LDMigrationError=function(e){return{success:!1,error:e}};class ws{constructor(e,t){var r,i;this._client=e,this._config=t,this._readTable={[bs.LDMigrationStage.Off]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[bs.LDMigrationStage.DualWrite]:async e=>this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),[bs.LDMigrationStage.Shadow]:async e=>{const{fromOld:t,fromNew:r}=await this._doRead(e);return this._trackConsistency(e,t,r),t},[bs.LDMigrationStage.Live]:async e=>{const{fromNew:t,fromOld:r}=await this._doRead(e);return this._trackConsistency(e,r,t),t},[bs.LDMigrationStage.RampDown]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[bs.LDMigrationStage.Complete]:async e=>this._doSingleOp(e,"new",this._config.readNew.bind(this._config))},this._writeTable={[bs.LDMigrationStage.Off]:async e=>({authoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}),[bs.LDMigrationStage.DualWrite]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[bs.LDMigrationStage.Shadow]:async e=>{const t=await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))}},[bs.LDMigrationStage.Live]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[bs.LDMigrationStage.RampDown]:async e=>{const t=await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config));if(!t.success)return{authoritative:t};return{authoritative:t,nonAuthoritative:await this._doSingleOp(e,"old",this._config.writeOld.bind(this._config))}},[bs.LDMigrationStage.Complete]:async e=>({authoritative:await this._doSingleOp(e,"new",this._config.writeNew.bind(this._config))})},this._config.execution?this._execution=this._config.execution:this._execution=new Es.LDConcurrentExecution,this._latencyTracking=null===(r=this._config.latencyTracking)||void 0===r||r,this._errorTracking=null===(i=this._config.errorTracking)||void 0===i||i}async read(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._readTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("read"),this._sendEvent(n.tracker),s}async write(e,t,r,i){const n=await this._client.migrationVariation(e,t,r),s=await this._writeTable[n.value]({payload:i,tracker:n.tracker});return n.tracker.op("write"),this._sendEvent(n.tracker),s}_sendEvent(e){const t=e.createEvent();t&&this._client.trackMigration(t)}_trackConsistency(e,t,r){this._config.check&&t.success&&r.success&&e.tracker.consistency((()=>this._config.check(t.result,r.result)))}async _readSequentialFixed(e){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}async _readConcurrent(e){const t=this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),r=this._doSingleOp(e,"new",this._config.readNew.bind(this._config)),[i,n]=await Promise.all([t,r]);return{fromOld:i,fromNew:n}}async _readSequentialRandom(e){if(0===Math.floor(2*Math.random())){return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:await this._doSingleOp(e,"new",this._config.readNew.bind(this._config))}}const t=await this._doSingleOp(e,"new",this._config.readNew.bind(this._config));return{fromOld:await this._doSingleOp(e,"old",this._config.readOld.bind(this._config)),fromNew:t}}async _doRead(e){var t;if((null===(t=this._execution)||void 0===t?void 0:t.type)===Es.LDExecution.Serial){return this._execution.ordering===Es.LDExecutionOrdering.Fixed?this._readSequentialFixed(e):this._readSequentialRandom(e)}return this._readConcurrent(e)}async _doSingleOp(e,t,r){e.tracker.invoked(t);const i=await this._trackLatency(e.tracker,t,(()=>async function(e){try{return await e()}catch(e){return{success:!1,error:e}}}((()=>r(e.payload)))));return!i.success&&this._errorTracking&&e.tracker.error(t),Object.assign({origin:t},i)}async _trackLatency(e,t,r){if(!this._latencyTracking)return r();let i,n,s;"undefined"!=typeof performance?(i=performance.now(),s=await r(),n=performance.now()):(i=Date.now(),s=await r(),n=Date.now());const a=n-i;return e.latency(t,a),s}}ms.createMigration=function(e,t){return new ws(e,t)};var Ss={},ks={},xs={},Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.default=class{constructor(e,t,r,i){this._filesystem=e,this._paths=t,this._watch=r,this._callback=i,this._watchers=[],this._fileData={},this._fileTimestamps={}}async loadAndWatch(){const e=this._paths.map((async e=>({data:await this._filesystem.readFile(e),path:e,timeStamp:await this._filesystem.getFileTimestamp(e)}))),t=await Promise.all(e);t.forEach((e=>{this._fileData[e.path]=e.data,this._fileTimestamps[e.path]=e.timeStamp})),this._callback(t),this._watch&&this._paths.forEach((e=>{const t=this._filesystem.watch(e,(async(e,t)=>{const r=await this._filesystem.getFileTimestamp(t);if(r===this._fileTimestamps[t])return;this._fileTimestamps[t]=r;const i=await this._filesystem.readFile(t);this._fileData[t]=i,this._debounceCallback()}));this._watchers.push(t)}))}close(){this._watchers.forEach((e=>e.close()))}_debounceCallback(){this._debounceHandle||(this._debounceHandle=e=>{e()})}},Object.defineProperty(xs,"__esModule",{value:!0});const Ds=Z,Rs=Q,Is=Os;xs.default=class{constructor(e,t,r,i=()=>{},n){var s;this._featureStore=r,this._initSuccessHandler=i,this._errorHandler=n,this._allData={},this._fileLoader=new Is.default(t,e.paths,null!==(s=e.autoUpdate)&&void 0!==s&&s,(e=>{var t,r;try{this._processFileData(e)}catch(e){null===(t=this._errorHandler)||void 0===t||t.call(this,e),null===(r=this._logger)||void 0===r||r.error(`Error processing files: ${e}`)}})),this._logger=e.logger,this._yamlParser=e.yamlParser}start(){(async()=>{var e;try{await this._fileLoader.loadAndWatch()}catch(t){null===(e=this._errorHandler)||void 0===e||e.call(this,t)}})()}stop(){this._fileLoader.close()}close(){this.stop()}_addItem(e,t){if(this._allData[e.namespace]||(this._allData[e.namespace]={}),this._allData[e.namespace][t.key])throw new Error(`found duplicate key: "${t.key}"`);this._allData[e.namespace][t.key]=t}_processFileData(e){const t=this._allData;this._allData={},e.forEach((e=>{let r;if(e.path.endsWith(".yml")||e.path.endsWith(".yaml")){if(!this._yamlParser)throw new Error(`Attempted to parse yaml file (${e.path}) without parser.`);r=this._yamlParser(e.data)}else r=JSON.parse(e.data);this._processParsedData(r,t)})),this._featureStore.init(this._allData,(()=>{this._initSuccessHandler(),this._initSuccessHandler=()=>{}}))}_processParsedData(e,t){Object.keys(e.flags||{}).forEach((t=>{(0,Ds.processFlag)(e.flags[t]),this._addItem(Rs.default.Features,e.flags[t])})),Object.keys(e.flagValues||{}).forEach((r=>{var i,n;const s=null===(i=t[Rs.default.Features.namespace])||void 0===i?void 0:i[r];let{version:a}=null!=s?s:{version:1};s&&JSON.stringify(e.flagValues[r])!==JSON.stringify(null===(n=null==s?void 0:s.variations)||void 0===n?void 0:n[0])&&(a+=1);const o=function(e,t,r){return{key:e,on:!0,fallthrough:{variation:0},variations:[t],version:r}}(r,e.flagValues[r],a);(0,Ds.processFlag)(o),this._addItem(Rs.default.Features,o)})),Object.keys(e.segments||{}).forEach((t=>{(0,Ds.processSegment)(e.segments[t]),this._addItem(Rs.default.Segments,e.segments[t])}))}},Object.defineProperty(ks,"__esModule",{value:!0});const Ps=xs;ks.default=class{constructor(e){this._options=e}create(e,t,r,i){const n={paths:this._options.paths,autoUpdate:this._options.autoUpdate,logger:this._options.logger||e.basicConfiguration.logger,yamlParser:this._options.yamlParser};return new Ps.default(n,e.platform.fileSystem,t,r,i)}getFactory(){return(e,t,r,i)=>this.create(e,t,r,i)}};var As={},Ts={},Ms={},Cs={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.variationForBoolean=e.FALSE_VARIATION_INDEX=e.TRUE_VARIATION_INDEX=void 0,e.TRUE_VARIATION_INDEX=0,e.FALSE_VARIATION_INDEX=1,e.variationForBoolean=function(t){return t?e.TRUE_VARIATION_INDEX:e.FALSE_VARIATION_INDEX}}(Cs);var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});const Fs=a,js=Cs;class $s{constructor(e,t,r){this._flagBuilder=e,this._clauses=[],t&&(this._clauses=[...t]),void 0!==r&&(this._variation=r)}andMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Fs.AttributeReference(t),op:"in",values:r,negate:!1}),this}andNotMatch(e,t,...r){return this._clauses.push({contextKind:e,attribute:t,attributeReference:new Fs.AttributeReference(t),op:"in",values:r,negate:!0}),this}thenReturn(e){return Fs.TypeValidators.Boolean.is(e)?(this._flagBuilder.booleanFlag(),this.thenReturn((0,js.variationForBoolean)(e))):(this._variation=e,this._flagBuilder.addRule(this),this._flagBuilder)}build(e){return{id:`rule${e}`,variation:this._variation,clauses:this._clauses}}clone(){return new $s(this._flagBuilder,this._clauses,this._variation)}}Ns.default=$s,Object.defineProperty(Ms,"__esModule",{value:!0});const Ls=a,Bs=Cs,Vs=Ns;class zs{constructor(e,t){this._key=e,this._data={on:!0,variations:[]},t&&(this._data={on:t.on,variations:[...t.variations]},void 0!==t.offVariation&&(this._data.offVariation=t.offVariation),void 0!==t.fallthroughVariation&&(this._data.fallthroughVariation=t.fallthroughVariation),t.targetsByVariation&&(this._data.targetsByVariation=JSON.parse(JSON.stringify(t.targetsByVariation))),t.rules&&(this._data.rules=[],t.rules.forEach((e=>{var t;null===(t=this._data.rules)||void 0===t||t.push(e.clone())}))))}get _isBooleanFlag(){return 2===this._data.variations.length&&!0===this._data.variations[Bs.TRUE_VARIATION_INDEX]&&!1===this._data.variations[Bs.FALSE_VARIATION_INDEX]}booleanFlag(){return this._isBooleanFlag?this:this.variations(!0,!1).fallthroughVariation(Bs.TRUE_VARIATION_INDEX).offVariation(Bs.FALSE_VARIATION_INDEX)}variations(...e){return this._data.variations=[...e],this}on(e){return this._data.on=e,this}fallthroughVariation(e){return Ls.TypeValidators.Boolean.is(e)?this.booleanFlag().fallthroughVariation((0,Bs.variationForBoolean)(e)):(this._data.fallthroughVariation=e,this)}offVariation(e){return Ls.TypeValidators.Boolean.is(e)?this.booleanFlag().offVariation((0,Bs.variationForBoolean)(e)):(this._data.offVariation=e,this)}variationForAll(e){return this.on(!0).clearRules().clearAllTargets().fallthroughVariation(e)}valueForAll(e){return this.variations(e).variationForAll(0)}variationForUser(e,t){return this.variationForContext("user",e,t)}variationForContext(e,t,r){return Ls.TypeValidators.Boolean.is(r)?this.booleanFlag().variationForContext(e,t,(0,Bs.variationForBoolean)(r)):(this._data.targetsByVariation||(this._data.targetsByVariation={}),this._data.variations.forEach(((i,n)=>{if(n===r){const r=this._data.targetsByVariation[n]||{};e in r||(r[e]=[]);-1!==r[e].indexOf(t)||r[e].push(t),this._data.targetsByVariation[n]=r}else{const r=this._data.targetsByVariation[n];if(r){const i=r[e];if(i){const n=i.indexOf(t);-1!==n&&(i.splice(n,1),i.length||delete r[e])}Object.keys(r).length||delete this._data.targetsByVariation[n]}}})),this)}clearRules(){return delete this._data.rules,this}clearAllTargets(){return delete this._data.targetsByVariation,this}ifMatch(e,t,...r){return new Vs.default(this).andMatch(e,t,...r)}ifNotMatch(e,t,...r){return new Vs.default(this).andNotMatch(e,t,...r)}checkRatio(e){var t;return this._data.migration=null!==(t=this._data.migration)&&void 0!==t?t:{},this._data.migration.checkRatio=e,this}samplingRatio(e){return this._data.samplingRatio=e,this}addRule(e){this._data.rules||(this._data.rules=[]),this._data.rules.push(e)}build(e){const t={key:this._key,version:e,on:this._data.on,offVariation:this._data.offVariation,fallthrough:{variation:this._data.fallthroughVariation},variations:[...this._data.variations],migration:this._data.migration,samplingRatio:this._data.samplingRatio};if(this._data.targetsByVariation){const e=[],r=[];Object.entries(this._data.targetsByVariation).forEach((([t,i])=>{Object.entries(i).forEach((([i,n])=>{const s=parseInt(t,10);e.push({contextKind:i,values:"user"===i?[]:n,variation:s}),"user"===i&&r.push({values:n,variation:s})}))})),t.targets=r,t.contextTargets=e}return this._data.rules&&(t.rules=this._data.rules.map(((e,t)=>e.build(String(t))))),t}clone(){return new zs(this._key,this._data)}getKey(){return this._key}}Ms.default=zs;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.default=class{constructor(e,t,r,i,n){this._featureStore=e,this._onStop=i,this._listeners=n,this._flags=Object.assign({},t),this._segments=Object.assign({},r)}async start(){this._listeners.forEach((({processJson:e})=>{e({data:{flags:this._flags,segments:this._segments}})}))}stop(){this._onStop(this)}close(){this.stop()}async upsert(e,t){return this._featureStore.upsert(e,t)}},Object.defineProperty(Ts,"__esModule",{value:!0});const Us=Y,Ks=be,qs=Z,Ws=Q,Gs=Ms,Xs=Hs;Ts.default=class{constructor(){this._currentFlags={},this._currentSegments={},this._dataSources=[],this._flagBuilders={}}getFactory(){return(e,t,r,i)=>{const n=(0,Us.createStreamListeners)(t,e.basicConfiguration.logger,{put:r}),s=new Xs.default(new Ks.default(t),this._currentFlags,this._currentSegments,(e=>{this._dataSources.splice(this._dataSources.indexOf(e))}),n);return this._dataSources.push(s),s}}flag(e){return this._flagBuilders[e]?this._flagBuilders[e].clone():new Gs.default(e).booleanFlag()}update(e){const t=e.getKey(),r=this._currentFlags[t],i=r?r.version:0,n=e.build(i+1);return this._currentFlags[t]=n,this._flagBuilders[t]=e.clone(),Promise.all(this._dataSources.map((e=>e.upsert(Ws.default.Features,n))))}usePreconfiguredFlag(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentFlags[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,qs.processFlag)(i),this._currentFlags[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Ws.default.Features,i))))}usePreconfiguredSegment(e){const t=JSON.parse(JSON.stringify(e)),r=this._currentSegments[t.key],i=Object.assign(Object.assign({},t),{version:r?r.version+1:t.version});return(0,qs.processSegment)(i),this._currentSegments[t.key]=i,Promise.all(this._dataSources.map((e=>e.upsert(Ws.default.Segments,i))))}},Object.defineProperty(As,"__esModule",{value:!0}),As.TestDataRuleBuilder=As.TestDataFlagBuilder=As.TestData=void 0;const Js=Ts;As.TestData=Js.default;const Ys=Ms;As.TestDataFlagBuilder=Ys.default;const Zs=Ns;As.TestDataRuleBuilder=Zs.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.FileDataSourceFactory=void 0;const n=ks;e.FileDataSourceFactory=n.default,i(As,e),i(I,e)}(Ss);var Qs={},ea={};Object.defineProperty(ea,"__esModule",{value:!0});ea.default=class{constructor(e,t){this.handlers={},this.closed=!1,this.url=e,this.options=t}addEventListener(e,t){this.handlers[e]=t}close(){this.closed=!0}simulateError(e){this.options.errorFilter(e)||(this.closed=!0)}},Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.NullEventSource=void 0;const ta=ea;Qs.NullEventSource=ta.default;var ra={};Object.defineProperty(ra,"__esModule",{value:!0}),ra.TtlCache=void 0;const ia=ke;ra.TtlCache=ia.default,function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMigration=e.LDMigrationSuccess=e.LDMigrationError=e.BigSegmentStoreStatusProviderImpl=e.LDClientImpl=e.internalServer=e.platform=e.integrations=void 0;const l=n;e.BigSegmentStoreStatusProviderImpl=l.default;const c=s;e.LDClientImpl=c.default;const u=ms;Object.defineProperty(e,"createMigration",{enumerable:!0,get:function(){return u.createMigration}}),Object.defineProperty(e,"LDMigrationError",{enumerable:!0,get:function(){return u.LDMigrationError}}),Object.defineProperty(e,"LDMigrationSuccess",{enumerable:!0,get:function(){return u.LDMigrationSuccess}}),e.integrations=Ss,e.platform=a,i(o,e),i(me,e),i(Qs,e),i(a,e),e.internalServer=ra}(i);var na={},sa={},aa={};Object.defineProperty(aa,"__esModule",{value:!0}),aa.createCallbacks=void 0;aa.createCallbacks=e=>({onError:t=>{var r;null===(r=null==e?void 0:e.error)||void 0===r||r.call(e,t.message)},onFailed:e=>{},onReady:()=>{},onUpdate:e=>{},hasEventListeners:()=>!1});var oa={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createOptions=e.defaultOptions=void 0;const t=i;e.defaultOptions={stream:!1,sendEvents:!1,useLdd:!0,diagnosticOptOut:!0,logger:t.BasicLogger.get()};e.createOptions=t=>{var r;const i=Object.assign(Object.assign({},e.defaultOptions),t);return null===(r=i.logger)||void 0===r||r.debug(`Using LD options: ${JSON.stringify(i)}`),i}}(oa);var la={},ca=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(la,"__esModule",{value:!0}),la.validateOptions=void 0;la.validateOptions=(e,t)=>{const{featureStore:r,logger:i,sendEvents:n}=t,s=ca(t,["featureStore","logger","sendEvents"]);if(!e)throw new Error("You must configure the client with a client key");if(!r||"object"!=typeof r||!r.get)throw new Error("You must configure the client with a feature store");if(!i)throw new Error("You must configure the client with a logger");if("{}"!==JSON.stringify(s))throw new Error(`Invalid configuration: ${Object.keys(s).toString()} not supported`);return!0},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),i=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),i(aa,e),i(oa,e),i(la,e)}(sa),Object.defineProperty(na,"__esModule",{value:!0});const ua=i,ha=sa;na.default=class extends ua.LDClientImpl{constructor(e,t,r){const i=(0,ha.createOptions)(r);super(e,t,i,(0,ha.createCallbacks)(i.logger))}initialized(){return!0}waitForInitialization(){return Promise.resolve(this)}};var da={},fa={};Object.defineProperty(fa,"__esModule",{value:!0});fa.default=class{constructor(e){this._cacheTtlMs=e}get(){if(!(this._cacheTtlMs<0)&&void 0!==this._cache)return 0===this._cacheTtlMs||Date.now()<this._cache.expiration?this._cache.value:void(this._cache=void 0)}set(e){this._cache={value:e,expiration:Date.now()+this._cacheTtlMs}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeFeatureStore=e.buildRootKey=void 0;const t=i,r=fa;e.buildRootKey=e=>`LD-Env-${e}`;e.EdgeFeatureStore=class{constructor(i,n,s,a,o){this._edgeProvider=i,this._sdkKey=n,this._description=s,this._logger=a,this.close=t.noop,this.delete=t.noop,this.upsert=t.noop,this._rootKey=(0,e.buildRootKey)(this._sdkKey),this._cache=new r.default(o)}async get(e,t,r){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting ${t} from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags[t]);break;case"segments":r(e.segments[t]);break;default:r(null)}}catch(e){this._logger.error(e),r(null)}}async all(e,r=t.noop){const{namespace:i}=e,n="features"===i?"flags":i;this._logger.debug(`Requesting all from ${this._rootKey}.${n}`);try{const e=await this._getStorePayload();switch(i){case"features":r(e.flags);break;case"segments":r(e.segments);break;default:throw new Error(`Unsupported DataKind: ${i}`)}}catch(e){this._logger.error(e),r({})}}async _getStorePayload(){let e=this._cache.get();if(void 0!==e)return e;const r=await this._edgeProvider.get(this._rootKey);if(!r)throw new Error(`${this._rootKey} is not found in KV.`);if(e=(0,t.deserializePoll)(r),!e)throw new Error(`Error deserializing ${this._rootKey}`);return this._cache.set(e),e}async initialized(e=t.noop){const r=null!==await this._edgeProvider.get(this._rootKey);this._logger.debug(`Is ${this._rootKey} initialized? ${r}`),e(r)}init(e,t){t()}getDescription(){return this._description}}}(da);var pa={},va={},_a={},ga={exports:{}};var ya,ma={exports:{}};function ba(){return ya||(ya=1,ma.exports=function(){var e=e||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=require("crypto")}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},l=o.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var a=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o<n;o+=4)t[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=a.enc={},h=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(r,t)}},f=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,u=e.min(4*l,s);if(l){for(var h=0;h<l;h+=a)this._doProcessBlock(n,h);r=n.splice(0,l),i.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=a.algo={};return a}(Math);return e}()),ma.exports}var Ea,wa={exports:{}};function Sa(){return Ea?wa.exports:(Ea=1,wa.exports=function(e){return i=(r=e).lib,n=i.Base,s=i.WordArray,(a=r.x64={}).Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),e;var t,r,i,n,s,a}(ba()))}var ka,xa={exports:{}};function Oa(){return ka||(ka=1,xa.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,i=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,i=[],n=0;n<t;n++)i[n>>>2]|=e[n]<<24-n%4*8;r.call(this,i,t)}else r.apply(this,arguments)};i.prototype=t}}(),e.lib.WordArray}(ba())),xa.exports}var Da,Ra={exports:{}};function Ia(){return Da?Ra.exports:(Da=1,Ra.exports=function(e){return function(){var t=e,r=t.lib.WordArray,i=t.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,i=[],n=0;n<t;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return r.create(i,2*t)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s<r;s+=2){var a=n(t[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s++)i[s>>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return r.create(i,2*t)}}}(),e.enc.Utf16}(ba()))}var Pa,Aa={exports:{}},Ta=Aa.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var a=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<r;o++)n.push(i.charAt(a>>>6*(3-o)&63));var l=i.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s<r.length;s++)n[r.charCodeAt(s)]=s}var a=r.charAt(64);if(a){var o=e.indexOf(a);-1!==o&&(t=o)}return i(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(ba()),Ma={exports:{}};function Ca(){return Pa?Ma.exports:(Pa=1,Ma.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function i(e,t,i){for(var n=[],s=0,a=0;a<t;a++)if(a%4){var o=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return r.create(n,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a<i;a+=3)for(var o=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l<i;l++)s.push(n.charAt(o>>>6*(3-l)&63));var c=n.charAt(64);if(c)for(;s.length%4;)s.push(c);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a<n.length;a++)s[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var l=e.indexOf(o);-1!==l&&(r=l)}return i(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(ba()))}var Na,Fa={exports:{}};function ja(){return Na||(Na=1,Fa.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=a.MD5=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],l=e[t+1],f=e[t+2],p=e[t+3],v=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],m=e[t+8],b=e[t+9],E=e[t+10],w=e[t+11],S=e[t+12],k=e[t+13],x=e[t+14],O=e[t+15],D=s[0],R=s[1],I=s[2],P=s[3];D=c(D,R,I,P,a,7,o[0]),P=c(P,D,R,I,l,12,o[1]),I=c(I,P,D,R,f,17,o[2]),R=c(R,I,P,D,p,22,o[3]),D=c(D,R,I,P,v,7,o[4]),P=c(P,D,R,I,_,12,o[5]),I=c(I,P,D,R,g,17,o[6]),R=c(R,I,P,D,y,22,o[7]),D=c(D,R,I,P,m,7,o[8]),P=c(P,D,R,I,b,12,o[9]),I=c(I,P,D,R,E,17,o[10]),R=c(R,I,P,D,w,22,o[11]),D=c(D,R,I,P,S,7,o[12]),P=c(P,D,R,I,k,12,o[13]),I=c(I,P,D,R,x,17,o[14]),D=u(D,R=c(R,I,P,D,O,22,o[15]),I,P,l,5,o[16]),P=u(P,D,R,I,g,9,o[17]),I=u(I,P,D,R,w,14,o[18]),R=u(R,I,P,D,a,20,o[19]),D=u(D,R,I,P,_,5,o[20]),P=u(P,D,R,I,E,9,o[21]),I=u(I,P,D,R,O,14,o[22]),R=u(R,I,P,D,v,20,o[23]),D=u(D,R,I,P,b,5,o[24]),P=u(P,D,R,I,x,9,o[25]),I=u(I,P,D,R,p,14,o[26]),R=u(R,I,P,D,m,20,o[27]),D=u(D,R,I,P,k,5,o[28]),P=u(P,D,R,I,f,9,o[29]),I=u(I,P,D,R,y,14,o[30]),D=h(D,R=u(R,I,P,D,S,20,o[31]),I,P,_,4,o[32]),P=h(P,D,R,I,m,11,o[33]),I=h(I,P,D,R,w,16,o[34]),R=h(R,I,P,D,x,23,o[35]),D=h(D,R,I,P,l,4,o[36]),P=h(P,D,R,I,v,11,o[37]),I=h(I,P,D,R,y,16,o[38]),R=h(R,I,P,D,E,23,o[39]),D=h(D,R,I,P,k,4,o[40]),P=h(P,D,R,I,a,11,o[41]),I=h(I,P,D,R,p,16,o[42]),R=h(R,I,P,D,g,23,o[43]),D=h(D,R,I,P,b,4,o[44]),P=h(P,D,R,I,S,11,o[45]),I=h(I,P,D,R,O,16,o[46]),D=d(D,R=h(R,I,P,D,f,23,o[47]),I,P,a,6,o[48]),P=d(P,D,R,I,y,10,o[49]),I=d(I,P,D,R,x,15,o[50]),R=d(R,I,P,D,_,21,o[51]),D=d(D,R,I,P,S,6,o[52]),P=d(P,D,R,I,p,10,o[53]),I=d(I,P,D,R,E,15,o[54]),R=d(R,I,P,D,l,21,o[55]),D=d(D,R,I,P,m,6,o[56]),P=d(P,D,R,I,O,10,o[57]),I=d(I,P,D,R,g,15,o[58]),R=d(R,I,P,D,k,21,o[59]),D=d(D,R,I,P,v,6,o[60]),P=d(P,D,R,I,w,10,o[61]),I=d(I,P,D,R,f,15,o[62]),R=d(R,I,P,D,b,21,o[63]),s[0]=s[0]+D|0,s[1]=s[1]+R|0,s[2]=s[2]+I|0,s[3]=s[3]+P|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var s=t.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,l=o.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<<s|o>>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<<s|o>>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<<s|o>>>32-s)+t}function d(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<<s|o>>>32-s)+t}r.MD5=s._createHelper(l),r.HmacMD5=s._createHmacHelper(l)}(Math),e.MD5}(ba())),Fa.exports}var $a,La={exports:{}};function Ba(){return $a||($a=1,La.exports=function(e){return r=(t=e).lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=[],o=s.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],l=r[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var u=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=u<<1|u>>>31}var h=(i<<5|i>>>27)+l+a[c];h+=c<20?1518500249+(n&s|~n&o):c<40?1859775393+(n^s^o):c<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,l=o,o=s,s=n<<30|n>>>2,n=i,i=h}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o),e.SHA1;var t,r,i,n,s,a,o}(ba())),La.exports}var Va,za={exports:{}};function Ha(){return Va||(Va=1,za.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],l=[];!function(){function e(e){for(var r=t.sqrt(e),i=2;i<=r;i++)if(!(e%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)e(i)&&(n<8&&(o[n]=r(t.pow(i,.5))),l[n]=r(t.pow(i,1/3)),n++),i++}();var c=[],u=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],h=r[6],d=r[7],f=0;f<64;f++){if(f<16)c[f]=0|e[t+f];else{var p=c[f-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=c[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;c[f]=v+c[f-7]+g+c[f-16]}var y=i&n^i&s^n&s,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&u^~o&h)+l[f]+c[f];d=h,h=u,u=o,o=a+b|0,a=s,s=n,n=i,i=b+(m+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+d|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=t.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(ba())),za.exports}var Ua,Ka={exports:{}};var qa,Wa={exports:{}};function Ga(){return qa||(qa=1,Wa.exports=function(e){return function(){var t=e,r=t.lib.Hasher,i=t.x64,n=i.Word,s=i.WordArray,a=t.algo;function o(){return n.create.apply(n,arguments)}var l=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=o()}();var u=a.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],u=r[5],h=r[6],d=r[7],f=i.high,p=i.low,v=n.high,_=n.low,g=s.high,y=s.low,m=a.high,b=a.low,E=o.high,w=o.low,S=u.high,k=u.low,x=h.high,O=h.low,D=d.high,R=d.low,I=f,P=p,A=v,T=_,M=g,C=y,N=m,F=b,j=E,$=w,L=S,B=k,V=x,z=O,H=D,U=R,K=0;K<80;K++){var q,W,G=c[K];if(K<16)W=G.high=0|e[t+2*K],q=G.low=0|e[t+2*K+1];else{var X=c[K-15],J=X.high,Y=X.low,Z=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=c[K-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=c[K-7],ae=se.high,oe=se.low,le=c[K-16],ce=le.high,ue=le.low;W=(W=(W=Z+ae+((q=Q+oe)>>>0<Q>>>0?1:0))+ie+((q+=ne)>>>0<ne>>>0?1:0))+ce+((q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=q}var he,de=j&L^~j&V,fe=$&B^~$&z,pe=I&A^I&M^A&M,ve=P&T^P&C^T&C,_e=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),ge=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),ye=(j>>>14|$<<18)^(j>>>18|$<<14)^(j<<23|$>>>9),me=($>>>14|j<<18)^($>>>18|j<<14)^($<<23|j>>>9),be=l[K],Ee=be.high,we=be.low,Se=H+ye+((he=U+me)>>>0<U>>>0?1:0),ke=ge+ve;H=V,U=z,V=L,z=B,L=j,B=$,j=N+(Se=(Se=(Se=Se+de+((he+=fe)>>>0<fe>>>0?1:0))+Ee+((he+=we)>>>0<we>>>0?1:0))+W+((he+=q)>>>0<q>>>0?1:0))+(($=F+he|0)>>>0<F>>>0?1:0)|0,N=M,F=C,M=A,C=T,A=I,T=P,I=Se+(_e+pe+(ke>>>0<ge>>>0?1:0))+((P=he+ke|0)>>>0<he>>>0?1:0)|0}p=i.low=p+P,i.high=f+I+(p>>>0<P>>>0?1:0),_=n.low=_+T,n.high=v+A+(_>>>0<T>>>0?1:0),y=s.low=y+C,s.high=g+M+(y>>>0<C>>>0?1:0),b=a.low=b+F,a.high=m+N+(b>>>0<F>>>0?1:0),w=o.low=w+$,o.high=E+j+(w>>>0<$>>>0?1:0),k=u.low=k+B,u.high=S+L+(k>>>0<B>>>0?1:0),O=h.low=O+z,h.high=x+V+(O>>>0<z>>>0?1:0),R=d.low=R+U,d.high=D+H+(R>>>0<U>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(ba(),Sa())),Wa.exports}var Xa,Ja={exports:{}};var Ya,Za={exports:{}};function Qa(){return Ya||(Ya=1,Za.exports=function(e){return function(t){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.x64.Word,o=r.algo,l=[],c=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){l[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,h=0,d=0;d<7;d++){if(1&n){var f=(1<<d)-1;f<32?h^=1<<f:o^=1<<f-32}128&n?n=n<<1^113:n<<=1}u[s]=a.create(o,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var d=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],a=e[t+2*n+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(R=r[n]).high^=a,R.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var f=0,p=0,v=0;v<5;v++)f^=(R=r[d+5*v]).high,p^=R.low;var _=h[d];_.high=f,_.low=p}for(d=0;d<5;d++){var g=h[(d+4)%5],y=h[(d+1)%5],m=y.high,b=y.low;for(f=g.high^(m<<1|b>>>31),p=g.low^(b<<1|m>>>31),v=0;v<5;v++)(R=r[d+5*v]).high^=f,R.low^=p}for(var E=1;E<25;E++){var w=(R=r[E]).high,S=R.low,k=l[E];k<32?(f=w<<k|S>>>32-k,p=S<<k|w>>>32-k):(f=S<<k-32|w>>>64-k,p=w<<k-32|S>>>64-k);var x=h[c[E]];x.high=f,x.low=p}var O=h[0],D=r[0];for(O.high=D.high,O.low=D.low,d=0;d<5;d++)for(v=0;v<5;v++){var R=r[E=d+5*v],I=h[E],P=h[(d+1)%5+5*v],A=h[(d+2)%5+5*v];R.high=I.high^~P.high&A.high,R.low=I.low^~P.low&A.low}R=r[0];var T=u[o];R.high^=T.high,R.low^=T.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var i=8*e.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(t.ceil((i+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,l=o/8,c=[],u=0;u<l;u++){var h=a[u],d=h.high,f=h.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c.push(f),c.push(d)}return new n.init(c,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(d),r.HmacSHA3=s._createHmacHelper(d)}(Math),e.SHA3}(ba(),Sa())),Za.exports}var eo,to={exports:{}};var ro,io={exports:{}};function no(){return ro?io.exports:(ro=1,io.exports=function(e){var t,r,i;r=(t=e).lib.Base,i=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,l=a.words,c=0;c<r;c++)o[c]^=1549556828,l[c]^=909522486;s.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(ba()))}var so,ao={exports:{}};var oo,lo={exports:{}};function co(){return oo?lo.exports:(oo=1,lo.exports=function(e){return r=(t=e).lib,i=r.Base,n=r.WordArray,s=t.algo,a=s.MD5,o=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,s=i.hasher.create(),a=n.create(),o=a.words,l=i.keySize,c=i.iterations;o.length<l;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<c;u++)r=s.finalize(r),s.reset();a.concat(r)}return a.sigBytes=4*l,a}}),t.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF;var t,r,i,n,s,a,o}(ba(),Ba(),no()))}var uo,ho={exports:{}};function fo(){return uo||(uo=1,ho.exports=function(e){e.lib.Cipher||function(t){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=i.BufferedBlockAlgorithm,o=r.enc;o.Utf8;var l=o.Base64,c=r.algo.EvpKDF,u=i.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?m:g}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()});i.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=r.mode={},d=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=h.CBC=function(){var e=d.extend();function r(e,r,i){var n,s=this._iv;s?(n=s,this._iv=t):n=this._prevBlock;for(var a=0;a<i;a++)e[r+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);i.decryptBlock(e,t),r.call(this,e,t,n),this._prevBlock=s}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,a=[],o=0;o<i;o+=4)a.push(n);var l=s.create(a,i);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return v.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(r.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=c.create({keySize:t+r,hasher:n}).compute(e,i);else var a=c.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:o,salt:i})}},m=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}()}(ba(),co())),ho.exports}var po,vo={exports:{}};function _o(){return po?vo.exports:(po=1,vo.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a<r;a++)e[t+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n,i),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);r.call(this,e,t,n,i),this._prevBlock=s}}),t}(),e.mode.CFB}(ba(),fo()))}var go,yo={exports:{}};function mo(){return go?yo.exports:(go=1,yo.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var a=s.slice(0);r.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var o=0;o<i;o++)e[t+o]^=a[o]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(ba(),fo()))}var bo,Eo={exports:{}};function wo(){return bo?Eo.exports:(bo=1,Eo.exports=function(e){
|
|
2
2
|
/** @preserve
|
|
3
3
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
4
4
|
* derived from CryptoJS.mode.CTR
|
|
5
5
|
* Jan Hruby jhruby.web@gmail.com
|
|
6
6
|
*/
|
|
7
|
-
return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}return e}function i(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var l=0;l<n;l++)e[t+l]^=o[l]}});return t.Decryptor=n,t}(),e.mode.CTRGladman}(ma(),ho()))}var wo,So={exports:{}};function ko(){return wo?So.exports:(wo=1,So.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var a=0;a<i;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(ma(),ho()))}var xo,Oo={exports:{}};var Ro,Do={exports:{}};var Io,Ao={exports:{}};var Po,To={exports:{}};var Mo,Co={exports:{}};var No,jo={exports:{}};var Fo,$o={exports:{}};var Lo,Bo={exports:{}};var Vo,zo={exports:{}};function Ho(){return Vo||(Vo=1,zo.exports=function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,s=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var c=n[s]=[],u=l[s];for(r=0;r<24;r++)c[r/6|0]|=t[(o[r]-1+u)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(o[r+24]-1+u)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],d.call(this,4,252645135),d.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),d.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,l=0;l<8;l++)o|=c[l][((a^n[l])&u[l])>>>0];this._lBlock=a,this._rBlock=s^o}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=n._createHelper(h);var p=s.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(i.create(t)),this._des2=h.createEncryptor(i.create(r)),this._des3=h.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=n._createHelper(p)}(),e.TripleDES}(ma(),ja(),lo(),ho())),zo.exports}var Ko,Uo={exports:{}};var qo,Wo={exports:{}};var Go,Xo={exports:{}};var Jo,Yo={exports:{}};function Zo(){return Jo?Yo.exports:(Jo=1,Yo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function l(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function c(e,t,r){let i,s=t,a=r;for(let t=0;t<n;++t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[n],s^=e.pbox[n+1],{left:s,right:a}}function u(e,t,r){let i,s=t,a=r;for(let t=n+1;t>1;--t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function h(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a<n+2;a++)e.pbox[a]=s[a]^t[i],i++,i>=r&&(i=0);let o=0,l=0,u=0;for(let t=0;t<n+2;t+=2)u=c(e,o,l),o=u.left,l=u.right,e.pbox[t]=o,e.pbox[t+1]=l;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=c(e,o,l),o=u.left,l=u.right,e.sbox[t][r]=o,e.sbox[t][r+1]=l;return!0}var d=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(o,t,r)}},encryptBlock:function(e,t){var r=c(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(d)}(),e.Blowfish}(ma(),ja(),lo(),ho()))}ga.exports=function(e){return e}(ma(),wa(),xa(),Da(),Ma(),ja(),La(),za(),Ha||(Ha=1,Ka.exports=function(e){return r=(t=e).lib.WordArray,i=t.algo,n=i.SHA256,s=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=n._createHelper(s),t.HmacSHA224=n._createHmacHelper(s),e.SHA224;var t,r,i,n,s}(ma(),za())),Wa(),Ga||(Ga=1,Xa.exports=function(e){return r=(t=e).x64,i=r.Word,n=r.WordArray,s=t.algo,a=s.SHA512,o=s.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=a._createHelper(o),t.HmacSHA384=a._createHmacHelper(o),e.SHA384;var t,r,i,n,s,a,o}(ma(),wa(),Wa())),Za(),Qa||(Qa=1,eo.exports=function(e){
|
|
7
|
+
return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}return e}function i(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var l=0;l<n;l++)e[t+l]^=o[l]}});return t.Decryptor=n,t}(),e.mode.CTRGladman}(ba(),fo()))}var So,ko={exports:{}};function xo(){return So?ko.exports:(So=1,ko.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var a=0;a<i;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(ba(),fo()))}var Oo,Do={exports:{}};var Ro,Io={exports:{}};var Po,Ao={exports:{}};var To,Mo={exports:{}};var Co,No={exports:{}};var Fo,jo={exports:{}};var $o,Lo={exports:{}};var Bo,Vo={exports:{}};var zo,Ho={exports:{}};function Uo(){return zo||(zo=1,Ho.exports=function(e){return function(){var t=e,r=t.lib,i=r.WordArray,n=r.BlockCipher,s=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var c=n[s]=[],u=l[s];for(r=0;r<24;r++)c[r/6|0]|=t[(o[r]-1+u)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(o[r+24]-1+u)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],d.call(this,4,252645135),d.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),d.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,l=0;l<8;l++)o|=c[l][((a^n[l])&u[l])>>>0];this._lBlock=a,this._rBlock=s^o}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=n._createHelper(h);var p=s.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(i.create(t)),this._des2=h.createEncryptor(i.create(r)),this._des3=h.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=n._createHelper(p)}(),e.TripleDES}(ba(),ja(),co(),fo())),Ho.exports}var Ko,qo={exports:{}};var Wo,Go={exports:{}};var Xo,Jo={exports:{}};var Yo,Zo={exports:{}};function Qo(){return Yo?Zo.exports:(Yo=1,Zo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function l(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function c(e,t,r){let i,s=t,a=r;for(let t=0;t<n;++t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[n],s^=e.pbox[n+1],{left:s,right:a}}function u(e,t,r){let i,s=t,a=r;for(let t=n+1;t>1;--t)s^=e.pbox[t],a=l(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function h(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a<n+2;a++)e.pbox[a]=s[a]^t[i],i++,i>=r&&(i=0);let o=0,l=0,u=0;for(let t=0;t<n+2;t+=2)u=c(e,o,l),o=u.left,l=u.right,e.pbox[t]=o,e.pbox[t+1]=l;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=c(e,o,l),o=u.left,l=u.right,e.sbox[t][r]=o,e.sbox[t][r+1]=l;return!0}var d=i.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;h(o,t,r)}},encryptBlock:function(e,t){var r=c(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(o,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(d)}(),e.Blowfish}(ba(),ja(),co(),fo()))}ga.exports=function(e){return e}(ba(),Sa(),Oa(),Ia(),Ca(),ja(),Ba(),Ha(),Ua||(Ua=1,Ka.exports=function(e){return r=(t=e).lib.WordArray,i=t.algo,n=i.SHA256,s=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=n._createHelper(s),t.HmacSHA224=n._createHmacHelper(s),e.SHA224;var t,r,i,n,s}(ba(),Ha())),Ga(),Xa||(Xa=1,Ja.exports=function(e){return r=(t=e).x64,i=r.Word,n=r.WordArray,s=t.algo,a=s.SHA512,o=s.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=a._createHelper(o),t.HmacSHA384=a._createHmacHelper(o),e.SHA384;var t,r,i,n,s,a,o}(ba(),Sa(),Ga())),Qa(),eo||(eo=1,to.exports=function(e){
|
|
8
8
|
/** @preserve
|
|
9
9
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
10
10
|
|
|
@@ -15,5 +15,5 @@ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();functio
|
|
|
15
15
|
|
|
16
16
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
17
|
*/
|
|
18
|
-
return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=s.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,d,m,b,E,w,S,k,x,O,R,D=this._hash.words,I=u.words,A=h.words,P=a.words,T=o.words,M=l.words,C=c.words;for(w=s=D[0],S=d=D[1],k=m=D[2],x=b=D[3],O=E=D[4],r=0;r<80;r+=1)R=s+e[t+P[r]]|0,R+=r<16?f(d,m,b)+I[0]:r<32?p(d,m,b)+I[1]:r<48?v(d,m,b)+I[2]:r<64?g(d,m,b)+I[3]:_(d,m,b)+I[4],R=(R=y(R|=0,M[r]))+E|0,s=E,E=b,b=y(m,10),m=d,d=R,R=w+e[t+T[r]]|0,R+=r<16?_(S,k,x)+A[0]:r<32?g(S,k,x)+A[1]:r<48?v(S,k,x)+A[2]:r<64?p(S,k,x)+A[3]:f(S,k,x)+A[4],R=(R=y(R|=0,C[r]))+O|0,w=O,O=x,x=y(k,10),k=S,S=R;R=D[1]+m+x|0,D[1]=D[2]+b+O|0,D[2]=D[3]+E+w|0,D[3]=D[4]+s+S|0,D[4]=D[0]+d+k|0,D[0]=R},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function _(e,t,r){return e^(t|~r)}function y(e,t){return e<<t|e>>>32-t}t.RIPEMD160=n._createHelper(d),t.HmacRIPEMD160=n._createHmacHelper(d)}(),e.RIPEMD160}(ma())),io(),no||(no=1,so.exports=function(e){return i=(r=(t=e).lib).Base,n=r.WordArray,a=(s=t.algo).SHA256,o=s.HMAC,l=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=o.create(r.hasher,e),s=n.create(),a=n.create([1]),l=s.words,c=a.words,u=r.keySize,h=r.iterations;l.length<u;){var d=i.update(t).finalize(a);i.reset();for(var f=d.words,p=f.length,v=d,g=1;g<h;g++){v=i.finalize(v),i.reset();for(var _=v.words,y=0;y<p;y++)f[y]^=_[y]}s.concat(d),c[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},e.PBKDF2;var t,r,i,n,s,a,o,l}(ma(),za(),io())),lo(),ho(),vo(),yo(),Eo(),ko(),xo||(xo=1,Oo.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(ma(),ho())),Ro||(Ro=1,Do.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(ma(),ho())),Io||(Io=1,Ao.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var i=4*r,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(ma(),ho())),Po||(Po=1,To.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(ma(),ho())),Mo||(Mo=1,Co.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(ma(),ho())),No||(No=1,jo.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(ma(),ho())),Fo||(Fo=1,$o.exports=function(e){return r=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,i}(ma(),ho())),Lo||(Lo=1,Bo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],h=[],d=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var v=e[r],g=e[v],_=e[g],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,l[r]=y<<8|y>>>24,c[r]=y,y=16843009*_^65537*g^257*v^16843008*r,u[p]=y<<24|y>>>8,h[p]=y<<16|y>>>16,d[p]=y<<8|y>>>24,f[p]=y,r?(r=v^e[e[e[_^v]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a<i;a++)a<r?s[a]=t[a]:(c=s[a-1],a%r?r>6&&a%r==4&&(c=n[c>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c]):(c=n[(c=c<<8|c>>>24)>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c],c^=p[a/r|0]<<24),s[a]=s[a-r]^c);for(var o=this._invKeySchedule=[],l=0;l<i;l++){if(a=i-l,l%4)var c=s[a];else c=s[a-4];o[l]=l<4||a<=4?c:u[n[c>>>24]]^h[n[c>>>16&255]]^d[n[c>>>8&255]]^f[n[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,l,c,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,h,d,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var l=this._nRounds,c=e[t]^r[0],u=e[t+1]^r[1],h=e[t+2]^r[2],d=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&d]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[d>>>8&255]^a[255&c]^r[f++],_=i[h>>>24]^n[d>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[d>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++];c=v,u=g,h=_,d=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&c])^r[f++],_=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[d>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],e[t]=v,e[t+1]=g,e[t+2]=_,e[t+3]=y},keySize:8});t.AES=r._createHelper(v)}(),e.AES}(ma(),ja(),lo(),ho())),Ho(),Ko||(Ko=1,Uo.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=i.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var l=i[n];i[n]=i[s],i[s]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}t.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4}(ma(),ja(),lo(),ho())),qo||(qo=1,Wo.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(n[0]^=c,n[1]^=h,n[2]^=u,n[3]^=d,n[4]^=c,n[5]^=h,n[6]^=u,n[7]^=d,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(o)}(),e.Rabbit}(ma(),ja(),lo(),ho())),Go||(Go=1,Xo.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=u,i[3]^=d,i[4]^=c,i[5]^=h,i[6]^=u,i[7]^=d,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(o)}(),e.RabbitLegacy}(ma(),ja(),lo(),ho())),Zo());var Qo=ga.exports,el={exports:{}},tl=el.exports=function(e){return e.enc.Hex}(ma());Object.defineProperty(va,"__esModule",{value:!0});const rl=Qo,il=Pa,nl=tl;va.default=class{constructor(e){let t;switch(e){case"sha1":t=rl.algo.SHA1;break;case"sha256":t=rl.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHasher=t.create()}digest(e){const t=this._cryptoJSHasher.finalize();let r;switch(e){case"base64":r=il.default;break;case"hex":r=nl.default;break;default:throw new Error("unsupported output encoding. Only base64 and hex are supported.")}return t.toString(r)}update(e){return this._cryptoJSHasher.update(e),this}};var sl={};Object.defineProperty(sl,"__esModule",{value:!0});const al=Qo;sl.default=class{constructor(e,t){let r;switch(e){case"sha1":r=al.algo.SHA1;break;case"sha256":r=al.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=al.algo.HMAC.create(r,t)}digest(e){const t=this._cryptoJSHmac.finalize();if("base64"===e)return t.toString(CryptoJS.enc.Base64);if("hex"===e)return t.toString(CryptoJS.enc.Hex);throw new Error("unsupported output encoding. Only base64 and hex are supported.")}update(e){return this._cryptoJSHmac.update(e),this}},Object.defineProperty(pa,"__esModule",{value:!0});const ol=e,ll=va,cl=sl;pa.default=class{createHash(e){return new ll.default(e)}createHmac(e,t){return new cl.default(e,t)}randomUUID(){const e=new Uint32Array(1);return ol.crypto.getRandomValues(e),e.join()}};var ul={};Object.defineProperty(ul,"__esModule",{value:!0});const hl=i;class dl{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}ul.default=class{fetch(e,t={}){return Promise.resolve(new dl)}createEventSource(e,t){return new hl.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(fa,"__esModule",{value:!0});const fl=pa,pl=ul;fa.default=class{constructor(e){this.crypto=new fl.default,this.requests=new pl.default,this.info=e}};var vl={};Object.defineProperty(vl,"__esModule",{value:!0});class gl{constructor(e,t,r){this._platformName=e,this._sdkName=t,this._sdkVersion=r}platformData(){return{name:this._platformName}}sdkData(){return{name:this._sdkName,version:this._sdkVersion,userAgentBase:"AkamaiEdgeSDK"}}}vl.default=(e,t,r)=>new gl(e,t,r),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},s=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.EdgeFeatureStore=void 0;const a=i,o=ia,l=ha;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=fa,u=vl,h=na;n(i,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:d,sdkName:f,sdkVersion:p}=e,v=null!==(t=i.logger)&&void 0!==t?t:a.BasicLogger.get(),g=i,{cacheTtlMs:_}=g,y=s(g,["cacheTtlMs"]),m=new l.EdgeFeatureStore(n,r,"Akamai",v,null!=_?_:100),b=Object.assign({featureStore:m,logger:v},y);(0,h.validateOptions)(e.sdkKey,b);const E=(0,u.default)(d,f,p);return new o.default(r,new c.default(E),b)}}(r);exports.init=({options:e={},sdkKey:t,featureStoreProvider:i})=>r.init({sdkKey:t,options:e,featureStoreProvider:i,platformName:"Akamai EdgeWorker",sdkName:"@launchdarkly/akamai-server-base-sdk",sdkVersion:"3.0.4"});
|
|
18
|
+
return function(){var t=e,r=t.lib,i=r.WordArray,n=r.Hasher,s=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=s.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,d,m,b,E,w,S,k,x,O,D,R=this._hash.words,I=u.words,P=h.words,A=a.words,T=o.words,M=l.words,C=c.words;for(w=s=R[0],S=d=R[1],k=m=R[2],x=b=R[3],O=E=R[4],r=0;r<80;r+=1)D=s+e[t+A[r]]|0,D+=r<16?f(d,m,b)+I[0]:r<32?p(d,m,b)+I[1]:r<48?v(d,m,b)+I[2]:r<64?_(d,m,b)+I[3]:g(d,m,b)+I[4],D=(D=y(D|=0,M[r]))+E|0,s=E,E=b,b=y(m,10),m=d,d=D,D=w+e[t+T[r]]|0,D+=r<16?g(S,k,x)+P[0]:r<32?_(S,k,x)+P[1]:r<48?v(S,k,x)+P[2]:r<64?p(S,k,x)+P[3]:f(S,k,x)+P[4],D=(D=y(D|=0,C[r]))+O|0,w=O,O=x,x=y(k,10),k=S,S=D;D=R[1]+m+x|0,R[1]=R[2]+b+O|0,R[2]=R[3]+E+w|0,R[3]=R[4]+s+S|0,R[4]=R[0]+d+k|0,R[0]=D},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,r){return e^t^r}function p(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function _(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function y(e,t){return e<<t|e>>>32-t}t.RIPEMD160=n._createHelper(d),t.HmacRIPEMD160=n._createHmacHelper(d)}(),e.RIPEMD160}(ba())),no(),so||(so=1,ao.exports=function(e){return i=(r=(t=e).lib).Base,n=r.WordArray,a=(s=t.algo).SHA256,o=s.HMAC,l=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=o.create(r.hasher,e),s=n.create(),a=n.create([1]),l=s.words,c=a.words,u=r.keySize,h=r.iterations;l.length<u;){var d=i.update(t).finalize(a);i.reset();for(var f=d.words,p=f.length,v=d,_=1;_<h;_++){v=i.finalize(v),i.reset();for(var g=v.words,y=0;y<p;y++)f[y]^=g[y]}s.concat(d),c[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return l.create(r).compute(e,t)},e.PBKDF2;var t,r,i,n,s,a,o,l}(ba(),Ha(),no())),co(),fo(),_o(),mo(),wo(),xo(),Oo||(Oo=1,Do.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(ba(),fo())),Ro||(Ro=1,Io.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(ba(),fo())),Po||(Po=1,Ao.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var i=4*r,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(ba(),fo())),To||(To=1,Mo.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(ba(),fo())),Co||(Co=1,No.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(ba(),fo())),Fo||(Fo=1,jo.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(ba(),fo())),$o||($o=1,Lo.exports=function(e){return r=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,i}(ba(),fo())),Bo||(Bo=1,Vo.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],s=[],a=[],o=[],l=[],c=[],u=[],h=[],d=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var v=e[r],_=e[v],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,l[r]=y<<8|y>>>24,c[r]=y,y=16843009*g^65537*_^257*v^16843008*r,u[p]=y<<24|y>>>8,h[p]=y<<16|y>>>16,d[p]=y<<8|y>>>24,f[p]=y,r?(r=v^e[e[e[g^v]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a<i;a++)a<r?s[a]=t[a]:(c=s[a-1],a%r?r>6&&a%r==4&&(c=n[c>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c]):(c=n[(c=c<<8|c>>>24)>>>24]<<24|n[c>>>16&255]<<16|n[c>>>8&255]<<8|n[255&c],c^=p[a/r|0]<<24),s[a]=s[a-r]^c);for(var o=this._invKeySchedule=[],l=0;l<i;l++){if(a=i-l,l%4)var c=s[a];else c=s[a-4];o[l]=l<4||a<=4?c:u[n[c>>>24]]^h[n[c>>>16&255]]^d[n[c>>>8&255]]^f[n[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,l,c,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,h,d,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var l=this._nRounds,c=e[t]^r[0],u=e[t+1]^r[1],h=e[t+2]^r[2],d=e[t+3]^r[3],f=4,p=1;p<l;p++){var v=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&d]^r[f++],_=i[u>>>24]^n[h>>>16&255]^s[d>>>8&255]^a[255&c]^r[f++],g=i[h>>>24]^n[d>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++],y=i[d>>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++];c=v,u=_,h=g,d=y}v=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^r[f++],_=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&c])^r[f++],g=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],y=(o[d>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],e[t]=v,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});t.AES=r._createHelper(v)}(),e.AES}(ba(),ja(),co(),fo())),Uo(),Ko||(Ko=1,qo.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=i.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var l=i[n];i[n]=i[s],i[s]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}t.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4}(ba(),ja(),co(),fo())),Wo||(Wo=1,Go.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(n[0]^=c,n[1]^=h,n[2]^=u,n[3]^=d,n[4]^=c,n[5]^=h,n[6]^=u,n[7]^=d,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(o)}(),e.Rabbit}(ba(),ja(),co(),fo())),Xo||(Xo=1,Jo.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,i=t.algo,n=[],s=[],a=[],o=i.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=c>>>16|4294901760&u,d=u<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=u,i[3]^=d,i[4]^=c,i[5]^=h,i[6]^=u,i[7]^=d,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,l=((n*n>>>17)+n*o>>>15)+o*o,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(o)}(),e.RabbitLegacy}(ba(),ja(),co(),fo())),Qo());var el=ga.exports,tl={exports:{}},rl=tl.exports=function(e){return e.enc.Hex}(ba());Object.defineProperty(_a,"__esModule",{value:!0});const il=el,nl=Ta,sl=rl;_a.default=class{constructor(e){let t;switch(e){case"sha1":t=il.algo.SHA1;break;case"sha256":t=il.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHasher=t.create()}digest(e){const t=this._cryptoJSHasher.finalize();let r;switch(e){case"base64":r=nl.default;break;case"hex":r=sl.default;break;default:throw new Error("unsupported output encoding. Only base64 and hex are supported.")}return t.toString(r)}update(e){return this._cryptoJSHasher.update(e),this}};var al={};Object.defineProperty(al,"__esModule",{value:!0});const ol=el;al.default=class{constructor(e,t){let r;switch(e){case"sha1":r=ol.algo.SHA1;break;case"sha256":r=ol.algo.SHA256;break;default:throw new Error("unsupported hash algorithm. Only sha1 and sha256 are supported.")}this._cryptoJSHmac=ol.algo.HMAC.create(r,t)}digest(e){const t=this._cryptoJSHmac.finalize();if("base64"===e)return t.toString(CryptoJS.enc.Base64);if("hex"===e)return t.toString(CryptoJS.enc.Hex);throw new Error("unsupported output encoding. Only base64 and hex are supported.")}update(e){return this._cryptoJSHmac.update(e),this}},Object.defineProperty(va,"__esModule",{value:!0});const ll=e,cl=_a,ul=al;va.default=class{createHash(e){return new cl.default(e)}createHmac(e,t){return new ul.default(e,t)}randomUUID(){const e=new Uint32Array(1);return ll.crypto.getRandomValues(e),e.join()}};var hl={};Object.defineProperty(hl,"__esModule",{value:!0});const dl=i;class fl{constructor(){this.headers={},this.status=0}text(){return Promise.resolve("")}json(){return Promise.resolve({})}}hl.default=class{fetch(e,t={}){return Promise.resolve(new fl)}createEventSource(e,t){return new dl.NullEventSource(e,t)}getEventSourceCapabilities(){return{readTimeout:!1,headers:!1,customMethod:!1}}},Object.defineProperty(pa,"__esModule",{value:!0});const pl=va,vl=hl;pa.default=class{constructor(e){this.crypto=new pl.default,this.requests=new vl.default,this.info=e}};var _l={};Object.defineProperty(_l,"__esModule",{value:!0});class gl{constructor(e,t,r){this._platformName=e,this._sdkName=t,this._sdkVersion=r}platformData(){return{name:this._platformName}}sdkData(){return{name:this._sdkName,version:this._sdkVersion,userAgentBase:"AkamaiEdgeSDK"}}}_l.default=(e,t,r)=>new gl(e,t,r),function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),n=t&&t.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)},s=t&&t.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.EdgeFeatureStore=void 0;const a=i,o=na,l=da;Object.defineProperty(e,"EdgeFeatureStore",{enumerable:!0,get:function(){return l.EdgeFeatureStore}});const c=pa,u=_l,h=sa;n(i,e);e.init=e=>{var t;const{sdkKey:r,options:i={},featureStoreProvider:n,platformName:d,sdkName:f,sdkVersion:p}=e,v=null!==(t=i.logger)&&void 0!==t?t:a.BasicLogger.get(),_=i,{cacheTtlMs:g}=_,y=s(_,["cacheTtlMs"]),m=new l.EdgeFeatureStore(n,r,"Akamai",v,null!=g?g:100),b=Object.assign({featureStore:m,logger:v},y);(0,h.validateOptions)(e.sdkKey,b);const E=(0,u.default)(d,f,p);return new o.default(r,new c.default(E),b)}}(r);exports.init=({options:e={},sdkKey:t,featureStoreProvider:i})=>r.init({sdkKey:t,options:e,featureStoreProvider:i,platformName:"Akamai EdgeWorker",sdkName:"@launchdarkly/akamai-server-base-sdk",sdkVersion:"3.0.6"});
|
|
19
19
|
//# sourceMappingURL=bundle.cjs.js.map
|